From 728da1fc38bb1a5710415808b41d25364b5e40c2 Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sun, 25 Oct 2015 10:57:04 +0100 Subject: [PATCH] fix #3089, revert pipe speed tweaks for now --- buildcraft_resources/changelog/7.1.12 | 2 +- common/buildcraft/core/proxy/CoreProxy.java | 5 --- .../core/proxy/CoreProxyClient.java | 12 +----- .../core/render/BlockHighlightHandler.java | 4 +- .../silicon/TileIntegrationTable.java | 37 ++++++++++++------- .../gui/ContainerIntegrationTable.java | 2 +- .../transport/PipeTransportFluids.java | 2 +- .../transport/PipeTransportPower.java | 18 ++++----- .../transport/TransportConstants.java | 8 ++++ .../transport/pipes/PipeItemsGold.java | 2 +- 10 files changed, 48 insertions(+), 44 deletions(-) diff --git a/buildcraft_resources/changelog/7.1.12 b/buildcraft_resources/changelog/7.1.12 index 4d0a5527..60547efb 100644 --- a/buildcraft_resources/changelog/7.1.12 +++ b/buildcraft_resources/changelog/7.1.12 @@ -3,7 +3,6 @@ Improvements: * [#3088] Miner Robots now support enchantments correctly. (asie) * Robots ignore broken tools and unload them when they break - think Tinkers' Construct here. (asie) * Stained Glass Pipe recipes now support ore dictionary colored glass. (asie) -* Tweaked item movement speed in pipes. (asie) Removals: @@ -14,6 +13,7 @@ Bugs fixed: * [#3092, #3087, #3085] Robot unstucking code being a terrible hack - removed it for now (asie) * [#3091, #3083] Various recipe disabling crashes (asie) * [#3090] Robots delete repairable tools after they break (asie) +* [#3089] Integration Table dupe (asie) * [#3082] Void not killing robots (asie) * [#3081] Emzuli Pipe behaviour bug (asie) diff --git a/common/buildcraft/core/proxy/CoreProxy.java b/common/buildcraft/core/proxy/CoreProxy.java index 2f574cfe..9ea90c73 100644 --- a/common/buildcraft/core/proxy/CoreProxy.java +++ b/common/buildcraft/core/proxy/CoreProxy.java @@ -57,11 +57,6 @@ public class CoreProxy implements ICoreProxy { entity.worldObj.removeEntity(entity); } - /* WRAPPER */ - @SuppressWarnings("rawtypes") - public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) { - } - public String getItemDisplayName(ItemStack newStack) { return ""; } diff --git a/common/buildcraft/core/proxy/CoreProxyClient.java b/common/buildcraft/core/proxy/CoreProxyClient.java index 62b919bd..5a410797 100644 --- a/common/buildcraft/core/proxy/CoreProxyClient.java +++ b/common/buildcraft/core/proxy/CoreProxyClient.java @@ -66,16 +66,6 @@ public class CoreProxyClient extends CoreProxy { } /* WRAPPER */ - @SuppressWarnings("rawtypes") - @Override - public void feedSubBlocks(Block block, CreativeTabs tab, List itemList) { - if (block == null) { - return; - } - - block.getSubBlocks(Item.getItemFromBlock(block), tab, itemList); - } - @Override public String getItemDisplayName(ItemStack stack) { if (stack.getItem() == null) { @@ -154,7 +144,7 @@ public class CoreProxyClient extends CoreProxy { public TileEntity getServerTile(TileEntity source) { if (BuildCraftCore.useServerDataOnClient && Minecraft.getMinecraft().isSingleplayer() && source.getWorldObj().isRemote) { WorldServer w = DimensionManager.getWorld(source.getWorldObj().provider.dimensionId); - if (w != null) { + if (w != null && w.getChunkProvider() != null) { Chunk c = w.getChunkFromBlockCoords(source.xCoord, source.zCoord); if (c != null) { TileEntity t = c.getTileEntityUnsafe(source.xCoord & 15, source.yCoord, source.zCoord & 15); diff --git a/common/buildcraft/core/render/BlockHighlightHandler.java b/common/buildcraft/core/render/BlockHighlightHandler.java index 92bb1537..e2ef83b4 100644 --- a/common/buildcraft/core/render/BlockHighlightHandler.java +++ b/common/buildcraft/core/render/BlockHighlightHandler.java @@ -25,7 +25,6 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent; import buildcraft.core.lib.render.ICustomHighlight; public class BlockHighlightHandler { - @SideOnly(Side.CLIENT) @SubscribeEvent public void handleBlockHighlight(DrawBlockHighlightEvent e) { @@ -37,18 +36,21 @@ public class BlockHighlightHandler { if (block instanceof ICustomHighlight) { AxisAlignedBB[] aabbs = ((ICustomHighlight) block).getBoxes(e.player.worldObj, x, y, z, e.player); Vec3 pos = e.player.getPosition(e.partialTicks); + GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); + double exp = ((ICustomHighlight) block).getExpansion(); for (AxisAlignedBB aabb : aabbs) { RenderGlobal.drawOutlinedBoundingBox(aabb.copy().expand(exp, exp, exp) .offset(x, y, z) .offset(-pos.xCoord, -pos.yCoord, -pos.zCoord), -1); } + GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); diff --git a/common/buildcraft/silicon/TileIntegrationTable.java b/common/buildcraft/silicon/TileIntegrationTable.java index 525c7e48..84354499 100644 --- a/common/buildcraft/silicon/TileIntegrationTable.java +++ b/common/buildcraft/silicon/TileIntegrationTable.java @@ -13,17 +13,22 @@ import java.util.List; import io.netty.buffer.ByteBuf; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import buildcraft.api.recipes.BuildcraftRecipeRegistry; import buildcraft.api.recipes.IIntegrationRecipe; +import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; +import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.StringUtils; import buildcraft.core.lib.utils.Utils; public class TileIntegrationTable extends TileLaserTableBase implements ISidedInventory { public static final int SLOT_OUTPUT = 9; + public final IInventory clientOutputInv = new SimpleInventory(1, "Preview", 64); + private static final int CYCLE_LENGTH = 16; private static final int[] SLOTS = Utils.createSlotArray(0, 10); private int tick = 0; @@ -58,7 +63,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn updateRecipeOutput(); - ItemStack output = getStackInSlot(10); + ItemStack output = clientOutputInv.getStackInSlot(0); if (!isRoomForOutput(output)) { setEnergy(0); return; @@ -100,22 +105,24 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn } private void updateRecipeOutput() { - if (activeRecipe == null) { - inv.setInventorySlotContents(10, null); - return; + ItemStack oldClientOutput = clientOutputInv.getStackInSlot(0); + + activeRecipeValid = false; + clientOutputInv.setInventorySlotContents(0, null); + + if (activeRecipe != null) { + List expansions = getExpansions(); + + if (expansions.size() > 0) { + clientOutputInv.setInventorySlotContents(0, activeRecipe.craft(getStackInSlot(0), expansions, true)); + } } - List expansions = getExpansions(); + activeRecipeValid = clientOutputInv.getStackInSlot(0) != null; - if (expansions.size() == 0) { - activeRecipeValid = false; - inv.setInventorySlotContents(10, null); - return; + if (!StackHelper.isEqualItem(clientOutputInv.getStackInSlot(0), oldClientOutput)) { + sendNetworkUpdate(); } - - ItemStack output = activeRecipe.craft(getStackInSlot(0), expansions, true); - activeRecipeValid = output != null; - inv.setInventorySlotContents(10, output); } private void setNewActiveRecipe() { @@ -153,11 +160,13 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn @Override public void writeData(ByteBuf buf) { buf.writeByte((byte) getMaxExpansionCount()); + NetworkUtils.writeStack(buf, clientOutputInv.getStackInSlot(0)); } @Override public void readData(ByteBuf buf) { maxExpCountClient = buf.readByte(); + clientOutputInv.setInventorySlotContents(0, NetworkUtils.readStack(buf)); } public int getMaxExpansionCount() { @@ -193,7 +202,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements ISidedIn @Override public int getSizeInventory() { - return 11; + return 10; } @Override diff --git a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java index 74f8e73e..699b70b8 100644 --- a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java +++ b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java @@ -38,7 +38,7 @@ public class ContainerIntegrationTable extends BuildCraftContainer { } addSlot(new SlotOutput(table, 9, 138, 49)); - addSlot(new SlotUntouchable(table, 10, 101, 36)); + addSlot(new SlotUntouchable(table.clientOutputInv, 0, 101, 36)); for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { diff --git a/common/buildcraft/transport/PipeTransportFluids.java b/common/buildcraft/transport/PipeTransportFluids.java index 496f84e3..3cd78641 100644 --- a/common/buildcraft/transport/PipeTransportFluids.java +++ b/common/buildcraft/transport/PipeTransportFluids.java @@ -673,13 +673,13 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler, fluidCapacities.put(PipeFluidsWood.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsCobblestone.class, 1 * BuildCraftTransport.pipeFluidsBaseFlowRate); + fluidCapacities.put(PipeFluidsSandstone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsStone.class, 2 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsClay.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsEmerald.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsIron.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsQuartz.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); - fluidCapacities.put(PipeFluidsSandstone.class, 4 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsDiamond.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); fluidCapacities.put(PipeFluidsGold.class, 8 * BuildCraftTransport.pipeFluidsBaseFlowRate); diff --git a/common/buildcraft/transport/PipeTransportPower.java b/common/buildcraft/transport/PipeTransportPower.java index 03ed073d..2e1e7252 100644 --- a/common/buildcraft/transport/PipeTransportPower.java +++ b/common/buildcraft/transport/PipeTransportPower.java @@ -475,15 +475,15 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { } static { - powerCapacities.put(PipePowerCobblestone.class, 80); - powerCapacities.put(PipePowerStone.class, 160); - powerCapacities.put(PipePowerWood.class, 320); - powerCapacities.put(PipePowerSandstone.class, 320); - powerCapacities.put(PipePowerQuartz.class, 640); - powerCapacities.put(PipePowerIron.class, 1280); - powerCapacities.put(PipePowerGold.class, 2560); - powerCapacities.put(PipePowerEmerald.class, 2560); - powerCapacities.put(PipePowerDiamond.class, 10240); + powerCapacities.put(PipePowerCobblestone.class, TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerStone.class, 2 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerWood.class, 4 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerSandstone.class, 4 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerQuartz.class, 8 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerIron.class, 16 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerGold.class, 32 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerEmerald.class, 32 * TransportConstants.PIPE_POWER_BASE_CAP); + powerCapacities.put(PipePowerDiamond.class, 128 * TransportConstants.PIPE_POWER_BASE_CAP); powerResistances.put(PipePowerCobblestone.class, 0.05F); powerResistances.put(PipePowerStone.class, 0.025F); diff --git a/common/buildcraft/transport/TransportConstants.java b/common/buildcraft/transport/TransportConstants.java index ba34c081..eb488699 100644 --- a/common/buildcraft/transport/TransportConstants.java +++ b/common/buildcraft/transport/TransportConstants.java @@ -12,11 +12,19 @@ public final class TransportConstants { public static final float FACADE_THICKNESS = 2F / 16F; + /* public static final float PIPE_MIN_SPEED = (1.0F / 80.0F); public static final float PIPE_MAX_SPEED = (1.0F / 7.0F); public static final float PIPE_SLOWDOWN_SPEED = 0.008F; public static final float PIPE_DEFAULT_SPEED = (1.0F / 25.0F); + */ + public static final int PIPE_POWER_BASE_CAP = 80; + public static final float PIPE_SPEEDUP_MULTIPLIER = 4F; + public static final float PIPE_MIN_SPEED = 0.01F; + public static final float PIPE_MAX_SPEED = 0.15F; + public static final float PIPE_SLOWDOWN_SPEED = 0.01F; + public static final float PIPE_DEFAULT_SPEED = PIPE_MIN_SPEED; /** * Deactivate constructor */ diff --git a/common/buildcraft/transport/pipes/PipeItemsGold.java b/common/buildcraft/transport/pipes/PipeItemsGold.java index af243741..acc75106 100644 --- a/common/buildcraft/transport/pipes/PipeItemsGold.java +++ b/common/buildcraft/transport/pipes/PipeItemsGold.java @@ -44,6 +44,6 @@ public class PipeItemsGold extends Pipe { public void eventHandler(PipeEventItem.AdjustSpeed event) { event.handled = true; TravelingItem item = event.item; - item.setSpeed(MathUtils.clamp(item.getSpeed() * 4F, TransportConstants.PIPE_MIN_SPEED * 4F, TransportConstants.PIPE_MAX_SPEED)); + item.setSpeed(MathUtils.clamp(item.getSpeed() * TransportConstants.PIPE_SPEEDUP_MULTIPLIER, TransportConstants.PIPE_MIN_SPEED * TransportConstants.PIPE_SPEEDUP_MULTIPLIER, TransportConstants.PIPE_MAX_SPEED)); } }