mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 12:59:41 +00:00
Start integrating security into all machinery. This is a very rough implementation, there's gonna be a lot of balance and corrections to make before release
This commit is contained in:
1 parent
9c480954e3
commit
f904c8b80c
58 files changed
+700
-1822
No files matched your search
@@ -17,7 +17,6 @@ public class MekanismConfig
|
||||
public static boolean voiceServerEnabled = true;
|
||||
public static boolean cardboardSpawners = true;
|
||||
public static boolean enableWorldRegeneration = true;
|
||||
public static boolean creativeOverrideElectricChest = true;
|
||||
public static boolean spawnBabySkeletons = true;
|
||||
public static int obsidianTNTBlastRadius = 12;
|
||||
public static int osmiumPerChunk = 12;
|
||||
|
||||
@@ -22,7 +22,6 @@ import mekanism.client.gui.GuiCrusher;
|
||||
import mekanism.client.gui.GuiDictionary;
|
||||
import mekanism.client.gui.GuiDigitalMiner;
|
||||
import mekanism.client.gui.GuiDynamicTank;
|
||||
import mekanism.client.gui.GuiElectricChest;
|
||||
import mekanism.client.gui.GuiElectricPump;
|
||||
import mekanism.client.gui.GuiElectrolyticSeparator;
|
||||
import mekanism.client.gui.GuiEnergizedSmelter;
|
||||
@@ -41,8 +40,7 @@ import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOredictionificator;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPRC;
|
||||
import mekanism.client.gui.GuiPasswordEnter;
|
||||
import mekanism.client.gui.GuiPasswordModify;
|
||||
import mekanism.client.gui.GuiPersonalChest;
|
||||
import mekanism.client.gui.GuiPrecisionSawmill;
|
||||
import mekanism.client.gui.GuiPurificationChamber;
|
||||
import mekanism.client.gui.GuiQuantumEntangloporter;
|
||||
@@ -86,7 +84,6 @@ import mekanism.client.render.tileentity.RenderChemicalWasher;
|
||||
import mekanism.client.render.tileentity.RenderConfigurableMachine;
|
||||
import mekanism.client.render.tileentity.RenderDigitalMiner;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank;
|
||||
import mekanism.client.render.tileentity.RenderElectricChest;
|
||||
import mekanism.client.render.tileentity.RenderElectricPump;
|
||||
import mekanism.client.render.tileentity.RenderElectrolyticSeparator;
|
||||
import mekanism.client.render.tileentity.RenderEnergyCube;
|
||||
@@ -99,6 +96,7 @@ import mekanism.client.render.tileentity.RenderLaserTractorBeam;
|
||||
import mekanism.client.render.tileentity.RenderLogisticalSorter;
|
||||
import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
|
||||
import mekanism.client.render.tileentity.RenderObsidianTNT;
|
||||
import mekanism.client.render.tileentity.RenderPersonalChest;
|
||||
import mekanism.client.render.tileentity.RenderPressurizedReactionChamber;
|
||||
import mekanism.client.render.tileentity.RenderRotaryCondensentrator;
|
||||
import mekanism.client.render.tileentity.RenderSeismicVibrator;
|
||||
@@ -110,7 +108,6 @@ import mekanism.common.CommonProxy;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.MekanismItems;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
@@ -119,7 +116,7 @@ import mekanism.common.entity.EntityBalloon;
|
||||
import mekanism.common.entity.EntityFlame;
|
||||
import mekanism.common.entity.EntityObsidianTNT;
|
||||
import mekanism.common.entity.EntityRobit;
|
||||
import mekanism.common.inventory.InventoryElectricChest;
|
||||
import mekanism.common.inventory.InventoryPersonalChest;
|
||||
import mekanism.common.item.ItemPortableTeleporter;
|
||||
import mekanism.common.item.ItemSeismicReader;
|
||||
import mekanism.common.multiblock.MultiblockManager;
|
||||
@@ -142,7 +139,6 @@ import mekanism.common.tile.TileEntityCrusher;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityDynamicTank;
|
||||
import mekanism.common.tile.TileEntityDynamicValve;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityElectricMachine;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
@@ -169,6 +165,7 @@ import mekanism.common.tile.TileEntityObsidianTNT;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
@@ -240,58 +237,28 @@ public class ClientProxy extends CommonProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z)
|
||||
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z)
|
||||
{
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)entityplayer.worldObj.getTileEntity(x, y, z);
|
||||
TileEntityPersonalChest tileEntity = (TileEntityPersonalChest)entityplayer.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if(id == 0)
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiElectricChest(entityplayer.inventory, tileEntity));
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, tileEntity));
|
||||
entityplayer.openContainer.windowId = windowId;
|
||||
}
|
||||
else {
|
||||
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
if(MachineType.get(stack) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
InventoryElectricChest inventory = new InventoryElectricChest(entityplayer);
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiElectricChest(entityplayer.inventory, inventory));
|
||||
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer);
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, inventory));
|
||||
entityplayer.openContainer.windowId = windowId;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(id == 1)
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordEnter(tileEntity));
|
||||
}
|
||||
else {
|
||||
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordEnter(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(id == 2)
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordModify(tileEntity));
|
||||
}
|
||||
else {
|
||||
ItemStack stack = entityplayer.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPasswordModify(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,7 +278,7 @@ public class ClientProxy extends CommonProxy
|
||||
ClientRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank", new RenderGasTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube", new RenderEnergyCube());
|
||||
ClientRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump", new RenderElectricPump());
|
||||
ClientRegistry.registerTileEntity(TileEntityElectricChest.class, "ElectricChest", new RenderElectricChest());
|
||||
ClientRegistry.registerTileEntity(TileEntityPersonalChest.class, "ElectricChest", new RenderPersonalChest()); //TODO rename
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve", new RenderDynamicTank());
|
||||
ClientRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad", new RenderChargepad());
|
||||
@@ -446,10 +413,7 @@ public class ClientProxy extends CommonProxy
|
||||
return new GuiElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
|
||||
case 18:
|
||||
return new GuiDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
|
||||
case 19:
|
||||
return new GuiPasswordEnter((TileEntityElectricChest)tileEntity);
|
||||
case 20:
|
||||
return new GuiPasswordModify((TileEntityElectricChest)tileEntity);
|
||||
//EMPTY 19, 20
|
||||
case 21:
|
||||
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -41,6 +42,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
|
||||
|
||||
@@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -39,6 +40,7 @@ public class GuiChanceMachine extends GuiMekanism
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
|
||||
|
||||
@@ -17,6 +17,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -59,6 +60,7 @@ public class GuiChemicalCrystallizer extends GuiMekanism
|
||||
super(tentity, new ContainerChemicalCrystallizer(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.png"), 160, 23));
|
||||
|
||||
@@ -7,6 +7,7 @@ import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.element.GuiElement.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
@@ -39,6 +40,7 @@ public class GuiChemicalDissolutionChamber extends GuiMekanism
|
||||
super(tentity, new ContainerChemicalDissolutionChamber(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalDissolutionChamber.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
|
||||
@@ -13,6 +13,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -39,6 +40,7 @@ public class GuiChemicalInfuser extends GuiMekanism
|
||||
super(tentity, new ContainerChemicalInfuser(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalInfuser.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalInfuser.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalInfuser.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
|
||||
@@ -13,6 +13,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -39,6 +40,7 @@ public class GuiChemicalOxidizer extends GuiMekanism
|
||||
super(tentity, new ContainerChemicalOxidizer(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
|
||||
@@ -17,6 +17,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -44,6 +45,7 @@ public class GuiChemicalWasher extends GuiMekanism
|
||||
super(tentity, new ContainerChemicalWasher(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
|
||||
guiElements.add(new GuiBucketIO(this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
|
||||
|
||||
@@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiElement.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -51,6 +52,7 @@ public class GuiDigitalMiner extends GuiMekanism
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"), 163, 23));
|
||||
guiElements.add(new GuiVisualsTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.inventory.container.ContainerElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiElectricChest extends GuiMekanism
|
||||
{
|
||||
public TileEntityElectricChest tileEntity;
|
||||
public IInventory itemInventory;
|
||||
public boolean isBlock;
|
||||
|
||||
public GuiElectricChest(InventoryPlayer inventory, TileEntityElectricChest tentity)
|
||||
{
|
||||
super(tentity, new ContainerElectricChest(inventory, tentity, null, true));
|
||||
|
||||
xSize+=26;
|
||||
ySize+=64;
|
||||
tileEntity = tentity;
|
||||
isBlock = true;
|
||||
}
|
||||
|
||||
public GuiElectricChest(InventoryPlayer inventory, IInventory inv)
|
||||
{
|
||||
super(new ContainerElectricChest(inventory, null, inv, false));
|
||||
|
||||
xSize+=26;
|
||||
ySize+=64;
|
||||
itemInventory = inv;
|
||||
isBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButton(0, guiWidth + 93, guiHeight + 4, 76, 20, LangUtils.localize("gui.electricChest.editPassword")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
mc.thePlayer.openGui(Mekanism.instance, 20, mc.theWorld, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
}
|
||||
else {
|
||||
FMLClientHandler.instance().displayGuiScreen(mc.thePlayer, new GuiPasswordModify(mc.thePlayer.getCurrentEquippedItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("tile.MachineBlock.ElectricChest.name"), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(getLocked() ? EnumColor.DARK_RED + "Locked" : EnumColor.BRIGHT_GREEN + "Unlocked", 97, 137, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
if(xAxis >= 180 && xAxis <= 184 && yAxis >= 32 && yAxis <= 84)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(getEnergy()), xAxis, yAxis);
|
||||
}
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 88 && yAxis <= 106)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.LOCK, !getLocked(), true, 0, 0, null, Coord4D.get(tileEntity)));
|
||||
}
|
||||
else {
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.LOCK, !getLocked(), false, 0, 0, null, null));
|
||||
|
||||
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
|
||||
((IElectricChest)stack.getItem()).setLocked(stack, !getLocked());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricChest.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 88 && yAxis <= 106)
|
||||
{
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 88, 176 + 26, 52, 18, 18);
|
||||
}
|
||||
else {
|
||||
drawTexturedModalRect(guiWidth + 179, guiHeight + 88, 176 + 26, 70, 18, 18);
|
||||
}
|
||||
|
||||
int displayInt = getScale();
|
||||
drawTexturedModalRect(guiWidth + 180, guiHeight + 32 + 52 - displayInt, 176 + 26, 52 - displayInt, 4, displayInt);
|
||||
}
|
||||
|
||||
public boolean getLocked()
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
return tileEntity.locked;
|
||||
}
|
||||
else {
|
||||
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
|
||||
return ((IElectricChest)stack.getItem()).getLocked(stack);
|
||||
}
|
||||
}
|
||||
|
||||
public int getScale()
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
return tileEntity.getScaledEnergyLevel(52);
|
||||
}
|
||||
else {
|
||||
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
|
||||
return (int)(((IEnergizedItem)stack.getItem()).getEnergy(stack)*52 / ((IEnergizedItem)stack.getItem()).getMaxEnergy(stack));
|
||||
}
|
||||
}
|
||||
|
||||
public double getEnergy()
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
return tileEntity.getEnergy();
|
||||
}
|
||||
else {
|
||||
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
|
||||
return ((IEnergizedItem)stack.getItem()).getEnergy(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -39,6 +40,7 @@ public class GuiElectricMachine extends GuiMekanism
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
|
||||
|
||||
@@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -59,6 +60,7 @@ public class GuiElectricPump extends GuiMekanism
|
||||
return ListUtils.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t", LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
|
||||
}
|
||||
}, this, guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, guiLocation));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, guiLocation));
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEntangledBlock extends GuiMekanism
|
||||
{
|
||||
public TileEntityQuantumEntangloporter tileEntity;
|
||||
|
||||
public GuiTextField frequencyField;
|
||||
|
||||
public boolean isCreative;
|
||||
|
||||
public GuiEntangledBlock(InventoryPlayer inventory, TileEntityQuantumEntangloporter tentity)
|
||||
{
|
||||
super(tentity, new ContainerNull(inventory.player, tentity));
|
||||
tileEntity = tentity;
|
||||
isCreative = inventory.player.capabilities.isCreativeMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), 55, 6, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
frequencyField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
super.updateScreen();
|
||||
|
||||
frequencyField.updateCursorCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
frequencyField.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if(!frequencyField.isFocused() || i == Keyboard.KEY_ESCAPE)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
}
|
||||
|
||||
if(i == Keyboard.KEY_RETURN)
|
||||
{
|
||||
if(frequencyField.isFocused())
|
||||
{
|
||||
setFrequency();
|
||||
}
|
||||
}
|
||||
|
||||
frequencyField.textboxKeyTyped(c, i);
|
||||
}
|
||||
|
||||
private void setFrequency()
|
||||
{
|
||||
if(!frequencyField.getText().isEmpty())
|
||||
{
|
||||
String toUse;
|
||||
|
||||
toUse = frequencyField.getText();
|
||||
|
||||
ArrayList data = new ArrayList();
|
||||
data.add(0);
|
||||
data.add(toUse);
|
||||
|
||||
if(!toUse.startsWith("creative.") || isCreative)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
frequencyField.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
String prevFreq = frequencyField != null ? frequencyField.getText() : "";
|
||||
|
||||
frequencyField = new GuiTextField(fontRendererObj, guiWidth + 75, guiHeight + 55, 96, 11);
|
||||
frequencyField.setText(prevFreq);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import mekanism.client.gui.element.GuiElement.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiRecipeType;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSortingTab;
|
||||
import mekanism.client.gui.element.GuiTransporterConfigTab;
|
||||
@@ -47,6 +48,7 @@ public class GuiFactory extends GuiMekanism
|
||||
ySize += 11;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
guiElements.add(new GuiRecipeType(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
|
||||
@@ -10,6 +10,7 @@ import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -59,6 +60,7 @@ public class GuiFluidicPlenisher extends GuiMekanism
|
||||
return ListUtils.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t", LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
|
||||
}
|
||||
}, this, guiLocation));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, guiLocation));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, guiLocation));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, guiLocation));
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import mekanism.client.gui.element.GuiElement.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -42,6 +43,7 @@ public class GuiFormulaicAssemblicator extends GuiMekanism
|
||||
{
|
||||
super(tentity, new ContainerFormulaicAssemblicator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFormulaicAssemblicator.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFormulaicAssemblicator.png")));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFormulaicAssemblicator.png")));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFormulaicAssemblicator.png")));
|
||||
|
||||
@@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiGauge.Type;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
import mekanism.client.gui.element.GuiNumberGauge.INumberInfoHandler;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerLaserAmplifier;
|
||||
@@ -66,6 +67,7 @@ public class GuiLaserAmplifier extends GuiMekanism
|
||||
return LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(level);
|
||||
}
|
||||
}, Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 6, 10));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiDetectionTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.common.inventory.container.ContainerLaserTractorBeam;
|
||||
import mekanism.common.tile.TileEntityLaserTractorBeam;
|
||||
import mekanism.common.util.LangUtils;
|
||||
@@ -17,6 +18,8 @@ public class GuiLaserTractorBeam extends GuiMekanism
|
||||
{
|
||||
super(tentity, new ContainerLaserTractorBeam(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiFullInv.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Set;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
@@ -92,6 +93,7 @@ public class GuiLogisticalSorter extends GuiMekanism
|
||||
|
||||
// Add common Mekanism gui elements
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png")));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiLogisticalSorter.png")));
|
||||
}
|
||||
|
||||
public int getScroll()
|
||||
|
||||
@@ -9,6 +9,8 @@ import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
@@ -50,6 +52,8 @@ public class GuiOredictionificator extends GuiMekanism
|
||||
super(tentity, new ContainerOredictionificator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png")));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiOredictionificator.png")));
|
||||
guiElements.add(new GuiProgress(new IProgressInfoHandler()
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
@@ -46,6 +47,7 @@ public class GuiPRC extends GuiMekanism
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPasswordEnter extends GuiScreen
|
||||
{
|
||||
public int xSize = 176;
|
||||
public int ySize = 95;
|
||||
|
||||
public TileEntityElectricChest tileEntity;
|
||||
|
||||
public ItemStack itemStack;
|
||||
|
||||
public boolean isBlock;
|
||||
|
||||
public GuiTextField passwordField;
|
||||
|
||||
public String displayText = EnumColor.BRIGHT_GREEN + LangUtils.localize("gui.password.enterPassword");
|
||||
|
||||
public int ticker = 0;
|
||||
|
||||
public GuiPasswordEnter(TileEntityElectricChest tileentity)
|
||||
{
|
||||
isBlock = true;
|
||||
tileEntity = tileentity;
|
||||
}
|
||||
|
||||
public GuiPasswordEnter(ItemStack itemstack)
|
||||
{
|
||||
isBlock = false;
|
||||
itemStack = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
passwordField.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButton(0, guiWidth + 55, guiHeight + 68, 60, 20, LangUtils.localize("gui.open")));
|
||||
|
||||
passwordField = new GuiTextField(fontRendererObj, guiWidth + 45, guiHeight + 50, 80, 12);
|
||||
passwordField.setMaxStringLength(12);
|
||||
passwordField.setFocused(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
|
||||
if(i == Keyboard.KEY_RETURN)
|
||||
{
|
||||
tryOpen();
|
||||
}
|
||||
|
||||
passwordField.textboxKeyTyped(c, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
passwordField.updateCursorCounter();
|
||||
|
||||
if(ticker > 0)
|
||||
{
|
||||
ticker--;
|
||||
}
|
||||
else {
|
||||
displayText = EnumColor.BRIGHT_GREEN + LangUtils.localize("gui.password.enterPassword");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
tryOpen();
|
||||
}
|
||||
}
|
||||
|
||||
public void tryOpen()
|
||||
{
|
||||
if(passwordField.getText() == null || passwordField.getText() == "")
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + LangUtils.localize("gui.password.fieldsEmpty");
|
||||
SoundHandler.playSound("mekanism:etc.Error");
|
||||
ticker = 30;
|
||||
}
|
||||
else if(!getPassword().equals(passwordField.getText()))
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + LangUtils.localize("gui.password.invalid");
|
||||
passwordField.setText("");
|
||||
SoundHandler.playSound("mekanism:etc.Error");
|
||||
ticker = 30;
|
||||
}
|
||||
else {
|
||||
if(isBlock)
|
||||
{
|
||||
tileEntity.setEnergy(tileEntity.getEnergy() - 100);
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, true, true, 0, 0, null, Coord4D.get(tileEntity)));
|
||||
}
|
||||
else {
|
||||
((IEnergizedItem)itemStack.getItem()).setEnergy(itemStack, ((IEnergizedItem)itemStack.getItem()).getEnergy(itemStack) - 100);
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, true, false, 0, 0, null, null));
|
||||
}
|
||||
|
||||
SoundHandler.playSound("mekanism:etc.Success");
|
||||
}
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
return tileEntity.password;
|
||||
}
|
||||
else {
|
||||
return ((IElectricChest)itemStack.getItem()).getPassword(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
drawDefaultBackground();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordEnter.png"));
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
String actualPass = passwordField.getText();
|
||||
String censored = new String(new char[actualPass.length()]).replace("\0", "*");
|
||||
passwordField.setText(censored);
|
||||
passwordField.drawTextBox();
|
||||
passwordField.setText(actualPass);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.password"), guiWidth + 64, guiHeight + 5, 0x404040);
|
||||
fontRendererObj.drawString("Enter:", guiWidth + 45, guiHeight + 40, 0x404040);
|
||||
fontRendererObj.drawString(displayText, guiWidth + 37, guiHeight + 19, 0x404040);
|
||||
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPasswordModify extends GuiScreen
|
||||
{
|
||||
public int xSize = 176;
|
||||
public int ySize = 95;
|
||||
|
||||
public TileEntityElectricChest tileEntity;
|
||||
|
||||
public ItemStack itemStack;
|
||||
|
||||
public boolean isBlock;
|
||||
|
||||
public GuiTextField newPasswordField;
|
||||
|
||||
public GuiTextField confirmPasswordField;
|
||||
|
||||
public String displayText = EnumColor.BRIGHT_GREEN + LangUtils.localize("gui.password.setPassword");
|
||||
|
||||
public int ticker = 0;
|
||||
|
||||
public GuiPasswordModify(TileEntityElectricChest tileentity)
|
||||
{
|
||||
isBlock = true;
|
||||
tileEntity = tileentity;
|
||||
}
|
||||
|
||||
public GuiPasswordModify(ItemStack itemstack)
|
||||
{
|
||||
isBlock = false;
|
||||
itemStack = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButton(0, guiWidth + 55, guiHeight + 68, 60, 20, LangUtils.localize("gui.confirm")));
|
||||
|
||||
newPasswordField = new GuiTextField(fontRendererObj, guiWidth + 60, guiHeight + 34, 80, 12);
|
||||
newPasswordField.setMaxStringLength(12);
|
||||
newPasswordField.setFocused(true);
|
||||
|
||||
confirmPasswordField = new GuiTextField(fontRendererObj, guiWidth + 60, guiHeight + 51, 80, 12);
|
||||
confirmPasswordField.setMaxStringLength(12);
|
||||
confirmPasswordField.setFocused(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
newPasswordField.mouseClicked(mouseX, mouseY, button);
|
||||
confirmPasswordField.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
|
||||
if(i == Keyboard.KEY_TAB)
|
||||
{
|
||||
if(!newPasswordField.isFocused() && !confirmPasswordField.isFocused())
|
||||
{
|
||||
newPasswordField.setFocused(true);
|
||||
return;
|
||||
}
|
||||
else if(newPasswordField.isFocused() && confirmPasswordField.isFocused())
|
||||
{
|
||||
newPasswordField.setFocused(true);
|
||||
confirmPasswordField.setFocused(false);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
newPasswordField.setFocused(!newPasswordField.isFocused());
|
||||
confirmPasswordField.setFocused(!confirmPasswordField.isFocused());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(i == Keyboard.KEY_RETURN)
|
||||
{
|
||||
tryModify();
|
||||
}
|
||||
|
||||
newPasswordField.textboxKeyTyped(c, i);
|
||||
confirmPasswordField.textboxKeyTyped(c, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
newPasswordField.updateCursorCounter();
|
||||
|
||||
if(ticker > 0)
|
||||
{
|
||||
ticker--;
|
||||
}
|
||||
else {
|
||||
displayText = EnumColor.BRIGHT_GREEN + LangUtils.localize("gui.password.setPassword");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if(guibutton.id == 0)
|
||||
{
|
||||
tryModify();
|
||||
}
|
||||
}
|
||||
|
||||
public void tryModify()
|
||||
{
|
||||
if(newPasswordField.getText() == null || newPasswordField.getText().equals("") || confirmPasswordField.getText() == null || confirmPasswordField.getText().equals(""))
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + LangUtils.localize("gui.password.fieldsEmpty");
|
||||
ticker = 30;
|
||||
}
|
||||
else if(!newPasswordField.getText().equals(confirmPasswordField.getText()))
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + LangUtils.localize("gui.password.notMatching");
|
||||
ticker = 30;
|
||||
}
|
||||
else if(confirmPasswordField.getText().equals(getPassword()))
|
||||
{
|
||||
displayText = EnumColor.DARK_RED + LangUtils.localize("gui.password.identical");
|
||||
ticker = 30;
|
||||
}
|
||||
else {
|
||||
if(isBlock)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.PASSWORD, true, false, 0, 0, confirmPasswordField.getText(), Coord4D.get(tileEntity)));
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, false, true, 0, 0, null, Coord4D.get(tileEntity)));
|
||||
}
|
||||
else {
|
||||
((IElectricChest)itemStack.getItem()).setPassword(itemStack, confirmPasswordField.getText());
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.PASSWORD, false, false, 0, 0, confirmPasswordField.getText(), null));
|
||||
Mekanism.packetHandler.sendToServer(new ElectricChestMessage(ElectricChestPacketType.SERVER_OPEN, false, false, 0, 0, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
if(isBlock)
|
||||
{
|
||||
return tileEntity.password;
|
||||
}
|
||||
else {
|
||||
return ((IElectricChest)itemStack.getItem()).getPassword(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTick)
|
||||
{
|
||||
drawDefaultBackground();
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPasswordModify.png"));
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTick);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.password"), guiWidth + 64, guiHeight + 5, 0x404040);
|
||||
fontRendererObj.drawString(displayText, guiWidth + 37, guiHeight + 19, 0x404040);
|
||||
fontRendererObj.drawString("Enter:", guiWidth + 27, guiHeight + 37, 0x404040);
|
||||
fontRendererObj.drawString("Repeat:", guiWidth + 21, guiHeight + 54, 0x404040);
|
||||
String actualPass = newPasswordField.getText();
|
||||
String censored = new String(new char[actualPass.length()]).replace("\0", "*");
|
||||
newPasswordField.setText(censored);
|
||||
newPasswordField.drawTextBox();
|
||||
newPasswordField.setText(actualPass);
|
||||
actualPass = confirmPasswordField.getText();
|
||||
censored = new String(new char[actualPass.length()]).replace("\0", "*");
|
||||
confirmPasswordField.setText(censored);
|
||||
confirmPasswordField.drawTextBox();
|
||||
confirmPasswordField.setText(actualPass);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.common.inventory.container.ContainerPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPersonalChest extends GuiMekanism
|
||||
{
|
||||
public TileEntityPersonalChest tileEntity;
|
||||
public IInventory itemInventory;
|
||||
public boolean isBlock;
|
||||
|
||||
public GuiPersonalChest(InventoryPlayer inventory, TileEntityPersonalChest tentity)
|
||||
{
|
||||
super(tentity, new ContainerPersonalChest(inventory, tentity, null, true));
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPersonalChest.png")));
|
||||
|
||||
xSize+=26;
|
||||
ySize+=64;
|
||||
tileEntity = tentity;
|
||||
isBlock = true;
|
||||
}
|
||||
|
||||
public GuiPersonalChest(InventoryPlayer inventory, IInventory inv)
|
||||
{
|
||||
super(new ContainerPersonalChest(inventory, null, inv, false));
|
||||
|
||||
xSize+=26;
|
||||
ySize+=64;
|
||||
itemInventory = inv;
|
||||
isBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("tile.MachineBlock.PersonalChest.name"), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPersonalChest.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiScrollList;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSideConfigurationTab;
|
||||
import mekanism.client.gui.element.GuiTransporterConfigTab;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
@@ -61,6 +62,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism
|
||||
resource = MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png");
|
||||
|
||||
guiElements.add(scrollList = new GuiScrollList(this, resource, 28, 37, 120, 4));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
|
||||
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
|
||||
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png")));
|
||||
|
||||
@@ -122,7 +124,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism
|
||||
|
||||
public void updateButtons()
|
||||
{
|
||||
if(tileEntity.owner == null)
|
||||
if(tileEntity.getSecurity().getOwner() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -167,7 +169,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism
|
||||
setButton.enabled = false;
|
||||
}
|
||||
|
||||
if(tileEntity.owner.equals(freq.owner))
|
||||
if(tileEntity.getSecurity().getOwner().equals(freq.owner))
|
||||
{
|
||||
deleteButton.enabled = true;
|
||||
}
|
||||
@@ -298,8 +300,7 @@ public class GuiQuantumEntangloporter extends GuiMekanism
|
||||
int yAxis = (mouseY-(height-ySize)/2);
|
||||
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 4, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.owner") + ": " + (tileEntity.owner != null ? tileEntity.owner : LangUtils.localize("gui.none")), 8, (ySize-96)+4, 0x404040);
|
||||
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiHeatInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -46,6 +47,7 @@ public class GuiResistiveHeater extends GuiMekanism
|
||||
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiResistiveHeater.png"), 164, 15));
|
||||
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, "GuiResistiveHeater.png"), 14, 34).with(SlotOverlay.POWER));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiResistiveHeater.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiResistiveHeater.png")));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -47,6 +48,7 @@ public class GuiRotaryCondensentrator extends GuiMekanism
|
||||
super(tentity, new ContainerRotaryCondensentrator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png")));
|
||||
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png")));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png"), 4, 24).with(SlotOverlay.PLUS));
|
||||
|
||||
@@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiElement.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -33,6 +34,7 @@ public class GuiSeismicVibrator extends GuiMekanism
|
||||
super(tentity, new ContainerSeismicVibrator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSeismicVibrator.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSeismicVibrator.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSeismicVibrator.png"), 164, 15));
|
||||
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -33,6 +34,7 @@ public class GuiSolarNeutronActivator extends GuiMekanism
|
||||
super(tentity, new ContainerSolarNeutronActivator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png")));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 4, 55).with(SlotOverlay.MINUS));
|
||||
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBlank.png"), 154, 55).with(SlotOverlay.PLUS));
|
||||
|
||||
@@ -7,7 +7,9 @@ import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiScrollList;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiSlot;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
|
||||
import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
@@ -75,6 +77,8 @@ public class GuiTeleporter extends GuiMekanism
|
||||
tileEntity = tentity;
|
||||
resource = MekanismUtils.getResource(ResourceType.GUI, "GuiTeleporter.png");
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, resource));
|
||||
guiElements.add(new GuiSecurityTab(this, tileEntity, resource));
|
||||
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
|
||||
@Override
|
||||
public String getTooltip()
|
||||
@@ -463,7 +467,7 @@ public class GuiTeleporter extends GuiMekanism
|
||||
|
||||
private String getOwner()
|
||||
{
|
||||
return tileEntity != null ? tileEntity.owner : entityPlayer.getCommandSenderName();
|
||||
return tileEntity != null ? tileEntity.getSecurity().getOwner() : entityPlayer.getCommandSenderName();
|
||||
}
|
||||
|
||||
private byte getStatus()
|
||||
|
||||
@@ -76,7 +76,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class ItemRenderingHandler implements IItemRenderer
|
||||
{
|
||||
public ModelRobit robit = new ModelRobit();
|
||||
public ModelChest electricChest = new ModelChest();
|
||||
public ModelChest personalChest = new ModelChest();
|
||||
public ModelEnergyCube energyCube = new ModelEnergyCube();
|
||||
public ModelEnergyCore energyCore = new ModelEnergyCore();
|
||||
public ModelGasTank gasTank = new ModelGasTank();
|
||||
@@ -325,7 +325,7 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||
MekanismRenderer.glowOff();
|
||||
}
|
||||
}
|
||||
else if(MachineType.get(item) == MachineType.ELECTRIC_CHEST)
|
||||
else if(MachineType.get(item) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
ItemBlockMachine chest = (ItemBlockMachine)item.getItem();
|
||||
@@ -335,9 +335,9 @@ public class ItemRenderingHandler implements IItemRenderer
|
||||
GL11.glTranslatef(0, 1.0F, 1.0F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricChest.png"));
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PersonalChest.png"));
|
||||
|
||||
electricChest.renderAll();
|
||||
personalChest.renderAll();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if(item.getItem() instanceof ItemRobit)
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
@@ -13,22 +13,22 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderElectricChest extends TileEntitySpecialRenderer
|
||||
public class RenderPersonalChest extends TileEntitySpecialRenderer
|
||||
{
|
||||
private ModelChest model = new ModelChest();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
renderAModelAt((TileEntityElectricChest)tileEntity, x, y, z, partialTick);
|
||||
renderAModelAt((TileEntityPersonalChest)tileEntity, x, y, z, partialTick);
|
||||
}
|
||||
|
||||
private void renderAModelAt(TileEntityElectricChest tileEntity, double x, double y, double z, float partialTick)
|
||||
private void renderAModelAt(TileEntityPersonalChest tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x, (float)y + 1.0F, (float)z);
|
||||
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricChest.png"));
|
||||
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PersonalChest.png"));
|
||||
|
||||
switch(tileEntity.facing)
|
||||
{
|
||||
@@ -79,7 +79,6 @@ import mekanism.common.tile.TileEntityCrusher;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityDynamicTank;
|
||||
import mekanism.common.tile.TileEntityDynamicValve;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityElectricMachine;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
@@ -106,6 +105,7 @@ import mekanism.common.tile.TileEntityObsidianTNT;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
@@ -169,7 +169,7 @@ public class CommonProxy implements IGuiProvider
|
||||
GameRegistry.registerTileEntity(TileEntityGasTank.class, "GasTank");
|
||||
GameRegistry.registerTileEntity(TileEntityEnergyCube.class, "EnergyCube");
|
||||
GameRegistry.registerTileEntity(TileEntityElectricPump.class, "ElectricPump");
|
||||
GameRegistry.registerTileEntity(TileEntityElectricChest.class, "ElectricChest");
|
||||
GameRegistry.registerTileEntity(TileEntityPersonalChest.class, "ElectricChest"); //TODO rename
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicTank.class, "DynamicTank");
|
||||
GameRegistry.registerTileEntity(TileEntityDynamicValve.class, "DynamicValve");
|
||||
GameRegistry.registerTileEntity(TileEntityChargepad.class, "Chargepad");
|
||||
@@ -212,16 +212,16 @@ public class CommonProxy implements IGuiProvider
|
||||
public void handleTeleporterUpdate(PortableTeleporterMessage message) {}
|
||||
|
||||
/**
|
||||
* Handles an ELECTRIC_CHEST_CLIENT_OPEN packet via the proxy, not handled on the server-side.
|
||||
* Handles an PERSONAL_CHEST_CLIENT_OPEN packet via the proxy, not handled on the server-side.
|
||||
* @param entityplayer - player the packet was sent from
|
||||
* @param id - the electric chest gui ID to open
|
||||
* @param id - the gui ID to open
|
||||
* @param windowId - the container-specific window ID
|
||||
* @param isBlock - if the chest is a block
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
* @param z - z coordinate
|
||||
*/
|
||||
public void openElectricChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z) {}
|
||||
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, int x, int y, int z) {}
|
||||
|
||||
/**
|
||||
* Register and load client-only render information.
|
||||
@@ -250,7 +250,6 @@ public class CommonProxy implements IGuiProvider
|
||||
general.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean();
|
||||
general.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean();
|
||||
general.enableWorldRegeneration = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableWorldRegeneration", false).getBoolean();
|
||||
general.creativeOverrideElectricChest = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "CreativeOverrideElectricChest", true).getBoolean();
|
||||
general.spawnBabySkeletons = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SpawnBabySkeletons", true).getBoolean();
|
||||
general.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
|
||||
general.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
|
||||
|
||||
@@ -352,7 +352,7 @@ public class Mekanism
|
||||
MachineType.ELECTRIC_PUMP.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 12), new Object[] {
|
||||
" B ", "ECE", "OOO", Character.valueOf('B'), Items.bucket, Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('O'), "ingotOsmium"
|
||||
}));
|
||||
MachineType.ELECTRIC_CHEST.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 13), new Object[] {
|
||||
MachineType.PERSONAL_CHEST.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 13), new Object[] {
|
||||
"SGS", "CcC", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), Blocks.chest, Character.valueOf('c'), MekanismUtils.getControlCircuit(BaseTier.BASIC)
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 4, 9), new Object[] {
|
||||
|
||||
@@ -27,8 +27,8 @@ import mekanism.common.network.PacketEditFilter;
|
||||
import mekanism.common.network.PacketEditFilter.EditFilterMessage;
|
||||
import mekanism.common.network.PacketElectricBowState;
|
||||
import mekanism.common.network.PacketElectricBowState.ElectricBowStateMessage;
|
||||
import mekanism.common.network.PacketElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketPersonalChest;
|
||||
import mekanism.common.network.PacketPersonalChest.PersonalChestMessage;
|
||||
import mekanism.common.network.PacketFlamethrowerData;
|
||||
import mekanism.common.network.PacketFlamethrowerData.FlamethrowerDataMessage;
|
||||
import mekanism.common.network.PacketJetpackData;
|
||||
@@ -94,8 +94,8 @@ public class PacketHandler
|
||||
{
|
||||
netHandler.registerMessage(PacketRobit.class, RobitMessage.class, 0, Side.SERVER);
|
||||
netHandler.registerMessage(PacketTransmitterUpdate.class, TransmitterUpdateMessage.class, 1, Side.CLIENT);
|
||||
netHandler.registerMessage(PacketElectricChest.class, ElectricChestMessage.class, 2, Side.CLIENT);
|
||||
netHandler.registerMessage(PacketElectricChest.class, ElectricChestMessage.class, 2, Side.SERVER);
|
||||
netHandler.registerMessage(PacketPersonalChest.class, PersonalChestMessage.class, 2, Side.CLIENT);
|
||||
netHandler.registerMessage(PacketPersonalChest.class, PersonalChestMessage.class, 2, Side.SERVER);
|
||||
netHandler.registerMessage(PacketElectricBowState.class, ElectricBowStateMessage.class, 3, Side.SERVER);
|
||||
netHandler.registerMessage(PacketConfiguratorState.class, ConfiguratorStateMessage.class, 4, Side.SERVER);
|
||||
netHandler.registerMessage(PacketTileEntity.class, TileEntityMessage.class, 5, Side.CLIENT);
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package mekanism.common.base;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Internal interface used for managing Electric Chests.
|
||||
* @author aidancbrady
|
||||
*
|
||||
*/
|
||||
public interface IElectricChest
|
||||
{
|
||||
/**
|
||||
* Sets the 'authenticated' value of this electric chest to a new value.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @param auth - new value
|
||||
*/
|
||||
public void setAuthenticated(ItemStack itemStack, boolean auth);
|
||||
|
||||
/**
|
||||
* Retrieves the 'authenticated' value of this electric chest.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @return authenticated value
|
||||
*/
|
||||
public boolean getAuthenticated(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Sets the 'password' value of this electric chest to a new value.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @param pass - new value
|
||||
*/
|
||||
public void setPassword(ItemStack itemStack, String pass);
|
||||
|
||||
/**
|
||||
* Retrieves the 'password' value of this electric chest.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @return authenticated value
|
||||
*/
|
||||
public String getPassword(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Sets the 'locked' value of this electric chest to a new value.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @param locked - new value
|
||||
*/
|
||||
public void setLocked(ItemStack itemStack, boolean locked);
|
||||
|
||||
/**
|
||||
* Retrieves the 'locked' value of this electric chest.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @return authenticated value
|
||||
*/
|
||||
public boolean getLocked(ItemStack itemStack);
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.MekanismConfig.client;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.MekanismConfig.machines;
|
||||
@@ -26,7 +25,6 @@ import mekanism.common.Tier.FluidTankTier;
|
||||
import mekanism.common.base.IActiveState;
|
||||
import mekanism.common.base.IBlockCTM;
|
||||
import mekanism.common.base.IBoundingBlock;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.base.IFactory;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
@@ -38,14 +36,12 @@ import mekanism.common.base.ISustainedTank;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.item.ItemBlockMachine;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.LogisticalSorterGuiMessage;
|
||||
import mekanism.common.network.PacketLogisticalSorterGui.SorterGuiPacket;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.tile.TileEntityAdvancedFactory;
|
||||
import mekanism.common.tile.TileEntityAmbientAccumulator;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
@@ -60,7 +56,6 @@ import mekanism.common.tile.TileEntityCombiner;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.TileEntityCrusher;
|
||||
import mekanism.common.tile.TileEntityDigitalMiner;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityElectricPump;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
import mekanism.common.tile.TileEntityEliteFactory;
|
||||
@@ -78,6 +73,7 @@ import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityOredictionificator;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityQuantumEntangloporter;
|
||||
@@ -105,7 +101,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -314,16 +309,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(tileEntity instanceof TileEntityTeleporter)
|
||||
{
|
||||
TileEntityTeleporter teleporter = (TileEntityTeleporter)tileEntity;
|
||||
teleporter.owner = entityliving.getCommandSenderName();
|
||||
}
|
||||
else if(tileEntity instanceof TileEntityQuantumEntangloporter)
|
||||
{
|
||||
TileEntityQuantumEntangloporter entangloporter = (TileEntityQuantumEntangloporter)tileEntity;
|
||||
entangloporter.owner = entityliving.getCommandSenderName();
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
tileEntity.redstone = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
@@ -580,45 +565,46 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, x, y, z))
|
||||
{
|
||||
if(entityplayer.isSneaking() && MachineType.get(blockType, metadata) != MachineType.ELECTRIC_CHEST)
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, x, y, z, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
}
|
||||
|
||||
int change = ForgeDirection.ROTATION_MATRIX[ForgeDirection.UP.ordinal()][tileEntity.facing];
|
||||
|
||||
if(tileEntity instanceof TileEntityLogisticalSorter)
|
||||
{
|
||||
if(!((TileEntityLogisticalSorter)tileEntity).hasInventory())
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, x, y, z);
|
||||
}
|
||||
|
||||
int change = ForgeDirection.ROTATION_MATRIX[ForgeDirection.UP.ordinal()][tileEntity.facing];
|
||||
|
||||
if(tileEntity instanceof TileEntityLogisticalSorter)
|
||||
{
|
||||
if(!((TileEntityLogisticalSorter)tileEntity).hasInventory())
|
||||
{
|
||||
TileEntity tile = Coord4D.get(tileEntity).getFromSide(dir).getTileEntity(world);
|
||||
|
||||
if(tile instanceof IInventory)
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
change = dir.getOpposite().ordinal();
|
||||
break;
|
||||
TileEntity tile = Coord4D.get(tileEntity).getFromSide(dir).getTileEntity(world);
|
||||
|
||||
if(tile instanceof IInventory)
|
||||
{
|
||||
change = dir.getOpposite().ordinal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
}
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, this);
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -629,91 +615,78 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case ELECTRIC_CHEST:
|
||||
TileEntityElectricChest electricChest = (TileEntityElectricChest)tileEntity;
|
||||
|
||||
if(!(entityplayer.isSneaking() || world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)))
|
||||
case PERSONAL_CHEST:
|
||||
if(!entityplayer.isSneaking() && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))
|
||||
{
|
||||
if(electricChest.canAccess() || MekanismUtils.isOp((EntityPlayerMP)entityplayer))
|
||||
TileEntityPersonalChest chest = (TileEntityPersonalChest)tileEntity;
|
||||
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
MekanismUtils.openElectricChestGui((EntityPlayerMP)entityplayer, electricChest, null, true);
|
||||
}
|
||||
else if(!electricChest.authenticated)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, true, false, 2, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
|
||||
}
|
||||
MekanismUtils.openPersonalChestGui((EntityPlayerMP)entityplayer, chest, null, true);
|
||||
}
|
||||
else {
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, true, false, 1, 0, null, Coord4D.get(electricChest)), (EntityPlayerMP)entityplayer);
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case FLUID_TANK:
|
||||
if(entityplayer.getCurrentEquippedItem() != null && FluidContainerRegistry.isContainer(entityplayer.getCurrentEquippedItem()))
|
||||
{
|
||||
if(manageInventory(entityplayer, (TileEntityFluidTank)tileEntity))
|
||||
{
|
||||
entityplayer.inventory.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
break;
|
||||
case FLUID_TANK:
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
if(entityplayer.getCurrentEquippedItem() != null && FluidContainerRegistry.isContainer(entityplayer.getCurrentEquippedItem()))
|
||||
{
|
||||
if(manageInventory(entityplayer, (TileEntityFluidTank)tileEntity))
|
||||
{
|
||||
entityplayer.inventory.markDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LOGISTICAL_SORTER:
|
||||
LogisticalSorterGuiMessage.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
|
||||
return true;
|
||||
case TELEPORTER:
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
TileEntityTeleporter teleporter = (TileEntityTeleporter)tileEntity;
|
||||
|
||||
if(teleporter.owner == null)
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
teleporter.owner = entityplayer.getCommandSenderName();
|
||||
}
|
||||
|
||||
if(teleporter.owner.equals(entityplayer.getCommandSenderName()) || MekanismUtils.isOp((EntityPlayerMP)entityplayer))
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
LogisticalSorterGuiMessage.openServerGui(SorterGuiPacket.SERVER, 0, world, (EntityPlayerMP)entityplayer, Coord4D.get(tileEntity), -1);
|
||||
}
|
||||
else {
|
||||
entityplayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("gui.teleporter.noAccess")));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
case QUANTUM_ENTANGLOPORTER:
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
TileEntityQuantumEntangloporter teleporter = (TileEntityQuantumEntangloporter)tileEntity;
|
||||
|
||||
if(teleporter.owner == null)
|
||||
{
|
||||
teleporter.owner = entityplayer.getCommandSenderName();
|
||||
}
|
||||
|
||||
if(teleporter.owner.equals(entityplayer.getCommandSenderName()) || MekanismUtils.isOp((EntityPlayerMP)entityplayer))
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
entityplayer.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("gui.entangloporter.noAccess")));
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if(!entityplayer.isSneaking() && type.guiId != -1)
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, type.guiId, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,31 +739,23 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||
if(tile instanceof ISecurityTile)
|
||||
{
|
||||
if(tile instanceof ISecurityTile)
|
||||
{
|
||||
return SecurityUtils.getSecurity((ISecurityTile)tile) == SecurityMode.PUBLIC ? blockHardness : -1;
|
||||
}
|
||||
|
||||
return blockHardness;
|
||||
}
|
||||
else {
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
|
||||
return tileEntity.canAccess() ? 3.5F : -1;
|
||||
return SecurityUtils.getSecurity((ISecurityTile)tile) == SecurityMode.PUBLIC ? blockHardness : -1;
|
||||
}
|
||||
|
||||
return blockHardness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
{
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(x, y, z)) != MachineType.ELECTRIC_CHEST)
|
||||
if(MachineType.get(blockType, world.getBlockMetadata(x, y, z)) != MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
return blockResistance;
|
||||
}
|
||||
else {
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)world.getTileEntity(x, y, z);
|
||||
return tileEntity.canAccess() ? 3.5F : -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,14 +992,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof TileEntityElectricChest)
|
||||
{
|
||||
IElectricChest electricChest = (IElectricChest)itemStack.getItem();
|
||||
electricChest.setAuthenticated(itemStack, ((TileEntityElectricChest)tileEntity).authenticated);
|
||||
electricChest.setLocked(itemStack, ((TileEntityElectricChest)tileEntity).locked);
|
||||
electricChest.setPassword(itemStack, ((TileEntityElectricChest)tileEntity).password);
|
||||
}
|
||||
|
||||
if(tileEntity instanceof TileEntityFactory)
|
||||
{
|
||||
IFactory factoryItem = (IFactory)itemStack.getItem();
|
||||
@@ -1133,7 +1090,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
switch(type)
|
||||
{
|
||||
case CHARGEPAD:
|
||||
case ELECTRIC_CHEST:
|
||||
case PERSONAL_CHEST:
|
||||
return false;
|
||||
case FLUID_TANK:
|
||||
return side == ForgeDirection.UP || side == ForgeDirection.DOWN;
|
||||
@@ -1179,7 +1136,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
ENERGIZED_SMELTER(MachineBlock.MACHINE_BLOCK_1, 10, "EnergizedSmelter", 16, TileEntityEnergizedSmelter.class, true, false, true),
|
||||
TELEPORTER(MachineBlock.MACHINE_BLOCK_1, 11, "Teleporter", 13, TileEntityTeleporter.class, true, false, false),
|
||||
ELECTRIC_PUMP(MachineBlock.MACHINE_BLOCK_1, 12, "ElectricPump", 17, TileEntityElectricPump.class, true, true, false),
|
||||
ELECTRIC_CHEST(MachineBlock.MACHINE_BLOCK_1, 13, "ElectricChest", -1, TileEntityElectricChest.class, true, true, false),
|
||||
PERSONAL_CHEST(MachineBlock.MACHINE_BLOCK_1, 13, "PersonalChest", -1, TileEntityPersonalChest.class, false, true, false),
|
||||
CHARGEPAD(MachineBlock.MACHINE_BLOCK_1, 14, "Chargepad", -1, TileEntityChargepad.class, true, true, false),
|
||||
LOGISTICAL_SORTER(MachineBlock.MACHINE_BLOCK_1, 15, "LogisticalSorter", -1, TileEntityLogisticalSorter.class, false, true, false),
|
||||
ROTARY_CONDENSENTRATOR(MachineBlock.MACHINE_BLOCK_2, 0, "RotaryCondensentrator", 7, TileEntityRotaryCondensentrator.class, true, true, false),
|
||||
@@ -1328,8 +1285,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
||||
return 12500;
|
||||
case ELECTRIC_PUMP:
|
||||
return usage.electricPumpUsage;
|
||||
case ELECTRIC_CHEST:
|
||||
return 30;
|
||||
case CHARGEPAD:
|
||||
return 25;
|
||||
case LOGISTICAL_SORTER:
|
||||
|
||||
+5
-5
@@ -7,24 +7,24 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class InventoryElectricChest extends InventoryBasic
|
||||
public class InventoryPersonalChest extends InventoryBasic
|
||||
{
|
||||
public EntityPlayer entityPlayer;
|
||||
public ItemStack itemStack;
|
||||
|
||||
public boolean reading;
|
||||
|
||||
public InventoryElectricChest(EntityPlayer player)
|
||||
public InventoryPersonalChest(EntityPlayer player)
|
||||
{
|
||||
super("Electric Chest", false, 55);
|
||||
super("PersonalChest", false, 55);
|
||||
entityPlayer = player;
|
||||
|
||||
read();
|
||||
}
|
||||
|
||||
public InventoryElectricChest(ItemStack stack)
|
||||
public InventoryPersonalChest(ItemStack stack)
|
||||
{
|
||||
super("Electric Chest", false, 55);
|
||||
super("PersonalChest", false, 55);
|
||||
itemStack = stack;
|
||||
|
||||
read();
|
||||
+17
-44
@@ -1,12 +1,9 @@
|
||||
package mekanism.common.inventory.container;
|
||||
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.slot.SlotElectricChest;
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.inventory.slot.SlotPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -15,13 +12,13 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ChestContainer(isLargeChest=true)
|
||||
public class ContainerElectricChest extends Container
|
||||
public class ContainerPersonalChest extends Container
|
||||
{
|
||||
private TileEntityElectricChest tileEntity;
|
||||
private TileEntityPersonalChest tileEntity;
|
||||
private IInventory itemInventory;
|
||||
private boolean isBlock;
|
||||
|
||||
public ContainerElectricChest(InventoryPlayer inventory, TileEntityElectricChest tentity, IInventory inv, boolean b)
|
||||
public ContainerPersonalChest(InventoryPlayer inventory, TileEntityPersonalChest tentity, IInventory inv, boolean b)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
itemInventory = inv;
|
||||
@@ -40,25 +37,23 @@ public class ContainerElectricChest extends Container
|
||||
{
|
||||
for(int slotX = 0; slotX < 9; slotX++)
|
||||
{
|
||||
addSlotToContainer(new SlotElectricChest(getInv(), slotX + slotY * 9, 8 + slotX * 18, 26 + slotY * 18));
|
||||
addSlotToContainer(new SlotPersonalChest(getInv(), slotX + slotY * 9, 8 + slotX * 18, 26 + slotY * 18));
|
||||
}
|
||||
}
|
||||
|
||||
addSlotToContainer(new SlotDischarge(getInv(), 54, 180, 11));
|
||||
|
||||
int slotX;
|
||||
|
||||
for(slotX = 0; slotX < 3; ++slotX)
|
||||
{
|
||||
for(int slotY = 0; slotY < 9; ++slotY)
|
||||
{
|
||||
addSlotToContainer(new SlotElectricChest(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 148 + slotX * 18));
|
||||
addSlotToContainer(new SlotPersonalChest(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 148 + slotX * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(slotX = 0; slotX < 9; ++slotX)
|
||||
{
|
||||
addSlotToContainer(new SlotElectricChest(inventory, slotX, 8 + slotX * 18, 206));
|
||||
addSlotToContainer(new SlotPersonalChest(inventory, slotX, 8 + slotX * 18, 206));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,36 +105,17 @@ public class ContainerElectricChest extends Container
|
||||
ItemStack slotStack = currentSlot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if(ChargeUtils.canBeDischarged(slotStack))
|
||||
if(slotID < 54)
|
||||
{
|
||||
if(slotID != 54)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 54, 55, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID == 54)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 55, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(slotID < 54)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 55, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(!mergeItemStack(slotStack, 0, 54, false))
|
||||
if(!mergeItemStack(slotStack, 54, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(!mergeItemStack(slotStack, 0, 54, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(slotStack.stackSize == 0)
|
||||
{
|
||||
@@ -166,14 +142,11 @@ public class ContainerElectricChest extends Container
|
||||
if(modifier == 2 && destSlot >= 0 && destSlot < 9)
|
||||
{
|
||||
ItemStack itemStack = player.inventory.getStackInSlot(destSlot);
|
||||
if(itemStack != null && itemStack.getItem() instanceof IElectricChest)
|
||||
|
||||
if(MachineType.get(itemStack) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
if(MachineType.get(itemStack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return super.slotClick(slotNumber, destSlot, modifier, player);
|
||||
@@ -1,37 +0,0 @@
|
||||
package mekanism.common.inventory.slot;
|
||||
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotElectricChest extends Slot
|
||||
{
|
||||
public SlotElectricChest(IInventory inventory, int index, int x, int y)
|
||||
{
|
||||
super(inventory, index, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player)
|
||||
{
|
||||
ItemStack itemstack = inventory.getStackInSlot(getSlotIndex());
|
||||
|
||||
if(itemstack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(itemstack.getItem() instanceof IElectricChest)
|
||||
{
|
||||
if(MachineType.get(itemstack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package mekanism.common.inventory.slot;
|
||||
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class SlotPersonalChest extends Slot
|
||||
{
|
||||
public SlotPersonalChest(IInventory inventory, int index, int x, int y)
|
||||
{
|
||||
super(inventory, index, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player)
|
||||
{
|
||||
return MachineType.get(inventory.getStackInSlot(getSlotIndex())) != MachineType.PERSONAL_CHEST;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
|
||||
@@ -11,15 +9,12 @@ import java.util.Map;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.energy.EnergizedItemManager;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.client.MekKeyHandler;
|
||||
import mekanism.client.MekanismKeyHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.Tier.FluidTankTier;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.base.IFactory;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.IRedstoneControl.RedstoneControl;
|
||||
@@ -31,15 +26,12 @@ import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.integration.IC2ItemManager;
|
||||
import mekanism.common.inventory.InventoryElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.inventory.InventoryPersonalChest;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.tile.TileEntityFluidTank;
|
||||
import mekanism.common.util.LangUtils;
|
||||
@@ -48,11 +40,8 @@ import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -120,7 +109,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
@InterfaceList({
|
||||
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2")
|
||||
})
|
||||
public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IElectricChest, IEnergyContainerItem, IFluidContainerItem, ITierItem, ISecurityItem
|
||||
public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IEnergyContainerItem, IFluidContainerItem, ITierItem, ISecurityItem
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
@@ -212,12 +201,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.recipeType") + ": " + EnumColor.GREY + RecipeType.values()[getRecipeType(itemstack)].getLocalizedName());
|
||||
}
|
||||
|
||||
if(type == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.auth") + ": " + EnumColor.GREY + LangUtils.transYesNo(getAuthenticated(itemstack)));
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.locked") + ": " + EnumColor.GREY + LangUtils.transYesNo(getLocked(itemstack)));
|
||||
}
|
||||
|
||||
if(type == MachineType.FLUID_TANK)
|
||||
{
|
||||
@@ -380,13 +363,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof TileEntityElectricChest)
|
||||
{
|
||||
((TileEntityElectricChest)tileEntity).authenticated = getAuthenticated(stack);
|
||||
((TileEntityElectricChest)tileEntity).locked = getLocked(stack);
|
||||
((TileEntityElectricChest)tileEntity).password = getPassword(stack);
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISustainedInventory)
|
||||
{
|
||||
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
|
||||
@@ -431,68 +407,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
|
||||
{
|
||||
MachineType type = MachineType.get(itemstack);
|
||||
|
||||
if(type == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
if(world != null && !world.isRemote)
|
||||
{
|
||||
InventoryElectricChest inv = new InventoryElectricChest(itemstack);
|
||||
|
||||
if(inv.getStackInSlot(54) != null && getEnergy(itemstack) < getMaxEnergy(itemstack))
|
||||
{
|
||||
if(inv.getStackInSlot(54).getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
setEnergy(itemstack, getEnergy(itemstack) + EnergizedItemManager.discharge(inv.getStackInSlot(54), getMaxEnergy(itemstack) - getEnergy(itemstack)));
|
||||
}
|
||||
else if(MekanismUtils.useIC2() && inv.getStackInSlot(54).getItem() instanceof IElectricItem)
|
||||
{
|
||||
IElectricItem item = (IElectricItem)inv.getStackInSlot(54).getItem();
|
||||
|
||||
if(item.canProvideEnergy(inv.getStackInSlot(54)))
|
||||
{
|
||||
double gain = ElectricItem.manager.discharge(inv.getStackInSlot(54), (int)((getMaxEnergy(itemstack) - getEnergy(itemstack))* general.TO_IC2), 3, false, true, false)* general.FROM_IC2;
|
||||
setEnergy(itemstack, getEnergy(itemstack) + gain);
|
||||
}
|
||||
}
|
||||
else if(MekanismUtils.useRF() && inv.getStackInSlot(54).getItem() instanceof IEnergyContainerItem)
|
||||
{
|
||||
ItemStack itemStack = inv.getStackInSlot(54);
|
||||
IEnergyContainerItem item = (IEnergyContainerItem)inv.getStackInSlot(54).getItem();
|
||||
|
||||
int itemEnergy = (int)Math.round(Math.min(Math.sqrt(item.getMaxEnergyStored(itemStack)), item.getEnergyStored(itemStack)));
|
||||
int toTransfer = (int)Math.round(Math.min(itemEnergy, ((getMaxEnergy(itemstack) - getEnergy(itemstack))* general.TO_TE)));
|
||||
|
||||
setEnergy(itemstack, getEnergy(itemstack) + (item.extractEnergy(itemStack, toTransfer, false)* general.FROM_TE));
|
||||
}
|
||||
else if(inv.getStackInSlot(54).getItem() == Items.redstone && getEnergy(itemstack)+ general.ENERGY_PER_REDSTONE <= getMaxEnergy(itemstack))
|
||||
{
|
||||
setEnergy(itemstack, getEnergy(itemstack) + general.ENERGY_PER_REDSTONE);
|
||||
inv.getStackInSlot(54).stackSize--;
|
||||
|
||||
if(inv.getStackInSlot(54).stackSize <= 0)
|
||||
{
|
||||
inv.setInventorySlotContents(54, null);
|
||||
}
|
||||
}
|
||||
|
||||
inv.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntityItemUpdate(EntityItem entityItem)
|
||||
{
|
||||
onUpdate(entityItem.getEntityItem(), null, entityItem, 0, false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryPlaceContainedLiquid(World world, ItemStack itemstack, int x, int y, int z)
|
||||
{
|
||||
if(getFluidStack(itemstack) == null || !getFluidStack(itemstack).getFluid().canBePlacedInWorld())
|
||||
@@ -536,101 +450,103 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
{
|
||||
MachineType type = MachineType.get(itemstack);
|
||||
|
||||
if(MachineType.get(itemstack) == MachineType.ELECTRIC_CHEST)
|
||||
if(MachineType.get(itemstack) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if(!getAuthenticated(itemstack))
|
||||
if(SecurityUtils.canAccess(entityplayer, itemstack))
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, false, false, 2, 0, null, null), (EntityPlayerMP)entityplayer);
|
||||
}
|
||||
else if(getLocked(itemstack) && getEnergy(itemstack) > 0)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, false, false, 1, 0, null, null), (EntityPlayerMP)entityplayer);
|
||||
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer);
|
||||
MekanismUtils.openPersonalChestGui((EntityPlayerMP)entityplayer, null, inventory, false);
|
||||
}
|
||||
else {
|
||||
InventoryElectricChest inventory = new InventoryElectricChest(entityplayer);
|
||||
MekanismUtils.openElectricChestGui((EntityPlayerMP)entityplayer, null, inventory, false);
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type == MachineType.FLUID_TANK && getBucketMode(itemstack))
|
||||
{
|
||||
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(world, entityplayer, !entityplayer.isSneaking());
|
||||
|
||||
if(pos == null)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
else {
|
||||
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
Coord4D coord = new Coord4D(pos.blockX, pos.blockY, pos.blockZ, world.provider.dimensionId);
|
||||
if(SecurityUtils.canAccess(entityplayer, itemstack))
|
||||
{
|
||||
MovingObjectPosition pos = getMovingObjectPositionFromPlayer(world, entityplayer, !entityplayer.isSneaking());
|
||||
|
||||
if(pos == null)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
else {
|
||||
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
Coord4D coord = new Coord4D(pos.blockX, pos.blockY, pos.blockZ, world.provider.dimensionId);
|
||||
|
||||
if(!world.canMineBlock(entityplayer, coord.xCoord, coord.yCoord, coord.zCoord))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
if(!entityplayer.canPlayerEdit(coord.xCoord, coord.yCoord, coord.zCoord, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
FluidStack fluid = MekanismUtils.getFluid(world, coord, false);
|
||||
|
||||
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
|
||||
{
|
||||
int needed = getCapacity(itemstack)-(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0);
|
||||
|
||||
if(fluid.amount > needed)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(getFluidStack(itemstack) == null)
|
||||
{
|
||||
setFluidStack(fluid, itemstack);
|
||||
}
|
||||
else {
|
||||
FluidStack newStack = getFluidStack(itemstack);
|
||||
newStack.amount += fluid.amount;
|
||||
setFluidStack(newStack, itemstack);
|
||||
}
|
||||
|
||||
world.setBlockToAir(coord.xCoord, coord.yCoord, coord.zCoord);
|
||||
}
|
||||
}
|
||||
else {
|
||||
FluidStack stored = getFluidStack(itemstack);
|
||||
|
||||
if(stored == null || stored.amount < FluidContainerRegistry.BUCKET_VOLUME)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
Coord4D trans = coord.getFromSide(ForgeDirection.getOrientation(pos.sideHit));
|
||||
|
||||
if(!world.canMineBlock(entityplayer, coord.xCoord, coord.yCoord, coord.zCoord))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
if(!entityplayer.canPlayerEdit(trans.xCoord, trans.yCoord, trans.zCoord, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
if(!entityplayer.canPlayerEdit(coord.xCoord, coord.yCoord, coord.zCoord, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
FluidStack fluid = MekanismUtils.getFluid(world, coord, false);
|
||||
|
||||
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
|
||||
{
|
||||
int needed = getCapacity(itemstack)-(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0);
|
||||
|
||||
if(fluid.amount > needed)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(getFluidStack(itemstack) == null)
|
||||
{
|
||||
setFluidStack(fluid, itemstack);
|
||||
}
|
||||
else {
|
||||
FluidStack newStack = getFluidStack(itemstack);
|
||||
newStack.amount += fluid.amount;
|
||||
setFluidStack(newStack, itemstack);
|
||||
}
|
||||
|
||||
world.setBlockToAir(coord.xCoord, coord.yCoord, coord.zCoord);
|
||||
}
|
||||
}
|
||||
else {
|
||||
FluidStack stored = getFluidStack(itemstack);
|
||||
|
||||
if(stored == null || stored.amount < FluidContainerRegistry.BUCKET_VOLUME)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
Coord4D trans = coord.getFromSide(ForgeDirection.getOrientation(pos.sideHit));
|
||||
|
||||
if(!entityplayer.canPlayerEdit(trans.xCoord, trans.yCoord, trans.zCoord, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(tryPlaceContainedLiquid(world, itemstack, trans.xCoord, trans.yCoord, trans.zCoord) && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
FluidStack newStack = stored.copy();
|
||||
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
|
||||
|
||||
setFluidStack(newStack.amount > 0 ? newStack : null, itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
if(tryPlaceContainedLiquid(world, itemstack, trans.xCoord, trans.yCoord, trans.zCoord) && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
FluidStack newStack = stored.copy();
|
||||
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
|
||||
|
||||
setFluidStack(newStack.amount > 0 ? newStack : null, itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -746,72 +662,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
return type == MachineType.ELECTRIC_PUMP || type == MachineType.FLUID_TANK || type == MachineType.FLUIDIC_PLENISHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthenticated(ItemStack itemStack, boolean auth)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setBoolean("authenticated", auth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAuthenticated(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getBoolean("authenticated");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPassword(ItemStack itemStack, String pass)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setString("password", pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getString("password");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocked(ItemStack itemStack, boolean locked)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setBoolean("locked", locked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLocked(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getBoolean("locked");
|
||||
}
|
||||
|
||||
public void setBucketMode(ItemStack itemStack, boolean bucketMode)
|
||||
{
|
||||
@@ -1100,6 +950,13 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
@Override
|
||||
public boolean hasSecurity(ItemStack stack)
|
||||
{
|
||||
return true;
|
||||
MachineType type = MachineType.get(stack);
|
||||
|
||||
if(type != MachineType.LASER)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,9 @@ import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -77,20 +77,27 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
{
|
||||
SideData data = config.getConfig().getOutput(getState(stack).getTransmission(), side, config.getOrientation());
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getViewModeText(getState(stack).getTransmission()) + ": " + data.color + data.localize() + " (" + data.color.getName() + ")"));
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if(getEnergy(stack) >= ENERGY_PER_CONFIGURE)
|
||||
{
|
||||
setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
|
||||
MekanismUtils.incrementOutput(config, getState(stack).getTransmission(), MekanismUtils.getBaseOrientation(side, config.getOrientation()));
|
||||
SideData data = config.getConfig().getOutput(getState(stack).getTransmission(), side, config.getOrientation());
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getToggleModeText(getState(stack).getTransmission()) + ": " + data.color + data.localize() + " (" + data.color.getName() + ")"));
|
||||
|
||||
if(config instanceof TileEntityBasicBlock)
|
||||
if(SecurityUtils.canAccess(player, tile))
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
|
||||
MekanismUtils.incrementOutput(config, getState(stack).getTransmission(), MekanismUtils.getBaseOrientation(side, config.getOrientation()));
|
||||
SideData data = config.getConfig().getOutput(getState(stack).getTransmission(), side, config.getOrientation());
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + getToggleModeText(getState(stack).getTransmission()) + ": " + data.color + data.localize() + " (" + data.color.getName() + ")"));
|
||||
|
||||
if(config instanceof TileEntityBasicBlock)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -101,12 +108,20 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
{
|
||||
IConfigurable config = (IConfigurable)tile;
|
||||
|
||||
if(player.isSneaking())
|
||||
if(SecurityUtils.canAccess(player, tile))
|
||||
{
|
||||
return config.onSneakRightClick(player, side);
|
||||
if(player.isSneaking())
|
||||
{
|
||||
return config.onSneakRightClick(player, side);
|
||||
}
|
||||
else {
|
||||
return config.onRightClick(player, side);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return config.onRightClick(player, side);
|
||||
SecurityUtils.displayNoAccess(player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +131,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
{
|
||||
IInventory inv = (IInventory)tile;
|
||||
|
||||
if(!(inv instanceof TileEntityElectricChest) || (((TileEntityElectricChest)inv).canAccess()))
|
||||
if(SecurityUtils.canAccess(player, tile))
|
||||
{
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
@@ -165,7 +180,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.unauth")));
|
||||
SecurityUtils.displayNoAccess(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
||||
dataStream.writeBoolean(general.dynamicTankEasterEgg);
|
||||
dataStream.writeBoolean(general.voiceServerEnabled);
|
||||
dataStream.writeBoolean(general.cardboardSpawners);
|
||||
dataStream.writeBoolean(general.creativeOverrideElectricChest);
|
||||
dataStream.writeBoolean(general.spawnBabySkeletons);
|
||||
dataStream.writeInt(general.obsidianTNTDelay);
|
||||
dataStream.writeInt(general.obsidianTNTBlastRadius);
|
||||
@@ -121,7 +120,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
||||
general.dynamicTankEasterEgg = dataStream.readBoolean();
|
||||
general.voiceServerEnabled = dataStream.readBoolean();
|
||||
general.cardboardSpawners = dataStream.readBoolean();
|
||||
general.creativeOverrideElectricChest = dataStream.readBoolean();
|
||||
general.spawnBabySkeletons = dataStream.readBoolean();
|
||||
general.obsidianTNTDelay = dataStream.readInt();
|
||||
general.obsidianTNTBlastRadius = dataStream.readInt();
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
package mekanism.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.InventoryElectricChest;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class PacketElectricChest implements IMessageHandler<ElectricChestMessage, IMessage>
|
||||
{
|
||||
@Override
|
||||
public IMessage onMessage(ElectricChestMessage message, MessageContext context)
|
||||
{
|
||||
EntityPlayer player = PacketHandler.getPlayer(context);
|
||||
|
||||
if(message.packetType == ElectricChestPacketType.SERVER_OPEN)
|
||||
{
|
||||
try {
|
||||
if(message.isBlock)
|
||||
{
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
|
||||
|
||||
if(message.useEnergy)
|
||||
{
|
||||
tileEntity.setEnergy(tileEntity.getEnergy() - 100);
|
||||
}
|
||||
|
||||
MekanismUtils.openElectricChestGui((EntityPlayerMP)player, tileEntity, null, true);
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
if(message.useEnergy)
|
||||
{
|
||||
((IEnergizedItem)stack.getItem()).setEnergy(stack, ((IEnergizedItem)stack.getItem()).getEnergy(stack) - 100);
|
||||
}
|
||||
|
||||
InventoryElectricChest inventory = new InventoryElectricChest(player);
|
||||
MekanismUtils.openElectricChestGui((EntityPlayerMP)player, null, inventory, false);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest open packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ElectricChestPacketType.CLIENT_OPEN)
|
||||
{
|
||||
try {
|
||||
int x = message.coord4D != null ? message.coord4D.xCoord : 0;
|
||||
int y = message.coord4D != null ? message.coord4D.yCoord : 0;
|
||||
int z = message.coord4D != null ? message.coord4D.zCoord : 0;
|
||||
|
||||
Mekanism.proxy.openElectricChest(player, message.guiType, message.windowId, message.isBlock, x, y, z);
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest open packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ElectricChestPacketType.PASSWORD)
|
||||
{
|
||||
try {
|
||||
if(message.isBlock)
|
||||
{
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
|
||||
tileEntity.password = message.password;
|
||||
tileEntity.authenticated = true;
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
((IElectricChest)stack.getItem()).setPassword(stack, message.password);
|
||||
((IElectricChest)stack.getItem()).setAuthenticated(stack, true);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest password packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(message.packetType == ElectricChestPacketType.LOCK)
|
||||
{
|
||||
try {
|
||||
if(message.isBlock)
|
||||
{
|
||||
TileEntityElectricChest tileEntity = (TileEntityElectricChest)message.coord4D.getTileEntity(player.worldObj);
|
||||
tileEntity.locked = message.locked;
|
||||
player.worldObj.notifyBlocksOfNeighborChange(message.coord4D.xCoord, message.coord4D.yCoord, message.coord4D.zCoord, tileEntity.getBlockType());
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(stack != null && stack.getItem() instanceof IElectricChest && MachineType.get(stack) == MachineType.ELECTRIC_CHEST)
|
||||
{
|
||||
((IElectricChest)stack.getItem()).setLocked(stack, message.locked);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest password packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class ElectricChestMessage implements IMessage
|
||||
{
|
||||
public ElectricChestPacketType packetType;
|
||||
|
||||
public boolean isBlock;
|
||||
|
||||
public boolean locked;
|
||||
|
||||
public String password;
|
||||
|
||||
public int guiType;
|
||||
public int windowId;
|
||||
|
||||
public boolean useEnergy;
|
||||
|
||||
public Coord4D coord4D;
|
||||
|
||||
public ElectricChestMessage() {}
|
||||
|
||||
//This is a really messy implementation...
|
||||
public ElectricChestMessage(ElectricChestPacketType type, boolean b1, boolean b2, int i1, int i2, String s1, Coord4D c1)
|
||||
{
|
||||
packetType = type;
|
||||
|
||||
switch(packetType)
|
||||
{
|
||||
case LOCK:
|
||||
locked = b1;
|
||||
isBlock = b2;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
case PASSWORD:
|
||||
password = s1;
|
||||
isBlock = b1;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
case CLIENT_OPEN:
|
||||
guiType = i1;
|
||||
windowId = i2;
|
||||
isBlock = b1;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
case SERVER_OPEN:
|
||||
useEnergy = b1;
|
||||
isBlock = b2;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf dataStream)
|
||||
{
|
||||
dataStream.writeInt(packetType.ordinal());
|
||||
|
||||
switch(packetType)
|
||||
{
|
||||
case LOCK:
|
||||
dataStream.writeBoolean(locked);
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
case PASSWORD:
|
||||
PacketHandler.writeString(dataStream, password);
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
case CLIENT_OPEN:
|
||||
dataStream.writeInt(guiType);
|
||||
dataStream.writeInt(windowId);
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
case SERVER_OPEN:
|
||||
dataStream.writeBoolean(useEnergy);
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf dataStream)
|
||||
{
|
||||
packetType = ElectricChestPacketType.values()[dataStream.readInt()];
|
||||
|
||||
if(packetType == ElectricChestPacketType.SERVER_OPEN)
|
||||
{
|
||||
useEnergy = dataStream.readBoolean();
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
else if(packetType == ElectricChestPacketType.CLIENT_OPEN)
|
||||
{
|
||||
guiType = dataStream.readInt();
|
||||
windowId = dataStream.readInt();
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
else if(packetType == ElectricChestPacketType.PASSWORD)
|
||||
{
|
||||
password = PacketHandler.readString(dataStream);
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
else if(packetType == ElectricChestPacketType.LOCK)
|
||||
{
|
||||
locked = dataStream.readBoolean();
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ElectricChestPacketType
|
||||
{
|
||||
LOCK,
|
||||
PASSWORD,
|
||||
CLIENT_OPEN,
|
||||
SERVER_OPEN
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package mekanism.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.InventoryPersonalChest;
|
||||
import mekanism.common.network.PacketPersonalChest.PersonalChestMessage;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
|
||||
public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage, IMessage>
|
||||
{
|
||||
@Override
|
||||
public IMessage onMessage(PersonalChestMessage message, MessageContext context)
|
||||
{
|
||||
EntityPlayer player = PacketHandler.getPlayer(context);
|
||||
|
||||
if(message.packetType == PersonalChestPacketType.SERVER_OPEN)
|
||||
{
|
||||
try {
|
||||
if(message.isBlock)
|
||||
{
|
||||
TileEntityPersonalChest tileEntity = (TileEntityPersonalChest)message.coord4D.getTileEntity(player.worldObj);
|
||||
MekanismUtils.openPersonalChestGui((EntityPlayerMP)player, tileEntity, null, true);
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if(MachineType.get(stack) == MachineType.PERSONAL_CHEST)
|
||||
{
|
||||
InventoryPersonalChest inventory = new InventoryPersonalChest(player);
|
||||
MekanismUtils.openPersonalChestGui((EntityPlayerMP)player, null, inventory, false);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest open packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(message.packetType == PersonalChestPacketType.CLIENT_OPEN)
|
||||
{
|
||||
try {
|
||||
int x = message.coord4D != null ? message.coord4D.xCoord : 0;
|
||||
int y = message.coord4D != null ? message.coord4D.yCoord : 0;
|
||||
int z = message.coord4D != null ? message.coord4D.zCoord : 0;
|
||||
|
||||
Mekanism.proxy.openPersonalChest(player, message.guiType, message.windowId, message.isBlock, x, y, z);
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while handling electric chest open packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class PersonalChestMessage implements IMessage
|
||||
{
|
||||
public PersonalChestPacketType packetType;
|
||||
|
||||
public boolean isBlock;
|
||||
|
||||
public int guiType;
|
||||
public int windowId;
|
||||
|
||||
public Coord4D coord4D;
|
||||
|
||||
public PersonalChestMessage() {}
|
||||
|
||||
//This is a really messy implementation...
|
||||
public PersonalChestMessage(PersonalChestPacketType type, boolean b1, int i1, int i2, Coord4D c1)
|
||||
{
|
||||
packetType = type;
|
||||
|
||||
switch(packetType)
|
||||
{
|
||||
case CLIENT_OPEN:
|
||||
guiType = i1;
|
||||
windowId = i2;
|
||||
isBlock = b1;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
case SERVER_OPEN:
|
||||
isBlock = b1;
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = c1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf dataStream)
|
||||
{
|
||||
dataStream.writeInt(packetType.ordinal());
|
||||
|
||||
switch(packetType)
|
||||
{
|
||||
case CLIENT_OPEN:
|
||||
dataStream.writeInt(guiType);
|
||||
dataStream.writeInt(windowId);
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
case SERVER_OPEN:
|
||||
dataStream.writeBoolean(isBlock);
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf dataStream)
|
||||
{
|
||||
packetType = PersonalChestPacketType.values()[dataStream.readInt()];
|
||||
|
||||
if(packetType == PersonalChestPacketType.SERVER_OPEN)
|
||||
{
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
else if(packetType == PersonalChestPacketType.CLIENT_OPEN)
|
||||
{
|
||||
guiType = dataStream.readInt();
|
||||
windowId = dataStream.readInt();
|
||||
isBlock = dataStream.readBoolean();
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum PersonalChestPacketType
|
||||
{
|
||||
CLIENT_OPEN,
|
||||
SERVER_OPEN
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class TileEntityOredictionificator extends TileEntityContainerBlock imple
|
||||
|
||||
didProcess = false;
|
||||
|
||||
if(inventory[0] != null && getValidName(inventory[0]) != null)
|
||||
if(MekanismUtils.canFunction(this) && inventory[0] != null && getValidName(inventory[0]) != null)
|
||||
{
|
||||
ItemStack result = getResult(inventory[0]);
|
||||
|
||||
|
||||
+21
-84
@@ -1,41 +1,33 @@
|
||||
package mekanism.common.tile;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.component.TileComponentSecurity;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityElectricChest extends TileEntityElectricBlock
|
||||
public class TileEntityPersonalChest extends TileEntityContainerBlock implements ISecurityTile
|
||||
{
|
||||
public static int[] INV;
|
||||
|
||||
public String password = "";
|
||||
|
||||
public boolean authenticated = false;
|
||||
|
||||
public boolean locked = false;
|
||||
|
||||
public float lidAngle;
|
||||
|
||||
public float prevLidAngle;
|
||||
|
||||
public TileComponentSecurity securityComponent;
|
||||
|
||||
public TileEntityElectricChest()
|
||||
public TileEntityPersonalChest()
|
||||
{
|
||||
super("ElectricChest", 12000);
|
||||
inventory = new ItemStack[55];
|
||||
super("PersonalChest");
|
||||
inventory = new ItemStack[54];
|
||||
|
||||
securityComponent = new TileComponentSecurity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
prevLidAngle = lidAngle;
|
||||
float increment = 0.1F;
|
||||
|
||||
@@ -73,73 +65,18 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
|
||||
lidAngle = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
ChargeUtils.discharge(54, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
authenticated = nbtTags.getBoolean("authenticated");
|
||||
locked = nbtTags.getBoolean("locked");
|
||||
password = nbtTags.getString("password");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
nbtTags.setBoolean("authenticated", authenticated);
|
||||
nbtTags.setBoolean("locked", locked);
|
||||
nbtTags.setString("password", password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(ByteBuf dataStream)
|
||||
{
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
authenticated = dataStream.readBoolean();
|
||||
locked = dataStream.readBoolean();
|
||||
password = PacketHandler.readString(dataStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList getNetworkedData(ArrayList data)
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
data.add(authenticated);
|
||||
data.add(locked);
|
||||
data.add(password);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public boolean canAccess()
|
||||
{
|
||||
return authenticated && (getEnergy() == 0 || !locked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
if(slotID == 54)
|
||||
{
|
||||
return ChargeUtils.canBeDischarged(itemstack);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side)
|
||||
{
|
||||
if(side == 0 || !canAccess())
|
||||
if(side == 0 || SecurityUtils.getSecurity(this) != SecurityMode.PUBLIC)
|
||||
{
|
||||
return InventoryUtils.EMPTY;
|
||||
}
|
||||
@@ -161,19 +98,13 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
|
||||
@Override
|
||||
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
if(slotID == 54)
|
||||
{
|
||||
return ChargeUtils.canBeOutputted(itemstack, false);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
||||
{
|
||||
return false;
|
||||
return SecurityUtils.canAccess(entityPlayer, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,4 +112,10 @@ public class TileEntityElectricChest extends TileEntityElectricBlock
|
||||
{
|
||||
return side != 0 && side != 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentSecurity getSecurity()
|
||||
{
|
||||
return securityComponent;
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,10 @@ import mekanism.common.frequency.Frequency;
|
||||
import mekanism.common.frequency.FrequencyManager;
|
||||
import mekanism.common.frequency.IFrequencyHandler;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.component.TileComponentConfig;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.tile.component.TileComponentSecurity;
|
||||
import mekanism.common.util.CableUtils;
|
||||
import mekanism.common.util.HeatUtils;
|
||||
import mekanism.common.util.InventoryUtils;
|
||||
@@ -39,10 +41,8 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandler, IFrequencyHandler, IGasHandler, IHeatTransfer, ITubeConnection, IComputerIntegration
|
||||
public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock implements ISideConfiguration, ITankManager, IFluidHandler, IFrequencyHandler, IGasHandler, IHeatTransfer, ITubeConnection, IComputerIntegration, ISecurityTile
|
||||
{
|
||||
public String owner;
|
||||
|
||||
public InventoryFrequency frequency;
|
||||
|
||||
public double heatToAbsorb = 0;
|
||||
@@ -57,6 +57,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
|
||||
public TileComponentEjector ejectorComponent;
|
||||
public TileComponentConfig configComponent;
|
||||
public TileComponentSecurity securityComponent;
|
||||
|
||||
public TileEntityQuantumEntangloporter()
|
||||
{
|
||||
@@ -85,6 +86,8 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
|
||||
ejectorComponent.setOutputData(TransmissionType.FLUID, configComponent.getOutputs(TransmissionType.FLUID).get(2));
|
||||
ejectorComponent.setOutputData(TransmissionType.GAS, configComponent.getOutputs(TransmissionType.GAS).get(2));
|
||||
|
||||
securityComponent = new TileComponentSecurity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,13 +115,13 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
{
|
||||
if(frequency != null && !frequency.valid)
|
||||
{
|
||||
frequency = (InventoryFrequency)manager.validateFrequency(owner, Coord4D.get(this), frequency);
|
||||
frequency = (InventoryFrequency)manager.validateFrequency(getSecurity().getOwner(), Coord4D.get(this), frequency);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
frequency = (InventoryFrequency)manager.update(owner, Coord4D.get(this), frequency);
|
||||
frequency = (InventoryFrequency)manager.update(getSecurity().getOwner(), Coord4D.get(this), frequency);
|
||||
|
||||
if(frequency == null)
|
||||
{
|
||||
@@ -169,7 +172,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
|
||||
public FrequencyManager getManager(Frequency freq)
|
||||
{
|
||||
if(owner == null || freq == null)
|
||||
if(getSecurity().getOwner() == null || freq == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -179,14 +182,14 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
return Mekanism.publicEntangloporters;
|
||||
}
|
||||
else {
|
||||
if(!Mekanism.privateEntangloporters.containsKey(owner))
|
||||
if(!Mekanism.privateEntangloporters.containsKey(getSecurity().getOwner()))
|
||||
{
|
||||
FrequencyManager manager = new FrequencyManager(InventoryFrequency.class, owner);
|
||||
Mekanism.privateEntangloporters.put(owner, manager);
|
||||
FrequencyManager manager = new FrequencyManager(InventoryFrequency.class, getSecurity().getOwner());
|
||||
Mekanism.privateEntangloporters.put(getSecurity().getOwner(), manager);
|
||||
manager.createOrLoad(worldObj);
|
||||
}
|
||||
|
||||
return Mekanism.privateEntangloporters.get(owner);
|
||||
return Mekanism.privateEntangloporters.get(getSecurity().getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +209,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
}
|
||||
}
|
||||
|
||||
Frequency freq = new InventoryFrequency(name, owner).setPublic(publicFreq);
|
||||
Frequency freq = new InventoryFrequency(name, getSecurity().getOwner()).setPublic(publicFreq);
|
||||
freq.activeCoords.add(Coord4D.get(this));
|
||||
manager.addFrequency(freq);
|
||||
frequency = (InventoryFrequency)freq;
|
||||
@@ -220,11 +223,6 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
if(nbtTags.hasKey("owner"))
|
||||
{
|
||||
owner = nbtTags.getString("owner");
|
||||
}
|
||||
|
||||
if(nbtTags.hasKey("frequency"))
|
||||
{
|
||||
frequency = new InventoryFrequency(nbtTags.getCompoundTag("frequency"));
|
||||
@@ -237,11 +235,6 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
nbtTags.setString("owner", owner);
|
||||
}
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
NBTTagCompound frequencyTag = new NBTTagCompound();
|
||||
@@ -273,7 +266,7 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
|
||||
if(manager != null)
|
||||
{
|
||||
manager.remove(freq, owner);
|
||||
manager.remove(freq, getSecurity().getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,14 +278,6 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
lastTransferLoss = dataStream.readDouble();
|
||||
lastEnvironmentLoss = dataStream.readDouble();
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
owner = PacketHandler.readString(dataStream);
|
||||
}
|
||||
else {
|
||||
owner = null;
|
||||
}
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
frequency = new InventoryFrequency(dataStream);
|
||||
@@ -327,15 +312,6 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
data.add(lastTransferLoss);
|
||||
data.add(lastEnvironmentLoss);
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
data.add(true);
|
||||
data.add(owner);
|
||||
}
|
||||
else {
|
||||
data.add(false);
|
||||
}
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
data.add(true);
|
||||
@@ -667,6 +643,12 @@ public class TileEntityQuantumEntangloporter extends TileEntityElectricBlock imp
|
||||
{
|
||||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentSecurity getSecurity()
|
||||
{
|
||||
return securityComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
|
||||
@@ -9,8 +9,8 @@ import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
import mekanism.common.frequency.FrequencyManager;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.security.SecurityFrequency;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,10 +40,13 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock
|
||||
{
|
||||
ISecurityItem item = (ISecurityItem)inventory[0].getItem();
|
||||
|
||||
if(item.hasSecurity(inventory[0]))
|
||||
if(item.hasSecurity(inventory[0]) && item.getOwner(inventory[0]) != null)
|
||||
{
|
||||
item.setOwner(inventory[0], null);
|
||||
item.setSecurity(inventory[0], SecurityMode.PUBLIC);
|
||||
if(item.getOwner(inventory[0]).equals(owner))
|
||||
{
|
||||
item.setOwner(inventory[0], null);
|
||||
item.setSecurity(inventory[0], SecurityMode.PUBLIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ public class TileEntitySecurityDesk extends TileEntityContainerBlock
|
||||
{
|
||||
ISecurityItem item = (ISecurityItem)inventory[1].getItem();
|
||||
|
||||
if(item.hasSecurity(inventory[1]))
|
||||
if(item.hasSecurity(inventory[1]) && item.getOwner(inventory[1]) == null)
|
||||
{
|
||||
item.setOwner(inventory[1], owner);
|
||||
item.setSecurity(inventory[1], frequency.securityMode);
|
||||
|
||||
@@ -13,6 +13,7 @@ import mekanism.api.Coord4D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.chunkloading.IChunkLoader;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
@@ -21,6 +22,8 @@ import mekanism.common.frequency.IFrequencyHandler;
|
||||
import mekanism.common.integration.IComputerIntegration;
|
||||
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.tile.component.TileComponentSecurity;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -44,7 +47,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityTeleporter extends TileEntityElectricBlock implements IComputerIntegration, IChunkLoader, IFrequencyHandler
|
||||
public class TileEntityTeleporter extends TileEntityElectricBlock implements IComputerIntegration, IChunkLoader, IFrequencyHandler, IRedstoneControl, ISecurityTile
|
||||
{
|
||||
private MinecraftServer server = MinecraftServer.getServer();
|
||||
|
||||
@@ -58,8 +61,6 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
public boolean prevShouldRender;
|
||||
|
||||
public String owner;
|
||||
|
||||
public Frequency frequency;
|
||||
|
||||
public List<Frequency> publicCache = new ArrayList<Frequency>();
|
||||
@@ -69,11 +70,17 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
/** This teleporter's current status. */
|
||||
public byte status = 0;
|
||||
|
||||
public RedstoneControl controlType = RedstoneControl.DISABLED;
|
||||
|
||||
public TileComponentSecurity securityComponent;
|
||||
|
||||
public TileEntityTeleporter()
|
||||
{
|
||||
super("Teleporter", MachineType.TELEPORTER.baseEnergy);
|
||||
inventory = new ItemStack[1];
|
||||
|
||||
securityComponent = new TileComponentSecurity(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,12 +115,12 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
if(frequency != null && !frequency.valid)
|
||||
{
|
||||
frequency = manager.validateFrequency(owner, Coord4D.get(this), frequency);
|
||||
frequency = manager.validateFrequency(getSecurity().getOwner(), Coord4D.get(this), frequency);
|
||||
}
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
frequency = manager.update(owner, Coord4D.get(this), frequency);
|
||||
frequency = manager.update(getSecurity().getOwner(), Coord4D.get(this), frequency);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -122,7 +129,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
status = canTeleport();
|
||||
|
||||
if(status == 1 && teleDelay == 0)
|
||||
if(MekanismUtils.canFunction(this) && status == 1 && teleDelay == 0)
|
||||
{
|
||||
teleport();
|
||||
}
|
||||
@@ -179,7 +186,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
}
|
||||
}
|
||||
|
||||
Frequency freq = new Frequency(name, owner).setPublic(publicFreq);
|
||||
Frequency freq = new Frequency(name, getSecurity().getOwner()).setPublic(publicFreq);
|
||||
freq.activeCoords.add(Coord4D.get(this));
|
||||
manager.addFrequency(freq);
|
||||
frequency = freq;
|
||||
@@ -189,7 +196,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
public FrequencyManager getManager(Frequency freq)
|
||||
{
|
||||
if(owner == null || freq == null)
|
||||
if(getSecurity().getOwner() == null || freq == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -199,14 +206,14 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
return Mekanism.publicTeleporters;
|
||||
}
|
||||
else {
|
||||
if(!Mekanism.privateTeleporters.containsKey(owner))
|
||||
if(!Mekanism.privateTeleporters.containsKey(getSecurity().getOwner()))
|
||||
{
|
||||
FrequencyManager manager = new FrequencyManager(Frequency.class, owner);
|
||||
Mekanism.privateTeleporters.put(owner, manager);
|
||||
FrequencyManager manager = new FrequencyManager(Frequency.class, getSecurity().getOwner());
|
||||
Mekanism.privateTeleporters.put(getSecurity().getOwner(), manager);
|
||||
manager.createOrLoad(worldObj);
|
||||
}
|
||||
|
||||
return Mekanism.privateTeleporters.get(owner);
|
||||
return Mekanism.privateTeleporters.get(getSecurity().getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,10 +545,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
super.readFromNBT(nbtTags);
|
||||
|
||||
if(nbtTags.hasKey("owner"))
|
||||
{
|
||||
owner = nbtTags.getString("owner");
|
||||
}
|
||||
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
|
||||
|
||||
if(nbtTags.hasKey("frequency"))
|
||||
{
|
||||
@@ -555,10 +559,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
super.writeToNBT(nbtTags);
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
nbtTags.setString("owner", owner);
|
||||
}
|
||||
nbtTags.setInteger("controlType", controlType.ordinal());
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
@@ -591,7 +592,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
if(manager != null)
|
||||
{
|
||||
manager.remove(freq, owner);
|
||||
manager.remove(freq, getSecurity().getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,14 +601,6 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
super.handlePacketData(dataStream);
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
owner = PacketHandler.readString(dataStream);
|
||||
}
|
||||
else {
|
||||
owner = null;
|
||||
}
|
||||
|
||||
if(dataStream.readBoolean())
|
||||
{
|
||||
frequency = new Frequency(dataStream);
|
||||
@@ -618,6 +611,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
status = dataStream.readByte();
|
||||
shouldRender = dataStream.readBoolean();
|
||||
controlType = RedstoneControl.values()[dataStream.readInt()];
|
||||
|
||||
publicCache.clear();
|
||||
privateCache.clear();
|
||||
@@ -642,15 +636,6 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
{
|
||||
super.getNetworkedData(data);
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
data.add(true);
|
||||
data.add(owner);
|
||||
}
|
||||
else {
|
||||
data.add(false);
|
||||
}
|
||||
|
||||
if(frequency != null)
|
||||
{
|
||||
data.add(true);
|
||||
@@ -662,6 +647,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
|
||||
data.add(status);
|
||||
data.add(shouldRender);
|
||||
data.add(controlType.ordinal());
|
||||
|
||||
data.add(Mekanism.publicTeleporters.getFrequencies().size());
|
||||
|
||||
@@ -757,4 +743,28 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
|
||||
chunkTicket = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControl getControlType()
|
||||
{
|
||||
return controlType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlType(RedstoneControl type)
|
||||
{
|
||||
controlType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPulse()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentSecurity getSecurity()
|
||||
{
|
||||
return securityComponent;
|
||||
}
|
||||
}
|
||||
@@ -48,16 +48,16 @@ import mekanism.common.base.IModule;
|
||||
import mekanism.common.base.IRedstoneControl;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.inventory.container.ContainerElectricChest;
|
||||
import mekanism.common.inventory.container.ContainerPersonalChest;
|
||||
import mekanism.common.item.ItemBlockBasic;
|
||||
import mekanism.common.item.ItemBlockEnergyCube;
|
||||
import mekanism.common.item.ItemBlockGasTank;
|
||||
import mekanism.common.item.ItemBlockMachine;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||
import mekanism.common.network.PacketPersonalChest.PersonalChestMessage;
|
||||
import mekanism.common.network.PacketPersonalChest.PersonalChestPacketType;
|
||||
import mekanism.common.tile.TileEntityAdvancedBoundingBlock;
|
||||
import mekanism.common.tile.TileEntityBoundingBlock;
|
||||
import mekanism.common.tile.TileEntityElectricChest;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -953,7 +953,7 @@ public final class MekanismUtils
|
||||
* @param inventory - IInventory of the item, if it's not a block
|
||||
* @param isBlock - whether or not this electric chest is in it's block form
|
||||
*/
|
||||
public static void openElectricChestGui(EntityPlayerMP player, TileEntityElectricChest tileEntity, IInventory inventory, boolean isBlock)
|
||||
public static void openPersonalChestGui(EntityPlayerMP player, TileEntityPersonalChest tileEntity, IInventory inventory, boolean isBlock)
|
||||
{
|
||||
player.getNextWindowId();
|
||||
player.closeContainer();
|
||||
@@ -961,13 +961,13 @@ public final class MekanismUtils
|
||||
|
||||
if(isBlock)
|
||||
{
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, true, false, 0, id, null, Coord4D.get(tileEntity)), player);
|
||||
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, true, 0, id, Coord4D.get(tileEntity)), player);
|
||||
}
|
||||
else {
|
||||
Mekanism.packetHandler.sendTo(new ElectricChestMessage(ElectricChestPacketType.CLIENT_OPEN, false, false, 0, id, null, null), player);
|
||||
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, false, 0, id, null), player);
|
||||
}
|
||||
|
||||
player.openContainer = new ContainerElectricChest(player.inventory, tileEntity, inventory, isBlock);
|
||||
player.openContainer = new ContainerPersonalChest(player.inventory, tileEntity, inventory, isBlock);
|
||||
player.openContainer.windowId = id;
|
||||
player.openContainer.addCraftingToCrafters(player);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.security.SecurityFrequency;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
@@ -16,7 +17,7 @@ public final class SecurityUtils
|
||||
{
|
||||
public static boolean canAccess(EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
if(stack == null || !(stack.getItem() instanceof ISecurityItem))
|
||||
if((!player.worldObj.isRemote && MekanismUtils.isOp((EntityPlayerMP)player)) || stack == null || !(stack.getItem() instanceof ISecurityItem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -28,7 +29,7 @@ public final class SecurityUtils
|
||||
|
||||
public static boolean canAccess(EntityPlayer player, TileEntity tile)
|
||||
{
|
||||
if(tile == null || !(tile instanceof ISecurityTile))
|
||||
if((!player.worldObj.isRemote && MekanismUtils.isOp((EntityPlayerMP)player)) || tile == null || !(tile instanceof ISecurityTile))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public final class SecurityUtils
|
||||
return canAccess(security.getSecurity().getMode(), player.getCommandSenderName(), security.getSecurity().getOwner());
|
||||
}
|
||||
|
||||
public static boolean canAccess(SecurityMode mode, String username, String owner)
|
||||
private static boolean canAccess(SecurityMode mode, String username, String owner)
|
||||
{
|
||||
if(owner == null || username.equals(owner))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user