Fixed not being able to place cake or string
This commit is contained in:
@@ -54,7 +54,6 @@ public abstract class BlockMachine extends BlockBase {
|
||||
super.neighborChanged(state, world, pos, block);
|
||||
|
||||
if (!world.isRemote) {
|
||||
System.out.println("NeighbourChange");
|
||||
((TileMachine) world.getTileEntity(pos)).searchController(world);
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package refinedstorage.container.slot;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemBlockSpecial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
@@ -29,7 +30,7 @@ public class SlotSpecimen extends SlotItemHandler {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return isBlockOnly() ? (stack.getItem() instanceof ItemBlock) : true;
|
||||
return isBlockOnly() ? (stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlockSpecial) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -78,7 +78,6 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
System.out.println("READ FROM NBT " + pos);
|
||||
if (tag.hasKey(NBT_UPDATE)) {
|
||||
readUpdate(tag);
|
||||
} else {
|
||||
|
@@ -4,7 +4,9 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemBlockSpecial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -22,6 +24,8 @@ import refinedstorage.item.ItemUpgrade;
|
||||
import refinedstorage.tile.autocrafting.task.CraftingTaskScheduler;
|
||||
import refinedstorage.tile.config.ICompareConfig;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class TileConstructor extends TileMachine implements ICompareConfig {
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
|
||||
@@ -49,9 +53,24 @@ public class TileConstructor extends TileMachine implements ICompareConfig {
|
||||
if (ticks % RefinedStorageUtils.getSpeed(upgrades, BASE_SPEED, 4) == 0 && filter.getStackInSlot(0) != null) {
|
||||
BlockPos front = pos.offset(getDirection());
|
||||
|
||||
Block block = ((ItemBlock) filter.getStackInSlot(0).getItem()).getBlock();
|
||||
Item item = filter.getStackInSlot(0).getItem();
|
||||
Block block = null;
|
||||
|
||||
if (block.canPlaceBlockAt(worldObj, front)) {
|
||||
if (item instanceof ItemBlockSpecial) {
|
||||
try {
|
||||
Field f = ((ItemBlockSpecial) item).getClass().getDeclaredField("block");
|
||||
f.setAccessible(true);
|
||||
block = (Block) f.get(item);
|
||||
} catch (IllegalAccessException e) {
|
||||
// NO OP
|
||||
} catch (NoSuchFieldException e) {
|
||||
// NO OP
|
||||
}
|
||||
} else if (item instanceof ItemBlock) {
|
||||
block = ((ItemBlock) item).getBlock();
|
||||
}
|
||||
|
||||
if (block != null && block.canPlaceBlockAt(worldObj, front)) {
|
||||
ItemStack took = controller.take(filter.getStackInSlot(0).copy(), compare);
|
||||
|
||||
if (took != null) {
|
||||
|
Reference in New Issue
Block a user