Sliiightly more efficient AbstractSchematic#approxPlaceable()

This commit is contained in:
Logan Darklock 2019-09-03 21:44:45 -07:00
parent 991283182c
commit 620fc9af64
No known key found for this signature in database
GPG Key ID: B8C37CEDE1AC60EA

View File

@ -6,6 +6,7 @@ import baritone.api.utils.ISchematic;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@ -54,17 +55,20 @@ public abstract class AbstractSchematic implements ISchematic {
// 27 + 9
for (int i = 0; i < 36; i++) {
ItemStack stack = inventory.get(i);
Item item = stack.getItem();
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
ItemBlock itemBlock = (ItemBlock) item;
// <toxic cloud>
placeable.add(((ItemBlock) stack.getItem()).getBlock().getStateForPlacement(
placeable.add(itemBlock.getBlock().getStateForPlacement(
ctx.world(),
ctx.playerFeet(),
EnumFacing.UP,
(float) player.posX,
(float) player.posY,
(float) player.posZ,
stack.getItem().getMetadata(stack.getMetadata()),
itemBlock.getMetadata(stack.getMetadata()),
player
));
// </toxic cloud>