diff --git a/common/mekanism/api/IEjector.java b/common/mekanism/api/IEjector.java index 6ab97a2bb..9a95e34af 100644 --- a/common/mekanism/api/IEjector.java +++ b/common/mekanism/api/IEjector.java @@ -17,4 +17,8 @@ public interface IEjector public boolean isEjecting(); public void setEjecting(boolean eject); + + public boolean hasStrictInput(); + + public void setStrictInput(boolean strict); } diff --git a/common/mekanism/client/gui/GuiConfiguration.java b/common/mekanism/client/gui/GuiConfiguration.java index b81302ff5..4c6c9dde0 100644 --- a/common/mekanism/client/gui/GuiConfiguration.java +++ b/common/mekanism/client/gui/GuiConfiguration.java @@ -78,6 +78,14 @@ public class GuiConfiguration extends GuiMekanism drawTexturedModalRect(guiWidth + 156, guiHeight + 6, 176 + 14, 14, 14, 14); } + if(xAxis >= 156 && xAxis <= 170 && yAxis >= 21 && yAxis <= 35) + { + drawTexturedModalRect(guiWidth + 156, guiHeight + 21, 176 + 42, 0, 14, 14); + } + else { + drawTexturedModalRect(guiWidth + 156, guiHeight + 21, 176 + 42, 14, 14, 14); + } + if(xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) { drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176 + 28, 0, 14, 14); @@ -142,13 +150,11 @@ public class GuiConfiguration extends GuiMekanism int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); - - String ejecting = configurable.getEjector().isEjecting() ? "On" : "Off"; fontRenderer.drawString("Configuration", 60, 5, 0x404040); - fontRenderer.drawString("Eject: " + ejecting, 53, 17, 0x00CD00); + fontRenderer.drawString("Eject: " + (configurable.getEjector().isEjecting() ? "On" : "Off"), 53, 17, 0x00CD00); - fontRenderer.drawString("Input", 32, 81, 0x787878); + fontRenderer.drawString("Input (" + (configurable.getEjector().hasStrictInput() ? "On" : "Off") + ")", 18, 81, 0x787878); fontRenderer.drawString("Output", 72, 68, 0x787878); fontRenderer.drawString("Slots", 122, 81, 0x787878); @@ -241,6 +247,12 @@ public class GuiConfiguration extends GuiMekanism PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.EJECT, Object3D.get(tile))); } + if(xAxis >= 156 && xAxis <= 170 && yAxis >= 21 && yAxis <= 35) + { + mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); + PacketHandler.sendPacket(Transmission.SERVER, new PacketConfigurationUpdate().setParams(ConfigurationPacket.STRICT_INPUT, Object3D.get(tile))); + } + if(xAxis >= 80 && xAxis <= 96 && yAxis >= 49 && yAxis <= 65) { mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); diff --git a/common/mekanism/client/gui/GuiElement.java b/common/mekanism/client/gui/GuiElement.java index 5d4b3cf27..c94bf2400 100644 --- a/common/mekanism/client/gui/GuiElement.java +++ b/common/mekanism/client/gui/GuiElement.java @@ -3,6 +3,8 @@ package mekanism.client.gui; import java.lang.reflect.Field; import java.lang.reflect.Method; +import mekanism.common.ObfuscatedNames; +import mekanism.common.util.MekanismUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; @@ -33,7 +35,7 @@ public abstract class GuiElement protected void displayTooltip(String s, int xAxis, int yAxis) { try { - Method m = GuiContainer.class.getDeclaredMethod("drawCreativeTabHoveringText", String.class, Integer.TYPE, Integer.TYPE); + Method m = MekanismUtils.getPrivateMethod(GuiContainer.class, ObfuscatedNames.GuiContainer_drawCreativeTabHoveringText, String.class, Integer.TYPE, Integer.TYPE); m.setAccessible(true); m.invoke(guiObj, s, xAxis, yAxis); } catch(Exception e) {} @@ -44,9 +46,8 @@ public abstract class GuiElement if(guiObj instanceof GuiContainer) { try { - Field f = GuiContainer.class.getDeclaredField("xSize"); - f.setAccessible(true); - f.set(guiObj, ((Integer)f.get(guiObj))+xSize); + int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize); + MekanismUtils.setPrivateValue(guiObj, size+xSize, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize); } catch(Exception e) {} } } @@ -56,9 +57,8 @@ public abstract class GuiElement if(guiObj instanceof GuiContainer) { try { - Field f = GuiContainer.class.getDeclaredField("ySize"); - f.setAccessible(true); - f.set(guiObj, ((Integer)f.get(guiObj))+ySize); + int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize); + MekanismUtils.setPrivateValue(guiObj, size+ySize, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize); } catch(Exception e) {} } } @@ -66,9 +66,7 @@ public abstract class GuiElement protected FontRenderer getFontRenderer() { try { - Field f = GuiScreen.class.getDeclaredField("fontRenderer"); - f.setAccessible(true); - return (FontRenderer)f.get(guiObj); + return (FontRenderer)MekanismUtils.getPrivateValue(guiObj, GuiScreen.class, ObfuscatedNames.GuiScreen_fontRenderer); } catch(Exception e) {} return null; diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index 14dc65307..bb2508c45 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -319,7 +319,7 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(AtomicDisassembler.getUnchargedItem(), new Object[] { "AEA", "ACA", " O ", Character.valueOf('A'), EnrichedAlloy, Character.valueOf('E'), EnergyTablet.getUnchargedItem(), Character.valueOf('C'), AtomicCore, Character.valueOf('O'), "ingotRefinedObsidian" })); - CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(GasTank), new Object[] { + CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getEmptyGasTank(), new Object[] { "PPP", "PDP", "PPP", Character.valueOf('P'), "ingotOsmium", Character.valueOf('D'), "dustIron" })); CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismUtils.getEnergyCube(EnergyCubeTier.BASIC), new Object[] { diff --git a/common/mekanism/common/ObfuscatedNames.java b/common/mekanism/common/ObfuscatedNames.java index af6eeb1a9..6fb3a2524 100644 --- a/common/mekanism/common/ObfuscatedNames.java +++ b/common/mekanism/common/ObfuscatedNames.java @@ -7,4 +7,8 @@ public final class ObfuscatedNames public static String[] AbstractClientPlayer_downloadImageCape = new String[] {"downloadImageCape", "field_110315_c", "c"}; public static String[] AbstractClientPlayer_locationCape = new String[] {"locationCape", "field_110313_e", "e"}; public static String[] AbstractClientPlayer_getDownloadImage = new String[] {"getDownloadImage", "func_110301_a", "a"}; + public static String[] GuiContainer_drawCreativeTabHoveringText = new String[] {"drawCreativeTabHoveringText", "func_74190_a", "a"}; + public static String[] GuiContainer_xSize = new String[] {"xSize", "field_74194_b", "c"}; + public static String[] GuiContainer_ySize = new String[] {"ySize", "field_74195_c", "d"}; + public static String[] GuiScreen_fontRenderer = new String[] {"fontRenderer", "field_73886_k", "o"}; } \ No newline at end of file diff --git a/common/mekanism/common/TileComponentEjector.java b/common/mekanism/common/TileComponentEjector.java index 96b0635ea..b3a2cc5b7 100644 --- a/common/mekanism/common/TileComponentEjector.java +++ b/common/mekanism/common/TileComponentEjector.java @@ -24,6 +24,8 @@ public class TileComponentEjector implements ITileComponent, IEjector { public TileEntityContainerBlock tileEntity; + public boolean strictInput; + public boolean ejecting; public EnumColor outputColor; @@ -137,6 +139,18 @@ public class TileComponentEjector implements ITileComponent, IEjector ejecting = eject; } + @Override + public boolean hasStrictInput() + { + return strictInput; + } + + @Override + public void setStrictInput(boolean strict) + { + strictInput = strict; + } + @Override public void setOutputColor(EnumColor color) { @@ -168,6 +182,7 @@ public class TileComponentEjector implements ITileComponent, IEjector public void read(NBTTagCompound nbtTags) { ejecting = nbtTags.getBoolean("ejecting"); + strictInput = nbtTags.getBoolean("strictInput"); if(nbtTags.hasKey("ejectColor")) { @@ -200,6 +215,7 @@ public class TileComponentEjector implements ITileComponent, IEjector public void read(ByteArrayDataInput dataStream) { ejecting = dataStream.readBoolean(); + strictInput = dataStream.readBoolean(); int c = dataStream.readInt(); @@ -229,6 +245,7 @@ public class TileComponentEjector implements ITileComponent, IEjector public void write(NBTTagCompound nbtTags) { nbtTags.setBoolean("ejecting", ejecting); + nbtTags.setBoolean("strictInput", strictInput); if(outputColor != null) { @@ -256,6 +273,7 @@ public class TileComponentEjector implements ITileComponent, IEjector public void write(ArrayList data) { data.add(ejecting); + data.add(strictInput); if(outputColor != null) { diff --git a/common/mekanism/common/network/PacketConfigurationUpdate.java b/common/mekanism/common/network/PacketConfigurationUpdate.java index 780681730..451d929cf 100644 --- a/common/mekanism/common/network/PacketConfigurationUpdate.java +++ b/common/mekanism/common/network/PacketConfigurationUpdate.java @@ -87,6 +87,10 @@ public class PacketConfigurationUpdate implements IMekanismPacket ForgeDirection side = ForgeDirection.getOrientation(inputSide); config.getEjector().setInputColor(side, TransporterUtils.increment(config.getEjector().getInputColor(side))); } + else if(packetType == ConfigurationPacket.STRICT_INPUT) + { + config.getEjector().setStrictInput(!config.getEjector().hasStrictInput()); + } } } @@ -114,6 +118,6 @@ public class PacketConfigurationUpdate implements IMekanismPacket public static enum ConfigurationPacket { - EJECT, SIDE_DATA, EJECT_COLOR, INPUT_COLOR + EJECT, SIDE_DATA, EJECT_COLOR, INPUT_COLOR, STRICT_INPUT } } diff --git a/common/mekanism/common/transporter/TransporterPathfinder.java b/common/mekanism/common/transporter/TransporterPathfinder.java index a645d784f..fd7ad973e 100644 --- a/common/mekanism/common/transporter/TransporterPathfinder.java +++ b/common/mekanism/common/transporter/TransporterPathfinder.java @@ -211,6 +211,11 @@ public final class TransporterPathfinder { closest = destinations.get(0); } + + if(closest == null) + { + return null; + } return closest.path; } diff --git a/common/mekanism/common/util/MekanismUtils.java b/common/mekanism/common/util/MekanismUtils.java index 23fc7b898..751217b6b 100644 --- a/common/mekanism/common/util/MekanismUtils.java +++ b/common/mekanism/common/util/MekanismUtils.java @@ -23,7 +23,6 @@ import mekanism.common.IModule; import mekanism.common.IRedstoneControl; import mekanism.common.IRedstoneControl.RedstoneControl; import mekanism.common.Mekanism; -import mekanism.common.MekanismHooks; import mekanism.common.PacketHandler; import mekanism.common.PacketHandler.Transmission; import mekanism.common.Teleporter; @@ -32,6 +31,7 @@ import mekanism.common.Tier.FactoryTier; import mekanism.common.Version; import mekanism.common.inventory.container.ContainerElectricChest; import mekanism.common.item.ItemBlockEnergyCube; +import mekanism.common.item.ItemBlockGasTank; import mekanism.common.network.PacketElectricChest; import mekanism.common.network.PacketElectricChest.ElectricChestPacketType; import mekanism.common.tileentity.TileEntityBoundingBlock; @@ -357,6 +357,16 @@ public final class MekanismUtils return itemstack; } + /** + * Retrieves an empty Gas Tank. + * @return empty gas tank + */ + public static ItemStack getEmptyGasTank() + { + ItemStack itemstack = ((ItemBlockGasTank)new ItemStack(Mekanism.GasTank).getItem()).getEmptyItem(); + return itemstack; + } + /** * Retrieves a Factory with a defined tier and recipe type. * @param tier - tier to add to the Factory diff --git a/common/mekanism/common/util/TransporterUtils.java b/common/mekanism/common/util/TransporterUtils.java index 7b86ec867..48c8addda 100644 --- a/common/mekanism/common/util/TransporterUtils.java +++ b/common/mekanism/common/util/TransporterUtils.java @@ -174,7 +174,7 @@ public final class TransporterUtils int tileSide = config.getOrientation(); EnumColor configColor = config.getEjector().getInputColor(ForgeDirection.getOrientation(MekanismUtils.getBaseOrientation(side, tileSide)).getOpposite()); - if(configColor != null && configColor != color) + if(config.getEjector().hasStrictInput() && configColor != null && configColor != color) { return false; } diff --git a/resources/assets/mekanism/gui/GuiConfiguration.png b/resources/assets/mekanism/gui/GuiConfiguration.png index fcef87319..1d6f94353 100644 Binary files a/resources/assets/mekanism/gui/GuiConfiguration.png and b/resources/assets/mekanism/gui/GuiConfiguration.png differ