From efaa44a6f422e6f8c1efbe7409037ea22dab5398 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Fri, 31 Oct 2014 17:26:22 +0100 Subject: [PATCH 1/4] Add check when placing multiblocks near the sky limit or bedrock level --- .../render/blocks/RenderBlockCraftingCPU.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java index ee29604f6..195719873 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java @@ -4,6 +4,7 @@ import java.util.EnumSet; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; @@ -22,8 +23,8 @@ import appeng.tile.crafting.TileCraftingTile; public class RenderBlockCraftingCPU extends BaseBlockRender { - protected RenderBlockCraftingCPU(boolean useTesr, int range) { - super( useTesr, range ); + protected RenderBlockCraftingCPU(boolean useTESR, int range) { + super( useTESR, range ); } public RenderBlockCraftingCPU() { @@ -303,6 +304,16 @@ public class RenderBlockCraftingCPU extends BaseBlockRender private boolean isConnected(IBlockAccess w, int x, int y, int z, ForgeDirection side) { - return w.getTileEntity( x + side.offsetX, y + side.offsetY, z + side.offsetZ ) instanceof TileCraftingTile; + final int tileYPos = y + side.offsetY; + if ( 0 <= tileYPos && tileYPos <= 255) + { + final TileEntity tile = w.getTileEntity( x + side.offsetX, y + side.offsetY, z + side.offsetZ ); + + return tile instanceof TileCraftingTile; + } + else + { + return false; + } } } From 9b18abdb3cdb587bfab31fbbd74a831a6496d695 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Fri, 31 Oct 2014 18:01:49 +0100 Subject: [PATCH 2/4] Re-use the self-declared variable --- .../appeng/client/render/blocks/RenderBlockCraftingCPU.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java index 195719873..a3d2e40eb 100644 --- a/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java +++ b/src/main/java/appeng/client/render/blocks/RenderBlockCraftingCPU.java @@ -307,7 +307,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender final int tileYPos = y + side.offsetY; if ( 0 <= tileYPos && tileYPos <= 255) { - final TileEntity tile = w.getTileEntity( x + side.offsetX, y + side.offsetY, z + side.offsetZ ); + final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ ); return tile instanceof TileCraftingTile; } From 19fb264b3b2b0b90fe43cba6a2b7f35162165f04 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Sun, 2 Nov 2014 23:55:01 +0100 Subject: [PATCH 3/4] Fixes #376 IO Port now dropping upgrades properly. --- .../java/appeng/tile/storage/TileIOPort.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/main/java/appeng/tile/storage/TileIOPort.java b/src/main/java/appeng/tile/storage/TileIOPort.java index 6a37cc134..fa4270d46 100644 --- a/src/main/java/appeng/tile/storage/TileIOPort.java +++ b/src/main/java/appeng/tile/storage/TileIOPort.java @@ -1,8 +1,27 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + package appeng.tile.storage; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.Actionable; @@ -45,6 +64,8 @@ import appeng.util.InventoryAdaptor; import appeng.util.Platform; import appeng.util.inv.WrapperInventoryRange; +import java.util.ArrayList; + public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable { @@ -419,4 +440,28 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC return false; } + /** + * Adds the items in the upgrade slots to the drop list. + * + * @param w world + * @param x x pos of tile entity + * @param y y pos of tile entity + * @param z z pos of tile entity + * @param drops drops of tile entity + */ + @Override + public void getDrops( World w, int x, int y, int z, ArrayList drops ) + { + super.getDrops( w, x, y, z, drops ); + + for (int upgradeInventoryIndex = 0; upgradeInventoryIndex < this.upgrades.getSizeInventory(); upgradeInventoryIndex++) + { + ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeInventoryIndex); + + if ( stackInSlot != null ) + { + drops.add( stackInSlot ); + } + } + } } From 2835e2139d48ce99e693f0b8b0331761cbb33856 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Mon, 3 Nov 2014 00:01:36 +0100 Subject: [PATCH 4/4] Shorten variable name to fit into the horizontal space. --- src/main/java/appeng/tile/storage/TileIOPort.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/appeng/tile/storage/TileIOPort.java b/src/main/java/appeng/tile/storage/TileIOPort.java index fa4270d46..6c69417e0 100644 --- a/src/main/java/appeng/tile/storage/TileIOPort.java +++ b/src/main/java/appeng/tile/storage/TileIOPort.java @@ -454,9 +454,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC { super.getDrops( w, x, y, z, drops ); - for (int upgradeInventoryIndex = 0; upgradeInventoryIndex < this.upgrades.getSizeInventory(); upgradeInventoryIndex++) + for (int upgradeIndex = 0; upgradeIndex < this.upgrades.getSizeInventory(); upgradeIndex++) { - ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeInventoryIndex); + ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeIndex); if ( stackInSlot != null ) {