This fixes all the bugs I got while playtesting

This commit is contained in:
Raoul Van den Berge
2016-04-02 00:07:25 +02:00
parent 0768d5ad11
commit 0c11c83eb9
3 changed files with 8 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ public class GuiController extends GuiBase {
TileMachine machineHovering = null; TileMachine machineHovering = null;
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
if (slot < machines.size()) { if (slot < machines.size() && machines.get(slot) != null && machines.get(slot).getWorld() != null) {
TileMachine machine = machines.get(slot); TileMachine machine = machines.get(slot);
IBlockState machineState = machine.getWorld().getBlockState(machine.getPos()); IBlockState machineState = machine.getWorld().getBlockState(machine.getPos());
Block machineBlock = machineState.getBlock(); Block machineBlock = machineState.getBlock();

View File

@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -39,7 +40,7 @@ public class TileDestructor extends TileMachine implements ICompareSetting, IMod
IBlockState frontBlockState = worldObj.getBlockState(front); IBlockState frontBlockState = worldObj.getBlockState(front);
Block frontBlock = frontBlockState.getBlock(); Block frontBlock = frontBlockState.getBlock();
if (!frontBlock.isAir(frontBlockState, worldObj, front)) { if (Item.getItemFromBlock(frontBlock) != null && !frontBlock.isAir(frontBlockState, worldObj, front)) {
if (ModeSettingUtils.doesNotViolateMode(inventory, this, compare, new ItemStack(frontBlock, 1, frontBlock.getMetaFromState(frontBlockState)))) { if (ModeSettingUtils.doesNotViolateMode(inventory, this, compare, new ItemStack(frontBlock, 1, frontBlock.getMetaFromState(frontBlockState)))) {
List<ItemStack> drops = frontBlock.getDrops(worldObj, front, frontBlockState, 0); List<ItemStack> drops = frontBlock.getDrops(worldObj, front, frontBlockState, 0);

View File

@@ -80,11 +80,16 @@ public class TileImporter extends TileMachine implements ICompareSetting, IModeS
ItemStack toTake = stack.copy(); ItemStack toTake = stack.copy();
toTake.stackSize = 1; toTake.stackSize = 1;
// If we can't import and/ or push, move on (otherwise we stay on the same slot forever)
if (canImport(toTake)) { if (canImport(toTake)) {
if (getController().push(toTake)) { if (getController().push(toTake)) {
inventory.decrStackSize(currentSlot, 1); inventory.decrStackSize(currentSlot, 1);
inventory.markDirty(); inventory.markDirty();
} else {
currentSlot++;
} }
} else {
currentSlot++;
} }
} }
} else { } else {