Fixed not being able to place cake or string
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
- Fixed NPE in some tiles
|
- Fixed NPE in some tiles
|
||||||
- Fixed going out of crafting GUI not restoring state (scrollbar and search term)
|
- Fixed going out of crafting GUI not restoring state (scrollbar and search term)
|
||||||
- Fixed not being able to create a pattern in disconnected Pattern Grid
|
- Fixed not being able to create a pattern in disconnected Pattern Grid
|
||||||
|
- Fixed not being able to place cake or string
|
||||||
|
|
||||||
### 0.7
|
### 0.7
|
||||||
**Bugfixes**
|
**Bugfixes**
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public abstract class BlockMachine extends BlockBase {
|
|||||||
super.neighborChanged(state, world, pos, block);
|
super.neighborChanged(state, world, pos, block);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
System.out.println("NeighbourChange");
|
|
||||||
((TileMachine) world.getTileEntity(pos)).searchController(world);
|
((TileMachine) world.getTileEntity(pos)).searchController(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package refinedstorage.container.slot;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemBlockSpecial;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
@@ -29,7 +30,7 @@ public class SlotSpecimen extends SlotItemHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack) {
|
public boolean isItemValid(ItemStack stack) {
|
||||||
return isBlockOnly() ? (stack.getItem() instanceof ItemBlock) : true;
|
return isBlockOnly() ? (stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlockSpecial) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
|||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
super.readFromNBT(tag);
|
super.readFromNBT(tag);
|
||||||
|
|
||||||
System.out.println("READ FROM NBT " + pos);
|
|
||||||
if (tag.hasKey(NBT_UPDATE)) {
|
if (tag.hasKey(NBT_UPDATE)) {
|
||||||
readUpdate(tag);
|
readUpdate(tag);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemBlockSpecial;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -22,6 +24,8 @@ import refinedstorage.item.ItemUpgrade;
|
|||||||
import refinedstorage.tile.autocrafting.task.CraftingTaskScheduler;
|
import refinedstorage.tile.autocrafting.task.CraftingTaskScheduler;
|
||||||
import refinedstorage.tile.config.ICompareConfig;
|
import refinedstorage.tile.config.ICompareConfig;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class TileConstructor extends TileMachine implements ICompareConfig {
|
public class TileConstructor extends TileMachine implements ICompareConfig {
|
||||||
public static final String NBT_COMPARE = "Compare";
|
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) {
|
if (ticks % RefinedStorageUtils.getSpeed(upgrades, BASE_SPEED, 4) == 0 && filter.getStackInSlot(0) != null) {
|
||||||
BlockPos front = pos.offset(getDirection());
|
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);
|
ItemStack took = controller.take(filter.getStackInSlot(0).copy(), compare);
|
||||||
|
|
||||||
if (took != null) {
|
if (took != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user