mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Merge branch 'master' of https://github.com/aidancbrady/Mekanism
This commit is contained in:
commit
7cc72e65b3
11 files changed
+73
-18
No files matched your search
@@ -17,4 +17,8 @@ public interface IEjector
|
||||
public boolean isEjecting();
|
||||
|
||||
public void setEjecting(boolean eject);
|
||||
|
||||
public boolean hasStrictInput();
|
||||
|
||||
public void setStrictInput(boolean strict);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -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"};
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -211,6 +211,11 @@ public final class TransporterPathfinder
|
||||
{
|
||||
closest = destinations.get(0);
|
||||
}
|
||||
|
||||
if(closest == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return closest.path;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.6 KiB |
Reference in new issue
Block a user