diff options
author | miozune <miozune@gmail.com> | 2022-10-09 18:10:02 +0900 |
---|---|---|
committer | miozune <miozune@gmail.com> | 2022-10-09 18:10:02 +0900 |
commit | a265085bd7742ebf1e2e95e4bf7397ba5bea01dc (patch) | |
tree | 92d6b48c083729e8952f0d02372682393145792e /src | |
parent | 46bafc67d318bbe7c5ffbb34d857958ebe72a6e5 (diff) | |
download | GT5-Unofficial-a265085bd7742ebf1e2e95e4bf7397ba5bea01dc.tar.gz GT5-Unofficial-a265085bd7742ebf1e2e95e4bf7397ba5bea01dc.tar.bz2 GT5-Unofficial-a265085bd7742ebf1e2e95e4bf7397ba5bea01dc.zip |
updateBuildScript & spotlessApply
Diffstat (limited to 'src')
89 files changed, 5576 insertions, 5294 deletions
diff --git a/src/main/java/client/ClientProxy.java b/src/main/java/client/ClientProxy.java index 5ed713f827..9eb07c62a4 100644 --- a/src/main/java/client/ClientProxy.java +++ b/src/main/java/client/ClientProxy.java @@ -8,7 +8,6 @@ import common.tileentities.TE_BeamTransmitter; import common.tileentities.TE_SpaceElevatorCapacitor; import common.tileentities.TE_SpaceElevatorTether; import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @@ -27,7 +26,6 @@ public class ClientProxy extends CommonProxy { public void init(final FMLInitializationEvent e) { super.init(e); // Register Simple Block Renderers - //RenderingRegistry.registerBlockHandler(ConduitRenderer.getInstance()); + // RenderingRegistry.registerBlockHandler(ConduitRenderer.getInstance()); } - } diff --git a/src/main/java/client/GTTexture.java b/src/main/java/client/GTTexture.java index 2ede4976fb..345bb8f790 100644 --- a/src/main/java/client/GTTexture.java +++ b/src/main/java/client/GTTexture.java @@ -2,14 +2,11 @@ package client; import gregtech.api.GregTech_API; import gregtech.api.interfaces.IIconContainer; -import gregtech.api.objects.GT_CopiedBlockTexture; import kekztech.KekzCore; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; -import java.util.HashMap; - public class GTTexture implements IIconContainer, Runnable { public static final GTTexture TFFT_CASING = new GTTexture("blocks/TFFTCasing"); diff --git a/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java index d6f2a61ce4..eabbb26ff1 100644 --- a/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java +++ b/src/main/java/client/gui/GUIContainer_ModularNuclearReactor.java @@ -1,46 +1,40 @@ -package client.gui;
-
-import org.lwjgl.opengl.GL11;
-
-import common.container.Container_ModularNuclearReactor;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import kekztech.KekzCore;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.inventory.GuiContainer;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.util.ResourceLocation;
-
-public class GUIContainer_ModularNuclearReactor extends GuiContainer {
-
- private ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/MultiblockDisplay_REACTOR.png");
-
- private InventoryPlayer inventory;
- private IGregTechTileEntity te;
-
- public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player)
- {
- super(new Container_ModularNuclearReactor(te, player));
- inventory = player.inventory;
- this.te = te;
- }
-
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
- {
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
-
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
-
- final int x = (super.width - super.xSize) / 2;
- final int y = (super.height - super.ySize) / 2;
- super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2)
- {
-
- }
-
-}
+package client.gui; + +import common.container.Container_ModularNuclearReactor; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import kekztech.KekzCore; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class GUIContainer_ModularNuclearReactor extends GuiContainer { + + private ResourceLocation texture = + new ResourceLocation(KekzCore.MODID, "textures/gui/MultiblockDisplay_REACTOR.png"); + + private InventoryPlayer inventory; + private IGregTechTileEntity te; + + public GUIContainer_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { + super(new Container_ModularNuclearReactor(te, player)); + inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) {} +} diff --git a/src/main/java/client/gui/Gui_ItemProxyEndpoint.java b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java index f978ed6495..4f80e5d7e3 100644 --- a/src/main/java/client/gui/Gui_ItemProxyEndpoint.java +++ b/src/main/java/client/gui/Gui_ItemProxyEndpoint.java @@ -1,7 +1,5 @@ package client.gui; -import org.lwjgl.opengl.GL11; - import common.container.Container_ItemProxyEndpoint; import kekztech.KekzCore; import net.minecraft.client.Minecraft; @@ -12,40 +10,42 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; public class Gui_ItemProxyEndpoint extends GuiContainer { - - private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTechReceiverNode.png"); - - private final InventoryPlayer inventory; - private final IInventory te; - - public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { - super(new Container_ItemProxyEndpoint(te, player)); - inventory = player.inventory; - this.te = (IInventory) te; - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - final int x = (super.width - super.xSize) / 2; - final int y = (super.height - super.ySize) / 2; - - super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int p1, int p2) { - super.fontRendererObj.drawString( - I18n.format(te.getInventoryName()), - (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), - 6, 4210752, false); - super.fontRendererObj.drawString( - I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); - } + + private final ResourceLocation texture = + new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTechReceiverNode.png"); + + private final InventoryPlayer inventory; + private final IInventory te; + + public Gui_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxyEndpoint(te, player)); + inventory = player.inventory; + this.te = (IInventory) te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p1, int p2) { + super.fontRendererObj.drawString( + I18n.format(te.getInventoryName()), + (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), + 6, + 4210752, + false); + super.fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); + } } diff --git a/src/main/java/client/gui/Gui_ItemProxySource.java b/src/main/java/client/gui/Gui_ItemProxySource.java index a811f01bbe..a4a4a5c38f 100644 --- a/src/main/java/client/gui/Gui_ItemProxySource.java +++ b/src/main/java/client/gui/Gui_ItemProxySource.java @@ -1,7 +1,5 @@ package client.gui; -import org.lwjgl.opengl.GL11; - import common.container.Container_ItemProxySource; import kekztech.KekzCore; import net.minecraft.client.Minecraft; @@ -12,40 +10,41 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; public class Gui_ItemProxySource extends GuiContainer { - - private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png"); - - private final InventoryPlayer inventory; - private final IInventory te; - - public Gui_ItemProxySource(TileEntity te, EntityPlayer player) { - super(new Container_ItemProxySource(te, player)); - inventory = player.inventory; - this.te = (IInventory) te; - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - final int x = (super.width - super.xSize) / 2; - final int y = (super.height - super.ySize) / 2; - - super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int p1, int p2) { - super.fontRendererObj.drawString( - I18n.format(te.getInventoryName()), - (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), - 6, 4210752, false); - super.fontRendererObj.drawString( - I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); - } + + private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemTech4by4.png"); + + private final InventoryPlayer inventory; + private final IInventory te; + + public Gui_ItemProxySource(TileEntity te, EntityPlayer player) { + super(new Container_ItemProxySource(te, player)); + inventory = player.inventory; + this.te = (IInventory) te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + final int x = (super.width - super.xSize) / 2; + final int y = (super.height - super.ySize) / 2; + + super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int p1, int p2) { + super.fontRendererObj.drawString( + I18n.format(te.getInventoryName()), + (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), + 6, + 4210752, + false); + super.fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752); + } } diff --git a/src/main/java/client/renderer/ConduitRenderer.java b/src/main/java/client/renderer/ConduitRenderer.java index 9266d22f55..1a653e8896 100644 --- a/src/main/java/client/renderer/ConduitRenderer.java +++ b/src/main/java/client/renderer/ConduitRenderer.java @@ -10,84 +10,79 @@ import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; public class ConduitRenderer implements ISimpleBlockRenderingHandler { - - public static final int RID = RenderingRegistry.getNextAvailableRenderId(); - private static final ConduitRenderer INSTANCE = new ConduitRenderer(); - private ConduitRenderer() { - - } - - public static ConduitRenderer getInstance() { - return INSTANCE; - } + public static final int RID = RenderingRegistry.getNextAvailableRenderId(); + private static final ConduitRenderer INSTANCE = new ConduitRenderer(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { + private ConduitRenderer() {} - } + public static ConduitRenderer getInstance() { + return INSTANCE; + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, - RenderBlocks renderer) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - - final float thickness = TE_ItemProxyCable.getThickness(); - final float space = (1.0f - thickness) / 2.0f; + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} - float xThickness = thickness; - float xOffset = space; - float yThickness = thickness; - float yOffset = space; - float zThickness = thickness; - float zOffset = space; + @Override + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ItemProxyCable) { + final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if(cable.isConnected(side)) { - switch(side) { - case DOWN: - yOffset = 0.0F; - yThickness += space; - break; - case UP: - yThickness += space; - break; - case NORTH: - zOffset = 0.0F; - zThickness += space; - break; - case SOUTH: - zThickness += space; - break; - case WEST: - xOffset += 0.0F; - xThickness += space; - break; - case EAST: - xThickness += space; - break; - } - } - } + final float thickness = TE_ItemProxyCable.getThickness(); + final float space = (1.0f - thickness) / 2.0f; - block.setBlockBounds(xOffset, yOffset, zOffset, - xOffset + xThickness, yOffset + yThickness, zOffset + zThickness); - renderer.setRenderBoundsFromBlock(block); - } - - return false; - } + float xThickness = thickness; + float xOffset = space; + float yThickness = thickness; + float yOffset = space; + float zThickness = thickness; + float zOffset = space; - @Override - public boolean shouldRender3DInInventory(int modelId) { - return true; - } + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + if (cable.isConnected(side)) { + switch (side) { + case DOWN: + yOffset = 0.0F; + yThickness += space; + break; + case UP: + yThickness += space; + break; + case NORTH: + zOffset = 0.0F; + zThickness += space; + break; + case SOUTH: + zThickness += space; + break; + case WEST: + xOffset += 0.0F; + xThickness += space; + break; + case EAST: + xThickness += space; + break; + } + } + } - @Override - public int getRenderId() { - return ConduitRenderer.RID; - } + block.setBlockBounds( + xOffset, yOffset, zOffset, xOffset + xThickness, yOffset + yThickness, zOffset + zThickness); + renderer.setRenderBoundsFromBlock(block); + } + return false; + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + @Override + public int getRenderId() { + return ConduitRenderer.RID; + } } diff --git a/src/main/java/client/renderer/TESR_BeamTransmitter.java b/src/main/java/client/renderer/TESR_BeamTransmitter.java index 81ab52654b..38e588dd43 100644 --- a/src/main/java/client/renderer/TESR_BeamTransmitter.java +++ b/src/main/java/client/renderer/TESR_BeamTransmitter.java @@ -12,7 +12,8 @@ import org.lwjgl.opengl.GL11; public class TESR_BeamTransmitter extends TileEntitySpecialRenderer { - private static final ResourceLocation beamTexture = new ResourceLocation(KekzCore.MODID, "textures/effects/Tether_beam.png"); + private static final ResourceLocation beamTexture = + new ResourceLocation(KekzCore.MODID, "textures/effects/Tether_beam.png"); @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) { @@ -35,14 +36,16 @@ public class TESR_BeamTransmitter extends TileEntitySpecialRenderer { tessellator.startDrawingQuads(); tessellator.setColorRGBA(255, 255, 255, 32); // Variables stuff II - final float exactTime = (float)beamTransmitter.getWorldObj().getTotalWorldTime() + partialTick; + final float exactTime = (float) beamTransmitter.getWorldObj().getTotalWorldTime() + partialTick; final float streamTextureOffset = -exactTime * 0.2F - (float) MathHelper.floor_float(-exactTime * 0.1F); final double halfBeamWidth = 0.1D; final double height = beamTransmitter.getDistanceFromTarget(); final double uv_x1 = 0.0D; final double uv_x2 = 1.0D; - final double uv_y1 = -1.0D - streamTextureOffset; // This makes the beam stream upwards if you subtract a time sensitive number from it + final double uv_y1 = -1.0D + - streamTextureOffset; // This makes the beam stream upwards if you subtract a time sensitive number + // from it final double uv_y2 = height * (0.5D / (halfBeamWidth * 2)) + uv_y1; // Construct mesh with texture tessellator.addVertexWithUV(x + 0.5 + halfBeamWidth, y + 0.5, z + 0.5, uv_x2, uv_y2); diff --git a/src/main/java/client/renderer/TESR_SECapacitor.java b/src/main/java/client/renderer/TESR_SECapacitor.java index 16c820917d..17f10ece83 100644 --- a/src/main/java/client/renderer/TESR_SECapacitor.java +++ b/src/main/java/client/renderer/TESR_SECapacitor.java @@ -9,7 +9,8 @@ import net.minecraft.util.ResourceLocation; public class TESR_SECapacitor extends TileEntitySpecialRenderer { - private static final ResourceLocation capSide = new ResourceLocation(KekzCore.MODID, "textures/blocks/SpaceElevatorCapacitor_side_renderbase.png"); + private static final ResourceLocation capSide = + new ResourceLocation(KekzCore.MODID, "textures/blocks/SpaceElevatorCapacitor_side_renderbase.png"); @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) { @@ -38,7 +39,7 @@ public class TESR_SECapacitor extends TileEntitySpecialRenderer { // Prepare Tessellator tessellator.startDrawingQuads(); // Render the caps as red if there are maintenance issues - if(teCap.isDamaged()) { + if (teCap.isDamaged()) { final float wave = (float) Math.abs(Math.sin((te.getWorldObj().getTotalWorldTime() + partialTick) / 20.0D)); final int redSat = 64 + (int) Math.ceil(191 * wave); tessellator.setColorRGBA(redSat, 0, 0, 255); diff --git a/src/main/java/client/renderer/TESR_SETether.java b/src/main/java/client/renderer/TESR_SETether.java index 2e4fa95cc5..a59954ce3e 100644 --- a/src/main/java/client/renderer/TESR_SETether.java +++ b/src/main/java/client/renderer/TESR_SETether.java @@ -10,7 +10,8 @@ import org.lwjgl.opengl.GL11; public class TESR_SETether extends TileEntitySpecialRenderer { - private static final ResourceLocation tetherBeamTexture = new ResourceLocation(KekzCore.MODID, "textures/effects/Tether_beam.png"); + private static final ResourceLocation tetherBeamTexture = + new ResourceLocation(KekzCore.MODID, "textures/effects/Tether_beam.png"); @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) { @@ -46,7 +47,7 @@ public class TESR_SETether extends TileEntitySpecialRenderer { final double uv_x1 = 0.0D; final double uv_x2 = 1.0D; final double uv_y1 = -1.0D; // This makes the beam stream upwards if you add a time sensitive number to it - final double uv_y2 = (double)(256.0F * beamLengthScale) * (0.5D / halfBeamWidth) + uv_y1; + final double uv_y2 = (double) (256.0F * beamLengthScale) * (0.5D / halfBeamWidth) + uv_y1; // Construct mesh with texture tessellator.addVertexWithUV(x + d_rot1, y + height, z + d_rot2, uv_x2, uv_y2); tessellator.addVertexWithUV(x + d_rot1, y, z + d_rot2, uv_x2, uv_y1); @@ -72,5 +73,4 @@ public class TESR_SETether extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } - } diff --git a/src/main/java/common/Blocks.java b/src/main/java/common/Blocks.java index 8c145bd634..2a4bf328f7 100644 --- a/src/main/java/common/Blocks.java +++ b/src/main/java/common/Blocks.java @@ -5,102 +5,101 @@ import kekztech.KekzCore; import net.minecraft.block.Block; public class Blocks { - - public static Block yszUnit; - public static Block gdcUnit; - - public static Block tfftCasing; - public static Block tfftStorageField1; - public static Block tfftStorageField2; - public static Block tfftStorageField3; - public static Block tfftStorageField4; - public static Block tfftStorageField5; - public static Block tfftMultiHatch; - - public static Block reactorChamberOFF; - public static Block reactorChamberON; - public static Block reactorControlRod; - - public static Block itemServerDrive; - public static Block itemServerRackCasing; - public static Block itemServerIOPort; - - public static Block itemProxyCable; - public static Block itemProxySource; - public static Block itemProxyEndpoint; - - public static Block jarThaumiumReinforced; - public static Block jarIchor; - - public static Block lscLapotronicEnergyUnit; - public static Block beamTransmitter; - - public static Block spaceElevatorStructure; - public static Block spaceElevatorCapacitor; - public static Block spaceElevatorTether; - - public static Block largeHexPlate; - - public static void preInit() { - KekzCore.LOGGER.info("Registering blocks..."); - - registerBlocks_SOFC(); - registerBlocks_TFFT(); - //registerBlocks_Nuclear(); - //registerBlocks_ItemProxy(); - registerBlocks_Jars(); - registerBlocks_LSC(); - //registerBlocks_SpaceElevator(); - registerBlocks_Cosmetics(); - - KekzCore.LOGGER.info("Finished registering blocks"); - } - - private static void registerBlocks_SOFC() { - yszUnit = Block_YSZUnit.registerBlock(); - gdcUnit = Block_GDCUnit.registerBlock(); - } - - private static void registerBlocks_TFFT() { - tfftCasing = Block_TFFTCasing.registerBlock(); - tfftStorageField1 = Block_TFFTStorageFieldBlockT1.registerBlock(); - tfftStorageField2 = Block_TFFTStorageFieldBlockT2.registerBlock(); - tfftStorageField3 = Block_TFFTStorageFieldBlockT3.registerBlock(); - tfftStorageField4 = Block_TFFTStorageFieldBlockT4.registerBlock(); - tfftStorageField5 = Block_TFFTStorageFieldBlockT5.registerBlock(); - tfftMultiHatch = Block_TFFTMultiHatch.registerBlock(); - } - - /*private static void registerBlocks_Nuclear() { - reactorChamberOFF = Block_ReactorChamber_OFF.registerBlock(); - reactorChamberON = Block_ReactorChamber_ON.registerBlock(); - reactorControlRod = Block_ControlRod.registerBlock(); - } - - private static void registerBlocks_ItemProxy() { - itemProxyCable = Block_ItemProxyCable.registerBlock(); - itemProxySource = Block_ItemProxySource.registerBlock(); - itemProxyEndpoint = Block_ItemProxyEndpoint.registerBlock(); - }*/ - - private static void registerBlocks_Jars() { - jarThaumiumReinforced = Block_ThaumiumReinforcedJar.registerBlock(); - jarIchor = Block_IchorJar.registerBlock(); - } - - private static void registerBlocks_LSC() { - lscLapotronicEnergyUnit = Block_LapotronicEnergyUnit.registerBlock(); - //beamTransmitter = Block_BeamTransmitter.registerBlock(); - } - - /*private static void registerBlocks_SpaceElevator() { - spaceElevatorStructure = Block_SpaceElevator.registerBlock(); - spaceElevatorCapacitor = Block_SpaceElevatorCapacitor.registerBlock(); - spaceElevatorTether = Block_SpaceElevatorTether.registerBlock(); - }*/ - - private static void registerBlocks_Cosmetics() { - largeHexPlate = Block_LargeHexPlate.registerBlock(); - } + public static Block yszUnit; + public static Block gdcUnit; + + public static Block tfftCasing; + public static Block tfftStorageField1; + public static Block tfftStorageField2; + public static Block tfftStorageField3; + public static Block tfftStorageField4; + public static Block tfftStorageField5; + public static Block tfftMultiHatch; + + public static Block reactorChamberOFF; + public static Block reactorChamberON; + public static Block reactorControlRod; + + public static Block itemServerDrive; + public static Block itemServerRackCasing; + public static Block itemServerIOPort; + + public static Block itemProxyCable; + public static Block itemProxySource; + public static Block itemProxyEndpoint; + + public static Block jarThaumiumReinforced; + public static Block jarIchor; + + public static Block lscLapotronicEnergyUnit; + public static Block beamTransmitter; + + public static Block spaceElevatorStructure; + public static Block spaceElevatorCapacitor; + public static Block spaceElevatorTether; + + public static Block largeHexPlate; + + public static void preInit() { + KekzCore.LOGGER.info("Registering blocks..."); + + registerBlocks_SOFC(); + registerBlocks_TFFT(); + // registerBlocks_Nuclear(); + // registerBlocks_ItemProxy(); + registerBlocks_Jars(); + registerBlocks_LSC(); + // registerBlocks_SpaceElevator(); + registerBlocks_Cosmetics(); + + KekzCore.LOGGER.info("Finished registering blocks"); + } + + private static void registerBlocks_SOFC() { + yszUnit = Block_YSZUnit.registerBlock(); + gdcUnit = Block_GDCUnit.registerBlock(); + } + + private static void registerBlocks_TFFT() { + tfftCasing = Block_TFFTCasing.registerBlock(); + tfftStorageField1 = Block_TFFTStorageFieldBlockT1.registerBlock(); + tfftStorageField2 = Block_TFFTStorageFieldBlockT2.registerBlock(); + tfftStorageField3 = Block_TFFTStorageFieldBlockT3.registerBlock(); + tfftStorageField4 = Block_TFFTStorageFieldBlockT4.registerBlock(); + tfftStorageField5 = Block_TFFTStorageFieldBlockT5.registerBlock(); + tfftMultiHatch = Block_TFFTMultiHatch.registerBlock(); + } + + /*private static void registerBlocks_Nuclear() { + reactorChamberOFF = Block_ReactorChamber_OFF.registerBlock(); + reactorChamberON = Block_ReactorChamber_ON.registerBlock(); + reactorControlRod = Block_ControlRod.registerBlock(); + } + + private static void registerBlocks_ItemProxy() { + itemProxyCable = Block_ItemProxyCable.registerBlock(); + itemProxySource = Block_ItemProxySource.registerBlock(); + itemProxyEndpoint = Block_ItemProxyEndpoint.registerBlock(); + }*/ + + private static void registerBlocks_Jars() { + jarThaumiumReinforced = Block_ThaumiumReinforcedJar.registerBlock(); + jarIchor = Block_IchorJar.registerBlock(); + } + + private static void registerBlocks_LSC() { + lscLapotronicEnergyUnit = Block_LapotronicEnergyUnit.registerBlock(); + // beamTransmitter = Block_BeamTransmitter.registerBlock(); + } + + /*private static void registerBlocks_SpaceElevator() { + spaceElevatorStructure = Block_SpaceElevator.registerBlock(); + spaceElevatorCapacitor = Block_SpaceElevatorCapacitor.registerBlock(); + spaceElevatorTether = Block_SpaceElevatorTether.registerBlock(); + }*/ + + private static void registerBlocks_Cosmetics() { + largeHexPlate = Block_LargeHexPlate.registerBlock(); + } } diff --git a/src/main/java/common/CommonProxy.java b/src/main/java/common/CommonProxy.java index 1e577148fb..bf92f6c697 100644 --- a/src/main/java/common/CommonProxy.java +++ b/src/main/java/common/CommonProxy.java @@ -40,5 +40,4 @@ public class CommonProxy { // Research Researches.postInit(); } - } diff --git a/src/main/java/common/Recipes.java b/src/main/java/common/Recipes.java index eec3020906..558f0b83db 100644 --- a/src/main/java/common/Recipes.java +++ b/src/main/java/common/Recipes.java @@ -14,6 +14,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import java.util.HashMap; import kekztech.Items; import kekztech.KekzCore; import net.minecraft.item.ItemStack; @@ -27,690 +28,834 @@ import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.InfusionRecipe; import util.Util; -import java.util.HashMap; - public class Recipes { - public static final HashMap<String, InfusionRecipe> infusionRecipes = new HashMap<>(); - static Fluid solderIndalloy = FluidRegistry.getFluid("molten.indalloy140") != null ? FluidRegistry.getFluid("molten.indalloy140") : FluidRegistry.getFluid("molten.solderingalloy"); - static Fluid solderUEV = FluidRegistry.getFluid("molten.mutatedlivingsolder") != null ? FluidRegistry.getFluid("molten.mutatedlivingsolder") : FluidRegistry.getFluid("molten.solderingalloy"); + public static final HashMap<String, InfusionRecipe> infusionRecipes = new HashMap<>(); + static Fluid solderIndalloy = FluidRegistry.getFluid("molten.indalloy140") != null + ? FluidRegistry.getFluid("molten.indalloy140") + : FluidRegistry.getFluid("molten.solderingalloy"); + static Fluid solderUEV = FluidRegistry.getFluid("molten.mutatedlivingsolder") != null + ? FluidRegistry.getFluid("molten.mutatedlivingsolder") + : FluidRegistry.getFluid("molten.solderingalloy"); public static void postInit() { - KekzCore.LOGGER.info("Registering recipes..."); - - registerRecipes_TFFT(); - registerRecipes_SOFC(); - //registerRecipes_Nuclear(); - registerRecipes_Jars(); - registerRecipes_LSC(); - //registerRecipes_SpaceElevator(); - registerRecipes_Cosmetics(); - - KekzCore.LOGGER.info("Finished registering recipes"); - } - - private static void registerRecipes_TFFT() { - - // Controller - final Object[] tfft_recipe = { - "HFH", "PVP", "CFC", - 'H', OrePrefixes.pipeMedium.get(Materials.StainlessSteel), - 'F', ItemList.Field_Generator_MV.get(1L), - 'P', ItemList.Electric_Pump_HV.get(1L), - 'V', OrePrefixes.rotor.get(Materials.VibrantAlloy), - 'C', OrePrefixes.circuit.get(Materials.Data) - }; - GT_ModHandler.addCraftingRecipe(TileEntities.fms.getStackForm(1), tfft_recipe); - - // Blocks - final ItemStack[] tfftcasing = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.DarkSteel, 3), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderPearl, 3), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1), - }; - GT_Values.RA.addAssemblerRecipe( - tfftcasing, - FluidRegistry.getFluidStack("molten.polytetrafluoroethylene", 144), - new ItemStack(Blocks.tfftCasing, 1), - 200, 256); - final ItemStack[] tfftstoragefield1 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Steel, 1), - ItemList.Electric_Pump_LV.get(1L) - }; - GT_Values.RA.addAssemblerRecipe( - tfftstoragefield1, - FluidRegistry.getFluidStack("molten.glass", 144), - new ItemStack(Blocks.tfftStorageField1, 1), - 200, 256); - final ItemStack[] tfftstoragefield2 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 4), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.StainlessSteel, 1), - ItemList.Electric_Pump_MV.get(1L) - }; - GT_Values.RA.addAssemblerRecipe( - tfftstoragefield2, - FluidRegistry.getFluidStack("molten.plastic", 576), - new ItemStack(Blocks.tfftStorageField2, 1), - 200, 480); - final ItemStack[] tfftstoragefield3 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 2), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.VibrantAlloy, 2), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Titanium, 1), - ItemList.Field_Generator_MV.get(1L), - ItemList.Electric_Pump_HV.get(2L) - }; - GT_Values.RA.addAssemblerRecipe( - tfftstoragefield3, - FluidRegistry.getFluidStack("molten.epoxid", 576), - new ItemStack(Blocks.tfftStorageField3, 1), - 300, 1920); - final ItemStack[] tfftstoragefield4 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 4), - GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.NiobiumTitanium, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.TungstenSteel, 1), - ItemList.Field_Generator_HV.get(1L), - ItemList.Electric_Pump_EV.get(1L) - }; - GT_Values.RA.addAssemblerRecipe( - tfftstoragefield4, - FluidRegistry.getFluidStack("molten.epoxid", 1152), - new ItemStack(Blocks.tfftStorageField4, 1), - 400, 4098); - final ItemStack[] tfftstoragefield5 = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 4), - GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.HSSS, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Enderium, 1), - ItemList.Field_Generator_EV.get(1L), - ItemList.Electric_Pump_IV.get(1L) - }; - GT_Values.RA.addAssemblerRecipe( - tfftstoragefield5, - FluidRegistry.getFluidStack("molten.epoxid", 1152), - new ItemStack(Blocks.tfftStorageField5, 1), - 400, 6147); - // Multi Hatch - final Object[] multi_hatch_HV = { - "PRP", "UFU", "PRP", - 'P', GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 1), - 'R', GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 1), - 'U', ItemList.Electric_Pump_HV.get(1L), - 'F', ItemList.Field_Generator_LV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_HV); - final Object[] multi_hatch_IV = { - "PRP", "UFU", "PRP", - 'P', GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.TungstenSteel, 1), - 'R', GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.TungstenSteel, 1), - 'U', ItemList.Electric_Pump_IV.get(1L), - 'F', ItemList.Field_Generator_HV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_IV); - final Object[] multi_hatch_ZPM = { - "PRP", "UFU", "PRP", - 'P', GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.NaquadahAlloy, 1), - 'R', GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.NaquadahAlloy, 1), - 'U', ItemList.Electric_Pump_ZPM.get(1L), - 'F', ItemList.Field_Generator_IV.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_ZPM); - - // Conversion recipe from deprecated hatch to new one (old hatch is equal to new IV hatch) - GT_ModHandler.addShapelessCraftingRecipe(TileEntities.mhIV.getStackForm(1), - new ItemStack[]{new ItemStack(Blocks.tfftMultiHatch, 1)}); - } - - private static void registerRecipes_SOFC() { - - final MetaItem_CraftingComponent craftingItem = MetaItem_CraftingComponent.getInstance(); - - // Controller - final Object[] mk1_recipe = { - "CCC", "PHP", "FBL", - 'C', OrePrefixes.circuit.get(Materials.Advanced), - 'P', ItemList.Electric_Pump_HV.get(1L), - 'H', ItemList.Hull_HV.get(1L), - 'F', GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.StainlessSteel, 1), - 'B', GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Gold, 1), - 'L', GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.StainlessSteel, 1) - }; - GT_ModHandler.addCraftingRecipe(TileEntities.sofc1.getStackForm(1), mk1_recipe); - final Object[] mk2_recipe = { - "CCC", "PHP", "FBL", - 'C', OrePrefixes.circuit.get(Materials.Master), - 'P', ItemList.Electric_Pump_IV.get(1L), - 'H', ItemList.Hull_IV.get(1L), - 'F', GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.Ultimate, 1), - 'B', Util.getStackofAmountFromOreDict("wireGt04SuperconductorEV", 1), - 'L', GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Ultimate, 1) - }; - GT_ModHandler.addCraftingRecipe(TileEntities.sofc2.getStackForm(1), mk2_recipe); - - // Blocks - final ItemStack[] yszUnit = { - GT_Utility.getIntegratedCircuit(6), - craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicPlate.getMetaID(), 4), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Yttrium, 1), - GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 1), - ItemList.Electric_Motor_HV.get(1L), - }; - GT_Values.RA.addAssemblerRecipe( - yszUnit, - Materials.Hydrogen.getGas(4000), - new ItemStack(Blocks.yszUnit, 1), - 1200, 480); - final ItemStack[] gdcUnit = { - GT_Utility.getIntegratedCircuit(6), - craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicPlate.getMetaID(), 8), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Gadolinium, new ItemStack(ErrorItem.getInstance(), 1), 1), - GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Desh, new ItemStack(ErrorItem.getInstance(), 1), 1), - ItemList.Electric_Motor_IV.get(1L), - }; - GT_Values.RA.addAssemblerRecipe( - gdcUnit, - Materials.Hydrogen.getGas(16000), - new ItemStack(Blocks.gdcUnit, 1), - 2400, 1920); - - // Items - GT_Values.RA.addAlloySmelterRecipe( - craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicDust.getMetaID(), Loader.isModLoaded("bartworks") ? 3 : 10), - ItemList.Shape_Mold_Plate.get(0), - craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicPlate.getMetaID(), 1), - 400, 480); - GT_Values.RA.addFormingPressRecipe( - craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicDust.getMetaID(), 10), - ItemList.Shape_Mold_Plate.get(0), - craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicPlate.getMetaID(), 1), - 800, 480); - - if (!Loader.isModLoaded("bartworks")) { - GT_Values.RA.addChemicalRecipe( - Materials.Yttrium.getDust(1), GT_Utility.getIntegratedCircuit(6), Materials.Oxygen.getGas(3000), - null, craftingItem.getStackOfAmountFromDamage(Items.YttriaDust.getMetaID(), 1), null, - 400, 30); - GT_Values.RA.addChemicalRecipe( - Util.getStackofAmountFromOreDict("dustZirconium", 1), GT_Utility.getIntegratedCircuit(6), Materials.Oxygen.getGas(2000), - null, craftingItem.getStackOfAmountFromDamage(Items.ZirconiaDust.getMetaID(), 1), null, - 400, 30); - } - - GT_Values.RA.addChemicalRecipe( - Materials.Cerium.getDust(2), GT_Utility.getIntegratedCircuit(6), Materials.Oxygen.getGas(3000), - null, craftingItem.getStackOfAmountFromDamage(Items.CeriaDust.getMetaID(), 2), null, - 400, 30); - GT_Values.RA.addMixerRecipe( - Items.YttriaDust.getOreDictedItemStack(1), - Items.ZirconiaDust.getOreDictedItemStack(5), - GT_Utility.getIntegratedCircuit(6), null, null, null, - craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicDust.getMetaID(), 6), - 400, 96); - GT_Values.RA.addMixerRecipe( - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gadolinium, new ItemStack(ErrorItem.getInstance(), 1), 1), - craftingItem.getStackOfAmountFromDamage(Items.CeriaDust.getMetaID(), 9), - GT_Utility.getIntegratedCircuit(6), null, null, null, - craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicDust.getMetaID(), 10), - 400, 1920); - } - - /*private static void registerRecipes_Nuclear() { - - final MetaItem_CraftingComponent craftingItem = MetaItem_CraftingComponent.getInstance(); - - // Controller - - // Blocks - final ItemStack[] controlrod = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Lead, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Steel, 4), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 64) - }; - GT_Values.RA.addAssemblerRecipe( - controlrod, - null, - new ItemStack(Blocks.reactorControlRod, 1), - 800, 480); - final ItemStack[] reactorchamber = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Lead, 1), - GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.Lead, 9), - GT_OreDictUnificator.get(OrePrefixes.ring, Materials.TungstenSteel, 18), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Steel, 2), - }; - GT_Values.RA.addAssemblerRecipe( - reactorchamber, - FluidRegistry.getFluidStack("wet.concrete", 144), - new ItemStack(Blocks.reactorChamberOFF, 1), - 1600, 480); - - // Items - GT_Values.RA.addMixerRecipe(Materials.Boron.getDust(1), Materials.Arsenic.getDust(1), GT_Utility.getIntegratedCircuit(6), null, - null, null, craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideDust.getMetaID(), 2), - 100, 1920); - GT_Values.RA.addChemicalRecipe( - Materials.Ammonia.getCells(2), - Materials.CarbonDioxide.getCells(1), - null, - null, - craftingItem.getStackOfAmountFromDamage(Items.AmineCarbamiteDust.getMetaID(), 1), - Util.getStackofAmountFromOreDict("cellEmpty", 3), - 400, 30); - GT_Values.RA.addChemicalRecipe( - craftingItem.getStackOfAmountFromDamage(Items.AmineCarbamiteDust.getMetaID(), 1), - Materials.Diamond.getDust(16), - Materials.CarbonDioxide.getGas(1000), - null, - craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondDust.getMetaID(), 1), - null, 1200, 480); - - GT_Values.RA.addAutoclaveRecipe( - craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondDust.getMetaID(), 4), - Materials.CarbonDioxide.getGas(16000), - craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondCrystal.getMetaID(), 1), 10000, 2400, 7680); - GT_Values.RA.addAutoclaveRecipe( - craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideDust.getMetaID(), 4), - Materials.Nitrogen.getGas(4000), - craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideCrystal.getMetaID(), 1), 10000, 2400, 1920); - - GT_Values.RA.addLatheRecipe( - GT_OreDictUnificator.get(OrePrefixes.stick, Materials.AnnealedCopper, 1), - craftingItem.getStackFromDamage(Items.CopperHeatPipe.getMetaID()), - null, 120, 120); - GT_Values.RA.addLatheRecipe( - GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Silver, 1), - craftingItem.getStackFromDamage(Items.SilverHeatPipe.getMetaID()), - null, 120, 480); - GT_Values.RA.addLatheRecipe( - craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideCrystal.getMetaID(), 4), - craftingItem.getStackFromDamage(Items.BoronArsenideHeatPipe.getMetaID()), - null, 1200, 1920); - GT_Values.RA.addLatheRecipe( - craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondCrystal.getMetaID(), 4), - craftingItem.getStackFromDamage(Items.DiamondHeatPipe.getMetaID()), - null, 1200, 7680); - }*/ - - private static void registerRecipes_Jars() { - - // Thaumium Reinforced Jar - final ItemStack[] recipe_jarthaumiumreinforced = { - GameRegistry.makeItemStack("Thaumcraft:ItemResource", 15, 1, null), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Titanium, 1), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - }; - final AspectList aspects_jarthaumiumreinforced = new AspectList() - .add(Aspect.ARMOR, 64) - .add(Aspect.ORDER, 32) - .add(Aspect.WATER, 32) - .add(Aspect.GREED, 16) - .add(Aspect.VOID, 16) - .add(Aspect.AIR, 8); - infusionRecipes.put("THAUMIUMREINFORCEDJAR", - ThaumcraftApi.addInfusionCraftingRecipe("THAUMIUMREINFORCEDJAR", new ItemStack(Blocks.jarThaumiumReinforced, 1, 0), - 5, aspects_jarthaumiumreinforced, ItemApi.getBlock("blockJar", 0), recipe_jarthaumiumreinforced)); - // Thaumium Reinforced Void Jar - final ItemStack[] recipe_voidjarupgrade = { - GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Obsidian, 1), - GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blaze, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderEye, 1), - ItemApi.getItem("itemNugget", 5) - }; - final AspectList aspects_voidjarupgrade = new AspectList() - .add(Aspect.VOID, 14) - .add(Aspect.MAGIC, 14) - .add(Aspect.ENTROPY, 14) - .add(Aspect.WATER, 14); - infusionRecipes.put("THAUMIUMREINFORCEDVOIDJAR", - ThaumcraftApi.addInfusionCraftingRecipe("THAUMIUMREINFORCEDJAR", new ItemStack(Blocks.jarThaumiumReinforced, 1, 3), - 2, aspects_voidjarupgrade, new ItemStack(Blocks.jarThaumiumReinforced, 1, 0), recipe_voidjarupgrade)); - - final ItemStack[] recipe_jarichor = { - GT_ModHandler.getModItem("ThaumicTinkerer", "kamiResource", 1, 0), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Diamond, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 1), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), - new ItemStack(net.minecraft.init.Blocks.glass_pane), - }; - final AspectList aspects_jarichor = new AspectList() - .add(Aspect.ARMOR, 256) - .add(Aspect.ELDRITCH, 128) - .add(Aspect.ORDER, 128) - .add(Aspect.WATER, 128) - .add(Aspect.GREED, 64) - .add(Aspect.VOID, 64) - .add(Aspect.AIR, 32); - infusionRecipes.put("ICHORJAR", - ThaumcraftApi.addInfusionCraftingRecipe("ICHORJAR", new ItemStack(Blocks.jarIchor, 1, 0), - 15, aspects_jarichor, ItemApi.getBlock("blockJar", 0), recipe_jarichor)); - // Ichor Void Jar - infusionRecipes.put("ICHORVOIDJAR", - ThaumcraftApi.addInfusionCraftingRecipe("ICHORJAR", new ItemStack(Blocks.jarIchor, 1, 3), - 5, aspects_voidjarupgrade, new ItemStack(Blocks.jarIchor, 1, 0), recipe_voidjarupgrade)); - - } - - private static void registerRecipes_LSC(){ - - // Controller - final Object[] lsc_recipe = { - "LPL", "CBC", "LPL", - 'L', ItemList.IC2_LapotronCrystal.getWithCharge(1L, 10000000), - 'P', ItemList.Circuit_Chip_PIC.get(1L), - 'C', OrePrefixes.circuit.get(Materials.Master), - 'B', new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), - }; - GT_ModHandler.addCraftingRecipe(TileEntities.lsc.getStackForm(1), lsc_recipe); - - // Blocks - final Object[] lcBase_recipe = { - "WBW", "RLR", "WBW", - 'W', OrePrefixes.plate.get(Materials.Tantalum), - 'B', OrePrefixes.frameGt.get(Materials.TungstenSteel), - 'R', OrePrefixes.stickLong.get(Materials.TungstenSteel), - 'L', OrePrefixes.block.get(Materials.Lapis) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), lcBase_recipe); - GT_Values.RA.addAssemblerRecipe(new ItemStack[] { - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tantalum, 4), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.TungstenSteel, 2), - GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 2), - GT_OreDictUnificator.get(OrePrefixes.block, Materials.Lapis, 1) - }, null, new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), 100, 480); - - // Empty Capacitor - final Object[] lcEmpty_recipe = { - "SLS", "L L", "SLS", - 'S', OrePrefixes.screw.get(Materials.Lapis), - 'L', OrePrefixes.plate.get(Materials.Lapis) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), lcEmpty_recipe); - - // EV Capacitor - final Object[] lcEV_recipe = { - "SLS", "LCL", "SLS", - 'S', OrePrefixes.screw.get(Materials.Lapis), - 'L', OrePrefixes.plate.get(Materials.Lapis), - 'C', GT_ModHandler.getIC2Item("lapotronCrystal", 1L, GT_Values.W) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), lcEV_recipe); - - // EV Capacitor alt recipe - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), - GT_ModHandler.getIC2Item("lapotronCrystal", 1L, GT_Values.W), - GT_Utility.getIntegratedCircuit(7) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), - 200, BW_Util.getMachineVoltageFromTier(3) - ); - - // IV Capacitor - final Object[] lcIV_recipe = { - "SLS", "LOL", "SLS", - 'S', OrePrefixes.screw.get(Materials.Lapis), - 'L', OrePrefixes.plate.get(Materials.Lapis), - 'O', ItemList.Energy_LapotronicOrb.get(1L) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), lcIV_recipe); - - // IV Capacitor alt recipe - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), - ItemList.Energy_LapotronicOrb.get(1L), - GT_Utility.getIntegratedCircuit(1) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), - 400, BW_Util.getMachineVoltageFromTier(4) - ); - - // LuV Capacitor - GT_Values.RA.addAssemblylineRecipe( - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), 288000, - new Object[] { - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), - ItemList.Circuit_Board_Elite.get(1), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NaquadahAlloy, 64), - new Object[]{OrePrefixes.circuit.get(Materials.Master), 4}, - ItemList.Circuit_Parts_Crystal_Chip_Master.get(36), - ItemList.Circuit_Parts_Crystal_Chip_Master.get(36), - ItemList.Circuit_Chip_HPIC.get(64), - ItemList.Circuit_Parts_DiodeASMD.get(8), - ItemList.Circuit_Parts_CapacitorASMD.get(8), - ItemList.Circuit_Parts_ResistorASMD.get(8), - ItemList.Circuit_Parts_TransistorASMD.get(8), - GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Platinum, 64) - }, - new FluidStack[] { - new FluidStack(solderIndalloy, 720) - }, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), 1000, 80000 - ); + KekzCore.LOGGER.info("Registering recipes..."); + + registerRecipes_TFFT(); + registerRecipes_SOFC(); + // registerRecipes_Nuclear(); + registerRecipes_Jars(); + registerRecipes_LSC(); + // registerRecipes_SpaceElevator(); + registerRecipes_Cosmetics(); + + KekzCore.LOGGER.info("Finished registering recipes"); + } + + private static void registerRecipes_TFFT() { + + // Controller + final Object[] tfft_recipe = { + "HFH", + "PVP", + "CFC", + 'H', + OrePrefixes.pipeMedium.get(Materials.StainlessSteel), + 'F', + ItemList.Field_Generator_MV.get(1L), + 'P', + ItemList.Electric_Pump_HV.get(1L), + 'V', + OrePrefixes.rotor.get(Materials.VibrantAlloy), + 'C', + OrePrefixes.circuit.get(Materials.Data) + }; + GT_ModHandler.addCraftingRecipe(TileEntities.fms.getStackForm(1), tfft_recipe); + + // Blocks + final ItemStack[] tfftcasing = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.DarkSteel, 3), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderPearl, 3), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1), + }; + GT_Values.RA.addAssemblerRecipe( + tfftcasing, + FluidRegistry.getFluidStack("molten.polytetrafluoroethylene", 144), + new ItemStack(Blocks.tfftCasing, 1), + 200, + 256); + final ItemStack[] tfftstoragefield1 = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Steel, 1), + ItemList.Electric_Pump_LV.get(1L) + }; + GT_Values.RA.addAssemblerRecipe( + tfftstoragefield1, + FluidRegistry.getFluidStack("molten.glass", 144), + new ItemStack(Blocks.tfftStorageField1, 1), + 200, + 256); + final ItemStack[] tfftstoragefield2 = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.PulsatingIron, 4), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.StainlessSteel, 1), + ItemList.Electric_Pump_MV.get(1L) + }; + GT_Values.RA.addAssemblerRecipe( + tfftstoragefield2, + FluidRegistry.getFluidStack("molten.plastic", 576), + new ItemStack(Blocks.tfftStorageField2, 1), + 200, + 480); + final ItemStack[] tfftstoragefield3 = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Data, 2), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.VibrantAlloy, 2), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Titanium, 1), + ItemList.Field_Generator_MV.get(1L), + ItemList.Electric_Pump_HV.get(2L) + }; + GT_Values.RA.addAssemblerRecipe( + tfftstoragefield3, + FluidRegistry.getFluidStack("molten.epoxid", 576), + new ItemStack(Blocks.tfftStorageField3, 1), + 300, + 1920); + final ItemStack[] tfftstoragefield4 = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Elite, 4), + GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.NiobiumTitanium, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.TungstenSteel, 1), + ItemList.Field_Generator_HV.get(1L), + ItemList.Electric_Pump_EV.get(1L) + }; + GT_Values.RA.addAssemblerRecipe( + tfftstoragefield4, + FluidRegistry.getFluidStack("molten.epoxid", 1152), + new ItemStack(Blocks.tfftStorageField4, 1), + 400, + 4098); + final ItemStack[] tfftstoragefield5 = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 4), + GT_OreDictUnificator.get(OrePrefixes.plateTriple, Materials.HSSS, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Enderium, 1), + ItemList.Field_Generator_EV.get(1L), + ItemList.Electric_Pump_IV.get(1L) + }; + GT_Values.RA.addAssemblerRecipe( + tfftstoragefield5, + FluidRegistry.getFluidStack("molten.epoxid", 1152), + new ItemStack(Blocks.tfftStorageField5, 1), + 400, + 6147); + // Multi Hatch + final Object[] multi_hatch_HV = { + "PRP", + "UFU", + "PRP", + 'P', + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.StainlessSteel, 1), + 'R', + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 1), + 'U', + ItemList.Electric_Pump_HV.get(1L), + 'F', + ItemList.Field_Generator_LV.get(1L) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_HV); + final Object[] multi_hatch_IV = { + "PRP", + "UFU", + "PRP", + 'P', + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.TungstenSteel, 1), + 'R', + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.TungstenSteel, 1), + 'U', + ItemList.Electric_Pump_IV.get(1L), + 'F', + ItemList.Field_Generator_HV.get(1L) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_IV); + final Object[] multi_hatch_ZPM = { + "PRP", + "UFU", + "PRP", + 'P', + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.NaquadahAlloy, 1), + 'R', + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.NaquadahAlloy, 1), + 'U', + ItemList.Electric_Pump_ZPM.get(1L), + 'F', + ItemList.Field_Generator_IV.get(1L) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.tfftMultiHatch), multi_hatch_ZPM); + + // Conversion recipe from deprecated hatch to new one (old hatch is equal to new IV hatch) + GT_ModHandler.addShapelessCraftingRecipe( + TileEntities.mhIV.getStackForm(1), new ItemStack[] {new ItemStack(Blocks.tfftMultiHatch, 1)}); + } + + private static void registerRecipes_SOFC() { + + final MetaItem_CraftingComponent craftingItem = MetaItem_CraftingComponent.getInstance(); + + // Controller + final Object[] mk1_recipe = { + "CCC", + "PHP", + "FBL", + 'C', + OrePrefixes.circuit.get(Materials.Advanced), + 'P', + ItemList.Electric_Pump_HV.get(1L), + 'H', + ItemList.Hull_HV.get(1L), + 'F', + GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.StainlessSteel, 1), + 'B', + GT_OreDictUnificator.get(OrePrefixes.cableGt02, Materials.Gold, 1), + 'L', + GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.StainlessSteel, 1) + }; + GT_ModHandler.addCraftingRecipe(TileEntities.sofc1.getStackForm(1), mk1_recipe); + final Object[] mk2_recipe = { + "CCC", + "PHP", + "FBL", + 'C', + OrePrefixes.circuit.get(Materials.Master), + 'P', + ItemList.Electric_Pump_IV.get(1L), + 'H', + ItemList.Hull_IV.get(1L), + 'F', + GT_OreDictUnificator.get(OrePrefixes.pipeSmall, Materials.Ultimate, 1), + 'B', + Util.getStackofAmountFromOreDict("wireGt04SuperconductorEV", 1), + 'L', + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Ultimate, 1) + }; + GT_ModHandler.addCraftingRecipe(TileEntities.sofc2.getStackForm(1), mk2_recipe); + + // Blocks + final ItemStack[] yszUnit = { + GT_Utility.getIntegratedCircuit(6), + craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicPlate.getMetaID(), 4), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Yttrium, 1), + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 1), + ItemList.Electric_Motor_HV.get(1L), + }; + GT_Values.RA.addAssemblerRecipe( + yszUnit, Materials.Hydrogen.getGas(4000), new ItemStack(Blocks.yszUnit, 1), 1200, 480); + final ItemStack[] gdcUnit = { + GT_Utility.getIntegratedCircuit(6), + craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicPlate.getMetaID(), 8), + GT_OreDictUnificator.get( + OrePrefixes.frameGt, Materials.Gadolinium, new ItemStack(ErrorItem.getInstance(), 1), 1), + GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Desh, new ItemStack(ErrorItem.getInstance(), 1), 1), + ItemList.Electric_Motor_IV.get(1L), + }; + GT_Values.RA.addAssemblerRecipe( + gdcUnit, Materials.Hydrogen.getGas(16000), new ItemStack(Blocks.gdcUnit, 1), 2400, 1920); + + // Items + GT_Values.RA.addAlloySmelterRecipe( + craftingItem.getStackOfAmountFromDamage( + Items.YSZCeramicDust.getMetaID(), Loader.isModLoaded("bartworks") ? 3 : 10), + ItemList.Shape_Mold_Plate.get(0), + craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicPlate.getMetaID(), 1), + 400, + 480); + GT_Values.RA.addFormingPressRecipe( + craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicDust.getMetaID(), 10), + ItemList.Shape_Mold_Plate.get(0), + craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicPlate.getMetaID(), 1), + 800, + 480); + + if (!Loader.isModLoaded("bartworks")) { + GT_Values.RA.addChemicalRecipe( + Materials.Yttrium.getDust(1), + GT_Utility.getIntegratedCircuit(6), + Materials.Oxygen.getGas(3000), + null, + craftingItem.getStackOfAmountFromDamage(Items.YttriaDust.getMetaID(), 1), + null, + 400, + 30); + GT_Values.RA.addChemicalRecipe( + Util.getStackofAmountFromOreDict("dustZirconium", 1), + GT_Utility.getIntegratedCircuit(6), + Materials.Oxygen.getGas(2000), + null, + craftingItem.getStackOfAmountFromDamage(Items.ZirconiaDust.getMetaID(), 1), + null, + 400, + 30); + } + + GT_Values.RA.addChemicalRecipe( + Materials.Cerium.getDust(2), + GT_Utility.getIntegratedCircuit(6), + Materials.Oxygen.getGas(3000), + null, + craftingItem.getStackOfAmountFromDamage(Items.CeriaDust.getMetaID(), 2), + null, + 400, + 30); + GT_Values.RA.addMixerRecipe( + Items.YttriaDust.getOreDictedItemStack(1), + Items.ZirconiaDust.getOreDictedItemStack(5), + GT_Utility.getIntegratedCircuit(6), + null, + null, + null, + craftingItem.getStackOfAmountFromDamage(Items.YSZCeramicDust.getMetaID(), 6), + 400, + 96); + GT_Values.RA.addMixerRecipe( + GT_OreDictUnificator.get( + OrePrefixes.dust, Materials.Gadolinium, new ItemStack(ErrorItem.getInstance(), 1), 1), + craftingItem.getStackOfAmountFromDamage(Items.CeriaDust.getMetaID(), 9), + GT_Utility.getIntegratedCircuit(6), + null, + null, + null, + craftingItem.getStackOfAmountFromDamage(Items.GDCCeramicDust.getMetaID(), 10), + 400, + 1920); + } + + /*private static void registerRecipes_Nuclear() { + + final MetaItem_CraftingComponent craftingItem = MetaItem_CraftingComponent.getInstance(); + + // Controller + + // Blocks + final ItemStack[] controlrod = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Lead, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Steel, 4), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 64) + }; + GT_Values.RA.addAssemblerRecipe( + controlrod, + null, + new ItemStack(Blocks.reactorControlRod, 1), + 800, 480); + final ItemStack[] reactorchamber = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.pipeHuge, Materials.Lead, 1), + GT_OreDictUnificator.get(OrePrefixes.pipeTiny, Materials.Lead, 9), + GT_OreDictUnificator.get(OrePrefixes.ring, Materials.TungstenSteel, 18), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Steel, 2), + }; + GT_Values.RA.addAssemblerRecipe( + reactorchamber, + FluidRegistry.getFluidStack("wet.concrete", 144), + new ItemStack(Blocks.reactorChamberOFF, 1), + 1600, 480); + + // Items + GT_Values.RA.addMixerRecipe(Materials.Boron.getDust(1), Materials.Arsenic.getDust(1), GT_Utility.getIntegratedCircuit(6), null, + null, null, craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideDust.getMetaID(), 2), + 100, 1920); + GT_Values.RA.addChemicalRecipe( + Materials.Ammonia.getCells(2), + Materials.CarbonDioxide.getCells(1), + null, + null, + craftingItem.getStackOfAmountFromDamage(Items.AmineCarbamiteDust.getMetaID(), 1), + Util.getStackofAmountFromOreDict("cellEmpty", 3), + 400, 30); + GT_Values.RA.addChemicalRecipe( + craftingItem.getStackOfAmountFromDamage(Items.AmineCarbamiteDust.getMetaID(), 1), + Materials.Diamond.getDust(16), + Materials.CarbonDioxide.getGas(1000), + null, + craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondDust.getMetaID(), 1), + null, 1200, 480); + + GT_Values.RA.addAutoclaveRecipe( + craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondDust.getMetaID(), 4), + Materials.CarbonDioxide.getGas(16000), + craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondCrystal.getMetaID(), 1), 10000, 2400, 7680); + GT_Values.RA.addAutoclaveRecipe( + craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideDust.getMetaID(), 4), + Materials.Nitrogen.getGas(4000), + craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideCrystal.getMetaID(), 1), 10000, 2400, 1920); + + GT_Values.RA.addLatheRecipe( + GT_OreDictUnificator.get(OrePrefixes.stick, Materials.AnnealedCopper, 1), + craftingItem.getStackFromDamage(Items.CopperHeatPipe.getMetaID()), + null, 120, 120); + GT_Values.RA.addLatheRecipe( + GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Silver, 1), + craftingItem.getStackFromDamage(Items.SilverHeatPipe.getMetaID()), + null, 120, 480); + GT_Values.RA.addLatheRecipe( + craftingItem.getStackOfAmountFromDamage(Items.BoronArsenideCrystal.getMetaID(), 4), + craftingItem.getStackFromDamage(Items.BoronArsenideHeatPipe.getMetaID()), + null, 1200, 1920); + GT_Values.RA.addLatheRecipe( + craftingItem.getStackOfAmountFromDamage(Items.IsotopicallyPureDiamondCrystal.getMetaID(), 4), + craftingItem.getStackFromDamage(Items.DiamondHeatPipe.getMetaID()), + null, 1200, 7680); + }*/ + + private static void registerRecipes_Jars() { + + // Thaumium Reinforced Jar + final ItemStack[] recipe_jarthaumiumreinforced = { + GameRegistry.makeItemStack("Thaumcraft:ItemResource", 15, 1, null), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Titanium, 1), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Thaumium, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + }; + final AspectList aspects_jarthaumiumreinforced = new AspectList() + .add(Aspect.ARMOR, 64) + .add(Aspect.ORDER, 32) + .add(Aspect.WATER, 32) + .add(Aspect.GREED, 16) + .add(Aspect.VOID, 16) + .add(Aspect.AIR, 8); + infusionRecipes.put( + "THAUMIUMREINFORCEDJAR", + ThaumcraftApi.addInfusionCraftingRecipe( + "THAUMIUMREINFORCEDJAR", + new ItemStack(Blocks.jarThaumiumReinforced, 1, 0), + 5, + aspects_jarthaumiumreinforced, + ItemApi.getBlock("blockJar", 0), + recipe_jarthaumiumreinforced)); + // Thaumium Reinforced Void Jar + final ItemStack[] recipe_voidjarupgrade = { + GT_OreDictUnificator.get(OrePrefixes.plateDense, Materials.Obsidian, 1), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Blaze, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.EnderEye, 1), + ItemApi.getItem("itemNugget", 5) + }; + final AspectList aspects_voidjarupgrade = new AspectList() + .add(Aspect.VOID, 14) + .add(Aspect.MAGIC, 14) + .add(Aspect.ENTROPY, 14) + .add(Aspect.WATER, 14); + infusionRecipes.put( + "THAUMIUMREINFORCEDVOIDJAR", + ThaumcraftApi.addInfusionCraftingRecipe( + "THAUMIUMREINFORCEDJAR", + new ItemStack(Blocks.jarThaumiumReinforced, 1, 3), + 2, + aspects_voidjarupgrade, + new ItemStack(Blocks.jarThaumiumReinforced, 1, 0), + recipe_voidjarupgrade)); + + final ItemStack[] recipe_jarichor = { + GT_ModHandler.getModItem("ThaumicTinkerer", "kamiResource", 1, 0), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.gemExquisite, Materials.Diamond, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 1), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Diamond, 1), + new ItemStack(net.minecraft.init.Blocks.glass_pane), + }; + final AspectList aspects_jarichor = new AspectList() + .add(Aspect.ARMOR, 256) + .add(Aspect.ELDRITCH, 128) + .add(Aspect.ORDER, 128) + .add(Aspect.WATER, 128) + .add(Aspect.GREED, 64) + .add(Aspect.VOID, 64) + .add(Aspect.AIR, 32); + infusionRecipes.put( + "ICHORJAR", + ThaumcraftApi.addInfusionCraftingRecipe( + "ICHORJAR", + new ItemStack(Blocks.jarIchor, 1, 0), + 15, + aspects_jarichor, + ItemApi.getBlock("blockJar", 0), + recipe_jarichor)); + // Ichor Void Jar + infusionRecipes.put( + "ICHORVOIDJAR", + ThaumcraftApi.addInfusionCraftingRecipe( + "ICHORJAR", + new ItemStack(Blocks.jarIchor, 1, 3), + 5, + aspects_voidjarupgrade, + new ItemStack(Blocks.jarIchor, 1, 0), + recipe_voidjarupgrade)); + } + + private static void registerRecipes_LSC() { + + // Controller + final Object[] lsc_recipe = { + "LPL", + "CBC", + "LPL", + 'L', + ItemList.IC2_LapotronCrystal.getWithCharge(1L, 10000000), + 'P', + ItemList.Circuit_Chip_PIC.get(1L), + 'C', + OrePrefixes.circuit.get(Materials.Master), + 'B', + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), + }; + GT_ModHandler.addCraftingRecipe(TileEntities.lsc.getStackForm(1), lsc_recipe); + + // Blocks + final Object[] lcBase_recipe = { + "WBW", + "RLR", + "WBW", + 'W', + OrePrefixes.plate.get(Materials.Tantalum), + 'B', + OrePrefixes.frameGt.get(Materials.TungstenSteel), + 'R', + OrePrefixes.stickLong.get(Materials.TungstenSteel), + 'L', + OrePrefixes.block.get(Materials.Lapis) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), lcBase_recipe); + GT_Values.RA.addAssemblerRecipe( + new ItemStack[] { + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tantalum, 4), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.TungstenSteel, 2), + GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.TungstenSteel, 2), + GT_OreDictUnificator.get(OrePrefixes.block, Materials.Lapis, 1) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 0), + 100, + 480); + + // Empty Capacitor + final Object[] lcEmpty_recipe = { + "SLS", + "L L", + "SLS", + 'S', + OrePrefixes.screw.get(Materials.Lapis), + 'L', + OrePrefixes.plate.get(Materials.Lapis) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), lcEmpty_recipe); + + // EV Capacitor + final Object[] lcEV_recipe = { + "SLS", + "LCL", + "SLS", + 'S', + OrePrefixes.screw.get(Materials.Lapis), + 'L', + OrePrefixes.plate.get(Materials.Lapis), + 'C', + GT_ModHandler.getIC2Item("lapotronCrystal", 1L, GT_Values.W) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), lcEV_recipe); + + // EV Capacitor alt recipe + GT_Values.RA.addAssemblerRecipe( + new ItemStack[] { + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), + GT_ModHandler.getIC2Item("lapotronCrystal", 1L, GT_Values.W), + GT_Utility.getIntegratedCircuit(7) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), + 200, + BW_Util.getMachineVoltageFromTier(3)); + + // IV Capacitor + final Object[] lcIV_recipe = { + "SLS", + "LOL", + "SLS", + 'S', + OrePrefixes.screw.get(Materials.Lapis), + 'L', + OrePrefixes.plate.get(Materials.Lapis), + 'O', + ItemList.Energy_LapotronicOrb.get(1L) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), lcIV_recipe); + + // IV Capacitor alt recipe + GT_Values.RA.addAssemblerRecipe( + new ItemStack[] { + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), + ItemList.Energy_LapotronicOrb.get(1L), + GT_Utility.getIntegratedCircuit(1) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), + 400, + BW_Util.getMachineVoltageFromTier(4)); + + // LuV Capacitor + GT_Values.RA.addAssemblylineRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), + 288000, + new Object[] { + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), + ItemList.Circuit_Board_Elite.get(1), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NaquadahAlloy, 64), + new Object[] {OrePrefixes.circuit.get(Materials.Master), 4}, + ItemList.Circuit_Parts_Crystal_Chip_Master.get(36), + ItemList.Circuit_Parts_Crystal_Chip_Master.get(36), + ItemList.Circuit_Chip_HPIC.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(8), + ItemList.Circuit_Parts_CapacitorASMD.get(8), + ItemList.Circuit_Parts_ResistorASMD.get(8), + ItemList.Circuit_Parts_TransistorASMD.get(8), + GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Platinum, 64) + }, + new FluidStack[] {new FluidStack(solderIndalloy, 720)}, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), + 1000, + 80000); // LuV Capacitor alt recipe GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - ItemList.Energy_LapotronicOrb2.get(1), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), - GT_Utility.getIntegratedCircuit(6) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), - 800, BW_Util.getMachineVoltageFromTier(5) - ); + new ItemStack[] { + ItemList.Energy_LapotronicOrb2.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), + GT_Utility.getIntegratedCircuit(6) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), + 800, + BW_Util.getMachineVoltageFromTier(5)); LuVTierEnhancer.addToBlackListForOsmiridiumReplacement(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2)); - // ZPM Capacitor - GT_Values.RA.addAssemblylineRecipe( - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), 288000, - new Object[] { - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.NaquadahAlloy, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 16L), - new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, - ItemList.Energy_LapotronicOrb2.get(8L), - ItemList.Field_Generator_LuV.get(2), - ItemList.Circuit_Wafer_SoC2.get(64), - ItemList.Circuit_Wafer_SoC2.get(64), - ItemList.Circuit_Parts_DiodeASMD.get(8), - GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 32) - }, - new FluidStack[] { - new FluidStack(solderIndalloy, 2880), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) - }, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), 2000, 100000 - ); + // ZPM Capacitor + GT_Values.RA.addAssemblylineRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), + 288000, + new Object[] { + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.NaquadahAlloy, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 16L), + new Object[] {OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Ultimate), 1}, + ItemList.Energy_LapotronicOrb2.get(8L), + ItemList.Field_Generator_LuV.get(2), + ItemList.Circuit_Wafer_SoC2.get(64), + ItemList.Circuit_Wafer_SoC2.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(8), + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.Naquadah, 32) + }, + new FluidStack[] { + new FluidStack(solderIndalloy, 2880), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) + }, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), + 2000, + 100000); // ZPM Capacitor alt recipe GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - ItemList.Energy_Module.get(1), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.NaquadahAlloy, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), - GT_Utility.getIntegratedCircuit(6) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), - 1600, BW_Util.getMachineVoltageFromTier(6) - ); - - // UV Capacitor - GT_Values.RA.addAssemblylineRecipe( - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), 288000, - new Object[] { - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Americium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, - ItemList.Energy_Module.get(8L), - ItemList.Field_Generator_ZPM.get(2), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Wafer_HPIC.get(64), - ItemList.Circuit_Parts_DiodeASMD.get(16), - GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.NaquadahAlloy, 32) - }, - new FluidStack[] { - new FluidStack(solderIndalloy, 2880), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) - }, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), 2000, 200000 - ); + new ItemStack[] { + ItemList.Energy_Module.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.NaquadahAlloy, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), + GT_Utility.getIntegratedCircuit(6) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), + 1600, + BW_Util.getMachineVoltageFromTier(6)); + + // UV Capacitor + GT_Values.RA.addAssemblylineRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), + 288000, + new Object[] { + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Americium, 32L), + new Object[] {OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Superconductor), 1}, + ItemList.Energy_Module.get(8L), + ItemList.Field_Generator_ZPM.get(2), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Wafer_HPIC.get(64), + ItemList.Circuit_Parts_DiodeASMD.get(16), + GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.NaquadahAlloy, 32) + }, + new FluidStack[] { + new FluidStack(solderIndalloy, 2880), new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) + }, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), + 2000, + 200000); // UV Capacitor alt recipe GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - ItemList.Energy_Cluster.get(1), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), - GT_Utility.getIntegratedCircuit(6) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), - 3200, BW_Util.getMachineVoltageFromTier(7) - ); - - // Ultimate Capacitor (UHV) - TT_recipeAdder.addResearchableAssemblylineRecipe( - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), 12000, - 16, 300000, 3, - new Object[] { - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 4), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1}, - new Object[]{OrePrefixes.circuit.get(Materials.Bio), 1}, - ItemList.ZPM2.get(8L), - ItemList.Field_Generator_UHV.get(4), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_UHPIC.get(64), - ItemList.Circuit_Wafer_SoC2.get(32), - ItemList.Circuit_Parts_DiodeASMD.get(64), - GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64) - }, - new FluidStack[] { - new FluidStack(solderUEV, 4608), - Materials.Naquadria.getMolten(9216), - new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) - }, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), 4000, 1600000 - ); + new ItemStack[] { + ItemList.Energy_Cluster.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), + GT_Utility.getIntegratedCircuit(6) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), + 3200, + BW_Util.getMachineVoltageFromTier(7)); + + // Ultimate Capacitor (UHV) + TT_recipeAdder.addResearchableAssemblylineRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), + 12000, + 16, + 300000, + 3, + new Object[] { + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Neutronium, 32L), + new Object[] {OrePrefixes.circuit.get(Materials.Bio), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Bio), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Bio), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Bio), 1}, + ItemList.ZPM2.get(8L), + ItemList.Field_Generator_UHV.get(4), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_UHPIC.get(64), + ItemList.Circuit_Wafer_SoC2.get(32), + ItemList.Circuit_Parts_DiodeASMD.get(64), + GT_OreDictUnificator.get(OrePrefixes.wireGt02, Materials.SuperconductorUHV, 64) + }, + new FluidStack[] { + new FluidStack(solderUEV, 4608), + Materials.Naquadria.getMolten(9216), + new FluidStack(FluidRegistry.getFluid("ic2coolant"), 32000) + }, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), + 4000, + 1600000); // UHV Capacitor alt recipe GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { - ItemList.ZPM3.get(1), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 4), + new ItemStack[] { + ItemList.ZPM3.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.CosmicNeutronium, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), + GT_Utility.getIntegratedCircuit(6) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), + 6400, + BW_Util.getMachineVoltageFromTier(8)); + + // Capacitor recycling + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), + GT_ModHandler.getIC2Item("lapotronCrystal", 1L, 26), + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), + 1200, + 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), + ItemList.Energy_LapotronicOrb.get(1L), + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), + 1200, + 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), + ItemList.Energy_LapotronicOrb2.get(1L), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), + 1200, + 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), + ItemList.Energy_Module.get(1L), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), + 1200, + 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), + ItemList.Energy_Cluster.get(1L), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), + 1200, + 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), + ItemList.ZPM3.get(1L), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), - GT_Utility.getIntegratedCircuit(6) - }, - null, - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), - 6400, BW_Util.getMachineVoltageFromTier(8) - ); - - // Capacitor recycling - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), - GT_ModHandler.getIC2Item("lapotronCrystal", 1L, 26), - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), - 1200, 32); - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), - ItemList.Energy_LapotronicOrb.get(1L), - new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 6), - 1200, 32); - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), - ItemList.Energy_LapotronicOrb2.get(1L), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Osmiridium, 24), - 1200, 32); - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 3), - ItemList.Energy_Module.get(1L), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.NaquadahAlloy, 24), - 1200, 32); - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 4), - ItemList.Energy_Cluster.get(1L), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 24), - 1200, 32); - GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), - ItemList.ZPM3.get(1L), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), - 1200, 32); - } - - /*private static void registerRecipes_SpaceElevator() { - // Controller - final Object[] se_recipe = { - "BCB", "CPC", "BCB", - 'B', new ItemStack(Blocks.spaceElevatorStructure, 1, 0), - 'C', OrePrefixes.cableGt16.get(Materials.Aluminium), - 'P', OrePrefixes.circuit.get(Materials.Master) - }; - GT_ModHandler.addCraftingRecipe(TileEntities.se.getStackForm(1), se_recipe); - // Blocks - final Object[] seBase_recipe = { - "DRD", "RCR", "DRD", - 'D', OrePrefixes.plate.get(Materials.DarkSteel), - 'R', OrePrefixes.stick.get(Materials.Steel), - 'C', OrePrefixes.block.get(Materials.Concrete), - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.spaceElevatorStructure, 1, 0), seBase_recipe); - final Object[] seCoilHolder_recipe = { - "DRD", "RCR", "DRD", - 'D', OrePrefixes.plate.get(Materials.DarkSteel), - 'R', OrePrefixes.ring.get(Materials.Steel), - 'C', OrePrefixes.cableGt01.get(Materials.Aluminium) - }; - GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.spaceElevatorStructure, 1, 1), seCoilHolder_recipe); - }*/ - - private static void registerRecipes_Cosmetics() { - // Hex Tiles - final ItemStack[] hexTiles = { - GT_Utility.getIntegratedCircuit(6), - GT_OreDictUnificator.get(OrePrefixes.stone, Materials.Concrete, 1), - GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Steel, 1), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.DarkSteel, 2) - }; - GT_Values.RA.addAssemblerRecipe( - hexTiles, - FluidRegistry.getFluidStack("molten.plastic", 36), - new ItemStack(Blocks.largeHexPlate, 2), - 600, 120); - } + 1200, + 32); + } + + /*private static void registerRecipes_SpaceElevator() { + // Controller + final Object[] se_recipe = { + "BCB", "CPC", "BCB", + 'B', new ItemStack(Blocks.spaceElevatorStructure, 1, 0), + 'C', OrePrefixes.cableGt16.get(Materials.Aluminium), + 'P', OrePrefixes.circuit.get(Materials.Master) + }; + GT_ModHandler.addCraftingRecipe(TileEntities.se.getStackForm(1), se_recipe); + // Blocks + final Object[] seBase_recipe = { + "DRD", "RCR", "DRD", + 'D', OrePrefixes.plate.get(Materials.DarkSteel), + 'R', OrePrefixes.stick.get(Materials.Steel), + 'C', OrePrefixes.block.get(Materials.Concrete), + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.spaceElevatorStructure, 1, 0), seBase_recipe); + final Object[] seCoilHolder_recipe = { + "DRD", "RCR", "DRD", + 'D', OrePrefixes.plate.get(Materials.DarkSteel), + 'R', OrePrefixes.ring.get(Materials.Steel), + 'C', OrePrefixes.cableGt01.get(Materials.Aluminium) + }; + GT_ModHandler.addCraftingRecipe(new ItemStack(Blocks.spaceElevatorStructure, 1, 1), seCoilHolder_recipe); + }*/ + + private static void registerRecipes_Cosmetics() { + // Hex Tiles + final ItemStack[] hexTiles = { + GT_Utility.getIntegratedCircuit(6), + GT_OreDictUnificator.get(OrePrefixes.stone, Materials.Concrete, 1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Steel, 1), + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.DarkSteel, 2) + }; + GT_Values.RA.addAssemblerRecipe( + hexTiles, + FluidRegistry.getFluidStack("molten.plastic", 36), + new ItemStack(Blocks.largeHexPlate, 2), + 600, + 120); + } } diff --git a/src/main/java/common/Researches.java b/src/main/java/common/Researches.java index 8982a4c583..51d9341ff3 100644 --- a/src/main/java/common/Researches.java +++ b/src/main/java/common/Researches.java @@ -17,7 +17,7 @@ public class Researches { // Blacklist these researches from being a requirement to unlock TTKami KekzCore.LOGGER.info("Blacklisting research " + THAUMIUMREINFORCEDJAR + " from /iskamiunlocked"); KamiResearchItem.Blacklist.add(ICHORJAR); - KekzCore.LOGGER.info("Blacklisting research" +ICHORJAR+ "from /iskamiunlocked"); + KekzCore.LOGGER.info("Blacklisting research" + ICHORJAR + "from /iskamiunlocked"); KamiResearchItem.Blacklist.add(ICHORJAR); } @@ -28,13 +28,19 @@ public class Researches { .add(Aspect.GREED, 3) .add(Aspect.VOID, 3); @SuppressWarnings("unused") - final ResearchItem jar_thaumiumreinforced = new ResearchItem("THAUMIUMREINFORCEDJAR", "ALCHEMY", aspects_jarthaumiumreinforced, 3, -4, 2, new ItemStack(Blocks.jarThaumiumReinforced, 1)) + final ResearchItem jar_thaumiumreinforced = new ResearchItem( + "THAUMIUMREINFORCEDJAR", + "ALCHEMY", + aspects_jarthaumiumreinforced, + 3, + -4, + 2, + new ItemStack(Blocks.jarThaumiumReinforced, 1)) .setPages( new ResearchPage("kekztech.research_page.THAUMIUMREINFORCEDJAR.0"), new ResearchPage(Recipes.infusionRecipes.get("THAUMIUMREINFORCEDJAR")), new ResearchPage(Recipes.infusionRecipes.get("THAUMIUMREINFORCEDVOIDJAR")), - new ResearchPage("kekztech.research_page.THAUMIUMREINFORCEDJAR.1") - ) + new ResearchPage("kekztech.research_page.THAUMIUMREINFORCEDJAR.1")) .setConcealed() .setParents("JARLABEL") .registerResearchItem(); @@ -46,12 +52,12 @@ public class Researches { .add(Aspect.GREED, 5) .add(Aspect.VOID, 5); @SuppressWarnings("unused") - final ResearchItem jar_ichor = new ResearchItem("ICHORJAR", "ALCHEMY", aspects_jarichor, 2, -5, 3, new ItemStack(Blocks.jarIchor, 1)) + final ResearchItem jar_ichor = new ResearchItem( + "ICHORJAR", "ALCHEMY", aspects_jarichor, 2, -5, 3, new ItemStack(Blocks.jarIchor, 1)) .setPages( new ResearchPage("kekztech.research_page.ICHORJAR.0"), new ResearchPage(Recipes.infusionRecipes.get("ICHORJAR")), - new ResearchPage(Recipes.infusionRecipes.get("ICHORVOIDJAR")) - ) + new ResearchPage(Recipes.infusionRecipes.get("ICHORVOIDJAR"))) .setConcealed() .setParents("THAUMIUMREINFORCEDJAR") .setParentsHidden("ICHOR") diff --git a/src/main/java/common/TileEntities.java b/src/main/java/common/TileEntities.java index 17f5f5d0ba..6253629ddb 100644 --- a/src/main/java/common/TileEntities.java +++ b/src/main/java/common/TileEntities.java @@ -8,7 +8,7 @@ public class TileEntities { // Multiblock controllers public static GTMTE_SOFuelCellMK1 sofc1; public static GTMTE_SOFuelCellMK2 sofc2; - //public static GTMTE_ModularNuclearReactor mdr; + // public static GTMTE_ModularNuclearReactor mdr; public static GTMTE_FluidMultiStorage fms; public static GTMTE_LapotronicSuperCapacitor lsc; public static GTMTE_SpaceElevator se; @@ -19,29 +19,28 @@ public class TileEntities { public static void preInit() { GameRegistry.registerTileEntity(TE_TFFTMultiHatch.class, "kekztech_tfftmultihatch_tile"); - //GameRegistry.registerTileEntity(TE_ItemProxyCable.class, "kekztech_itemproxycable_tile"); - //GameRegistry.registerTileEntity(TE_ItemProxySource.class, "kekztech_itemproxysource_tile"); - //GameRegistry.registerTileEntity(TE_ItemProxyEndpoint.class, "kekztech_itemproxyendpoint_tile"); + // GameRegistry.registerTileEntity(TE_ItemProxyCable.class, "kekztech_itemproxycable_tile"); + // GameRegistry.registerTileEntity(TE_ItemProxySource.class, "kekztech_itemproxysource_tile"); + // GameRegistry.registerTileEntity(TE_ItemProxyEndpoint.class, "kekztech_itemproxyendpoint_tile"); GameRegistry.registerTileEntity(TE_ThaumiumReinforcedJar.class, "kekztech_thaumiumreinforcedjar"); GameRegistry.registerTileEntity(TE_ThaumiumReinforcedVoidJar.class, "kekztech_thaumiumreinforcedvoidjar"); GameRegistry.registerTileEntity(TE_IchorJar.class, "kekztech_ichorjar"); GameRegistry.registerTileEntity(TE_IchorVoidJar.class, "kekztech_ichorvoidjar"); - //GameRegistry.registerTileEntity(TE_SpaceElevatorCapacitor.class, "kekztech_secapacitor"); - //GameRegistry.registerTileEntity(TE_BeamTransmitter.class, "kekztech_beamtransmitter"); + // GameRegistry.registerTileEntity(TE_SpaceElevatorCapacitor.class, "kekztech_secapacitor"); + // GameRegistry.registerTileEntity(TE_BeamTransmitter.class, "kekztech_beamtransmitter"); } - + public static void init() { // Multiblock controllers sofc1 = new GTMTE_SOFuelCellMK1(13101, "multimachine.fuelcellmk1", "Solid-Oxide Fuel Cell Mk I"); sofc2 = new GTMTE_SOFuelCellMK2(13102, "multimachine.fuelcellmk2", "Solid-Oxide Fuel Cell Mk II"); - //mdr = new GTMTE_ModularNuclearReactor(13103, "multimachine.nuclearreactor", "Nuclear Reactor"); + // mdr = new GTMTE_ModularNuclearReactor(13103, "multimachine.nuclearreactor", "Nuclear Reactor"); fms = new GTMTE_FluidMultiStorage(13104, "multimachine.tf_fluidtank", "T.F.F.T"); lsc = new GTMTE_LapotronicSuperCapacitor(13106, "multimachine.supercapacitor", "Lapotronic Supercapacitor"); - //se = new GTMTE_SpaceElevator(13107, "multimachine.spaceelevator", "Space Elevator"); + // se = new GTMTE_SpaceElevator(13107, "multimachine.spaceelevator", "Space Elevator"); // Singleblocks mhHV = new GTMTE_TFFTMultiHatch(13108, "machine.multihatch.0", "T.F.F.T Multi I/O Hatch [HV]", 3); mhIV = new GTMTE_TFFTMultiHatch(13109, "machine.multihatch.1", "T.F.F.T Multi I/O Hatch [IV]", 5); mhZPM = new GTMTE_TFFTMultiHatch(13110, "machine.multihatch.2", "T.F.F.T Multi I/O Hatch [ZPM]", 7); } - } diff --git a/src/main/java/common/blocks/BaseGTUpdateableBlock.java b/src/main/java/common/blocks/BaseGTUpdateableBlock.java index 6f554101ca..77ee67469f 100644 --- a/src/main/java/common/blocks/BaseGTUpdateableBlock.java +++ b/src/main/java/common/blocks/BaseGTUpdateableBlock.java @@ -1,6 +1,5 @@ package common.blocks; - import gregtech.api.GregTech_API; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -23,7 +22,7 @@ public abstract class BaseGTUpdateableBlock extends Block { } @Override - public int damageDropped(int meta){ + public int damageDropped(int meta) { return meta; } diff --git a/src/main/java/common/blocks/Block_BeamTransmitter.java b/src/main/java/common/blocks/Block_BeamTransmitter.java index af7a837fdd..be29bde3fd 100644 --- a/src/main/java/common/blocks/Block_BeamTransmitter.java +++ b/src/main/java/common/blocks/Block_BeamTransmitter.java @@ -1,7 +1,6 @@ package common.blocks; import common.tileentities.TE_BeamTransmitter; -import common.tileentities.TE_SpaceElevatorTether; import cpw.mods.fml.common.registry.GameRegistry; import kekztech.KekzCore; import net.minecraft.block.Block; @@ -41,15 +40,12 @@ public class Block_BeamTransmitter extends Block { } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - } diff --git a/src/main/java/common/blocks/Block_ControlRod.java b/src/main/java/common/blocks/Block_ControlRod.java index 808881dead..9849816a2a 100644 --- a/src/main/java/common/blocks/Block_ControlRod.java +++ b/src/main/java/common/blocks/Block_ControlRod.java @@ -7,22 +7,22 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class Block_ControlRod extends BaseGTUpdateableBlock { - - private static final Block_ControlRod instance = new Block_ControlRod(); - - private Block_ControlRod() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_controlrod_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "ControlRod"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, blockName); - - return instance; - } + + private static final Block_ControlRod instance = new Block_ControlRod(); + + private Block_ControlRod() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_controlrod_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "ControlRod"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } } diff --git a/src/main/java/common/blocks/Block_GDCUnit.java b/src/main/java/common/blocks/Block_GDCUnit.java index aab81e1aeb..c86a55f200 100644 --- a/src/main/java/common/blocks/Block_GDCUnit.java +++ b/src/main/java/common/blocks/Block_GDCUnit.java @@ -1,28 +1,28 @@ -package common.blocks;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_GDCUnit extends BaseGTUpdateableBlock {
-
- private static final Block_GDCUnit instance = new Block_GDCUnit();
-
- private Block_GDCUnit() {
- super(Material.iron);
- }
-
- public static Block registerBlock() {
- final String blockName = "kekztech_gdcceramicelectrolyteunit_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "GDCCeramicElectrolyteUnit");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_GDCUnit extends BaseGTUpdateableBlock { + + private static final Block_GDCUnit instance = new Block_GDCUnit(); + + private Block_GDCUnit() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_gdcceramicelectrolyteunit_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "GDCCeramicElectrolyteUnit"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_IchorJar.java b/src/main/java/common/blocks/Block_IchorJar.java index 0c2417b2f1..e7cf3c77eb 100644 --- a/src/main/java/common/blocks/Block_IchorJar.java +++ b/src/main/java/common/blocks/Block_IchorJar.java @@ -6,6 +6,9 @@ import common.tileentities.TE_IchorVoidJar; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -24,200 +27,204 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemEssence; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class Block_IchorJar extends BlockJar { - - private static final Block_IchorJar INSTANCE = new Block_IchorJar(); - - private Block_IchorJar() { - super(); - - super.setHardness(12.0F); - super.setResistance(3.0f); - } - - public static Block registerBlock() { - final String blockName = "kekztech_ichorjar_block"; - INSTANCE.setBlockName(blockName); - INSTANCE.setHarvestLevel("pickaxe", 3); - GameRegistry.registerBlock(INSTANCE, IB_IchorJar.class, blockName); - - return INSTANCE; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister ir) { - super.iconLiquid = ir.registerIcon("thaumcraft:animatedglow"); - super.iconJarSide = ir.registerIcon("kekztech:ichor_jar_side"); - super.iconJarTop = ir.registerIcon("kekztech:ichor_jar_top"); - super.iconJarTopVoid = ir.registerIcon("kekztech:ichor_jar_top_void"); - super.iconJarSideVoid = ir.registerIcon("kekztech:ichor_jar_side_void"); - super.iconJarBottom = ir.registerIcon("kekztech:ichor_jar_bottom"); - } - - @Override - @SideOnly(Side.CLIENT) - @SuppressWarnings({"unchecked"}) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - par3List.add(new ItemStack(par1, 1, 0)); // Normal jar - par3List.add(new ItemStack(par1, 1, 3)); // Void jar - } - - @Override - public TileEntity createTileEntity(World world, int meta) { - if(meta == 3) { - return new TE_IchorVoidJar(); - } else { - return new TE_IchorJar(); - } - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float f1, float f2, float f3) { - // Call parent method to handle jar emptying, labels stuff etc - super.onBlockActivated(world, x, y, z, player, side, f1, f2, f3); - // Interact with Essentia Phials if the player holds one - final ItemStack heldItem = player.getHeldItem(); - if(heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_IchorJar) { - return dealWithPhial(world, player, x, y, z); - } else if(te instanceof TE_IchorVoidJar) { - return dealWithPhial(world, player, x, y, z); - } - } - - return true; - } - - /** - * Handle compatibility with Essentia Phials - * @param world - * Pass through from onBlockActivated() - * @param player - * Pass through from onBlockActivated() - * @param x - * Pass through from onBlockActivated() - * @param y - * Pass through from onBlockActivated() - * @param z - * Pass through from onBlockActivated() - * @return Not sure tbh - */ - private boolean dealWithPhial(World world, EntityPlayer player, int x, int y, int z) { - final TileJarFillable jarTE = (TileJarFillable) world.getTileEntity(x, y, z); - final ItemStack heldItem = player.getHeldItem(); - // Check whether to fill or to drain the phial - if(heldItem.getItemDamage() == 0) { - if(jarTE.amount >= 8){ - if (world.isRemote) { - player.swingItem(); - return false; - } - - final Aspect jarAspect = Aspect.getAspect(jarTE.aspect.getTag()); - if(jarTE.takeFromContainer(jarAspect, 8)) { - // Take an empty phial from the player's inventory - heldItem.stackSize--; - // Fill a new phial - final ItemStack filledPhial = new ItemStack(ConfigItems.itemEssence, 1, 1); - final AspectList phialContent = new AspectList().add(jarAspect, 8); - ((ItemEssence) ConfigItems.itemEssence).setAspects(filledPhial, phialContent); - // Drop on ground if there's no inventory space - if (!player.inventory.addItemStackToInventory(filledPhial)) { - world.spawnEntityInWorld(new EntityItem(world, (float)x + 0.5F, (float)y + 0.5F, (float)z + 0.5F, filledPhial)); - } - - world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); - player.inventoryContainer.detectAndSendChanges(); - return true; - } - } - } else { - final AspectList phialContent = ((ItemEssence) ConfigItems.itemEssence).getAspects(heldItem); - if(phialContent != null && phialContent.size() == 1) { - final Aspect phialAspect = phialContent.getAspects()[0]; - if(jarTE.amount + 8 <= jarTE.maxAmount && jarTE.doesContainerAccept(phialAspect)) { - if (world.isRemote) { - player.swingItem(); - return false; - } - - if(jarTE.addToContainer(phialAspect, 8) == 0) { - world.markBlockForUpdate(x, y, z); - jarTE.markDirty(); - heldItem.stackSize--; - // Drop on ground if there's no inventory space - if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) { - world.spawnEntityInWorld(new EntityItem(world, (float)x + 0.5F, (float)y + 0.5F, (float)z + 0.5F, new ItemStack(ConfigItems.itemEssence, 1, 0))); - } - - world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); - player.inventoryContainer.detectAndSendChanges(); - return true; - } - } - } - } - - return true; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_IchorJar) { - final TE_IchorJar ite = (TE_IchorJar) te; - breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); - } else if(te instanceof TE_IchorVoidJar) { - final TE_IchorVoidJar ite = (TE_IchorVoidJar) te; - breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); - } - super.breakBlock(world, x, y, z, par5, par6); - } - - private void breakBlockWarpy(World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength){ - if(fillAmount > 0) { - // Create a decent explosion in the center of the block (TNT has strength 4.0F) - world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); - - // Place a lot of Flux in the area - final int limit = fillAmount / 16; - int created = 0; - for(int i = 0; i < iterations; i++) { - final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - if(world.isAirBlock(xf, yf, zf)) { - if(yf > y) { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); - } else { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); - } - - if(created++ > limit) { - break; - } - } - } - } - } - - @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) { - return new ArrayList<>(Collections.singleton(new ItemStack(this, 1, (meta == 3) ? 3 : 0))); - } - - @Override - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { - } - - @Override - public boolean canDropFromExplosion(Explosion e) { - return false; - } + + private static final Block_IchorJar INSTANCE = new Block_IchorJar(); + + private Block_IchorJar() { + super(); + + super.setHardness(12.0F); + super.setResistance(3.0f); + } + + public static Block registerBlock() { + final String blockName = "kekztech_ichorjar_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setHarvestLevel("pickaxe", 3); + GameRegistry.registerBlock(INSTANCE, IB_IchorJar.class, blockName); + + return INSTANCE; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister ir) { + super.iconLiquid = ir.registerIcon("thaumcraft:animatedglow"); + super.iconJarSide = ir.registerIcon("kekztech:ichor_jar_side"); + super.iconJarTop = ir.registerIcon("kekztech:ichor_jar_top"); + super.iconJarTopVoid = ir.registerIcon("kekztech:ichor_jar_top_void"); + super.iconJarSideVoid = ir.registerIcon("kekztech:ichor_jar_side_void"); + super.iconJarBottom = ir.registerIcon("kekztech:ichor_jar_bottom"); + } + + @Override + @SideOnly(Side.CLIENT) + @SuppressWarnings({"unchecked"}) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + par3List.add(new ItemStack(par1, 1, 0)); // Normal jar + par3List.add(new ItemStack(par1, 1, 3)); // Void jar + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 3) { + return new TE_IchorVoidJar(); + } else { + return new TE_IchorJar(); + } + } + + @Override + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float f1, float f2, float f3) { + // Call parent method to handle jar emptying, labels stuff etc + super.onBlockActivated(world, x, y, z, player, side, f1, f2, f3); + // Interact with Essentia Phials if the player holds one + final ItemStack heldItem = player.getHeldItem(); + if (heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_IchorJar) { + return dealWithPhial(world, player, x, y, z); + } else if (te instanceof TE_IchorVoidJar) { + return dealWithPhial(world, player, x, y, z); + } + } + + return true; + } + + /** + * Handle compatibility with Essentia Phials + * @param world + * Pass through from onBlockActivated() + * @param player + * Pass through from onBlockActivated() + * @param x + * Pass through from onBlockActivated() + * @param y + * Pass through from onBlockActivated() + * @param z + * Pass through from onBlockActivated() + * @return Not sure tbh + */ + private boolean dealWithPhial(World world, EntityPlayer player, int x, int y, int z) { + final TileJarFillable jarTE = (TileJarFillable) world.getTileEntity(x, y, z); + final ItemStack heldItem = player.getHeldItem(); + // Check whether to fill or to drain the phial + if (heldItem.getItemDamage() == 0) { + if (jarTE.amount >= 8) { + if (world.isRemote) { + player.swingItem(); + return false; + } + + final Aspect jarAspect = Aspect.getAspect(jarTE.aspect.getTag()); + if (jarTE.takeFromContainer(jarAspect, 8)) { + // Take an empty phial from the player's inventory + heldItem.stackSize--; + // Fill a new phial + final ItemStack filledPhial = new ItemStack(ConfigItems.itemEssence, 1, 1); + final AspectList phialContent = new AspectList().add(jarAspect, 8); + ((ItemEssence) ConfigItems.itemEssence).setAspects(filledPhial, phialContent); + // Drop on ground if there's no inventory space + if (!player.inventory.addItemStackToInventory(filledPhial)) { + world.spawnEntityInWorld(new EntityItem( + world, (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, filledPhial)); + } + + world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); + player.inventoryContainer.detectAndSendChanges(); + return true; + } + } + } else { + final AspectList phialContent = ((ItemEssence) ConfigItems.itemEssence).getAspects(heldItem); + if (phialContent != null && phialContent.size() == 1) { + final Aspect phialAspect = phialContent.getAspects()[0]; + if (jarTE.amount + 8 <= jarTE.maxAmount && jarTE.doesContainerAccept(phialAspect)) { + if (world.isRemote) { + player.swingItem(); + return false; + } + + if (jarTE.addToContainer(phialAspect, 8) == 0) { + world.markBlockForUpdate(x, y, z); + jarTE.markDirty(); + heldItem.stackSize--; + // Drop on ground if there's no inventory space + if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) { + world.spawnEntityInWorld(new EntityItem( + world, + (float) x + 0.5F, + (float) y + 0.5F, + (float) z + 0.5F, + new ItemStack(ConfigItems.itemEssence, 1, 0))); + } + + world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); + player.inventoryContainer.detectAndSendChanges(); + return true; + } + } + } + } + + return true; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_IchorJar) { + final TE_IchorJar ite = (TE_IchorJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); + } else if (te instanceof TE_IchorVoidJar) { + final TE_IchorVoidJar ite = (TE_IchorVoidJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); + } + super.breakBlock(world, x, y, z, par5, par6); + } + + private void breakBlockWarpy( + World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength) { + if (fillAmount > 0) { + // Create a decent explosion in the center of the block (TNT has strength 4.0F) + world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); + + // Place a lot of Flux in the area + final int limit = fillAmount / 16; + int created = 0; + for (int i = 0; i < iterations; i++) { + final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + if (world.isAirBlock(xf, yf, zf)) { + if (yf > y) { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); + } else { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); + } + + if (created++ > limit) { + break; + } + } + } + } + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) { + return new ArrayList<>(Collections.singleton(new ItemStack(this, 1, (meta == 3) ? 3 : 0))); + } + + @Override + public void onBlockHarvested( + World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {} + + @Override + public boolean canDropFromExplosion(Explosion e) { + return false; + } } diff --git a/src/main/java/common/blocks/Block_ItemProxyCable.java b/src/main/java/common/blocks/Block_ItemProxyCable.java index ce2f1e9820..57b5fc6138 100644 --- a/src/main/java/common/blocks/Block_ItemProxyCable.java +++ b/src/main/java/common/blocks/Block_ItemProxyCable.java @@ -1,5 +1,6 @@ package common.blocks; +import client.renderer.ConduitRenderer; import common.itemBlocks.IB_ItemProxyCable; import common.tileentities.TE_ItemProxyCable; import cpw.mods.fml.common.registry.GameRegistry; @@ -11,56 +12,55 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import client.renderer.ConduitRenderer; public class Block_ItemProxyCable extends Block { - - private static Block_ItemProxyCable instance = new Block_ItemProxyCable(); - - private Block_ItemProxyCable() { - super(Material.glass); - } - - public static Block registerBlock() { - final String blockName = "kekztech_itemproxycable_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing"); - instance.setHardness(3.0f); - instance.setResistance(2.0f); - GameRegistry.registerBlock(instance, IB_ItemProxyCable.class, blockName); - - return instance; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createTileEntity(World world, int p_149915_2_) { - return new TE_ItemProxyCable(); - } - @Override - public boolean hasTileEntity(int metadata) { - return true; - } + private static Block_ItemProxyCable instance = new Block_ItemProxyCable(); + + private Block_ItemProxyCable() { + super(Material.glass); + } + + public static Block registerBlock() { + final String blockName = "kekztech_itemproxycable_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing"); + instance.setHardness(3.0f); + instance.setResistance(2.0f); + GameRegistry.registerBlock(instance, IB_ItemProxyCable.class, blockName); + + return instance; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public TileEntity createTileEntity(World world, int p_149915_2_) { + return new TE_ItemProxyCable(); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - return 1; - } + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } - @Override - public int getRenderType() { - return ConduitRenderer.RID; - } + @Override + public int getRenderType() { + return ConduitRenderer.RID; + } - @Override - public boolean renderAsNormalBlock() { - return false; - } + @Override + public boolean renderAsNormalBlock() { + return false; + } } diff --git a/src/main/java/common/blocks/Block_ItemProxyEndpoint.java b/src/main/java/common/blocks/Block_ItemProxyEndpoint.java index 00e0426250..7c7712988d 100644 --- a/src/main/java/common/blocks/Block_ItemProxyEndpoint.java +++ b/src/main/java/common/blocks/Block_ItemProxyEndpoint.java @@ -13,49 +13,49 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class Block_ItemProxyEndpoint extends Block { - - private static final Block_ItemProxyEndpoint instance = new Block_ItemProxyEndpoint(); - - private Block_ItemProxyEndpoint() { - super(Material.glass); - } - - public static Block registerBlock() { - final String blockName = "kekztech_itemproxyendpoint_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxyEndpoint"); - instance.setHardness(3.0f); - instance.setResistance(2.0f); - instance.setHarvestLevel("wrench", 2); - GameRegistry.registerBlock(instance, IB_ItemProxyEndpoint.class, blockName); - - return instance; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { - if(world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ItemProxyEndpoint) { - player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_ENDPOINT, world, x, y, z); - return true; - } else { - return false; - } - } - - @Override - public TileEntity createTileEntity(World world, int p_149915_2_) { - return new TE_ItemProxyEndpoint(); - } - - @Override - public boolean hasTileEntity(int metadata) { - return true; - } - -}
\ No newline at end of file + + private static final Block_ItemProxyEndpoint instance = new Block_ItemProxyEndpoint(); + + private Block_ItemProxyEndpoint() { + super(Material.glass); + } + + public static Block registerBlock() { + final String blockName = "kekztech_itemproxyendpoint_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxyEndpoint"); + instance.setHardness(3.0f); + instance.setResistance(2.0f); + instance.setHarvestLevel("wrench", 2); + GameRegistry.registerBlock(instance, IB_ItemProxyEndpoint.class, blockName); + + return instance; + } + + @Override + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { + if (world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ItemProxyEndpoint) { + player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_ENDPOINT, world, x, y, z); + return true; + } else { + return false; + } + } + + @Override + public TileEntity createTileEntity(World world, int p_149915_2_) { + return new TE_ItemProxyEndpoint(); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } +} diff --git a/src/main/java/common/blocks/Block_ItemProxySource.java b/src/main/java/common/blocks/Block_ItemProxySource.java index 7291c15e6f..cb3c95bec0 100644 --- a/src/main/java/common/blocks/Block_ItemProxySource.java +++ b/src/main/java/common/blocks/Block_ItemProxySource.java @@ -13,49 +13,49 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class Block_ItemProxySource extends Block { - - private static final Block_ItemProxySource instance = new Block_ItemProxySource(); - - private Block_ItemProxySource() { - super(Material.glass); - } - - public static Block registerBlock() { - final String blockName = "kekztech_itemproxysource_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxySource"); - instance.setHardness(3.0f); - instance.setResistance(2.0f); - instance.setHarvestLevel("wrench", 2); - GameRegistry.registerBlock(instance, IB_ItemProxySource.class, blockName); - - return instance; - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { - if(world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ItemProxySource) { - player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_SOURCE, world, x, y, z); - return true; - } else { - return false; - } - } - - @Override - public TileEntity createTileEntity(World world, int p_149915_2_) { - return new TE_ItemProxySource(); - } - - @Override - public boolean hasTileEntity(int metadata) { - return true; - } + private static final Block_ItemProxySource instance = new Block_ItemProxySource(); + + private Block_ItemProxySource() { + super(Material.glass); + } + + public static Block registerBlock() { + final String blockName = "kekztech_itemproxysource_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "ItemProxySource"); + instance.setHardness(3.0f); + instance.setResistance(2.0f); + instance.setHarvestLevel("wrench", 2); + GameRegistry.registerBlock(instance, IB_ItemProxySource.class, blockName); + + return instance; + } + + @Override + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) { + if (world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ItemProxySource) { + player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_SOURCE, world, x, y, z); + return true; + } else { + return false; + } + } + + @Override + public TileEntity createTileEntity(World world, int p_149915_2_) { + return new TE_ItemProxySource(); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } } diff --git a/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java b/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java index db55c17610..b9c930d545 100644 --- a/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java +++ b/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java @@ -1,13 +1,12 @@ package common.blocks; -import java.util.List; - import common.itemBlocks.IB_LapotronicEnergyUnit; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,7 +19,8 @@ import net.minecraft.util.ResourceLocation; public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { - private static final Block_LapotronicEnergyUnit INSTANCE = new Block_LapotronicEnergyUnit(); + private static final Block_LapotronicEnergyUnit INSTANCE = new Block_LapotronicEnergyUnit(); + public enum IconBaseSide implements IIconContainer { INSTANCE; @@ -47,92 +47,99 @@ public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { Textures.BlockIcons.setCasingTexture((byte) 42, (byte) 127, TextureFactory.of(IconBaseSide.INSTANCE)); } - private IIcon iconBaseSide; - private IIcon iconBaseTop; - - private IIcon iconLapoEmptySide; - private IIcon iconLapoEmptyTop; - private IIcon iconLapoEVSide; - private IIcon iconLapoEVTop; - private IIcon iconLapoIVSide; - private IIcon iconLapoIVTop; - private IIcon iconLapoLuVSide; - private IIcon iconLapoLuVTop; - private IIcon iconLapoZPMSide; - private IIcon iconLapoZPMTop; - private IIcon iconLapoUVSide; - private IIcon iconLapoUVTop; - private IIcon iconUltimateSide; - private IIcon iconUltimateTop; - - private Block_LapotronicEnergyUnit() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_lapotronicenergyunit_block"; - INSTANCE.setBlockName(blockName); - INSTANCE.setCreativeTab(CreativeTabs.tabMisc); - INSTANCE.setHardness(5.0f); - INSTANCE.setResistance(6.0f); - GameRegistry.registerBlock(INSTANCE, IB_LapotronicEnergyUnit.class, blockName); - - return INSTANCE; - } - - @Override - public void registerBlockIcons(IIconRegister ir) { - iconBaseSide = ir.registerIcon("kekztech:LSCBase_side"); - iconBaseTop = ir.registerIcon("kekztech:LSCBase_top"); - - - iconLapoEmptySide = ir.registerIcon("kekztech:LapotronicEnergyUnit6_side"); - iconLapoEmptyTop = ir.registerIcon("kekztech:LapotronicEnergyUnit6_top"); - iconLapoEVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit7_side"); - iconLapoEVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit7_top"); - iconLapoIVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit1_side"); - iconLapoIVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit1_top"); - iconLapoLuVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit2_side"); - iconLapoLuVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit2_top"); - iconLapoZPMSide = ir.registerIcon("kekztech:LapotronicEnergyUnit3_side"); - iconLapoZPMTop = ir.registerIcon("kekztech:LapotronicEnergyUnit3_top"); - iconLapoUVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit4_side"); - iconLapoUVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit4_top"); - - iconUltimateSide = ir.registerIcon("kekztech:UltimateEnergyUnit_side"); - iconUltimateTop = ir.registerIcon("kekztech:UltimateEnergyUnit_top"); - } - - @Override - @SuppressWarnings({"unchecked" }) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - // Multi casing - par3List.add(new ItemStack(par1, 1, 0)); - // Empty capacitor - par3List.add(new ItemStack(par1, 1, 6)); - // Lapo capacitors EV - UV - par3List.add(new ItemStack(par1, 1, 7)); - par3List.add(new ItemStack(par1, 1, 1)); - par3List.add(new ItemStack(par1, 1, 2)); - par3List.add(new ItemStack(par1, 1, 3)); - par3List.add(new ItemStack(par1, 1, 4)); - // Ultimate battery - par3List.add(new ItemStack(par1, 1, 5)); - } - - @Override - public IIcon getIcon(int side, int meta) { - switch(meta) { - case 0: return (side < 2) ? iconBaseTop : iconBaseSide; - case 1: return (side < 2) ? iconLapoIVTop : iconLapoIVSide; - case 2: return (side < 2) ? iconLapoLuVTop : iconLapoLuVSide; - case 3: return (side < 2) ? iconLapoZPMTop : iconLapoZPMSide; - case 4: return (side < 2) ? iconLapoUVTop : iconLapoUVSide; - case 5: return (side < 2) ? iconUltimateTop : iconUltimateSide; - case 6: return (side < 2) ? iconLapoEmptyTop : iconLapoEmptySide; - case 7: return (side < 2) ? iconLapoEVTop : iconLapoEVSide; - default: return iconUltimateTop; - } - } + private IIcon iconBaseSide; + private IIcon iconBaseTop; + + private IIcon iconLapoEmptySide; + private IIcon iconLapoEmptyTop; + private IIcon iconLapoEVSide; + private IIcon iconLapoEVTop; + private IIcon iconLapoIVSide; + private IIcon iconLapoIVTop; + private IIcon iconLapoLuVSide; + private IIcon iconLapoLuVTop; + private IIcon iconLapoZPMSide; + private IIcon iconLapoZPMTop; + private IIcon iconLapoUVSide; + private IIcon iconLapoUVTop; + private IIcon iconUltimateSide; + private IIcon iconUltimateTop; + + private Block_LapotronicEnergyUnit() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_lapotronicenergyunit_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setCreativeTab(CreativeTabs.tabMisc); + INSTANCE.setHardness(5.0f); + INSTANCE.setResistance(6.0f); + GameRegistry.registerBlock(INSTANCE, IB_LapotronicEnergyUnit.class, blockName); + + return INSTANCE; + } + + @Override + public void registerBlockIcons(IIconRegister ir) { + iconBaseSide = ir.registerIcon("kekztech:LSCBase_side"); + iconBaseTop = ir.registerIcon("kekztech:LSCBase_top"); + + iconLapoEmptySide = ir.registerIcon("kekztech:LapotronicEnergyUnit6_side"); + iconLapoEmptyTop = ir.registerIcon("kekztech:LapotronicEnergyUnit6_top"); + iconLapoEVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit7_side"); + iconLapoEVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit7_top"); + iconLapoIVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit1_side"); + iconLapoIVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit1_top"); + iconLapoLuVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit2_side"); + iconLapoLuVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit2_top"); + iconLapoZPMSide = ir.registerIcon("kekztech:LapotronicEnergyUnit3_side"); + iconLapoZPMTop = ir.registerIcon("kekztech:LapotronicEnergyUnit3_top"); + iconLapoUVSide = ir.registerIcon("kekztech:LapotronicEnergyUnit4_side"); + iconLapoUVTop = ir.registerIcon("kekztech:LapotronicEnergyUnit4_top"); + + iconUltimateSide = ir.registerIcon("kekztech:UltimateEnergyUnit_side"); + iconUltimateTop = ir.registerIcon("kekztech:UltimateEnergyUnit_top"); + } + @Override + @SuppressWarnings({"unchecked"}) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + // Multi casing + par3List.add(new ItemStack(par1, 1, 0)); + // Empty capacitor + par3List.add(new ItemStack(par1, 1, 6)); + // Lapo capacitors EV - UV + par3List.add(new ItemStack(par1, 1, 7)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + // Ultimate battery + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public IIcon getIcon(int side, int meta) { + switch (meta) { + case 0: + return (side < 2) ? iconBaseTop : iconBaseSide; + case 1: + return (side < 2) ? iconLapoIVTop : iconLapoIVSide; + case 2: + return (side < 2) ? iconLapoLuVTop : iconLapoLuVSide; + case 3: + return (side < 2) ? iconLapoZPMTop : iconLapoZPMSide; + case 4: + return (side < 2) ? iconLapoUVTop : iconLapoUVSide; + case 5: + return (side < 2) ? iconUltimateTop : iconUltimateSide; + case 6: + return (side < 2) ? iconLapoEmptyTop : iconLapoEmptySide; + case 7: + return (side < 2) ? iconLapoEVTop : iconLapoEVSide; + default: + return iconUltimateTop; + } + } } diff --git a/src/main/java/common/blocks/Block_LargeHexPlate.java b/src/main/java/common/blocks/Block_LargeHexPlate.java index 8bdad56323..ab1ebc138e 100644 --- a/src/main/java/common/blocks/Block_LargeHexPlate.java +++ b/src/main/java/common/blocks/Block_LargeHexPlate.java @@ -32,8 +32,8 @@ public class Block_LargeHexPlate extends Block { @Override public void registerBlockIcons(IIconRegister ir) { - for(int x = 0; x < BATCH_SIZE; x++) { - for(int z = 0; z < BATCH_SIZE; z++) { + for (int x = 0; x < BATCH_SIZE; x++) { + for (int z = 0; z < BATCH_SIZE; z++) { parts[x][z] = ir.registerIcon("kekztech:LargeHexTile_" + x + "_" + z); } } @@ -41,13 +41,16 @@ public class Block_LargeHexPlate extends Block { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - final int xMod = x >= 0 ? Math.abs(x % BATCH_SIZE) : Math.abs((Math.abs(x) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; - final int yMod = y >= 0 ? Math.abs(y % BATCH_SIZE) : Math.abs((Math.abs(y) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; - final int zMod = z >= 0 ? Math.abs(z % BATCH_SIZE) : Math.abs((Math.abs(z) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; + final int xMod = + x >= 0 ? Math.abs(x % BATCH_SIZE) : Math.abs((Math.abs(x) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; + final int yMod = + y >= 0 ? Math.abs(y % BATCH_SIZE) : Math.abs((Math.abs(y) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; + final int zMod = + z >= 0 ? Math.abs(z % BATCH_SIZE) : Math.abs((Math.abs(z) % BATCH_SIZE) - BATCH_SIZE) % BATCH_SIZE; - if(side == 0 || side == 1) { + if (side == 0 || side == 1) { return parts[xMod][zMod]; - } else if(side == 2 || side == 3) { + } else if (side == 2 || side == 3) { return parts[xMod][yMod]; } else { return parts[zMod][yMod]; diff --git a/src/main/java/common/blocks/Block_ReactorChamber_OFF.java b/src/main/java/common/blocks/Block_ReactorChamber_OFF.java index e6a5b3c3b3..6f70534a4a 100644 --- a/src/main/java/common/blocks/Block_ReactorChamber_OFF.java +++ b/src/main/java/common/blocks/Block_ReactorChamber_OFF.java @@ -7,23 +7,22 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class Block_ReactorChamber_OFF extends BaseGTUpdateableBlock { - - private static Block_ReactorChamber_OFF instance = new Block_ReactorChamber_OFF(); - - private Block_ReactorChamber_OFF() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_reactorchamberoff_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "ReactorChamber_OFF"); - instance.setHardness(10.0f); - instance.setResistance(16.0f); - GameRegistry.registerBlock(instance, blockName); - - return instance; - } - + + private static Block_ReactorChamber_OFF instance = new Block_ReactorChamber_OFF(); + + private Block_ReactorChamber_OFF() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_reactorchamberoff_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "ReactorChamber_OFF"); + instance.setHardness(10.0f); + instance.setResistance(16.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } } diff --git a/src/main/java/common/blocks/Block_ReactorChamber_ON.java b/src/main/java/common/blocks/Block_ReactorChamber_ON.java index 0c7e230a11..66a3452bea 100644 --- a/src/main/java/common/blocks/Block_ReactorChamber_ON.java +++ b/src/main/java/common/blocks/Block_ReactorChamber_ON.java @@ -7,28 +7,27 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class Block_ReactorChamber_ON extends BaseGTUpdateableBlock { - - private static Block_ReactorChamber_ON instance = new Block_ReactorChamber_ON(); - - private Block_ReactorChamber_ON() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_reactorchamberon_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "ReactorChamber_ON"); - instance.setHardness(-1.0f); - instance.setResistance(16.0f); - GameRegistry.registerBlock(instance, blockName); - - return instance; - } - - @Override - public int getLightValue() { - return 15; - } + private static Block_ReactorChamber_ON instance = new Block_ReactorChamber_ON(); + + private Block_ReactorChamber_ON() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_reactorchamberon_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "ReactorChamber_ON"); + instance.setHardness(-1.0f); + instance.setResistance(16.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } + + @Override + public int getLightValue() { + return 15; + } } diff --git a/src/main/java/common/blocks/Block_SpaceElevator.java b/src/main/java/common/blocks/Block_SpaceElevator.java index 524f34ba46..0e9cec70d7 100644 --- a/src/main/java/common/blocks/Block_SpaceElevator.java +++ b/src/main/java/common/blocks/Block_SpaceElevator.java @@ -2,7 +2,7 @@ package common.blocks; import common.itemBlocks.IB_SpaceElevator; import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -11,8 +11,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - public class Block_SpaceElevator extends BaseGTUpdateableBlock { private static final Block_SpaceElevator INSTANCE = new Block_SpaceElevator(); @@ -44,7 +42,7 @@ public class Block_SpaceElevator extends BaseGTUpdateableBlock { } @Override - @SuppressWarnings({"unchecked" }) + @SuppressWarnings({"unchecked"}) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); @@ -52,7 +50,7 @@ public class Block_SpaceElevator extends BaseGTUpdateableBlock { @Override public IIcon getIcon(int side, int meta) { - if(meta == 0) { + if (meta == 0) { return (side < 2) ? baseTop : baseSide; } else { return coilHolder; diff --git a/src/main/java/common/blocks/Block_SpaceElevatorTether.java b/src/main/java/common/blocks/Block_SpaceElevatorTether.java index 3031cd8a12..67a4061d62 100644 --- a/src/main/java/common/blocks/Block_SpaceElevatorTether.java +++ b/src/main/java/common/blocks/Block_SpaceElevatorTether.java @@ -1,9 +1,7 @@ package common.blocks; -import common.tileentities.TE_ItemProxyCable; import common.tileentities.TE_SpaceElevatorTether; import cpw.mods.fml.common.registry.GameRegistry; -import kekztech.KekzCore; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -56,15 +54,12 @@ public class Block_SpaceElevatorTether extends BaseGTUpdateableBlock { } @Override - public boolean isOpaqueCube() - { + public boolean isOpaqueCube() { return false; } @Override - public boolean renderAsNormalBlock() - { + public boolean renderAsNormalBlock() { return false; } - } diff --git a/src/main/java/common/blocks/Block_TFFTCasing.java b/src/main/java/common/blocks/Block_TFFTCasing.java index 5815a75862..b6d793e7ec 100644 --- a/src/main/java/common/blocks/Block_TFFTCasing.java +++ b/src/main/java/common/blocks/Block_TFFTCasing.java @@ -1,28 +1,28 @@ -package common.blocks;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_TFFTCasing extends BaseGTUpdateableBlock {
-
- private static Block_TFFTCasing instance = new Block_TFFTCasing();
-
- private Block_TFFTCasing() {
- super(Material.iron);
- }
-
- public static Block registerBlock() {
- final String blockName = "kekztech_tfftcasingblock_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_TFFTCasing extends BaseGTUpdateableBlock { + + private static Block_TFFTCasing instance = new Block_TFFTCasing(); + + private Block_TFFTCasing() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_tfftcasingblock_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTCasing"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTMultiHatch.java b/src/main/java/common/blocks/Block_TFFTMultiHatch.java index 564113efe5..14d288b7bb 100644 --- a/src/main/java/common/blocks/Block_TFFTMultiHatch.java +++ b/src/main/java/common/blocks/Block_TFFTMultiHatch.java @@ -3,63 +3,53 @@ package common.blocks; import common.itemBlocks.IB_TFFTMultiHatch; import common.tileentities.TE_TFFTMultiHatch; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - @Deprecated public class Block_TFFTMultiHatch extends BaseGTUpdateableBlock { - - private static final Block_TFFTMultiHatch INSTANCE = new Block_TFFTMultiHatch(); - private IIcon casing; + private static final Block_TFFTMultiHatch INSTANCE = new Block_TFFTMultiHatch(); + + private IIcon casing; - private Block_TFFTMultiHatch() { - super(Material.iron); - } - - public static Block registerBlock() { - final String blockName = "kekztech_tfftmultihatch_block"; - INSTANCE.setBlockName(blockName); - INSTANCE.setCreativeTab(CreativeTabs.tabMisc); - INSTANCE.setHardness(5.0f); - INSTANCE.setResistance(6.0f); - GameRegistry.registerBlock(INSTANCE, IB_TFFTMultiHatch.class, blockName); + private Block_TFFTMultiHatch() { + super(Material.iron); + } - return INSTANCE; - } + public static Block registerBlock() { + final String blockName = "kekztech_tfftmultihatch_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setCreativeTab(CreativeTabs.tabMisc); + INSTANCE.setHardness(5.0f); + INSTANCE.setResistance(6.0f); + GameRegistry.registerBlock(INSTANCE, IB_TFFTMultiHatch.class, blockName); - @Override - public void registerBlockIcons(IIconRegister ir) { - casing = ir.registerIcon("kekztech:TFFTCasing"); - } + return INSTANCE; + } - @Override - public IIcon getIcon(int side, int meta) { - return casing; - } + @Override + public void registerBlockIcons(IIconRegister ir) { + casing = ir.registerIcon("kekztech:TFFTCasing"); + } - @Override - public TileEntity createTileEntity(World world, int meta) { - return new TE_TFFTMultiHatch(); - } + @Override + public IIcon getIcon(int side, int meta) { + return casing; + } - @Override - public boolean hasTileEntity(int meta) { - return true; - } + @Override + public TileEntity createTileEntity(World world, int meta) { + return new TE_TFFTMultiHatch(); + } + @Override + public boolean hasTileEntity(int meta) { + return true; + } } diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java index f7554c4724..e6e3649f3a 100644 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java +++ b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT1.java @@ -1,38 +1,37 @@ -package common.blocks;
-
-import common.itemBlocks.IB_TFFTStorageFieldBlockT1;
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_TFFTStorageFieldBlockT1 extends BaseGTUpdateableBlock {
-
- private static Block_TFFTStorageFieldBlockT1 instance;
-
- private Block_TFFTStorageFieldBlockT1() {
- super(Material.iron);
- }
-
- public static int getCapacity() {
- return 500000;
- }
-
- public static Block registerBlock() {
- if(instance == null) {
- instance = new Block_TFFTStorageFieldBlockT1();
- }
-
- final String blockName = "kekztech_tfftstoragefieldblock1_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock1");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT1.class, blockName);
-
- return instance;
- }
-
-}
+package common.blocks; + +import common.itemBlocks.IB_TFFTStorageFieldBlockT1; +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_TFFTStorageFieldBlockT1 extends BaseGTUpdateableBlock { + + private static Block_TFFTStorageFieldBlockT1 instance; + + private Block_TFFTStorageFieldBlockT1() { + super(Material.iron); + } + + public static int getCapacity() { + return 500000; + } + + public static Block registerBlock() { + if (instance == null) { + instance = new Block_TFFTStorageFieldBlockT1(); + } + + final String blockName = "kekztech_tfftstoragefieldblock1_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock1"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT1.class, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java index 394fbcf90f..2b3477f750 100644 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java +++ b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT2.java @@ -1,37 +1,37 @@ -package common.blocks;
-
-import common.itemBlocks.IB_TFFTStorageFieldBlockT2;
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_TFFTStorageFieldBlockT2 extends BaseGTUpdateableBlock {
-
- private static Block_TFFTStorageFieldBlockT2 instance;
-
- private Block_TFFTStorageFieldBlockT2() {
- super(Material.iron);
- }
-
- public static int getCapacity() {
- return 4000000;
- }
-
- public static Block registerBlock() {
- if(instance == null) {
- instance = new Block_TFFTStorageFieldBlockT2();
- }
-
- final String blockName = "kekztech_tfftstoragefieldblock2_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock2");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT2.class, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import common.itemBlocks.IB_TFFTStorageFieldBlockT2; +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_TFFTStorageFieldBlockT2 extends BaseGTUpdateableBlock { + + private static Block_TFFTStorageFieldBlockT2 instance; + + private Block_TFFTStorageFieldBlockT2() { + super(Material.iron); + } + + public static int getCapacity() { + return 4000000; + } + + public static Block registerBlock() { + if (instance == null) { + instance = new Block_TFFTStorageFieldBlockT2(); + } + + final String blockName = "kekztech_tfftstoragefieldblock2_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock2"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT2.class, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java index 0b2123ae87..313b87d10f 100644 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java +++ b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT3.java @@ -1,37 +1,37 @@ -package common.blocks;
-
-import common.itemBlocks.IB_TFFTStorageFieldBlockT3;
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_TFFTStorageFieldBlockT3 extends BaseGTUpdateableBlock {
-
- private static Block_TFFTStorageFieldBlockT3 instance;
-
- private Block_TFFTStorageFieldBlockT3() {
- super(Material.iron);
- }
-
- public static int getCapacity() {
- return 16000000;
- }
-
- public static Block registerBlock() {
- if(instance == null) {
- instance = new Block_TFFTStorageFieldBlockT3();
- }
-
- final String blockName = "kekztech_tfftstoragefieldblock3_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock3");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT3.class, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import common.itemBlocks.IB_TFFTStorageFieldBlockT3; +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_TFFTStorageFieldBlockT3 extends BaseGTUpdateableBlock { + + private static Block_TFFTStorageFieldBlockT3 instance; + + private Block_TFFTStorageFieldBlockT3() { + super(Material.iron); + } + + public static int getCapacity() { + return 16000000; + } + + public static Block registerBlock() { + if (instance == null) { + instance = new Block_TFFTStorageFieldBlockT3(); + } + + final String blockName = "kekztech_tfftstoragefieldblock3_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock3"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT3.class, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java index 138c66ac0c..bdd0af8d2b 100644 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java +++ b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT4.java @@ -1,37 +1,37 @@ -package common.blocks;
-
-import common.itemBlocks.IB_TFFTStorageFieldBlockT4;
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_TFFTStorageFieldBlockT4 extends BaseGTUpdateableBlock {
-
- private static Block_TFFTStorageFieldBlockT4 instance;
-
- private Block_TFFTStorageFieldBlockT4() {
- super(Material.iron);
- }
-
- public static int getCapacity() {
- return 64000000;
- }
-
- public static Block registerBlock() {
- if(instance == null) {
- instance = new Block_TFFTStorageFieldBlockT4();
- }
-
- final String blockName = "kekztech_tfftstoragefieldblock4_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock4");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT4.class, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import common.itemBlocks.IB_TFFTStorageFieldBlockT4; +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_TFFTStorageFieldBlockT4 extends BaseGTUpdateableBlock { + + private static Block_TFFTStorageFieldBlockT4 instance; + + private Block_TFFTStorageFieldBlockT4() { + super(Material.iron); + } + + public static int getCapacity() { + return 64000000; + } + + public static Block registerBlock() { + if (instance == null) { + instance = new Block_TFFTStorageFieldBlockT4(); + } + + final String blockName = "kekztech_tfftstoragefieldblock4_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock4"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT4.class, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java index 7e30695804..c215fe3909 100644 --- a/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java +++ b/src/main/java/common/blocks/Block_TFFTStorageFieldBlockT5.java @@ -8,30 +8,30 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class Block_TFFTStorageFieldBlockT5 extends BaseGTUpdateableBlock { - - private static Block_TFFTStorageFieldBlockT5 instance; - - private Block_TFFTStorageFieldBlockT5() { - super(Material.iron); - } - - public static int getCapacity() { - return 256000000; - } - - public static Block registerBlock() { - if(instance == null) { - instance = new Block_TFFTStorageFieldBlockT5(); - } - - final String blockName = "kekztech_tfftstoragefieldblock5_block"; - instance.setBlockName(blockName); - instance.setCreativeTab(CreativeTabs.tabMisc); - instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock5"); - instance.setHardness(5.0f); - instance.setResistance(6.0f); - GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT5.class, blockName); - - return instance; - } -}
\ No newline at end of file + + private static Block_TFFTStorageFieldBlockT5 instance; + + private Block_TFFTStorageFieldBlockT5() { + super(Material.iron); + } + + public static int getCapacity() { + return 256000000; + } + + public static Block registerBlock() { + if (instance == null) { + instance = new Block_TFFTStorageFieldBlockT5(); + } + + final String blockName = "kekztech_tfftstoragefieldblock5_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "TFFTStorageFieldBlock5"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, IB_TFFTStorageFieldBlockT5.class, blockName); + + return instance; + } +} diff --git a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java index cce03b0236..09a50f4b94 100644 --- a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java +++ b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java @@ -6,6 +6,8 @@ import common.tileentities.TE_ThaumiumReinforcedVoidJar; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -25,221 +27,226 @@ import thaumcraft.common.config.ConfigItems; import thaumcraft.common.items.ItemEssence; import thaumcraft.common.tiles.TileJarFillable; -import java.util.ArrayList; -import java.util.List; - public class Block_ThaumiumReinforcedJar extends BlockJar { - - private static final Block_ThaumiumReinforcedJar INSTANCE = new Block_ThaumiumReinforcedJar(); - - private Block_ThaumiumReinforcedJar() { - super(); - - super.setHardness(6.0F); - super.setResistance(6.0F); - } - - public static Block registerBlock() { - final String blockName = "kekztech_thaumiumreinforcedjar_block"; - INSTANCE.setBlockName(blockName); - INSTANCE.setHarvestLevel("pickaxe", 2); - GameRegistry.registerBlock(INSTANCE, IB_ThaumiumReinforcedJar.class, blockName); - - return INSTANCE; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister ir) { - super.iconLiquid = ir.registerIcon("thaumcraft:animatedglow"); - super.iconJarSide = ir.registerIcon("kekztech:thaumreinforced_jar_side"); - super.iconJarTop = ir.registerIcon("kekztech:thaumreinforced_jar_top"); - super.iconJarTopVoid = ir.registerIcon("kekztech:thaumreinforced_jar_top_void"); - super.iconJarSideVoid = ir.registerIcon("kekztech:thaumreinforced_jar_side_void"); - super.iconJarBottom = ir.registerIcon("kekztech:thaumreinforced_jar_bottom"); - } - - @Override - @SideOnly(Side.CLIENT) - @SuppressWarnings({"unchecked"}) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - par3List.add(new ItemStack(par1, 1, 0)); // Normal jar - par3List.add(new ItemStack(par1, 1, 3)); // Void jar - } - - @Override - public TileEntity createTileEntity(World world, int meta) { - if(meta == 3) { - return new TE_ThaumiumReinforcedVoidJar(); - } else { - return new TE_ThaumiumReinforcedJar(); - } - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ThaumiumReinforcedJar) { - final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; - breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); - } else if(te instanceof TE_ThaumiumReinforcedVoidJar) { - final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; - breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); - } - super.breakBlock(world, x, y, z, par5, par6); - } - - private void breakBlockWarpy(World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength){ - if(fillAmount > 0) { - // Create a decent explosion in the center of the block (TNT has strength 4.0F) - world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); - - // Place a lot of Flux in the area - final int limit = fillAmount / 16; - int created = 0; - for(int i = 0; i < iterations; i++) { - final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - if(world.isAirBlock(xf, yf, zf)) { - if(yf > y) { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); - } else { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); - } - - if(created++ > limit) { - break; - } - } - } - } - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float f1, float f2, float f3) { - // Call parent method to handle jar emptying, labels stuff etc - super.onBlockActivated(world, x, y, z, player, side, f1, f2, f3); - // Interact with Essentia Phials if the player holds one - final ItemStack heldItem = player.getHeldItem(); - if(heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ThaumiumReinforcedJar) { - return dealWithPhial(world, player, x, y, z); - } else if(te instanceof TE_ThaumiumReinforcedVoidJar) { - return dealWithPhial(world, player, x, y, z); - } - } - - return true; - } - - /** - * Handle compatibility with Essentia Phials - * @param world - * Pass through from onBlockActivated() - * @param player - * Pass through from onBlockActivated() - * @param x - * Pass through from onBlockActivated() - * @param y - * Pass through from onBlockActivated() - * @param z - * Pass through from onBlockActivated() - * @return Not sure tbh - */ - private boolean dealWithPhial(World world, EntityPlayer player, int x, int y, int z) { - final TileJarFillable kte = (TileJarFillable) world.getTileEntity(x, y, z); - final ItemStack heldItem = player.getHeldItem(); - // Check whether to fill or to drain the phial - if(heldItem.getItemDamage() == 0) { - if(kte.amount >= 8){ - if (world.isRemote) { - player.swingItem(); - return false; - } - - final Aspect jarAspect = Aspect.getAspect(kte.aspect.getTag()); - if(kte.takeFromContainer(jarAspect, 8)) { - // Take an empty phial from the player's inventory - heldItem.stackSize--; - // Fill a new phial - final ItemStack filledPhial = new ItemStack(ConfigItems.itemEssence, 1, 1); - final AspectList phialContent = new AspectList().add(jarAspect, 8); - ((ItemEssence) ConfigItems.itemEssence).setAspects(filledPhial, phialContent); - // Drop on ground if there's no inventory space - if (!player.inventory.addItemStackToInventory(filledPhial)) { - world.spawnEntityInWorld(new EntityItem(world, (float)x + 0.5F, (float)y + 0.5F, (float)z + 0.5F, filledPhial)); - } - - world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); - player.inventoryContainer.detectAndSendChanges(); - return true; - } - } - } else { - final AspectList phialContent = ((ItemEssence) ConfigItems.itemEssence).getAspects(heldItem); - if(phialContent != null && phialContent.size() == 1) { - final Aspect phialAspect = phialContent.getAspects()[0]; - if(kte.amount + 8 <= kte.maxAmount && kte.doesContainerAccept(phialAspect)) { - if (world.isRemote) { - player.swingItem(); - return false; - } - - if(kte.addToContainer(phialAspect, 8) == 0) { - world.markBlockForUpdate(x, y, z); - kte.markDirty(); - heldItem.stackSize--; - // Drop on ground if there's no inventory space - if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) { - world.spawnEntityInWorld(new EntityItem(world, (float)x + 0.5F, (float)y + 0.5F, (float)z + 0.5F, new ItemStack(ConfigItems.itemEssence, 1, 0))); - } - - world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); - player.inventoryContainer.detectAndSendChanges(); - return true; - } - } - } - } - - return true; - } - - @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) { - final ArrayList<ItemStack> drops = new ArrayList<>(); - drops.add(new ItemStack(this, 1, (meta == 3) ? 3 : 0)); - final TileEntity te = world.getTileEntity(x, y, z); - if(te instanceof TE_ThaumiumReinforcedJar) { - final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; - if(ite.aspectFilter != null){ - final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); - droppedLabel.setTagCompound(new NBTTagCompound()); - final AspectList aspect = new AspectList().add(ite.aspectFilter,0); - aspect.writeToNBT(droppedLabel.getTagCompound()); - drops.add(droppedLabel); - } - } else if(te instanceof TE_ThaumiumReinforcedVoidJar) { - final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; - if(ite.aspectFilter != null) { - final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); - droppedLabel.setTagCompound(new NBTTagCompound()); - final AspectList aspect = new AspectList().add(ite.aspectFilter,0); - aspect.writeToNBT(droppedLabel.getTagCompound()); - drops.add(droppedLabel); - } - } - return drops; - } - - @Override - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { - } - - @Override - public boolean canDropFromExplosion(Explosion e) { - return false; - } + + private static final Block_ThaumiumReinforcedJar INSTANCE = new Block_ThaumiumReinforcedJar(); + + private Block_ThaumiumReinforcedJar() { + super(); + + super.setHardness(6.0F); + super.setResistance(6.0F); + } + + public static Block registerBlock() { + final String blockName = "kekztech_thaumiumreinforcedjar_block"; + INSTANCE.setBlockName(blockName); + INSTANCE.setHarvestLevel("pickaxe", 2); + GameRegistry.registerBlock(INSTANCE, IB_ThaumiumReinforcedJar.class, blockName); + + return INSTANCE; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister ir) { + super.iconLiquid = ir.registerIcon("thaumcraft:animatedglow"); + super.iconJarSide = ir.registerIcon("kekztech:thaumreinforced_jar_side"); + super.iconJarTop = ir.registerIcon("kekztech:thaumreinforced_jar_top"); + super.iconJarTopVoid = ir.registerIcon("kekztech:thaumreinforced_jar_top_void"); + super.iconJarSideVoid = ir.registerIcon("kekztech:thaumreinforced_jar_side_void"); + super.iconJarBottom = ir.registerIcon("kekztech:thaumreinforced_jar_bottom"); + } + + @Override + @SideOnly(Side.CLIENT) + @SuppressWarnings({"unchecked"}) + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + par3List.add(new ItemStack(par1, 1, 0)); // Normal jar + par3List.add(new ItemStack(par1, 1, 3)); // Void jar + } + + @Override + public TileEntity createTileEntity(World world, int meta) { + if (meta == 3) { + return new TE_ThaumiumReinforcedVoidJar(); + } else { + return new TE_ThaumiumReinforcedJar(); + } + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ThaumiumReinforcedJar) { + final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); + } else if (te instanceof TE_ThaumiumReinforcedVoidJar) { + final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); + } + super.breakBlock(world, x, y, z, par5, par6); + } + + private void breakBlockWarpy( + World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength) { + if (fillAmount > 0) { + // Create a decent explosion in the center of the block (TNT has strength 4.0F) + world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); + + // Place a lot of Flux in the area + final int limit = fillAmount / 16; + int created = 0; + for (int i = 0; i < iterations; i++) { + final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + if (world.isAirBlock(xf, yf, zf)) { + if (yf > y) { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); + } else { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); + } + + if (created++ > limit) { + break; + } + } + } + } + } + + @Override + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float f1, float f2, float f3) { + // Call parent method to handle jar emptying, labels stuff etc + super.onBlockActivated(world, x, y, z, player, side, f1, f2, f3); + // Interact with Essentia Phials if the player holds one + final ItemStack heldItem = player.getHeldItem(); + if (heldItem != null && heldItem.getItem() == ConfigItems.itemEssence) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ThaumiumReinforcedJar) { + return dealWithPhial(world, player, x, y, z); + } else if (te instanceof TE_ThaumiumReinforcedVoidJar) { + return dealWithPhial(world, player, x, y, z); + } + } + + return true; + } + + /** + * Handle compatibility with Essentia Phials + * @param world + * Pass through from onBlockActivated() + * @param player + * Pass through from onBlockActivated() + * @param x + * Pass through from onBlockActivated() + * @param y + * Pass through from onBlockActivated() + * @param z + * Pass through from onBlockActivated() + * @return Not sure tbh + */ + private boolean dealWithPhial(World world, EntityPlayer player, int x, int y, int z) { + final TileJarFillable kte = (TileJarFillable) world.getTileEntity(x, y, z); + final ItemStack heldItem = player.getHeldItem(); + // Check whether to fill or to drain the phial + if (heldItem.getItemDamage() == 0) { + if (kte.amount >= 8) { + if (world.isRemote) { + player.swingItem(); + return false; + } + + final Aspect jarAspect = Aspect.getAspect(kte.aspect.getTag()); + if (kte.takeFromContainer(jarAspect, 8)) { + // Take an empty phial from the player's inventory + heldItem.stackSize--; + // Fill a new phial + final ItemStack filledPhial = new ItemStack(ConfigItems.itemEssence, 1, 1); + final AspectList phialContent = new AspectList().add(jarAspect, 8); + ((ItemEssence) ConfigItems.itemEssence).setAspects(filledPhial, phialContent); + // Drop on ground if there's no inventory space + if (!player.inventory.addItemStackToInventory(filledPhial)) { + world.spawnEntityInWorld(new EntityItem( + world, (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, filledPhial)); + } + + world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); + player.inventoryContainer.detectAndSendChanges(); + return true; + } + } + } else { + final AspectList phialContent = ((ItemEssence) ConfigItems.itemEssence).getAspects(heldItem); + if (phialContent != null && phialContent.size() == 1) { + final Aspect phialAspect = phialContent.getAspects()[0]; + if (kte.amount + 8 <= kte.maxAmount && kte.doesContainerAccept(phialAspect)) { + if (world.isRemote) { + player.swingItem(); + return false; + } + + if (kte.addToContainer(phialAspect, 8) == 0) { + world.markBlockForUpdate(x, y, z); + kte.markDirty(); + heldItem.stackSize--; + // Drop on ground if there's no inventory space + if (!player.inventory.addItemStackToInventory(new ItemStack(ConfigItems.itemEssence, 1, 0))) { + world.spawnEntityInWorld(new EntityItem( + world, + (float) x + 0.5F, + (float) y + 0.5F, + (float) z + 0.5F, + new ItemStack(ConfigItems.itemEssence, 1, 0))); + } + + world.playSoundAtEntity(player, "game.neutral.swim", 0.25F, 1.0F); + player.inventoryContainer.detectAndSendChanges(); + return true; + } + } + } + } + + return true; + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) { + final ArrayList<ItemStack> drops = new ArrayList<>(); + drops.add(new ItemStack(this, 1, (meta == 3) ? 3 : 0)); + final TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TE_ThaumiumReinforcedJar) { + final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; + if (ite.aspectFilter != null) { + final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); + droppedLabel.setTagCompound(new NBTTagCompound()); + final AspectList aspect = new AspectList().add(ite.aspectFilter, 0); + aspect.writeToNBT(droppedLabel.getTagCompound()); + drops.add(droppedLabel); + } + } else if (te instanceof TE_ThaumiumReinforcedVoidJar) { + final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; + if (ite.aspectFilter != null) { + final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); + droppedLabel.setTagCompound(new NBTTagCompound()); + final AspectList aspect = new AspectList().add(ite.aspectFilter, 0); + aspect.writeToNBT(droppedLabel.getTagCompound()); + drops.add(droppedLabel); + } + } + return drops; + } + + @Override + public void onBlockHarvested( + World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {} + + @Override + public boolean canDropFromExplosion(Explosion e) { + return false; + } } diff --git a/src/main/java/common/blocks/Block_YSZUnit.java b/src/main/java/common/blocks/Block_YSZUnit.java index fad48dd1b2..dcfc3a3d09 100644 --- a/src/main/java/common/blocks/Block_YSZUnit.java +++ b/src/main/java/common/blocks/Block_YSZUnit.java @@ -1,28 +1,28 @@ -package common.blocks;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import kekztech.KekzCore;
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.creativetab.CreativeTabs;
-
-public class Block_YSZUnit extends BaseGTUpdateableBlock {
-
- private static Block_YSZUnit instance = new Block_YSZUnit();
-
- private Block_YSZUnit() {
- super(Material.iron);
- }
-
- public static Block registerBlock() {
- final String blockName = "kekztech_yszceramicelectrolyteunit_block";
- instance.setBlockName(blockName);
- instance.setCreativeTab(CreativeTabs.tabMisc);
- instance.setBlockTextureName(KekzCore.MODID + ":" + "YSZCeramicElectrolyteUnit");
- instance.setHardness(5.0f);
- instance.setResistance(6.0f);
- GameRegistry.registerBlock(instance, blockName);
-
- return instance;
- }
-}
+package common.blocks; + +import cpw.mods.fml.common.registry.GameRegistry; +import kekztech.KekzCore; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class Block_YSZUnit extends BaseGTUpdateableBlock { + + private static Block_YSZUnit instance = new Block_YSZUnit(); + + private Block_YSZUnit() { + super(Material.iron); + } + + public static Block registerBlock() { + final String blockName = "kekztech_yszceramicelectrolyteunit_block"; + instance.setBlockName(blockName); + instance.setCreativeTab(CreativeTabs.tabMisc); + instance.setBlockTextureName(KekzCore.MODID + ":" + "YSZCeramicElectrolyteUnit"); + instance.setHardness(5.0f); + instance.setResistance(6.0f); + GameRegistry.registerBlock(instance, blockName); + + return instance; + } +} diff --git a/src/main/java/common/container/Container_ItemProxyEndpoint.java b/src/main/java/common/container/Container_ItemProxyEndpoint.java index 63f836e001..8f509e789c 100644 --- a/src/main/java/common/container/Container_ItemProxyEndpoint.java +++ b/src/main/java/common/container/Container_ItemProxyEndpoint.java @@ -8,20 +8,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class Container_ItemProxyEndpoint extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slot - addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); - // Config slot - addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); - - //Inventory + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxyEndpoint(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slot + addSlotToContainer(new Slot(teInventory, slotID++, 80, 35)); + // Config slot + addSlotToContainer(new Slot(teInventory, slotID++, 100, 35)); + + // Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -31,38 +31,36 @@ public class Container_ItemProxyEndpoint extends Container { for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); + } - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } -} + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } +} diff --git a/src/main/java/common/container/Container_ItemProxySource.java b/src/main/java/common/container/Container_ItemProxySource.java index 2f59b97b73..23af97e5bb 100644 --- a/src/main/java/common/container/Container_ItemProxySource.java +++ b/src/main/java/common/container/Container_ItemProxySource.java @@ -8,33 +8,33 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class Container_ItemProxySource extends Container { - - private final IInventory teInventory; - - private int slotID = 0; - - public Container_ItemProxySource(TileEntity te, EntityPlayer player) { - this.teInventory = (IInventory) te; - - // Source Slots - addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); - addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); - addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); - - //Inventory + + private final IInventory teInventory; + + private int slotID = 0; + + public Container_ItemProxySource(TileEntity te, EntityPlayer player) { + this.teInventory = (IInventory) te; + + // Source Slots + addSlotToContainer(new Slot(teInventory, slotID++, 53, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 8)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 26)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 44)); + addSlotToContainer(new Slot(teInventory, slotID++, 53, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 71, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 89, 62)); + addSlotToContainer(new Slot(teInventory, slotID++, 107, 62)); + + // Inventory for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -44,37 +44,36 @@ public class Container_ItemProxySource extends Container { for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { - ItemStack stack = null; - final Slot slot = (Slot) inventorySlots.get(slotRaw); + } - if (slot != null && slot.getHasStack()) { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); - if (slotRaw < 3 * 9) { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { - return null; - } - } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { - return null; - } + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); - if (stackInSlot.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return teInventory.isUseableByPlayer(player); - } + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + @Override + public boolean canInteractWith(EntityPlayer player) { + return teInventory.isUseableByPlayer(player); + } } diff --git a/src/main/java/common/container/Container_ModularNuclearReactor.java b/src/main/java/common/container/Container_ModularNuclearReactor.java index f5430351e5..da96a0b24b 100644 --- a/src/main/java/common/container/Container_ModularNuclearReactor.java +++ b/src/main/java/common/container/Container_ModularNuclearReactor.java @@ -1,78 +1,76 @@ -package common.container;
-
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.Container;
-import net.minecraft.inventory.Slot;
-import net.minecraft.item.ItemStack;
-import reactor.ButtonSlot;
-
-public class Container_ModularNuclearReactor extends Container {
-
- private int nextSlotID = 0;
- private final Slot[] REACTOR_SLOTS = new Slot[54];
- private final Slot SLOT_CONFIGURATION;
- private final Slot BUTTON_EU_MODE;
- private final Slot BUTTON_FLUID_MODE;
- private final Slot BUTTON_CONDITION;
- private final Slot BUTTON_CONFIGURE;
- private final Slot BUTTON_RESET;
-
-
- public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) {
-
- // Add the reactor chamber
- for(int x = 0; x < 9; x++) {
- for(int y = 0; y < 6; y++){
- REACTOR_SLOTS[nextSlotID] = super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y)));
- }
- }
- // Add the configuration slot
- SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0));
-
- // Add buttons (they're also slots)
- BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
- BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
- BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
- BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
- BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0));
-
- }
-
- private int getNextSlotID() {
- nextSlotID++;
- return nextSlotID - 1;
- }
-
- @Override
- public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) {
- ItemStack stack = null;
- final Slot slot = (Slot) inventorySlots.get(slotRaw);
-
- if (slot != null && slot.getHasStack()) {
- final ItemStack stackInSlot = slot.getStack();
- stack = stackInSlot.copy();
-
- if (slotRaw < 3 * 9) {
- if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) {
- return null;
- }
- } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) {
- return null;
- }
-
- if (stackInSlot.stackSize == 0) {
- slot.putStack(null);
- } else {
- slot.onSlotChanged();
- }
- }
- return stack;
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer p_75145_1_) {
- return true;
- }
-
-}
+package common.container; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import reactor.ButtonSlot; + +public class Container_ModularNuclearReactor extends Container { + + private int nextSlotID = 0; + private final Slot[] REACTOR_SLOTS = new Slot[54]; + private final Slot SLOT_CONFIGURATION; + private final Slot BUTTON_EU_MODE; + private final Slot BUTTON_FLUID_MODE; + private final Slot BUTTON_CONDITION; + private final Slot BUTTON_CONFIGURE; + private final Slot BUTTON_RESET; + + public Container_ModularNuclearReactor(IGregTechTileEntity te, EntityPlayer player) { + + // Add the reactor chamber + for (int x = 0; x < 9; x++) { + for (int y = 0; y < 6; y++) { + REACTOR_SLOTS[nextSlotID] = + super.addSlotToContainer(new Slot(te, getNextSlotID(), (16 + 67 * x), (16 + 67 * y))); + } + } + // Add the configuration slot + SLOT_CONFIGURATION = super.addSlotToContainer(new Slot(te, getNextSlotID(), 0, 0)); + + // Add buttons (they're also slots) + BUTTON_EU_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_FLUID_MODE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONDITION = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_CONFIGURE = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + BUTTON_RESET = super.addSlotToContainer(new ButtonSlot(te, getNextSlotID(), 0, 0)); + } + + private int getNextSlotID() { + nextSlotID++; + return nextSlotID - 1; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) { + ItemStack stack = null; + final Slot slot = (Slot) inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) { + final ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) { + return null; + } + } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) { + return null; + } + + if (stackInSlot.stackSize == 0) { + slot.putStack(null); + } else { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } +} diff --git a/src/main/java/common/itemBlocks/IB_IchorJar.java b/src/main/java/common/itemBlocks/IB_IchorJar.java index 11d63c4432..6e2d806a7e 100644 --- a/src/main/java/common/itemBlocks/IB_IchorJar.java +++ b/src/main/java/common/itemBlocks/IB_IchorJar.java @@ -1,12 +1,14 @@ package common.itemBlocks; - import net.minecraft.block.Block; - import net.minecraft.item.ItemBlock; - import net.minecraft.item.ItemStack; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; public class IB_IchorJar extends ItemBlock { - public IB_IchorJar(Block block) { super(block); } + public IB_IchorJar(Block block) { + super(block); + } @Override public int getMetadata(int meta) { @@ -23,4 +25,3 @@ public class IB_IchorJar extends ItemBlock { return super.getUnlocalizedName() + "." + stack.getItemDamage(); } } - diff --git a/src/main/java/common/itemBlocks/IB_ItemProxyCable.java b/src/main/java/common/itemBlocks/IB_ItemProxyCable.java index e4ae431c55..ed73b2ce15 100644 --- a/src/main/java/common/itemBlocks/IB_ItemProxyCable.java +++ b/src/main/java/common/itemBlocks/IB_ItemProxyCable.java @@ -1,7 +1,6 @@ package common.itemBlocks; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -10,13 +9,13 @@ import net.minecraft.util.StatCollector; public class IB_ItemProxyCable extends ItemBlock { - public IB_ItemProxyCable(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxycable_block.0.desc")); - } + public IB_ItemProxyCable(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxycable_block.0.desc")); + } } diff --git a/src/main/java/common/itemBlocks/IB_ItemProxyEndpoint.java b/src/main/java/common/itemBlocks/IB_ItemProxyEndpoint.java index b0a1a558a9..db4b41f53d 100644 --- a/src/main/java/common/itemBlocks/IB_ItemProxyEndpoint.java +++ b/src/main/java/common/itemBlocks/IB_ItemProxyEndpoint.java @@ -1,7 +1,6 @@ package common.itemBlocks; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -9,15 +8,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; public class IB_ItemProxyEndpoint extends ItemBlock { - - public IB_ItemProxyEndpoint(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxyendpoint_block.0.desc")); - lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxyendpoint_block.1.desc")); - } + + public IB_ItemProxyEndpoint(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxyendpoint_block.0.desc")); + lines.add(StatCollector.translateToLocal("tile.kekztech_itemproxyendpoint_block.1.desc")); + } } diff --git a/src/main/java/common/itemBlocks/IB_ItemProxySource.java b/src/main/java/common/itemBlocks/IB_ItemProxySource.java index 68ab1b00ff..7150336727 100644 --- a/src/main/java/common/itemBlocks/IB_ItemProxySource.java +++ b/src/main/java/common/itemBlocks/IB_ItemProxySource.java @@ -1,7 +1,6 @@ package common.itemBlocks; import java.util.List; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -9,16 +8,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; public class IB_ItemProxySource extends ItemBlock { - - public IB_ItemProxySource(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.0.desc")); - lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.1.desc")); - lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.2.desc")); - } + + public IB_ItemProxySource(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.0.desc")); + lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.1.desc")); + lines.add(StatCollector.translateToLocal("tile:kekztech_itemproxysource_block.2.desc")); + } } diff --git a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java index 488d2cdcd9..370dfb0a11 100644 --- a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java +++ b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java @@ -1,10 +1,11 @@ package common.itemBlocks; -import java.math.BigInteger; -import java.util.List; +import static com.google.common.math.LongMath.pow; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; +import java.math.BigInteger; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -12,60 +13,79 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import static com.google.common.math.LongMath.pow; - public class IB_LapotronicEnergyUnit extends ItemBlock { public IB_LapotronicEnergyUnit(Block block) { - super(block); - } + super(block); + } - @Override - public int getMetadata(int meta) { - return meta; - } + @Override + public int getMetadata(int meta) { + return meta; + } - @Override - public boolean getHasSubtypes() { - return true; - } + @Override + public boolean getHasSubtypes() { + return true; + } - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } // 5 Minutes, 5 mins * 60s * 20 ticks. public static long LSC_time_between_wireless_rebalance_in_ticks = 5L * 60L * 20L; // 60 Trillion EU. - public static BigInteger LSC_wireless_eu_cap = BigInteger.valueOf(60 * pow(10,12)); + public static BigInteger LSC_wireless_eu_cap = BigInteger.valueOf(60 * pow(10, 12)); // 10 Billion EU/t - private static BigInteger UHV_cap_eu_per_tick = LSC_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); + private static BigInteger UHV_cap_eu_per_tick = + LSC_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); - public static long EV_cap_storage = 60_000_000L; - public static long IV_cap_storage = 600_000_000L; + public static long EV_cap_storage = 60_000_000L; + public static long IV_cap_storage = 600_000_000L; public static long LuV_cap_storage = 6_000_000_000L; public static long ZPM_cap_storage = 60_000_000_000L; - public static long UV_cap_storage = 600_000_000_000L; + public static long UV_cap_storage = 600_000_000_000L; public static long UHV_cap_storage = Long.MAX_VALUE; @SuppressWarnings("unchecked") - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_lapotronicenergyunit_block.desc")); - switch(stack.getItemDamage()) { - case 1: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(IV_cap_storage) + EnumChatFormatting.GRAY + "EU"); break; - case 2: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(LuV_cap_storage) + EnumChatFormatting.GRAY + "EU"); break; - case 3: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(ZPM_cap_storage) + EnumChatFormatting.GRAY + "EU"); break; - case 4: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UV_cap_storage) + EnumChatFormatting.GRAY + "EU"); break; - case 5: - lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UHV_cap_storage) + EnumChatFormatting.GRAY + "EU"); - lines.add("Supports up to " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UHV_cap_eu_per_tick) + EnumChatFormatting.GRAY + "EU/t of wireless transfer per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + " capacitor."); - break; - case 6: lines.add("Capacity: None"); break; - case 7: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(EV_cap_storage) + EnumChatFormatting.GRAY + " EU"); break; - } - } + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_lapotronicenergyunit_block.desc")); + switch (stack.getItemDamage()) { + case 1: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(IV_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + break; + case 2: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(LuV_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + break; + case 3: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(ZPM_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + break; + case 4: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UV_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + break; + case 5: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UHV_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + lines.add("Supports up to " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UHV_cap_eu_per_tick) + + EnumChatFormatting.GRAY + "EU/t of wireless transfer per " + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + EnumChatFormatting.GRAY + " capacitor."); + break; + case 6: + lines.add("Capacity: None"); + break; + case 7: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(EV_cap_storage) + + EnumChatFormatting.GRAY + " EU"); + break; + } + } } diff --git a/src/main/java/common/itemBlocks/IB_SpaceElevator.java b/src/main/java/common/itemBlocks/IB_SpaceElevator.java index e2cceda494..5ac22e6875 100644 --- a/src/main/java/common/itemBlocks/IB_SpaceElevator.java +++ b/src/main/java/common/itemBlocks/IB_SpaceElevator.java @@ -1,16 +1,17 @@ package common.itemBlocks; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - public class IB_SpaceElevator extends ItemBlock { - public IB_SpaceElevator(Block block) { super(block); } + public IB_SpaceElevator(Block block) { + super(block); + } @Override public int getMetadata(int meta) { diff --git a/src/main/java/common/itemBlocks/IB_SpaceElevatorCapacitor.java b/src/main/java/common/itemBlocks/IB_SpaceElevatorCapacitor.java index 053cb2c567..5e3e87f277 100644 --- a/src/main/java/common/itemBlocks/IB_SpaceElevatorCapacitor.java +++ b/src/main/java/common/itemBlocks/IB_SpaceElevatorCapacitor.java @@ -1,13 +1,12 @@ package common.itemBlocks; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -import java.util.List; - public class IB_SpaceElevatorCapacitor extends ItemBlock { public IB_SpaceElevatorCapacitor(Block block) { diff --git a/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java b/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java index f00c5ef0c2..4e4da45b2d 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java +++ b/src/main/java/common/itemBlocks/IB_TFFTMultiHatch.java @@ -1,8 +1,6 @@ package common.itemBlocks; import java.util.List; - -import common.tileentities.TE_TFFTMultiHatch; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,29 +9,29 @@ import net.minecraft.util.StatCollector; @Deprecated public class IB_TFFTMultiHatch extends ItemBlock { - - public IB_TFFTMultiHatch(Block block) { - super(block); - } - @Override - public int getMetadata(int meta) { - return meta; - } + public IB_TFFTMultiHatch(Block block) { + super(block); + } + + @Override + public int getMetadata(int meta) { + return meta; + } - @Override - public boolean getHasSubtypes() { - return true; - } + @Override + public boolean getHasSubtypes() { + return true; + } - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftmultihatch_block.0.desc")); - } + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftmultihatch_block.0.desc")); + } } diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java index 13e6e06f50..adcf705bcb 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT1.java @@ -1,8 +1,7 @@ package common.itemBlocks; -import java.util.List; - import common.blocks.Block_TFFTStorageFieldBlockT1; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,16 +10,15 @@ import net.minecraft.util.StatCollector; public class IB_TFFTStorageFieldBlockT1 extends ItemBlock { - public IB_TFFTStorageFieldBlockT1(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT1.getCapacity() + "L"); - lines.add("Power Draw: +0.5EU/t"); - } - + public IB_TFFTStorageFieldBlockT1(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); + lines.add("Capacity: " + Block_TFFTStorageFieldBlockT1.getCapacity() + "L"); + lines.add("Power Draw: +0.5EU/t"); + } } diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java index e6a680f1f6..2ee7a632a7 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT2.java @@ -1,8 +1,7 @@ package common.itemBlocks; -import java.util.List; - import common.blocks.Block_TFFTStorageFieldBlockT2; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,16 +10,15 @@ import net.minecraft.util.StatCollector; public class IB_TFFTStorageFieldBlockT2 extends ItemBlock { - public IB_TFFTStorageFieldBlockT2(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT2.getCapacity() + "L"); - lines.add("Power Draw: +1EU/t"); - } - + public IB_TFFTStorageFieldBlockT2(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); + lines.add("Capacity: " + Block_TFFTStorageFieldBlockT2.getCapacity() + "L"); + lines.add("Power Draw: +1EU/t"); + } } diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java index 847e43f8ab..6305209bb3 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT3.java @@ -1,8 +1,7 @@ package common.itemBlocks; -import java.util.List; - import common.blocks.Block_TFFTStorageFieldBlockT3; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,16 +10,15 @@ import net.minecraft.util.StatCollector; public class IB_TFFTStorageFieldBlockT3 extends ItemBlock { - public IB_TFFTStorageFieldBlockT3(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT3.getCapacity() + "L"); - lines.add("Power Draw: +2EU/t"); - } - + public IB_TFFTStorageFieldBlockT3(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); + lines.add("Capacity: " + Block_TFFTStorageFieldBlockT3.getCapacity() + "L"); + lines.add("Power Draw: +2EU/t"); + } } diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java index ce35f9c4d4..f0ed537b66 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT4.java @@ -1,8 +1,7 @@ package common.itemBlocks; -import java.util.List; - import common.blocks.Block_TFFTStorageFieldBlockT4; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,16 +10,15 @@ import net.minecraft.util.StatCollector; public class IB_TFFTStorageFieldBlockT4 extends ItemBlock { - public IB_TFFTStorageFieldBlockT4(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT4.getCapacity() + "L"); - lines.add("Power Draw: +4EU/t"); - } - + public IB_TFFTStorageFieldBlockT4(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); + lines.add("Capacity: " + Block_TFFTStorageFieldBlockT4.getCapacity() + "L"); + lines.add("Power Draw: +4EU/t"); + } } diff --git a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java index b7c8e8190c..4913d791e0 100644 --- a/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java +++ b/src/main/java/common/itemBlocks/IB_TFFTStorageFieldBlockT5.java @@ -1,8 +1,7 @@ package common.itemBlocks; -import java.util.List; - import common.blocks.Block_TFFTStorageFieldBlockT5; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -11,16 +10,15 @@ import net.minecraft.util.StatCollector; public class IB_TFFTStorageFieldBlockT5 extends ItemBlock { - public IB_TFFTStorageFieldBlockT5(Block block) { - super(block); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { - lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); - lines.add("Capacity: " + Block_TFFTStorageFieldBlockT5.getCapacity() + "L"); - lines.add("Power Draw: +8EU/t"); - } - -}
\ No newline at end of file + public IB_TFFTStorageFieldBlockT5(Block block) { + super(block); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips) { + lines.add(StatCollector.translateToLocal("tile.kekztech_tfftstoragefieldblock1_block.0.desc")); + lines.add("Capacity: " + Block_TFFTStorageFieldBlockT5.getCapacity() + "L"); + lines.add("Power Draw: +8EU/t"); + } +} diff --git a/src/main/java/common/itemBlocks/IB_ThaumiumReinforcedJar.java b/src/main/java/common/itemBlocks/IB_ThaumiumReinforcedJar.java index 30b44f962c..9299126d67 100644 --- a/src/main/java/common/itemBlocks/IB_ThaumiumReinforcedJar.java +++ b/src/main/java/common/itemBlocks/IB_ThaumiumReinforcedJar.java @@ -6,7 +6,9 @@ import net.minecraft.item.ItemStack; public class IB_ThaumiumReinforcedJar extends ItemBlock { - public IB_ThaumiumReinforcedJar(Block block) { super(block); } + public IB_ThaumiumReinforcedJar(Block block) { + super(block); + } @Override public int getMetadata(int meta) { diff --git a/src/main/java/common/items/ErrorItem.java b/src/main/java/common/items/ErrorItem.java index 4b79e5fbd8..fb6e4d3c72 100644 --- a/src/main/java/common/items/ErrorItem.java +++ b/src/main/java/common/items/ErrorItem.java @@ -1,8 +1,7 @@ package common.items; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; +import java.util.List; import kekztech.KekzCore; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -11,38 +10,37 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ErrorItem extends Item { - - private static final ErrorItem INSTANCE = new ErrorItem(); - - private ErrorItem() { } - - public static ErrorItem getInstance() { - return INSTANCE; - } - - public void registerItem() { - super.setHasSubtypes(false); - final String unlocalizedName = "kekztech_error_item"; - super.setUnlocalizedName(unlocalizedName); - super.setCreativeTab(CreativeTabs.tabMisc); - super.setMaxStackSize(64); - super.setTextureName(KekzCore.MODID + ":" + "Error"); - GameRegistry.registerItem(getInstance(), unlocalizedName); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { - list.add("REMINDER: KekzTech recipes are only tested to work in GTNH!"); - list.add("Placeholder item in case something went wrong"); - list.add("If this item shows up in GTNH, you may report it to:"); - list.add("https://github.com/kekzdealer/KekzTech"); - } - - @Override - public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { - player.swingItem(); - return item; - } - + + private static final ErrorItem INSTANCE = new ErrorItem(); + + private ErrorItem() {} + + public static ErrorItem getInstance() { + return INSTANCE; + } + + public void registerItem() { + super.setHasSubtypes(false); + final String unlocalizedName = "kekztech_error_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(64); + super.setTextureName(KekzCore.MODID + ":" + "Error"); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("REMINDER: KekzTech recipes are only tested to work in GTNH!"); + list.add("Placeholder item in case something went wrong"); + list.add("If this item shows up in GTNH, you may report it to:"); + list.add("https://github.com/kekzdealer/KekzTech"); + } + + @Override + public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { + player.swingItem(); + return item; + } } diff --git a/src/main/java/common/items/MetaItem_CraftingComponent.java b/src/main/java/common/items/MetaItem_CraftingComponent.java index ca1c3dee7b..31c3d797ea 100644 --- a/src/main/java/common/items/MetaItem_CraftingComponent.java +++ b/src/main/java/common/items/MetaItem_CraftingComponent.java @@ -1,8 +1,7 @@ package common.items; -import java.util.List; - import cpw.mods.fml.common.registry.GameRegistry; +import java.util.List; import kekztech.KekzCore; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -12,90 +11,89 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; public class MetaItem_CraftingComponent extends Item { - - private static final MetaItem_CraftingComponent INSTANCE = new MetaItem_CraftingComponent(); - private final IIcon[] icons = new IIcon[16]; - - private MetaItem_CraftingComponent() { } - - public static MetaItem_CraftingComponent getInstance() { - return INSTANCE; - } - - public void registerItem() { - super.setHasSubtypes(true); - final String unlocalizedName = "kekztech_crafting_item"; - super.setUnlocalizedName(unlocalizedName); - super.setCreativeTab(CreativeTabs.tabMisc); - super.setMaxStackSize(64); - GameRegistry.registerItem(getInstance(), unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - int counter = 9; - // Raw heat pipes - /*icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "CopperHeatPipe"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "SilverHeatPipe"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideHeatPipe"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "DiamondHeatPipe"); - // Dust - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "AmineCarbamateDust"); - // Crystal - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideCrystal"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondCrystal");*/ - // Ceramics - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YttriaDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "ZirconiaDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "CeriaDust"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicPlate"); - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicPlate"); - } - - @Override - public IIcon getIconFromDamage(int meta) { - return icons[meta]; - } - - @SuppressWarnings({"unchecked"}) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for(int i = 9; i < icons.length; i++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { - list.add("Crafting component for KekzTech things"); - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - return 0.0d; - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - public ItemStack getStackFromDamage(int meta) { - return new ItemStack(getInstance(), 1, meta); - } - - public ItemStack getStackOfAmountFromDamage(int meta, int amount) { - return new ItemStack(getInstance(), amount, meta); - } - + + private static final MetaItem_CraftingComponent INSTANCE = new MetaItem_CraftingComponent(); + private final IIcon[] icons = new IIcon[16]; + + private MetaItem_CraftingComponent() {} + + public static MetaItem_CraftingComponent getInstance() { + return INSTANCE; + } + + public void registerItem() { + super.setHasSubtypes(true); + final String unlocalizedName = "kekztech_crafting_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(64); + GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + int counter = 9; + // Raw heat pipes + /*icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "CopperHeatPipe"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "SilverHeatPipe"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideHeatPipe"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "DiamondHeatPipe"); + // Dust + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "AmineCarbamateDust"); + // Crystal + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "BoronArsenideCrystal"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "IsotopicallyPureDiamondCrystal");*/ + // Ceramics + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YttriaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "ZirconiaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "CeriaDust"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "YSZCeramicPlate"); + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + "GDCCeramicPlate"); + } + + @Override + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + @SuppressWarnings({"unchecked"}) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 9; i < icons.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + list.add("Crafting component for KekzTech things"); + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return 0.0d; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + public ItemStack getStackFromDamage(int meta) { + return new ItemStack(getInstance(), 1, meta); + } + + public ItemStack getStackOfAmountFromDamage(int meta, int amount) { + return new ItemStack(getInstance(), amount, meta); + } } diff --git a/src/main/java/common/items/MetaItem_ReactorComponent.java b/src/main/java/common/items/MetaItem_ReactorComponent.java index 9d364e7585..ff1520b586 100644 --- a/src/main/java/common/items/MetaItem_ReactorComponent.java +++ b/src/main/java/common/items/MetaItem_ReactorComponent.java @@ -1,10 +1,6 @@ package common.items; import java.util.List; - -import org.lwjgl.input.Keyboard; - -import cpw.mods.fml.common.registry.GameRegistry; import kekztech.KekzCore; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,6 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; +import org.lwjgl.input.Keyboard; import reactor.items.CoolantCell; import reactor.items.FuelRod; import reactor.items.HeatExchanger; @@ -21,122 +18,95 @@ import reactor.items.HeatVent; import reactor.items.NeutronReflector; public class MetaItem_ReactorComponent extends Item { - - private static final MetaItem_ReactorComponent INSTANCE = new MetaItem_ReactorComponent(); - private final IIcon[] icons = new IIcon[50]; - - private MetaItem_ReactorComponent() { } - - public static MetaItem_ReactorComponent getInstance() { - return INSTANCE; - } - - public void registerItem() { - super.setHasSubtypes(true); - final String unlocalizedName = "kekztech_reactor_item"; - super.setUnlocalizedName(unlocalizedName); - super.setCreativeTab(CreativeTabs.tabMisc); - super.setMaxStackSize(1); - //GameRegistry.registerItem(getInstance(), unlocalizedName); - } - - @Override - public void registerIcons(IIconRegister reg) { - int counter = 0; - for(String s : HeatVent.RESOURCE_NAMES) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - for(String s : HeatExchanger.RESOURCE_NAME) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - for(String s : FuelRod.RESOURCE_NAME) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - for(String s : FuelRod.RESOURCE_NAME_DEPLETED) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - for(String s : NeutronReflector.RESOURCE_NAME) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - for(String s : CoolantCell.RESOURCE_NAME) { - icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); - } - } - - @Override - public IIcon getIconFromDamage(int meta) { - return icons[meta]; - } - - @SuppressWarnings({"unchecked"}) - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for(int i = 0; i < icons.length; i++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName() + "." + stack.getItemDamage(); - } - - @SuppressWarnings({"unchecked"}) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { - if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - list.add("Property = 1"); - } else { - list.add("Part for the Modular Nuclear Reactor"); - list.add("Hold " + EnumChatFormatting.BOLD + "[LSHIFT]" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + " to display properties"); - } - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) { - NBTTagCompound nbt = (stack.getTagCompound() == null) ? new NBTTagCompound() : stack.getTagCompound(); - if(nbt.getInteger("HEALTH") != 0 && nbt.getInteger("MAXHEALTH") != 0) { - return 1 - (double) (nbt.getInteger("HEALTH") / nbt.getInteger("MAXHEALTH")); - } else { - return 0.0d; - } - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - final int meta = stack.getItemDamage(); - return meta < 31 || meta > 45; - } - - public ItemStack getStackFromDamage(int meta) { - return new ItemStack(getInstance(), 1, meta); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - + private static final MetaItem_ReactorComponent INSTANCE = new MetaItem_ReactorComponent(); + private final IIcon[] icons = new IIcon[50]; + + private MetaItem_ReactorComponent() {} + + public static MetaItem_ReactorComponent getInstance() { + return INSTANCE; + } + + public void registerItem() { + super.setHasSubtypes(true); + final String unlocalizedName = "kekztech_reactor_item"; + super.setUnlocalizedName(unlocalizedName); + super.setCreativeTab(CreativeTabs.tabMisc); + super.setMaxStackSize(1); + // GameRegistry.registerItem(getInstance(), unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + int counter = 0; + for (String s : HeatVent.RESOURCE_NAMES) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for (String s : HeatExchanger.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for (String s : FuelRod.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for (String s : FuelRod.RESOURCE_NAME_DEPLETED) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for (String s : NeutronReflector.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + for (String s : CoolantCell.RESOURCE_NAME) { + icons[counter++] = reg.registerIcon(KekzCore.MODID + ":" + s); + } + } + + @Override + public IIcon getIconFromDamage(int meta) { + return icons[meta]; + } + + @SuppressWarnings({"unchecked"}) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < icons.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @SuppressWarnings({"unchecked"}) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + list.add("Property = 1"); + } else { + list.add("Part for the Modular Nuclear Reactor"); + list.add("Hold " + EnumChatFormatting.BOLD + "[LSHIFT]" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + + " to display properties"); + } + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + NBTTagCompound nbt = (stack.getTagCompound() == null) ? new NBTTagCompound() : stack.getTagCompound(); + if (nbt.getInteger("HEALTH") != 0 && nbt.getInteger("MAXHEALTH") != 0) { + return 1 - (double) (nbt.getInteger("HEALTH") / nbt.getInteger("MAXHEALTH")); + } else { + return 0.0d; + } + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + final int meta = stack.getItemDamage(); + return meta < 31 || meta > 45; + } + + public ItemStack getStackFromDamage(int meta) { + return new ItemStack(getInstance(), 1, meta); + } } diff --git a/src/main/java/common/reactorItem/AbstractReactorItem.java b/src/main/java/common/reactorItem/AbstractReactorItem.java index e78889b57f..0d02de40f1 100644 --- a/src/main/java/common/reactorItem/AbstractReactorItem.java +++ b/src/main/java/common/reactorItem/AbstractReactorItem.java @@ -7,7 +7,7 @@ public abstract class AbstractReactorItem extends Item { private final int[] behaviourID; - protected AbstractReactorItem(int...behaviourID) { + protected AbstractReactorItem(int... behaviourID) { this.behaviourID = behaviourID; } @@ -19,7 +19,8 @@ public abstract class AbstractReactorItem extends Item { @Override public final String getUnlocalizedName(ItemStack stack) { - return super.hasSubtypes ? (super.getUnlocalizedName() + "." + stack.getItemDamage()) + return super.hasSubtypes + ? (super.getUnlocalizedName() + "." + stack.getItemDamage()) : super.getUnlocalizedName(); } diff --git a/src/main/java/common/reactorItem/ReactorItem.java b/src/main/java/common/reactorItem/ReactorItem.java index e8dfbef21e..3d1c8ade32 100644 --- a/src/main/java/common/reactorItem/ReactorItem.java +++ b/src/main/java/common/reactorItem/ReactorItem.java @@ -27,9 +27,7 @@ public class ReactorItem extends AbstractReactorItem { } @Override - public void registerIcons(IIconRegister reg) { - - } + public void registerIcons(IIconRegister reg) {} @Override public IIcon getIconFromDamage(int meta) { diff --git a/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java b/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java index a73943b618..df60be8362 100644 --- a/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java +++ b/src/main/java/common/tileentities/GTMTE_FluidMultiStorage.java @@ -11,519 +11,552 @@ import gregtech.api.metatileentity.implementations.*; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.HashSet; import kekztech.MultiFluidHandler; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import util.Vector3i; import util.Vector3ic; -import java.util.ArrayList; -import java.util.HashSet; - public class GTMTE_FluidMultiStorage extends GT_MetaTileEntity_TooltipMultiBlockBase { - private final static String glassNameIC2Reinforced = "blockAlloyGlass"; - private final static Block CASING = Blocks.tfftCasing; - private final static Block_TFFTStorageFieldBlockT1 STORAGE_FIELD1 = (Block_TFFTStorageFieldBlockT1) Blocks.tfftStorageField1; - private final static Block_TFFTStorageFieldBlockT2 STORAGE_FIELD2 = (Block_TFFTStorageFieldBlockT2) Blocks.tfftStorageField2; - private final static Block_TFFTStorageFieldBlockT3 STORAGE_FIELD3 = (Block_TFFTStorageFieldBlockT3) Blocks.tfftStorageField3; - private final static Block_TFFTStorageFieldBlockT4 STORAGE_FIELD4 = (Block_TFFTStorageFieldBlockT4) Blocks.tfftStorageField4; - private final static Block_TFFTStorageFieldBlockT5 STORAGE_FIELD5 = (Block_TFFTStorageFieldBlockT5) Blocks.tfftStorageField5; - private final static int CASING_TEXTURE_ID = 176; - - private MultiFluidHandler mfh; - private final HashSet<GTMTE_TFFTMultiHatch> sMultiHatches = new HashSet<>(); - - private int runningCost = 0; - private boolean doVoidExcess = false; - private byte fluidSelector = 0; - - public GTMTE_FluidMultiStorage(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + private static final String glassNameIC2Reinforced = "blockAlloyGlass"; + private static final Block CASING = Blocks.tfftCasing; + private static final Block_TFFTStorageFieldBlockT1 STORAGE_FIELD1 = + (Block_TFFTStorageFieldBlockT1) Blocks.tfftStorageField1; + private static final Block_TFFTStorageFieldBlockT2 STORAGE_FIELD2 = + (Block_TFFTStorageFieldBlockT2) Blocks.tfftStorageField2; + private static final Block_TFFTStorageFieldBlockT3 STORAGE_FIELD3 = + (Block_TFFTStorageFieldBlockT3) Blocks.tfftStorageField3; + private static final Block_TFFTStorageFieldBlockT4 STORAGE_FIELD4 = + (Block_TFFTStorageFieldBlockT4) Blocks.tfftStorageField4; + private static final Block_TFFTStorageFieldBlockT5 STORAGE_FIELD5 = + (Block_TFFTStorageFieldBlockT5) Blocks.tfftStorageField5; + private static final int CASING_TEXTURE_ID = 176; + + private MultiFluidHandler mfh; + private final HashSet<GTMTE_TFFTMultiHatch> sMultiHatches = new HashSet<>(); + + private int runningCost = 0; + private boolean doVoidExcess = false; + private byte fluidSelector = 0; + + public GTMTE_FluidMultiStorage(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GTMTE_FluidMultiStorage(String aName) { - super(aName); - } + public GTMTE_FluidMultiStorage(String aName) { + super(aName); + } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { - return new GTMTE_FluidMultiStorage(super.mName); - } + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { + return new GTMTE_FluidMultiStorage(super.mName); + } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fluid Tank") - .addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") - .addInfo("Has 1/25th of the total capacity as capacity for each fluid.") - .addInfo("Right clicking the controller with a screwdriver will turn on excess voiding.") - .addInfo("Fluid storage amount and running cost depends on the storage field blocks used.") - .addSeparator() - .addInfo("Note on hatch locking:") - .addInfo("Use an Integrated Circuit in the GUI slot to limit which fluid is output.") - .addInfo("The index of a stored fluid can be obtained through the Tricorder.") - .addSeparator() - .beginStructureBlock(5, 9, 5, false) - .addController("Top Center") - .addCasingInfo("T.F.F.T. Casing", 20) - .addOtherStructurePart("Storage Field Blocks (Tier I-V)", "Inner 3x7x3 solid pillar") - .addOtherStructurePart("IC2 Reinforced Glass", "Outer 5x7x5 glass shell") - .addMaintenanceHatch("Any top or bottom casing") - .addEnergyHatch("Any top or bottom casing") - .addInputHatch("Instead of any casing or glass, has to touch storage field block") - .addOutputHatch("Instead of any casing or glass, has to touch storage field block") - .addStructureInfo("You can have a bunch of hatches") - .addOtherStructurePart("Multi I/O Hatches", "Instead of any casing or glass, has to touch storage field block") - .addStructureInfo("Use MIOH with conduits or fluid storage busses to see all fluids at once. If it's fixed.") - .addStructureInfo("Ask someone else why there's 4 versions, with 2 uncraftable ones") - .toolTipFinisher("KekzTech"); + tt.addMachineType("Fluid Tank") + .addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") + .addInfo("Has 1/25th of the total capacity as capacity for each fluid.") + .addInfo("Right clicking the controller with a screwdriver will turn on excess voiding.") + .addInfo("Fluid storage amount and running cost depends on the storage field blocks used.") + .addSeparator() + .addInfo("Note on hatch locking:") + .addInfo("Use an Integrated Circuit in the GUI slot to limit which fluid is output.") + .addInfo("The index of a stored fluid can be obtained through the Tricorder.") + .addSeparator() + .beginStructureBlock(5, 9, 5, false) + .addController("Top Center") + .addCasingInfo("T.F.F.T. Casing", 20) + .addOtherStructurePart("Storage Field Blocks (Tier I-V)", "Inner 3x7x3 solid pillar") + .addOtherStructurePart("IC2 Reinforced Glass", "Outer 5x7x5 glass shell") + .addMaintenanceHatch("Any top or bottom casing") + .addEnergyHatch("Any top or bottom casing") + .addInputHatch("Instead of any casing or glass, has to touch storage field block") + .addOutputHatch("Instead of any casing or glass, has to touch storage field block") + .addStructureInfo("You can have a bunch of hatches") + .addOtherStructurePart( + "Multi I/O Hatches", "Instead of any casing or glass, has to touch storage field block") + .addStructureInfo( + "Use MIOH with conduits or fluid storage busses to see all fluids at once. If it's fixed.") + .addStructureInfo("Ask someone else why there's 4 versions, with 2 uncraftable ones") + .toolTipFinisher("KekzTech"); return tt; } - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - return aSide == aFacing - ? new ITexture[]{BlockIcons.casingTexturePages[1][48], - new GT_RenderedTexture(aActive - ? BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE - : BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR)} - : new ITexture[]{BlockIcons.casingTexturePages[1][48]}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "MultiblockDisplay.png"); - } - - @Override - public boolean isCorrectMachinePart(ItemStack var1) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack guiSlotItem) { - - super.mEfficiency = 10000 - (super.getIdealStatus() - super.getRepairStatus()) * 1000; - super.mEfficiencyIncrease = 10000; - super.mEUt = runningCost; - super.mMaxProgresstime = 10; - - if(guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { - this.fluidSelector = (byte) guiSlotItem.getItemDamage(); - } - - // If there are no basic I/O hatches, let multi hatches handle it and skip a lot of code! - if (sMultiHatches.size() > 0 && super.mInputHatches.size() == 0 && super.mOutputHatches.size() == 0) { - return true; - } - - // Suck in fluids - final ArrayList<FluidStack> inputHatchFluids = super.getStoredFluids(); - if (inputHatchFluids.size() > 0) { - - for (FluidStack fluidStack : inputHatchFluids) { - - final int pushed = mfh.pushFluid(fluidStack, true); - final FluidStack toDeplete = fluidStack.copy(); - toDeplete.amount = pushed; - super.depleteInput(toDeplete); - } - } - - // Push out fluids - if (guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { - final FluidStack storedFluid = mfh.getFluidCopy(fluidSelector); - // Sum available output capacity - int possibleOutput = 0; - for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { - if (outputHatch.isFluidLocked() && outputHatch.getLockedFluidName().equals(storedFluid.getUnlocalizedName())) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } else if (outputHatch.getFluid() != null && outputHatch.getFluid().getUnlocalizedName().equals(storedFluid.getUnlocalizedName())) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } else if (outputHatch.getFluid() == null) { - possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - } - } - // Output as much as possible - final FluidStack tempStack = storedFluid.copy(); - tempStack.amount = possibleOutput; - tempStack.amount = mfh.pullFluid(tempStack, fluidSelector, true); - super.addOutput(tempStack); - - } else { - int tDistinct = mfh.getDistinctFluids(); - int tDistinctCount = 0; - int tMaxDistinct = mfh.getMaxDistinctFluids(); - for(int i = 0; i < tMaxDistinct && tDistinctCount< tDistinct;i++) { - final FluidStack storedFluidCopy = mfh.getFluidCopy(i); - if (storedFluidCopy == null) - continue; - tDistinctCount++; - storedFluidCopy.amount = 0; - // Calculate how much capacity all available Output Hatches offer - for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { - if (outputHatch.isFluidLocked() && outputHatch.getLockedFluidName().equals(storedFluidCopy.getUnlocalizedName())) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy,outputHatch); - } else if (outputHatch.getFluid() != null && outputHatch.getFluid().isFluidEqual(storedFluidCopy)) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy,outputHatch); - } else if (!outputHatch.isFluidLocked() && outputHatch.getFluid() == null) { - storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); - addFluidToHatch(storedFluidCopy,outputHatch); - } - } - } - } - - return true; - } - - public void addFluidToHatch(FluidStack aFluid, GT_MetaTileEntity_Hatch_Output aHatch) { - aFluid.amount = mfh.pullFluid(aFluid, true); - aHatch.fill(aFluid,true); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (mfh != null) { - mfh.setLock(!super.getBaseMetaTileEntity().isActive()); - mfh.setFluidSelector(fluidSelector); - mfh.setDoVoidExcess(doVoidExcess); - } - } - - public Vector3ic rotateOffsetVector(Vector3ic forgeDirection, int x, int y, int z) { - final Vector3i offset = new Vector3i(); - - // either direction on z-axis - if (forgeDirection.x() == 0 && forgeDirection.z() == -1) { - offset.x = x; - offset.y = y; - offset.z = z; - } - if (forgeDirection.x() == 0 && forgeDirection.z() == 1) { - offset.x = -x; - offset.y = y; - offset.z = -z; - } - // either direction on x-axis - if (forgeDirection.x() == -1 && forgeDirection.z() == 0) { - offset.x = z; - offset.y = y; - offset.z = -x; - } - if (forgeDirection.x() == 1 && forgeDirection.z() == 0) { - offset.x = -z; - offset.y = y; - offset.z = x; - } - // either direction on y-axis - if (forgeDirection.y() == -1) { - offset.x = x; - offset.y = z; - offset.z = y; - } - - return offset; - } - - @Override - public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { - // Figure out the vector for the direction the back face of the controller is facing - final Vector3ic forgeDirection = new Vector3i( - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX, - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetY, - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ - ); - int minCasingAmount = 20; - boolean formationChecklist = true; // If this is still true at the end, machine is good to go :) - float runningCostAcc = 0; - double fluidCapacityAcc = 0; - - sMultiHatches.clear(); - - // Front segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - if (X == 0 && Y == 0) { - continue; // Skip controller - } - - // Get next TE - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0); - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Fluid hatches should touch the storage field. - // Maintenance/Energy hatch can go anywhere - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - // Also check for multi hatch - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } else { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } - } - } - - // Middle seven long segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - for (int Z = -1; Z >= -7; Z--) { - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z); - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(STORAGE_FIELD1.getUnlocalizedName())) { - runningCostAcc += 0.5f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT1.getCapacity(); - } else if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(STORAGE_FIELD2.getUnlocalizedName())) { - runningCostAcc += 1.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT2.getCapacity(); - } else if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(STORAGE_FIELD3.getUnlocalizedName())) { - runningCostAcc += 2.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT3.getCapacity(); - } else if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(STORAGE_FIELD4.getUnlocalizedName())) { - runningCostAcc += 4.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT4.getCapacity(); - } else if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() - .equals(STORAGE_FIELD5.getUnlocalizedName())) { - runningCostAcc += 8.0f; - fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT5.getCapacity(); - } else { - formationChecklist = false; - } - continue; - } - - // Get next TE - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Corner allows only glass - if (X == -2 && Y == -2 || X == 2 && Y == 2 || X == -2 && Y == 2 || X == 2 && Y == -2) { - if (!(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameIC2Reinforced))) { - formationChecklist = false; - } - } else { - // Tries to add TE as either of those kinds of hatches. - // The number is the texture index number for the texture that needs to be painted over the hatch texture (TAE for GT++) - if (!super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - // Also check for multi hatch - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else if (!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameIC2Reinforced)) { - formationChecklist = false; - } - } - } - } - } - } - - // Back segment - for (int X = -2; X <= 2; X++) { - for (int Y = -2; Y <= 2; Y++) { - // Get next TE - final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -8); - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); - - // Fluid hatches should touch the storage field. - // Maintenance/Energy hatch can go anywhere - if (X > -2 && X < 2 && Y > -2 && Y < 2) { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) - && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } else { - if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) - && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { - - // If it's not a hatch, is it the right casing for this machine? Check block and block meta. - if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { - // Seems to be valid casing. Decrement counter. - minCasingAmount--; - } else { - formationChecklist = false; - } - } - } - } - } - - if (this.mEnergyHatches.size() < 1) { - formationChecklist = false; - } - - if (this.mMaintenanceHatches.size() != 1) { - formationChecklist = false; - } - - if (minCasingAmount > 0) { - formationChecklist = false; - } - - if (formationChecklist) { - runningCost = Math.round(-runningCostAcc); - // Update MultiFluidHandler in case storage cells have been changed - final int capacityPerFluid = (int) Math.round(fluidCapacityAcc / 25.0f); - if (mfh == null) { - mfh = MultiFluidHandler.newInstance(25, capacityPerFluid); - } else { - if (mfh.getCapacity() != capacityPerFluid) { - mfh = MultiFluidHandler.newAdjustedInstance(mfh, capacityPerFluid); - } - } - for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { - mh.setMultiFluidHandler(mfh); - } - } - - return formationChecklist; - } - - public boolean addMultiHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } else if (aMetaTileEntity instanceof GTMTE_TFFTMultiHatch) { - ((GTMTE_TFFTMultiHatch)aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.sMultiHatches.add((GTMTE_TFFTMultiHatch)aMetaTileEntity); - } else { - return false; - } - } - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - doVoidExcess = !doVoidExcess; - GT_Utility.sendChatToPlayer(aPlayer, doVoidExcess ? "Auto-voiding enabled" : "Auto-voiding disabled"); - } - - @Override - public String[] getInfoData() { - final ArrayList<String> ll = mfh.getInfoData(); - - ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); - ll.add("Auto-voiding: " + doVoidExcess); - ll.add("Per-Fluid Capacity: " + mfh.getCapacity() + "L"); - ll.add("Running Cost: " - // mEUt does not naturally reflect efficiency status. Do that here. - + ((-super.mEUt) * 10000 / Math.max(1000, super.mEfficiency)) + "EU/t"); - ll.add("Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) - ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); - ll.add("---------------------------------------------"); - - final String[] a = new String[ll.size()]; - return ll.toArray(a); - } - - @Override - public void saveNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - nbt.setInteger("runningCost", runningCost); - nbt.setBoolean("doVoidExcess", doVoidExcess); - - nbt.setInteger("capacityPerFluid", mfh.getCapacity()); - nbt.setTag("fluids", mfh.saveNBTData(new NBTTagCompound())); - - super.saveNBTData(nbt); - } - - @Override - public void loadNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - runningCost = nbt.getInteger("runningCost"); - doVoidExcess = nbt.getBoolean("doVoidExcess"); - - mfh = MultiFluidHandler.loadNBTData(nbt); - for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { - mh.setMultiFluidHandler(mfh); - } - super.loadNBTData(nbt); - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack var1) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack var1) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack var1) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack var1) { - return false; - } + @Override + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + return aSide == aFacing + ? new ITexture[] { + BlockIcons.casingTexturePages[1][48], + new GT_RenderedTexture( + aActive + ? BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE + : BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) + } + : new ITexture[] {BlockIcons.casingTexturePages[1][48]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack var1) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack guiSlotItem) { + + super.mEfficiency = 10000 - (super.getIdealStatus() - super.getRepairStatus()) * 1000; + super.mEfficiencyIncrease = 10000; + super.mEUt = runningCost; + super.mMaxProgresstime = 10; + + if (guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { + this.fluidSelector = (byte) guiSlotItem.getItemDamage(); + } + + // If there are no basic I/O hatches, let multi hatches handle it and skip a lot of code! + if (sMultiHatches.size() > 0 && super.mInputHatches.size() == 0 && super.mOutputHatches.size() == 0) { + return true; + } + + // Suck in fluids + final ArrayList<FluidStack> inputHatchFluids = super.getStoredFluids(); + if (inputHatchFluids.size() > 0) { + + for (FluidStack fluidStack : inputHatchFluids) { + + final int pushed = mfh.pushFluid(fluidStack, true); + final FluidStack toDeplete = fluidStack.copy(); + toDeplete.amount = pushed; + super.depleteInput(toDeplete); + } + } + + // Push out fluids + if (guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) { + final FluidStack storedFluid = mfh.getFluidCopy(fluidSelector); + // Sum available output capacity + int possibleOutput = 0; + for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { + if (outputHatch.isFluidLocked() + && outputHatch.getLockedFluidName().equals(storedFluid.getUnlocalizedName())) { + possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + } else if (outputHatch.getFluid() != null + && outputHatch.getFluid().getUnlocalizedName().equals(storedFluid.getUnlocalizedName())) { + possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + } else if (outputHatch.getFluid() == null) { + possibleOutput += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + } + } + // Output as much as possible + final FluidStack tempStack = storedFluid.copy(); + tempStack.amount = possibleOutput; + tempStack.amount = mfh.pullFluid(tempStack, fluidSelector, true); + super.addOutput(tempStack); + + } else { + int tDistinct = mfh.getDistinctFluids(); + int tDistinctCount = 0; + int tMaxDistinct = mfh.getMaxDistinctFluids(); + for (int i = 0; i < tMaxDistinct && tDistinctCount < tDistinct; i++) { + final FluidStack storedFluidCopy = mfh.getFluidCopy(i); + if (storedFluidCopy == null) continue; + tDistinctCount++; + storedFluidCopy.amount = 0; + // Calculate how much capacity all available Output Hatches offer + for (GT_MetaTileEntity_Hatch_Output outputHatch : super.mOutputHatches) { + if (outputHatch.isFluidLocked() + && outputHatch.getLockedFluidName().equals(storedFluidCopy.getUnlocalizedName())) { + storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + addFluidToHatch(storedFluidCopy, outputHatch); + } else if (outputHatch.getFluid() != null + && outputHatch.getFluid().isFluidEqual(storedFluidCopy)) { + storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + addFluidToHatch(storedFluidCopy, outputHatch); + } else if (!outputHatch.isFluidLocked() && outputHatch.getFluid() == null) { + storedFluidCopy.amount += outputHatch.getCapacity() - outputHatch.getFluidAmount(); + addFluidToHatch(storedFluidCopy, outputHatch); + } + } + } + } + + return true; + } + + public void addFluidToHatch(FluidStack aFluid, GT_MetaTileEntity_Hatch_Output aHatch) { + aFluid.amount = mfh.pullFluid(aFluid, true); + aHatch.fill(aFluid, true); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + + if (mfh != null) { + mfh.setLock(!super.getBaseMetaTileEntity().isActive()); + mfh.setFluidSelector(fluidSelector); + mfh.setDoVoidExcess(doVoidExcess); + } + } + + public Vector3ic rotateOffsetVector(Vector3ic forgeDirection, int x, int y, int z) { + final Vector3i offset = new Vector3i(); + + // either direction on z-axis + if (forgeDirection.x() == 0 && forgeDirection.z() == -1) { + offset.x = x; + offset.y = y; + offset.z = z; + } + if (forgeDirection.x() == 0 && forgeDirection.z() == 1) { + offset.x = -x; + offset.y = y; + offset.z = -z; + } + // either direction on x-axis + if (forgeDirection.x() == -1 && forgeDirection.z() == 0) { + offset.x = z; + offset.y = y; + offset.z = -x; + } + if (forgeDirection.x() == 1 && forgeDirection.z() == 0) { + offset.x = -z; + offset.y = y; + offset.z = x; + } + // either direction on y-axis + if (forgeDirection.y() == -1) { + offset.x = x; + offset.y = z; + offset.z = y; + } + + return offset; + } + + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + // Figure out the vector for the direction the back face of the controller is facing + final Vector3ic forgeDirection = new Vector3i( + ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX, + ForgeDirection.getOrientation(thisController.getBackFacing()).offsetY, + ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ); + int minCasingAmount = 20; + boolean formationChecklist = true; // If this is still true at the end, machine is good to go :) + float runningCostAcc = 0; + double fluidCapacityAcc = 0; + + sMultiHatches.clear(); + + // Front segment + for (int X = -2; X <= 2; X++) { + for (int Y = -2; Y <= 2; Y++) { + if (X == 0 && Y == 0) { + continue; // Skip controller + } + + // Get next TE + final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0); + final IGregTechTileEntity currentTE = + thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); + + // Fluid hatches should touch the storage field. + // Maintenance/Energy hatch can go anywhere + if (X > -2 && X < 2 && Y > -2 && Y < 2) { + if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + // Also check for multi hatch + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + formationChecklist = false; + } + } + } else { + if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + formationChecklist = false; + } + } + } + } + } + + // Middle seven long segment + for (int X = -2; X <= 2; X++) { + for (int Y = -2; Y <= 2; Y++) { + for (int Z = -1; Z >= -7; Z--) { + final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z); + if (X > -2 && X < 2 && Y > -2 && Y < 2) { + if (thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(STORAGE_FIELD1.getUnlocalizedName())) { + runningCostAcc += 0.5f; + fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT1.getCapacity(); + } else if (thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(STORAGE_FIELD2.getUnlocalizedName())) { + runningCostAcc += 1.0f; + fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT2.getCapacity(); + } else if (thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(STORAGE_FIELD3.getUnlocalizedName())) { + runningCostAcc += 2.0f; + fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT3.getCapacity(); + } else if (thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(STORAGE_FIELD4.getUnlocalizedName())) { + runningCostAcc += 4.0f; + fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT4.getCapacity(); + } else if (thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(STORAGE_FIELD5.getUnlocalizedName())) { + runningCostAcc += 8.0f; + fluidCapacityAcc += (float) Block_TFFTStorageFieldBlockT5.getCapacity(); + } else { + formationChecklist = false; + } + continue; + } + + // Get next TE + final IGregTechTileEntity currentTE = + thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); + + // Corner allows only glass + if (X == -2 && Y == -2 || X == 2 && Y == 2 || X == -2 && Y == 2 || X == 2 && Y == -2) { + if (!(thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(glassNameIC2Reinforced))) { + formationChecklist = false; + } + } else { + // Tries to add TE as either of those kinds of hatches. + // The number is the texture index number for the texture that needs to be painted over the + // hatch texture (TAE for GT++) + if (!super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) + && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + // Also check for multi hatch + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else if (!thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(glassNameIC2Reinforced)) { + formationChecklist = false; + } + } + } + } + } + } + + // Back segment + for (int X = -2; X <= 2; X++) { + for (int Y = -2; Y <= 2; Y++) { + // Get next TE + final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -8); + final IGregTechTileEntity currentTE = + thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); + + // Fluid hatches should touch the storage field. + // Maintenance/Energy hatch can go anywhere + if (X > -2 && X < 2 && Y > -2 && Y < 2) { + if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID) + && !addMultiHatchToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + formationChecklist = false; + } + } + } else { + if (!super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID) + && !super.addEnergyInputToMachineList(currentTE, CASING_TEXTURE_ID)) { + + // If it's not a hatch, is it the right casing for this machine? Check block and block meta. + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING) { + // Seems to be valid casing. Decrement counter. + minCasingAmount--; + } else { + formationChecklist = false; + } + } + } + } + } + + if (this.mEnergyHatches.size() < 1) { + formationChecklist = false; + } + + if (this.mMaintenanceHatches.size() != 1) { + formationChecklist = false; + } + + if (minCasingAmount > 0) { + formationChecklist = false; + } + + if (formationChecklist) { + runningCost = Math.round(-runningCostAcc); + // Update MultiFluidHandler in case storage cells have been changed + final int capacityPerFluid = (int) Math.round(fluidCapacityAcc / 25.0f); + if (mfh == null) { + mfh = MultiFluidHandler.newInstance(25, capacityPerFluid); + } else { + if (mfh.getCapacity() != capacityPerFluid) { + mfh = MultiFluidHandler.newAdjustedInstance(mfh, capacityPerFluid); + } + } + for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { + mh.setMultiFluidHandler(mfh); + } + } + + return formationChecklist; + } + + public boolean addMultiHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else if (aMetaTileEntity instanceof GTMTE_TFFTMultiHatch) { + ((GTMTE_TFFTMultiHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.sMultiHatches.add((GTMTE_TFFTMultiHatch) aMetaTileEntity); + } else { + return false; + } + } + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + doVoidExcess = !doVoidExcess; + GT_Utility.sendChatToPlayer(aPlayer, doVoidExcess ? "Auto-voiding enabled" : "Auto-voiding disabled"); + } + + @Override + public String[] getInfoData() { + final ArrayList<String> ll = mfh.getInfoData(); + + ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); + ll.add("Auto-voiding: " + doVoidExcess); + ll.add("Per-Fluid Capacity: " + mfh.getCapacity() + "L"); + ll.add("Running Cost: " + // mEUt does not naturally reflect efficiency status. Do that here. + + ((-super.mEUt) * 10000 / Math.max(1000, super.mEfficiency)) + "EU/t"); + ll.add("Maintenance Status: " + + ((super.getRepairStatus() == super.getIdealStatus()) + ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); + ll.add("---------------------------------------------"); + + final String[] a = new String[ll.size()]; + return ll.toArray(a); + } + + @Override + public void saveNBTData(NBTTagCompound nbt) { + nbt = (nbt == null) ? new NBTTagCompound() : nbt; + + nbt.setInteger("runningCost", runningCost); + nbt.setBoolean("doVoidExcess", doVoidExcess); + + nbt.setInteger("capacityPerFluid", mfh.getCapacity()); + nbt.setTag("fluids", mfh.saveNBTData(new NBTTagCompound())); + + super.saveNBTData(nbt); + } + + @Override + public void loadNBTData(NBTTagCompound nbt) { + nbt = (nbt == null) ? new NBTTagCompound() : nbt; + + runningCost = nbt.getInteger("runningCost"); + doVoidExcess = nbt.getBoolean("doVoidExcess"); + + mfh = MultiFluidHandler.loadNBTData(nbt); + for (GTMTE_TFFTMultiHatch mh : sMultiHatches) { + mh.setMultiFluidHandler(mfh); + } + super.loadNBTData(nbt); + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack var1) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack var1) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack var1) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack var1) { + return false; + } } diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index 0e0dea54d0..703217ba05 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -1,5 +1,13 @@ package common.tileentities; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static common.itemBlocks.IB_LapotronicEnergyUnit.*; +import static gregtech.api.enums.GT_HatchElement.Maintenance; +import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_StructureUtility.filterByMTEClass; +import static java.lang.Math.max; +import static java.lang.Math.min; + import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoTunnel; @@ -7,14 +15,10 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyTunnel; import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.StructureLibAPI; -import com.google.common.collect.ImmutableList; -import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; -import com.gtnewhorizon.structurelib.alignment.constructable.ConstructableUtility; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IItemSource; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult; @@ -35,6 +39,10 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; +import java.math.BigInteger; +import java.text.NumberFormat; +import java.util.*; +import java.util.function.Consumer; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -47,21 +55,9 @@ import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -import java.math.BigInteger; -import java.text.NumberFormat; -import java.util.*; -import java.util.function.Consumer; - -import static com.google.common.math.LongMath.pow; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static common.itemBlocks.IB_LapotronicEnergyUnit.*; -import static gregtech.api.enums.GT_HatchElement.Maintenance; -import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import static gregtech.api.util.GT_StructureUtility.filterByMTEClass; -import static java.lang.Math.max; -import static java.lang.Math.min; - -public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_LapotronicSuperCapacitor> implements IGlobalWirelessEnergy, ISurvivalConstructable { +public class GTMTE_LapotronicSuperCapacitor + extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_LapotronicSuperCapacitor> + implements IGlobalWirelessEnergy, ISurvivalConstructable { private enum TopState { MayBeTop, Top, @@ -89,7 +85,9 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu private final int minimalGlassTier; private final BigInteger providedCapacity; static final Capacitor[] VALUES = values(); - static final Capacitor[] VALUES_BY_TIER = Arrays.stream(values()).sorted(Comparator.comparingInt(Capacitor::getMinimalGlassTier)).toArray(Capacitor[]::new); + static final Capacitor[] VALUES_BY_TIER = Arrays.stream(values()) + .sorted(Comparator.comparingInt(Capacitor::getMinimalGlassTier)) + .toArray(Capacitor[]::new); Capacitor(int minimalGlassTier, BigInteger providedCapacity) { this.minimalGlassTier = minimalGlassTier; @@ -119,83 +117,179 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu private static final String STRUCTURE_PIECE_TOP = "top"; private static final String STRUCTURE_PIECE_MID = "mid"; - private static final Block LSC_PART = Blocks.lscLapotronicEnergyUnit; - private static final Item LSC_PART_ITEM = Item.getItemFromBlock(LSC_PART); - private static final int CASING_META = 0; - private static final int CASING_TEXTURE_ID = (42 << 7) | 127; + private static final Block LSC_PART = Blocks.lscLapotronicEnergyUnit; + private static final Item LSC_PART_ITEM = Item.getItemFromBlock(LSC_PART); + private static final int CASING_META = 0; + private static final int CASING_TEXTURE_ID = (42 << 7) | 127; private static final int DURATION_AVERAGE_TICKS = 100; // height channel for height. // glass channel for glass // capacitor channel for capacitor, but it really just pick whatever capacitor it can find in survival - private static final IStructureDefinition<GTMTE_LapotronicSuperCapacitor> STRUCTURE_DEFINITION = IStructureDefinition.<GTMTE_LapotronicSuperCapacitor>builder() - .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][]{ - {"bbbbb", "bbbbb", "bbbbb", "bbbbb", "bbbbb",}, - {"bb~bb", "bbbbb", "bbbbb", "bbbbb", "bbbbb",}, - })) - .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][]{ - {"ggggg", "gcccg", "gcccg", "gcccg", "ggggg",}, - })) - .addShape(STRUCTURE_PIECE_TOP, transpose(new String[][]{ - {"ggggg", "ggggg", "ggggg", "ggggg", "ggggg",}, - })) - .addShape(STRUCTURE_PIECE_MID, transpose(new String[][]{ - {"ggggg", "gCCCg", "gCCCg", "gCCCg", "ggggg",}, - })) - .addElement('b', buildHatchAdder(GTMTE_LapotronicSuperCapacitor.class) - .atLeast(LSCHatchElement.Energy, LSCHatchElement.Dynamo, Maintenance) - .hatchItemFilterAnd((t, h) -> ChannelDataAccessor.getChannelData(h, "glass") < 6 ? - filterByMTEClass(ImmutableList.of(GT_MetaTileEntity_Hatch_EnergyTunnel.class, GT_MetaTileEntity_Hatch_DynamoTunnel.class)).negate() : - s -> true) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain(onElementPass(te -> te.casingAmount++, ofBlock(LSC_PART, CASING_META))) - ) - .addElement('g', withChannel("glass", BorosilicateGlass.ofBoroGlass((byte) -1, (te, t) -> te.glassTier = t, te -> te.glassTier))) - .addElement('c', ofChain( - onlyIf(te -> te.topState != TopState.NotTop, onElementPass(te -> te.topState = TopState.Top, withChannel("glass", BorosilicateGlass.ofBoroGlass((byte) -1, (te, t) -> te.glassTier = t, te -> te.glassTier)))), - onlyIf(te -> te.topState != TopState.Top, onElementPass(te -> te.topState = TopState.NotTop, - new IStructureElement<GTMTE_LapotronicSuperCapacitor>() { - @Override - public boolean check(GTMTE_LapotronicSuperCapacitor t, World world, int x, int y, int z) { - Block worldBlock = world.getBlock(x, y, z); - int meta = worldBlock.getDamageValue(world, x, y, z); - if (LSC_PART != worldBlock || meta == 0) - return false; - t.capacitors[meta - 1]++; - return true; - } - - private int getHint(ItemStack stack) { - return Capacitor.VALUES_BY_TIER[Math.min(Capacitor.VALUES_BY_TIER.length, ChannelDataAccessor.getChannelData(stack, "capacitor")) - 1].getMinimalGlassTier() + 1; - } - - @Override - public boolean spawnHint(GTMTE_LapotronicSuperCapacitor t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, LSC_PART, getHint(trigger)); - return true; - } - - @Override - public boolean placeBlock(GTMTE_LapotronicSuperCapacitor t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, LSC_PART, getHint(trigger), 3); - return true; - } - - @Override - public PlaceResult survivalPlaceBlock(GTMTE_LapotronicSuperCapacitor t, World world, int x, int y, int z, ItemStack trigger, IItemSource source, EntityPlayerMP actor, Consumer<IChatComponent> chatter) { - if (check(t, world, x, y, z)) return PlaceResult.SKIP; - int glassTier = ChannelDataAccessor.getChannelData(trigger, "glass") + 2; - ItemStack targetStack = source.takeOne(s -> s != null && s.stackSize >= 0 && s.getItem() == LSC_PART_ITEM && Capacitor.VALUES[Math.min(s.getItemDamage(), Capacitor.VALUES.length) - 1].getMinimalGlassTier() > glassTier, true); - if (targetStack == null) return PlaceResult.REJECT; - return StructureUtility.survivalPlaceBlock(targetStack, NBTMode.EXACT, targetStack.stackTagCompound, true, world, x, y, z, source, actor, chatter); - } - } - )) - )) - .addElement('C', ofBlock(LSC_PART, 1)) - .build(); + private static final IStructureDefinition<GTMTE_LapotronicSuperCapacitor> STRUCTURE_DEFINITION = + IStructureDefinition.<GTMTE_LapotronicSuperCapacitor>builder() + .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][] { + { + "bbbbb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", + }, + { + "bb~bb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", + }, + })) + .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][] { + { + "ggggg", "gcccg", "gcccg", "gcccg", "ggggg", + }, + })) + .addShape(STRUCTURE_PIECE_TOP, transpose(new String[][] { + { + "ggggg", "ggggg", "ggggg", "ggggg", "ggggg", + }, + })) + .addShape(STRUCTURE_PIECE_MID, transpose(new String[][] { + { + "ggggg", "gCCCg", "gCCCg", "gCCCg", "ggggg", + }, + })) + .addElement( + 'b', + buildHatchAdder(GTMTE_LapotronicSuperCapacitor.class) + .atLeast(LSCHatchElement.Energy, LSCHatchElement.Dynamo, Maintenance) + .hatchItemFilterAnd((t, h) -> ChannelDataAccessor.getChannelData(h, "glass") < 6 + ? filterByMTEClass(ImmutableList.of( + GT_MetaTileEntity_Hatch_EnergyTunnel.class, + GT_MetaTileEntity_Hatch_DynamoTunnel.class)) + .negate() + : s -> true) + .casingIndex(CASING_TEXTURE_ID) + .dot(1) + .buildAndChain( + onElementPass(te -> te.casingAmount++, ofBlock(LSC_PART, CASING_META)))) + .addElement( + 'g', + withChannel( + "glass", + BorosilicateGlass.ofBoroGlass( + (byte) -1, (te, t) -> te.glassTier = t, te -> te.glassTier))) + .addElement( + 'c', + ofChain( + onlyIf( + te -> te.topState != TopState.NotTop, + onElementPass( + te -> te.topState = TopState.Top, + withChannel( + "glass", + BorosilicateGlass.ofBoroGlass( + (byte) -1, + (te, t) -> te.glassTier = t, + te -> te.glassTier)))), + onlyIf( + te -> te.topState != TopState.Top, + onElementPass( + te -> te.topState = TopState.NotTop, + new IStructureElement<GTMTE_LapotronicSuperCapacitor>() { + @Override + public boolean check( + GTMTE_LapotronicSuperCapacitor t, + World world, + int x, + int y, + int z) { + Block worldBlock = world.getBlock(x, y, z); + int meta = worldBlock.getDamageValue(world, x, y, z); + if (LSC_PART != worldBlock || meta == 0) return false; + t.capacitors[meta - 1]++; + return true; + } + + private int getHint(ItemStack stack) { + return Capacitor.VALUES_BY_TIER[ + Math.min( + Capacitor.VALUES_BY_TIER + .length, + ChannelDataAccessor + .getChannelData( + stack, + "capacitor")) + - 1] + .getMinimalGlassTier() + + 1; + } + + @Override + public boolean spawnHint( + GTMTE_LapotronicSuperCapacitor t, + World world, + int x, + int y, + int z, + ItemStack trigger) { + StructureLibAPI.hintParticle( + world, x, y, z, LSC_PART, getHint(trigger)); + return true; + } + + @Override + public boolean placeBlock( + GTMTE_LapotronicSuperCapacitor t, + World world, + int x, + int y, + int z, + ItemStack trigger) { + world.setBlock(x, y, z, LSC_PART, getHint(trigger), 3); + return true; + } + + @Override + public PlaceResult survivalPlaceBlock( + GTMTE_LapotronicSuperCapacitor t, + World world, + int x, + int y, + int z, + ItemStack trigger, + IItemSource source, + EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { + if (check(t, world, x, y, z)) return PlaceResult.SKIP; + int glassTier = + ChannelDataAccessor.getChannelData(trigger, "glass") + + 2; + ItemStack targetStack = source.takeOne( + s -> s != null + && s.stackSize >= 0 + && s.getItem() == LSC_PART_ITEM + && Capacitor.VALUES[ + Math.min( + s + .getItemDamage(), + Capacitor + .VALUES + .length) + - 1] + .getMinimalGlassTier() + > glassTier, + true); + if (targetStack == null) return PlaceResult.REJECT; + return StructureUtility.survivalPlaceBlock( + targetStack, + NBTMode.EXACT, + targetStack.stackTagCompound, + true, + world, + x, + y, + z, + source, + actor, + chatter); + } + })))) + .addElement('C', ofBlock(LSC_PART, 1)) + .build(); private static final BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE); @@ -208,6 +302,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu * Index = meta - 1 */ private final int[] capacitors = new int[7]; + private BigInteger capacity = BigInteger.ZERO; private BigInteger stored = BigInteger.ZERO; private long passiveDischargeAmount = 0; @@ -261,7 +356,8 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch)) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return GTMTE_LapotronicSuperCapacitor.this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + return GTMTE_LapotronicSuperCapacitor.this.mMaintenanceHatches.add( + (GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { // Add GT hatches final GT_MetaTileEntity_Hatch_Energy tHatch = ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); @@ -269,7 +365,8 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu return mEnergyHatches.add(tHatch); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyTunnel) { // Add TT Laser hatches - final GT_MetaTileEntity_Hatch_EnergyTunnel tHatch = ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity); + final GT_MetaTileEntity_Hatch_EnergyTunnel tHatch = + ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity); processInputHatch(tHatch, aBaseCasingIndex); return mEnergyTunnelsTT.add(tHatch); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { @@ -304,55 +401,81 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Energy Storage") - .addInfo("Loses energy equal to 1% of the total capacity every 24 hours. Capped") - .addInfo("at " + EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY + "EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + " capacitor.") - .addInfo("Passive loss is multiplied by the number of maintenance issues present.") - .addSeparator() - .addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.") - .addInfo(GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + "-tier glass required for " + EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.GRAY + " Laser Hatches.") - .addInfo("Add more or better capacitors to increase capacity.") - .addSeparator() - .addInfo("Wireless mode can be enabled by right clicking with a screwdriver.") - .addInfo("This mode can only be enabled if you have a "+ GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + " capacitor in the multiblock.") - .addInfo("When enabled every " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") - .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "EU in the LSC") - .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") - .addInfo("the EU to the network and remove it from the LSC.") - .addSeparator() - .beginVariableStructureBlock(5, 5, 4, 18, 5, 5, false) - .addStructureInfo("Modular height of 4-18 blocks.") - .addController("Front center bottom") - .addOtherStructurePart("Lapotronic Super Capacitor Casing", "5x2x5 base (at least 17x)") - .addOtherStructurePart("Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + GT_Values.VN[4] + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + "), Ultimate Capacitor (" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")", "Center 3x(1-15)x3 above base (9-135 blocks)") - .addStructureInfo("You can also use the Empty Capacitor to save materials if you use it for less than half the blocks") - .addOtherStructurePart("Borosilicate Glass (any)", "41-265x, Encase capacitor pillar") - .addEnergyHatch("Any casing") - .addDynamoHatch("Any casing") - .addOtherStructurePart("Laser Target/Source Hatches", "Any casing, must be using " + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + "-tier glass") - .addStructureInfo("You can have several I/O Hatches") - .addSubChannelUsage("glass", "Borosilicate Glass Tier") - .addSubChannelUsage("capacitor", "Maximum Capacitor Tier") - .addSubChannelUsage("height", "Height of structure") - .addMaintenanceHatch("Any casing") - .toolTipFinisher("KekzTech"); + .addInfo("Loses energy equal to 1% of the total capacity every 24 hours. Capped") + .addInfo("at " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY + + "EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + " capacitor.") + .addInfo("Passive loss is multiplied by the number of maintenance issues present.") + .addSeparator() + .addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.") + .addInfo(GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + + "-tier glass required for " + EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + + "Tech" + EnumChatFormatting.GRAY + " Laser Hatches.") + .addInfo("Add more or better capacitors to increase capacity.") + .addSeparator() + .addInfo("Wireless mode can be enabled by right clicking with a screwdriver.") + .addInfo("This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + " capacitor in the multiblock.") + .addInfo("When enabled every " + EnumChatFormatting.BLUE + + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") + .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "EU in the LSC") + .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") + .addInfo("the EU to the network and remove it from the LSC.") + .addSeparator() + .beginVariableStructureBlock(5, 5, 4, 18, 5, 5, false) + .addStructureInfo("Modular height of 4-18 blocks.") + .addController("Front center bottom") + .addOtherStructurePart("Lapotronic Super Capacitor Casing", "5x2x5 base (at least 17x)") + .addOtherStructurePart( + "Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + GT_Values.VN[4] + EnumChatFormatting.GRAY + + "-" + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + + "), Ultimate Capacitor (" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + ")", + "Center 3x(1-15)x3 above base (9-135 blocks)") + .addStructureInfo( + "You can also use the Empty Capacitor to save materials if you use it for less than half the blocks") + .addOtherStructurePart("Borosilicate Glass (any)", "41-265x, Encase capacitor pillar") + .addEnergyHatch("Any casing") + .addDynamoHatch("Any casing") + .addOtherStructurePart( + "Laser Target/Source Hatches", + "Any casing, must be using " + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + + EnumChatFormatting.GRAY + "-tier glass") + .addStructureInfo("You can have several I/O Hatches") + .addSubChannelUsage("glass", "Borosilicate Glass Tier") + .addSubChannelUsage("capacitor", "Maximum Capacitor Tier") + .addSubChannelUsage("height", "Height of structure") + .addMaintenanceHatch("Any casing") + .toolTipFinisher("KekzTech"); return tt; } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - ITexture[] sTexture = new ITexture[]{TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + ITexture[] sTexture = new ITexture[] { + TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) + }; if (aSide == aFacing && aActive) { - sTexture = new ITexture[]{TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, - Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + sTexture = new ITexture[] { + TextureFactory.of( + BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) + }; } return sTexture; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "MultiblockDisplay.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); } private String global_energy_user_uuid; @@ -402,20 +525,16 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu mMaxEUIn = 0; mMaxEUOut = 0; - if (!checkPiece(STRUCTURE_PIECE_BASE, 2, 1, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_BASE, 2, 1, 0)) return false; topState = TopState.NotTop; // need at least one layer of capacitor to form, obviously int layer = 2; while (true) { - if (!checkPiece(STRUCTURE_PIECE_LAYER, 2, layer, 0)) - return false; - layer ++; - if (topState == TopState.Top) - break; // top found, break out + if (!checkPiece(STRUCTURE_PIECE_LAYER, 2, layer, 0)) return false; + layer++; + if (topState == TopState.Top) break; // top found, break out topState = TopState.MayBeTop; - if (layer > 18) - return false; // too many layers + if (layer > 18) return false; // too many layers } // Make sure glass tier is T-2 of the highest tier capacitor in the structure @@ -424,25 +543,28 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu for (int highestGlassTier = capacitors.length - 1; highestGlassTier >= 0; highestGlassTier--) { int highestCapacitor = Capacitor.getIndexFromGlassTier(highestGlassTier); if (capacitors[highestCapacitor] > 0) { - if (Capacitor.VALUES[highestCapacitor].getMinimalGlassTier() > glassTier) - return false; + if (Capacitor.VALUES[highestCapacitor].getMinimalGlassTier() > glassTier) return false; break; } } // Glass has to be at least UV-tier to allow TT Laser hatches if (glassTier < 8) { - if(mEnergyTunnelsTT.size() > 0 || mDynamoTunnelsTT.size() > 0) - return false; + if (mEnergyTunnelsTT.size() > 0 || mDynamoTunnelsTT.size() > 0) return false; } - //Check if enough (more than 50%) non-empty caps - if (capacitors[5] > capacitors[0] + capacitors[1] + capacitors[2] + capacitors[3] + getUHVCapacitorCount() + capacitors[6]) - return false; + // Check if enough (more than 50%) non-empty caps + if (capacitors[5] + > capacitors[0] + + capacitors[1] + + capacitors[2] + + capacitors[3] + + getUHVCapacitorCount() + + capacitors[6]) return false; // Calculate total capacity capacity = BigInteger.ZERO; - for(int i = 0; i < capacitors.length; i++) { + for (int i = 0; i < capacitors.length; i++) { int count = capacitors[i]; capacity = capacity.add(Capacitor.VALUES[i].getProvidedCapacity().multiply(BigInteger.valueOf(count))); } @@ -455,8 +577,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu public void construct(ItemStack stackSize, boolean hintsOnly) { int layer = min(stackSize.stackSize + 3, 18); buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 2, 1, 0); - for (int i = 2; i < layer - 1; i++) - buildPiece(STRUCTURE_PIECE_MID, stackSize, hintsOnly, 2, i, 0); + for (int i = 2; i < layer - 1; i++) buildPiece(STRUCTURE_PIECE_MID, stackSize, hintsOnly, 2, i, 0); buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, layer - 1, 0); } @@ -465,16 +586,19 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu if (mMachine) return -1; int layer = Math.min(ChannelDataAccessor.getChannelData(stackSize, "height") + 3, 18); int built; - built = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 2, 1, 0, elementBudget, source, actor, false, true); + built = survivialBuildPiece( + STRUCTURE_PIECE_BASE, stackSize, 2, 1, 0, elementBudget, source, actor, false, true); if (built >= 0) return built; for (int i = 2; i < layer - 1; i++) - built = survivialBuildPiece(STRUCTURE_PIECE_MID, stackSize, 2, i, 0, elementBudget, source, actor, false, true); + built = survivialBuildPiece( + STRUCTURE_PIECE_MID, stackSize, 2, i, 0, elementBudget, source, actor, false, true); if (built >= 0) return built; - return survivialBuildPiece(STRUCTURE_PIECE_TOP, stackSize, 2, layer - 1, 0, elementBudget, source, actor, false, true); + return survivialBuildPiece( + STRUCTURE_PIECE_TOP, stackSize, 2, layer - 1, 0, elementBudget, source, actor, false, true); } @Override - public boolean onRunningTick(ItemStack stack){ + public boolean onRunningTick(ItemStack stack) { // Reset I/O cache inputLastTick = 0; outputLastTick = 0; @@ -482,12 +606,12 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu long temp_stored = 0L; // Draw energy from GT hatches - for(GT_MetaTileEntity_Hatch_Energy eHatch : super.mEnergyHatches) { - if(eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { + for (GT_MetaTileEntity_Hatch_Energy eHatch : super.mEnergyHatches) { + if (eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long power = getPowerToDraw(eHatch.maxEUInput() * eHatch.maxAmperesIn()); - if(eHatch.getEUVar() >= power) { + if (eHatch.getEUVar() >= power) { eHatch.setEUVar(eHatch.getEUVar() - power); temp_stored += power; inputLastTick += power; @@ -495,12 +619,12 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } // Output energy to GT hatches - for(GT_MetaTileEntity_Hatch_Dynamo eDynamo : super.mDynamoHatches){ - if(eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()){ + for (GT_MetaTileEntity_Hatch_Dynamo eDynamo : super.mDynamoHatches) { + if (eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long power = getPowerToPush(eDynamo.maxEUOutput() * eDynamo.maxAmperesOut()); - if(power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { + if (power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { eDynamo.setEUVar(eDynamo.getEUVar() + power); temp_stored -= power; outputLastTick += power; @@ -508,12 +632,12 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } // Draw energy from TT hatches - for(GT_MetaTileEntity_Hatch_EnergyMulti eHatch : mEnergyHatchesTT) { - if(eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { + for (GT_MetaTileEntity_Hatch_EnergyMulti eHatch : mEnergyHatchesTT) { + if (eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long power = getPowerToDraw(eHatch.maxEUInput() * eHatch.maxAmperesIn()); - if(eHatch.getEUVar() >= power) { + if (eHatch.getEUVar() >= power) { eHatch.setEUVar(eHatch.getEUVar() - power); temp_stored += power; inputLastTick += power; @@ -521,12 +645,12 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } // Output energy to TT hatches - for(GT_MetaTileEntity_Hatch_DynamoMulti eDynamo : mDynamoHatchesTT) { - if(eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()){ + for (GT_MetaTileEntity_Hatch_DynamoMulti eDynamo : mDynamoHatchesTT) { + if (eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long power = getPowerToPush(eDynamo.maxEUOutput() * eDynamo.maxAmperesOut()); - if(power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { + if (power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { eDynamo.setEUVar(eDynamo.getEUVar() + power); temp_stored -= power; outputLastTick += power; @@ -534,13 +658,13 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } // Draw energy from TT Laser hatches - for(GT_MetaTileEntity_Hatch_EnergyTunnel eHatch : mEnergyTunnelsTT) { - if(eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { + for (GT_MetaTileEntity_Hatch_EnergyTunnel eHatch : mEnergyTunnelsTT) { + if (eHatch == null || eHatch.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long ttLaserWattage = eHatch.maxEUInput() * eHatch.Amperes - (eHatch.Amperes / 20); final long power = getPowerToDraw(ttLaserWattage); - if(eHatch.getEUVar() >= power) { + if (eHatch.getEUVar() >= power) { eHatch.setEUVar(eHatch.getEUVar() - power); temp_stored += power; inputLastTick += power; @@ -548,13 +672,13 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } // Output energy to TT Laser hatches - for(GT_MetaTileEntity_Hatch_DynamoTunnel eDynamo : mDynamoTunnelsTT) { - if(eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()){ + for (GT_MetaTileEntity_Hatch_DynamoTunnel eDynamo : mDynamoTunnelsTT) { + if (eDynamo == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } final long ttLaserWattage = eDynamo.maxEUOutput() * eDynamo.Amperes - (eDynamo.Amperes / 20); final long power = getPowerToPush(ttLaserWattage); - if(power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { + if (power <= eDynamo.maxEUStore() - eDynamo.getEUVar()) { eDynamo.setEUVar(eDynamo.getEUVar() + power); temp_stored -= power; outputLastTick += power; @@ -573,7 +697,8 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu counter = 1; // Find difference. - BigInteger transferred_eu = stored.subtract(LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))); + BigInteger transferred_eu = + stored.subtract(LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))); if (transferred_eu.signum() == 1) { inputLastTick += transferred_eu.longValue(); @@ -590,7 +715,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu // Lose some energy. // Re-calculate if the repair status changed. - if(super.getRepairStatus() != repairStatusCache) { + if (super.getRepairStatus() != repairStatusCache) { passiveDischargeAmount = recalculateLossWithMaintenance(super.getRepairStatus()); } @@ -603,16 +728,16 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu IGregTechTileEntity tBMTE = this.getBaseMetaTileEntity(); - tBMTE.injectEnergyUnits((byte)ForgeDirection.UNKNOWN.ordinal(), inputLastTick, 1L); - tBMTE.drainEnergyUnits((byte)ForgeDirection.UNKNOWN.ordinal(), outputLastTick, 1L); + tBMTE.injectEnergyUnits((byte) ForgeDirection.UNKNOWN.ordinal(), inputLastTick, 1L); + tBMTE.drainEnergyUnits((byte) ForgeDirection.UNKNOWN.ordinal(), outputLastTick, 1L); - //Add I/O values to Queues - if(energyInputValues.size() > DURATION_AVERAGE_TICKS){ + // Add I/O values to Queues + if (energyInputValues.size() > DURATION_AVERAGE_TICKS) { energyInputValues.remove(); } energyInputValues.offer(inputLastTick); - if(energyOutputValues.size() > DURATION_AVERAGE_TICKS){ + if (energyOutputValues.size() > DURATION_AVERAGE_TICKS) { energyOutputValues.remove(); } @@ -631,15 +756,19 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu repairStatusCache = repairStatus; // This cannot overflow because there is a 135 capacitor maximum per LSC. - long temp_capacity_divided = capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue(); + long temp_capacity_divided = + capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue(); - // Passive loss is multiplied by number of UHV caps. Minimum of 1 otherwise loss is 0 for non-UHV caps calculations. - long uhv_cap_multiplier = min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount())); + // Passive loss is multiplied by number of UHV caps. Minimum of 1 otherwise loss is 0 for non-UHV caps + // calculations. + long uhv_cap_multiplier = + min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount())); // Passive loss is multiplied by number of maintenance issues. long total_passive_loss = uhv_cap_multiplier * (getIdealStatus() - repairStatus + 1); - // Maximum of 100,000 EU/t drained per UHV cell. The logic is 1% of EU capacity should be drained every 86400 seconds (1 day). + // Maximum of 100,000 EU/t drained per UHV cell. The logic is 1% of EU capacity should be drained every 86400 + // seconds (1 day). return total_passive_loss; } @@ -649,7 +778,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu * Hatch amperage * voltage * @return EU amount */ - private long getPowerToDraw(long hatchWatts){ + private long getPowerToDraw(long hatchWatts) { final BigInteger remcapActual = capacity.subtract(stored); final BigInteger recampLimited = (MAX_LONG.compareTo(remcapActual) > 0) ? remcapActual : MAX_LONG; return min(hatchWatts, recampLimited.longValue()); @@ -661,22 +790,22 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu * Hatch amperage * voltage * @return EU amount */ - private long getPowerToPush(long hatchWatts){ + private long getPowerToPush(long hatchWatts) { final BigInteger remStoredLimited = (MAX_LONG.compareTo(stored) > 0) ? stored : MAX_LONG; return min(hatchWatts, remStoredLimited.longValue()); } - private long getAvgIn(){ + private long getAvgIn() { long sum = 0L; - for(long l: energyInputValues){ + for (long l : energyInputValues) { sum += l; } return sum / Math.max(energyInputValues.size(), 1); } - private long getAvgOut(){ + private long getAvgOut() { long sum = 0L; - for(long l: energyOutputValues){ + for (long l : energyOutputValues) { sum += l; } return sum / Math.max(energyOutputValues.size(), 1); @@ -685,7 +814,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu @Override public String[] getInfoData() { NumberFormat nf = NumberFormat.getNumberInstance(); - int secInterval = DURATION_AVERAGE_TICKS/20; + int secInterval = DURATION_AVERAGE_TICKS / 20; final ArrayList<String> ll = new ArrayList<>(); ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); @@ -696,14 +825,18 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu ll.add("EU OUT: " + GT_Utility.formatNumbers(outputLastTick) + "EU/t"); ll.add("Avg EU IN: " + nf.format(getAvgIn()) + " (last " + secInterval + " seconds)"); ll.add("Avg EU OUT: " + nf.format(getAvgOut()) + " (last " + secInterval + " seconds)"); - ll.add("Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) - ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); - ll.add("Wireless mode: " + (wireless_mode - ? EnumChatFormatting.GREEN + "enabled" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "disabled" + EnumChatFormatting.RESET)); - ll.add(GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " Capacitors detected: " + getUHVCapacitorCount()); - ll.add("Total wireless EU: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid))); + ll.add("Maintenance Status: " + + ((super.getRepairStatus() == super.getIdealStatus()) + ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); + ll.add("Wireless mode: " + + (wireless_mode + ? EnumChatFormatting.GREEN + "enabled" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "disabled" + EnumChatFormatting.RESET)); + ll.add(GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " Capacitors detected: " + + getUHVCapacitorCount()); + ll.add("Total wireless EU: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid))); ll.add("---------------------------------------------"); final String[] a = new String[ll.size()]; @@ -738,67 +871,67 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu } @Override - public int getMaxEfficiency(ItemStack stack) { return 10000; } + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } @Override - public int getPollutionPerTick(ItemStack stack) { return 0; } + public int getPollutionPerTick(ItemStack stack) { + return 0; + } @Override - public int getDamageToComponent(ItemStack stack) { return 0; } + public int getDamageToComponent(ItemStack stack) { + return 0; + } @Override - public boolean explodesOnComponentBreak(ItemStack stack) { return false; } + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } - //called by the getEUCapacity() function in BaseMetaTileEntity + // called by the getEUCapacity() function in BaseMetaTileEntity @Override - public long maxEUStore() - { + public long maxEUStore() { return capacity.longValue(); } - //called by the getEUStored() function in BaseMetaTileEntity + // called by the getEUStored() function in BaseMetaTileEntity @Override - public long getEUVar() - { + public long getEUVar() { return stored.longValue(); } /* all of these are needed for the injectEnergyUnits() and drainEnergyUnits() - in IGregTechTileEntity - */ + in IGregTechTileEntity + */ @Override - public long maxEUInput() - { + public long maxEUInput() { return mMaxEUIn; } @Override - public long maxAmperesIn() - { + public long maxAmperesIn() { return 1L; } @Override - public long maxEUOutput() - { + public long maxEUOutput() { return mMaxEUOut; } @Override - public long maxAmperesOut() - { + public long maxAmperesOut() { return 1L; } @Override - public boolean isEnetInput() - { + public boolean isEnetInput() { return true; } @Override - public boolean isEnetOutput() - { + public boolean isEnetOutput() { return true; } @@ -808,7 +941,10 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMu wireless_mode = !wireless_mode; GT_Utility.sendChatToPlayer(aPlayer, "Wireless network mode " + (wireless_mode ? "enabled." : "disabled.")); } else { - GT_Utility.sendChatToPlayer(aPlayer, "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " capacitor."); + GT_Utility.sendChatToPlayer( + aPlayer, + "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.RESET + " capacitor."); wireless_mode = false; } } diff --git a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java index ec720b9354..67aaf2a0f9 100644 --- a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java +++ b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java @@ -1,245 +1,249 @@ -package common.tileentities;
-
-import org.joml.Vector3i;
-import org.lwjgl.input.Keyboard;
-
-import client.gui.GUIContainer_ModularNuclearReactor;
-import common.Blocks;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.objects.GT_RenderedTexture;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-
-public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase {
-
- private final Block CASING = GregTech_API.sBlockCasings3;
- private final int CASING_META = 12;
- private final int CASING_TEXTURE_ID = 44;
-
- private final Block CHAMBER_OFF = Blocks.reactorChamberOFF;
- private final Block CHAMBER_ON = Blocks.reactorChamberON;
- private final Block CONTROL_ROD = Blocks.reactorControlRod;
-
- private boolean euMode = true;
-
- public GTMTE_ModularNuclearReactor(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
-
- }
-
- public GTMTE_ModularNuclearReactor(String aName) {
- super(aName);
-
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
- return new GTMTE_ModularNuclearReactor(super.mName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[]{"Disabled"};
- /*
- final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder();
- b.addInfo("Can be built, BUT DOES NOT WORK")
- .addInfo("Converts fissile material and outputs power or heat")
- .addSeparator()
- .addInfo("EU-MODE:")
- .addInfo(" Directly outputs electricity depending on inserted fuel rods")
- .addSeparator()
- .addInfo("COOLANT-MODE:")
- .addInfo(" Requires coolant to be pumped into the reactor.")
- .addInfo(" Coolant is heated and should be drained and converted to electricity by other means.")
- .addSeparator()
- .addInfo("NOTES:")
- .addInfo(" Does NOT use Industrialcraft 2 reactor components!")
- .addInfo(" Consult controller GUI on how to arrange the outer casings.")
- .addSeparator()
- .beginStructureBlock(7, 6, 7)
- .addController("Front bottom Center")
- .addCasingInfo("Radiation Proof Machine Casing", 100)
- .addOtherStructurePart("Control Rods", "Four pillars, four blocks high each. Diagonal to the inner edges of the shell")
- .addOtherStructurePart("Nuclear Reactor Chamber", "17 of them to fill out the rest of the floor inside the shell")
- .addDynamoHatch("ONLY in EU-mode, at least one")
- .addOtherStructurePart("Input Bus, Output Bus", "Optional but required for automation")
- .addOtherStructurePart("Input Hatch, Output Hatch", "ONLY in Coolant-Mode, at least one each")
- .signAndFinalize("Kekzdealer");
- if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
- return b.getInformation();
- } else {
- return b.getStructureInformation();
- }*/
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
- final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- return aSide == aFacing
- ? new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
- new GT_RenderedTexture(aActive ?
- Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
- : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
- : new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
- }
-
- // TODO: Opening UI crashes server. Controller isn't craftable right now.
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- /*return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
- "MultiblockDisplay.png");*/
- return new GUIContainer_ModularNuclearReactor(aBaseMetaTileEntity, aPlayerInventory.player);
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack stack) {
- return true;
- }
-
- @Override
- public boolean checkRecipe(ItemStack stack) {
- return false;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity thisController, long aTick) {
- super.onPostTick(thisController, aTick);
-
- if(super.getBaseMetaTileEntity().isActive()) {
- // Switch to ON blocks
- } else {
- // Switch to OFF blocks
- }
- }
-
- @Override
- public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) {
- // Figure out the vector for the direction the back face of the controller is facing
- final int dirX = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX;
- final int dirZ = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ;
- int minCasingAmount = 100;
- boolean checklist = true; // if this is still true at the end, machine is good to go :)
-
- // Determine the ground level center of the structure
- final Vector3i center = new Vector3i(
- thisController.getXCoord(),
- thisController.getYCoord(),
- thisController.getZCoord())
- .add(dirX * 3, 0, dirZ * 3);
- // Scan for outer tube
- // - Scan sides
- for(int x = -3; x <= 3; x++) {
- for(int z = -3; z <= 3; z++) {
- // Only scan the three wide even sides, skip rest
- if((Math.abs(x) <= 1 && Math.abs(z) == 3) || (Math.abs(z) <= 1 && Math.abs(x) == 3)) {
- for(int h = 0; h < 6; h++) {
- final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z);
- if(h == 0 && pos.x() == thisController.getXCoord() && pos.y() == thisController.getYCoord() && pos.z() == thisController.getZCoord()) {
- // Ignore controller
- continue;
- } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING
- && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) {
- minCasingAmount--;
- } else {
- checklist = false;
- }
- }
- }
- }
- }
- // - Scan corners of tube
- for(int x = -2; x <= 2; x++) {
- for(int z = -2; z <= 2; z++) {
- // Only scan the four corners, skip rest
- if(Math.abs(x) + Math.abs(z) == 4) {
- for(int h = 0; h < 6; h++) {
- final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z);
- if(h == 0 && pos.x() == thisController.getXCoord() && pos.y() == thisController.getYCoord() && pos.z() == thisController.getZCoord()) {
- // Ignore controller
- continue;
- } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING
- && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) {
- minCasingAmount--;
- } else {
- checklist = false;
- }
- }
- }
- }
- }
- // Scan ground layer
- for(int x = -2; x <= 2; x++) {
- for(int z = -2; z <= 2; z++) {
- if(!(thisController.getBlock(center.x() + x, center.y(), center.z() + z) == CASING
- && thisController.getMetaID(center.x() + x, center.y(), center.z() + z) == CASING_META)) {
- checklist = false;
- } else {
- minCasingAmount--;
- }
- }
- }
- // Scan reactor chambers
- for(int x = -2; x <= 2; x++) {
- for(int z = -2; z <= 2; z++) {
- // Skip if diagonal, don't skip center
- if(Math.abs(x) == Math.abs(z) && !(x == 0 && z == 0)) {
- continue;
- }
- if(!(thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_OFF
- || thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_ON)) {
- checklist = false;
- }
- }
- }
- // Scan control rods
- for(int h = 1; h < 5; h++) {
- for(int x = -1; x <= 1; x++) {
- for(int z = -1; z <= 1; z++) {
- // Only check diagonal
- if(x == 0 || z == 0) {
- continue;
- }
- if(!(thisController.getBlock(center.x() + x, center.y() + h, center.z() + z) == CONTROL_ROD)) {
- checklist = false;
- }
- }
- }
- }
-
-
-
-
- if(minCasingAmount > 0) {
- checklist = false;
- }
-
- return checklist;
- }
-
- @Override
- public int getMaxEfficiency(ItemStack stack) {
- return 10000;
- }
-
- @Override
- public int getPollutionPerTick(ItemStack stack) {
- return 0;
- }
-
- @Override
- public int getDamageToComponent(ItemStack stack) {
- return 0;
- }
-
- @Override
- public boolean explodesOnComponentBreak(ItemStack stack) {
- return false;
- }
-
-}
+package common.tileentities; + +import client.gui.GUIContainer_ModularNuclearReactor; +import common.Blocks; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import org.joml.Vector3i; + +public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase { + + private final Block CASING = GregTech_API.sBlockCasings3; + private final int CASING_META = 12; + private final int CASING_TEXTURE_ID = 44; + + private final Block CHAMBER_OFF = Blocks.reactorChamberOFF; + private final Block CHAMBER_ON = Blocks.reactorChamberON; + private final Block CONTROL_ROD = Blocks.reactorControlRod; + + private boolean euMode = true; + + public GTMTE_ModularNuclearReactor(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GTMTE_ModularNuclearReactor(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { + return new GTMTE_ModularNuclearReactor(super.mName); + } + + @Override + public String[] getDescription() { + return new String[] {"Disabled"}; + /* + final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); + b.addInfo("Can be built, BUT DOES NOT WORK") + .addInfo("Converts fissile material and outputs power or heat") + .addSeparator() + .addInfo("EU-MODE:") + .addInfo(" Directly outputs electricity depending on inserted fuel rods") + .addSeparator() + .addInfo("COOLANT-MODE:") + .addInfo(" Requires coolant to be pumped into the reactor.") + .addInfo(" Coolant is heated and should be drained and converted to electricity by other means.") + .addSeparator() + .addInfo("NOTES:") + .addInfo(" Does NOT use Industrialcraft 2 reactor components!") + .addInfo(" Consult controller GUI on how to arrange the outer casings.") + .addSeparator() + .beginStructureBlock(7, 6, 7) + .addController("Front bottom Center") + .addCasingInfo("Radiation Proof Machine Casing", 100) + .addOtherStructurePart("Control Rods", "Four pillars, four blocks high each. Diagonal to the inner edges of the shell") + .addOtherStructurePart("Nuclear Reactor Chamber", "17 of them to fill out the rest of the floor inside the shell") + .addDynamoHatch("ONLY in EU-mode, at least one") + .addOtherStructurePart("Input Bus, Output Bus", "Optional but required for automation") + .addOtherStructurePart("Input Hatch, Output Hatch", "ONLY in Coolant-Mode, at least one each") + .signAndFinalize("Kekzdealer"); + if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return b.getInformation(); + } else { + return b.getStructureInformation(); + }*/ + } + + @Override + public ITexture[] getTexture( + final IGregTechTileEntity aBaseMetaTileEntity, + final byte aSide, + final byte aFacing, + final byte aColorIndex, + final boolean aActive, + final boolean aRedstone) { + return aSide == aFacing + ? new ITexture[] { + Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + new GT_RenderedTexture( + aActive + ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE + : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER) + } + : new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + } + + // TODO: Opening UI crashes server. Controller isn't craftable right now. + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + /*return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), + "MultiblockDisplay.png");*/ + return new GUIContainer_ModularNuclearReactor(aBaseMetaTileEntity, aPlayerInventory.player); + } + + @Override + public boolean isCorrectMachinePart(ItemStack stack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack stack) { + return false; + } + + @Override + public void onPostTick(IGregTechTileEntity thisController, long aTick) { + super.onPostTick(thisController, aTick); + + if (super.getBaseMetaTileEntity().isActive()) { + // Switch to ON blocks + } else { + // Switch to OFF blocks + } + } + + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + // Figure out the vector for the direction the back face of the controller is facing + final int dirX = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX; + final int dirZ = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ; + int minCasingAmount = 100; + boolean checklist = true; // if this is still true at the end, machine is good to go :) + + // Determine the ground level center of the structure + final Vector3i center = new Vector3i( + thisController.getXCoord(), thisController.getYCoord(), thisController.getZCoord()) + .add(dirX * 3, 0, dirZ * 3); + // Scan for outer tube + // - Scan sides + for (int x = -3; x <= 3; x++) { + for (int z = -3; z <= 3; z++) { + // Only scan the three wide even sides, skip rest + if ((Math.abs(x) <= 1 && Math.abs(z) == 3) || (Math.abs(z) <= 1 && Math.abs(x) == 3)) { + for (int h = 0; h < 6; h++) { + final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); + if (h == 0 + && pos.x() == thisController.getXCoord() + && pos.y() == thisController.getYCoord() + && pos.z() == thisController.getZCoord()) { + // Ignore controller + continue; + } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING + && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { + minCasingAmount--; + } else { + checklist = false; + } + } + } + } + } + // - Scan corners of tube + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + // Only scan the four corners, skip rest + if (Math.abs(x) + Math.abs(z) == 4) { + for (int h = 0; h < 6; h++) { + final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); + if (h == 0 + && pos.x() == thisController.getXCoord() + && pos.y() == thisController.getYCoord() + && pos.z() == thisController.getZCoord()) { + // Ignore controller + continue; + } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING + && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { + minCasingAmount--; + } else { + checklist = false; + } + } + } + } + } + // Scan ground layer + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + if (!(thisController.getBlock(center.x() + x, center.y(), center.z() + z) == CASING + && thisController.getMetaID(center.x() + x, center.y(), center.z() + z) == CASING_META)) { + checklist = false; + } else { + minCasingAmount--; + } + } + } + // Scan reactor chambers + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + // Skip if diagonal, don't skip center + if (Math.abs(x) == Math.abs(z) && !(x == 0 && z == 0)) { + continue; + } + if (!(thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_OFF + || thisController.getBlock(center.x() + x, center.y() + 1, center.z() + z) == CHAMBER_ON)) { + checklist = false; + } + } + } + // Scan control rods + for (int h = 1; h < 5; h++) { + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + // Only check diagonal + if (x == 0 || z == 0) { + continue; + } + if (!(thisController.getBlock(center.x() + x, center.y() + h, center.z() + z) == CONTROL_ROD)) { + checklist = false; + } + } + } + } + + if (minCasingAmount > 0) { + checklist = false; + } + + return checklist; + } + + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } +} diff --git a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java index 03668aaa28..1909b5ef27 100644 --- a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java +++ b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java @@ -1,14 +1,12 @@ package common.tileentities; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; - import common.Blocks; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; @@ -16,34 +14,33 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK1> { +public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK1> { - private final int OXYGEN_PER_SEC = 100; - private final int EU_PER_TICK = 2048; - private final int STEAM_PER_SEC = 20000; + private final int OXYGEN_PER_SEC = 100; + private final int EU_PER_TICK = 2048; + private final int STEAM_PER_SEC = 20000; - public GTMTE_SOFuelCellMK1(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - - } + public GTMTE_SOFuelCellMK1(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GTMTE_SOFuelCellMK1(String aName) { - super(aName); - } + public GTMTE_SOFuelCellMK1(String aName) { + super(aName); + } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { @@ -54,22 +51,25 @@ public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBa private static final int CASING_TEXTURE_ID = 49; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GTMTE_SOFuelCellMK1> STRUCTURE_DEFINITION = IStructureDefinition.<GTMTE_SOFuelCellMK1>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "ccc", "ccc", "ccc", "ccc"}, - {"c~c", "geg", "geg", "geg", "cdc"}, - {"ccc", "ccc", "ccc", "ccc", "ccc"} - })) - .addElement('c', ofChain( - onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), - ofHatchAdder(GTMTE_SOFuelCellMK1::addInputToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK1::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK1::addOutputToMachineList, CASING_TEXTURE_ID, 1) - )) - .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK1::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) - .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) - .addElement('e', ofBlockAnyMeta(Blocks.yszUnit)) - .build(); + private static final IStructureDefinition<GTMTE_SOFuelCellMK1> STRUCTURE_DEFINITION = + IStructureDefinition.<GTMTE_SOFuelCellMK1>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "ccc", "ccc", "ccc", "ccc"}, + {"c~c", "geg", "geg", "geg", "cdc"}, + {"ccc", "ccc", "ccc", "ccc", "ccc"} + })) + .addElement( + 'c', + ofChain( + onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), + ofHatchAdder(GTMTE_SOFuelCellMK1::addInputToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder( + GTMTE_SOFuelCellMK1::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK1::addOutputToMachineList, CASING_TEXTURE_ID, 1))) + .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK1::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) + .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) + .addElement('e', ofBlockAnyMeta(Blocks.yszUnit)) + .build(); @Override public IStructureDefinition<GTMTE_SOFuelCellMK1> getStructureDefinition() { @@ -80,132 +80,150 @@ public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBa protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Gas Turbine") - .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") - .addInfo("Consumes up to" + (EU_PER_TICK * 20) + "EU worth of fuel with up to 100% efficiency each second") - .addInfo("Steam production requires the SOFC to heat up completely first") - .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") - .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") - .addSeparator() - .beginStructureBlock(3, 3, 5, false) - .addController("Front center") - .addCasingInfo("Clean Stainless Steel Casing", 12) - .addOtherStructurePart("YSZ Ceramic Electrolyte Unit", "3x, Center 1x1x3") - .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") - .addDynamoHatch("Back center", 1) - .addMaintenanceHatch("Any casing") - .addInputHatch("Fuel, any casing") - .addInputHatch("Oxygen, any casing") - .addOutputHatch("Steam, any casing") - .toolTipFinisher("KekzTech"); + .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") + .addInfo("Consumes up to" + (EU_PER_TICK * 20) + + "EU worth of fuel with up to 100% efficiency each second") + .addInfo("Steam production requires the SOFC to heat up completely first") + .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") + .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") + .addSeparator() + .beginStructureBlock(3, 3, 5, false) + .addController("Front center") + .addCasingInfo("Clean Stainless Steel Casing", 12) + .addOtherStructurePart("YSZ Ceramic Electrolyte Unit", "3x, Center 1x1x3") + .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") + .addDynamoHatch("Back center", 1) + .addMaintenanceHatch("Any casing") + .addInputHatch("Fuel, any casing") + .addInputHatch("Oxygen, any casing") + .addOutputHatch("Steam, any casing") + .toolTipFinisher("KekzTech"); return tt; } - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + @Override + public ITexture[] getTexture( + final IGregTechTileEntity aBaseMetaTileEntity, + final byte aSide, + final byte aFacing, + final byte aColorIndex, + final boolean aActive, + final boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW) + .extFacing() + .glow() + .build() + }; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "MultiblockDisplay.png"); - } - - @Override - public boolean isCorrectMachinePart(ItemStack stack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack stack) { - final ArrayList<FluidStack> storedFluids = super.getStoredFluids(); - Collection<GT_Recipe> recipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList; - - if((storedFluids.size() > 0 && recipeList != null)) { - - final Iterator<FluidStack> fluidsIterator = storedFluids.iterator(); - while(fluidsIterator.hasNext()) { - - final FluidStack hatchFluid = fluidsIterator.next(); - final Iterator<GT_Recipe> recipeIterator = recipeList.iterator(); - while(recipeIterator.hasNext()) { - - final GT_Recipe aFuel = recipeIterator.next(); - FluidStack liquid; - if((liquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null - && hatchFluid.isFluidEqual(liquid)) { - - liquid.amount = (EU_PER_TICK * 20) / aFuel.mSpecialValue; - - if(super.depleteInput(liquid)) { - - if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_SEC))) { - super.mEUt = 0; - super.mEfficiency = 0; - return false; - } - - super.mEUt = EU_PER_TICK; - super.mMaxProgresstime = 20; - super.mEfficiencyIncrease = 40; - if(super.mEfficiency == getMaxEfficiency(null)) { - super.addOutput(GT_ModHandler.getSteam(STEAM_PER_SEC)); - } - return true; - } - } - } - } - } - - super.mEUt = 0; - super.mEfficiency = 0; - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack stack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack stack) { + final ArrayList<FluidStack> storedFluids = super.getStoredFluids(); + Collection<GT_Recipe> recipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList; + + if ((storedFluids.size() > 0 && recipeList != null)) { + + final Iterator<FluidStack> fluidsIterator = storedFluids.iterator(); + while (fluidsIterator.hasNext()) { + + final FluidStack hatchFluid = fluidsIterator.next(); + final Iterator<GT_Recipe> recipeIterator = recipeList.iterator(); + while (recipeIterator.hasNext()) { + + final GT_Recipe aFuel = recipeIterator.next(); + FluidStack liquid; + if ((liquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null + && hatchFluid.isFluidEqual(liquid)) { + + liquid.amount = (EU_PER_TICK * 20) / aFuel.mSpecialValue; + + if (super.depleteInput(liquid)) { + + if (!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_SEC))) { + super.mEUt = 0; + super.mEfficiency = 0; + return false; + } + + super.mEUt = EU_PER_TICK; + super.mMaxProgresstime = 20; + super.mEfficiencyIncrease = 40; + if (super.mEfficiency == getMaxEfficiency(null)) { + super.addOutput(GT_ModHandler.getSteam(STEAM_PER_SEC)); + } + return true; + } + } + } + } + } + + super.mEUt = 0; + super.mEfficiency = 0; + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { this.mCasing = 0; - if(!checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0)) - return false; - - return (this.mCasing >= 12 && - this.mMaintenanceHatches.size() == 1 && - this.mInputHatches.size() >= 2 - ); - } - - @Override - public int getMaxEfficiency(ItemStack stack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack stack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack stack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack stack) { - return false; - } + if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0)) return false; + + return (this.mCasing >= 12 && this.mMaintenanceHatches.size() == 1 && this.mInputHatches.size() >= 2); + } + + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } @Override public void construct(ItemStack itemStack, boolean b) { diff --git a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java index de1e9cc82f..4438c0add1 100644 --- a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java +++ b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java @@ -1,15 +1,14 @@ package common.tileentities; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; -import gregtech.api.render.TextureFactory; - import common.Blocks; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; @@ -17,35 +16,33 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAnyMeta; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK2> { +public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK2> { - private final int OXYGEN_PER_SEC = 2000; - private final int EU_PER_TICK = 24576; // 100% Efficiency, 3A IV - private final int STEAM_PER_SEC = 96000; // SH Steam (10,800EU/t @ 150% Efficiency) + private final int OXYGEN_PER_SEC = 2000; + private final int EU_PER_TICK = 24576; // 100% Efficiency, 3A IV + private final int STEAM_PER_SEC = 96000; // SH Steam (10,800EU/t @ 150% Efficiency) - public GTMTE_SOFuelCellMK2(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - - } + public GTMTE_SOFuelCellMK2(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GTMTE_SOFuelCellMK2(String aName) { - super(aName); - } + public GTMTE_SOFuelCellMK2(String aName) { + super(aName); + } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { @@ -56,22 +53,25 @@ public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBa private static final int CASING_TEXTURE_ID = 48; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GTMTE_SOFuelCellMK2> STRUCTURE_DEFINITION = IStructureDefinition.<GTMTE_SOFuelCellMK2>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{ - {"ccc", "ccc", "ccc", "ccc", "ccc"}, - {"c~c", "geg", "geg", "geg", "cdc"}, - {"ccc", "ccc", "ccc", "ccc", "ccc"} - })) - .addElement('c', ofChain( - onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 0)), - ofHatchAdder(GTMTE_SOFuelCellMK2::addInputToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK2::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK2::addOutputToMachineList, CASING_TEXTURE_ID, 1) - )) - .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK2::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) - .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) - .addElement('e', ofBlockAnyMeta(Blocks.gdcUnit)) - .build(); + private static final IStructureDefinition<GTMTE_SOFuelCellMK2> STRUCTURE_DEFINITION = + IStructureDefinition.<GTMTE_SOFuelCellMK2>builder() + .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { + {"ccc", "ccc", "ccc", "ccc", "ccc"}, + {"c~c", "geg", "geg", "geg", "cdc"}, + {"ccc", "ccc", "ccc", "ccc", "ccc"} + })) + .addElement( + 'c', + ofChain( + onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 0)), + ofHatchAdder(GTMTE_SOFuelCellMK2::addInputToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder( + GTMTE_SOFuelCellMK2::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK2::addOutputToMachineList, CASING_TEXTURE_ID, 1))) + .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK2::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) + .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) + .addElement('e', ofBlockAnyMeta(Blocks.gdcUnit)) + .build(); @Override public IStructureDefinition<GTMTE_SOFuelCellMK2> getStructureDefinition() { @@ -82,133 +82,152 @@ public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBa protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Gas Turbine") - .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") - .addInfo("Consumes up to" + (EU_PER_TICK * 20) + "EU worth of fuel with up to 100% efficiency each second") - .addInfo("Nitrobenzene and other gas fuels above 1M EU/bucket are more efficient") - .addInfo("Steam production requires the SOFC to heat up completely first") - .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") - .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") - .addSeparator() - .beginStructureBlock(3, 3, 5, false) - .addController("Front center") - .addCasingInfo("Robust Tungstensteel Machine Casing", 12) - .addOtherStructurePart("GDC Ceramic Electrolyte Unit", "3x, Center 1x1x3") - .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") - .addDynamoHatch("Back center", 1) - .addMaintenanceHatch("Any casing") - .addInputHatch("Fuel, any casing") - .addInputHatch("Oxygen, any casing") - .addOutputHatch("Superheated Steam, any casing") - .toolTipFinisher("KekzTech"); + .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") + .addInfo("Consumes up to" + (EU_PER_TICK * 20) + + "EU worth of fuel with up to 100% efficiency each second") + .addInfo("Nitrobenzene and other gas fuels above 1M EU/bucket are more efficient") + .addInfo("Steam production requires the SOFC to heat up completely first") + .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") + .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") + .addSeparator() + .beginStructureBlock(3, 3, 5, false) + .addController("Front center") + .addCasingInfo("Robust Tungstensteel Machine Casing", 12) + .addOtherStructurePart("GDC Ceramic Electrolyte Unit", "3x, Center 1x1x3") + .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") + .addDynamoHatch("Back center", 1) + .addMaintenanceHatch("Any casing") + .addInputHatch("Fuel, any casing") + .addInputHatch("Oxygen, any casing") + .addOutputHatch("Superheated Steam, any casing") + .toolTipFinisher("KekzTech"); return tt; } - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + @Override + public ITexture[] getTexture( + final IGregTechTileEntity aBaseMetaTileEntity, + final byte aSide, + final byte aFacing, + final byte aColorIndex, + final boolean aActive, + final boolean aRedstone) { if (aSide == aFacing) { if (aActive) - return new ITexture[]{ + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow().build()}; - return new ITexture[]{ + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() + }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build()}; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW) + .extFacing() + .glow() + .build() + }; + } + return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } + + @Override + public boolean isCorrectMachinePart(ItemStack stack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack stack) { + final ArrayList<FluidStack> storedFluids = super.getStoredFluids(); + Collection<GT_Recipe> recipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList; + + if ((storedFluids.size() > 0 && recipeList != null)) { + + final Iterator<FluidStack> fluidsIterator = storedFluids.iterator(); + while (fluidsIterator.hasNext()) { + + final FluidStack hatchFluid = fluidsIterator.next(); + final Iterator<GT_Recipe> recipeIterator = recipeList.iterator(); + while (recipeIterator.hasNext()) { + + final GT_Recipe aFuel = recipeIterator.next(); + FluidStack liquid; + if ((liquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null + && hatchFluid.isFluidEqual(liquid)) { + + liquid.amount = (int) (Math.floor((EU_PER_TICK * 20) / aFuel.mSpecialValue) + / Math.max(1, aFuel.mSpecialValue / 1000)); + + if (super.depleteInput(liquid)) { + + if (!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_SEC))) { + super.mEUt = 0; + super.mEfficiency = 0; + return false; + } + + super.mEUt = EU_PER_TICK; + super.mMaxProgresstime = 20; + super.mEfficiencyIncrease = 80; + if (super.mEfficiency == getMaxEfficiency(null)) { + super.addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", STEAM_PER_SEC)); + } + return true; + } + } + } + } } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "MultiblockDisplay.png"); - } - - @Override - public boolean isCorrectMachinePart(ItemStack stack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack stack) { - final ArrayList<FluidStack> storedFluids = super.getStoredFluids(); - Collection<GT_Recipe> recipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList; - - if((storedFluids.size() > 0 && recipeList != null)) { - - final Iterator<FluidStack> fluidsIterator = storedFluids.iterator(); - while(fluidsIterator.hasNext()) { - - final FluidStack hatchFluid = fluidsIterator.next(); - final Iterator<GT_Recipe> recipeIterator = recipeList.iterator(); - while(recipeIterator.hasNext()) { - - final GT_Recipe aFuel = recipeIterator.next(); - FluidStack liquid; - if((liquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null - && hatchFluid.isFluidEqual(liquid)) { - - liquid.amount = (int) (Math.floor((EU_PER_TICK * 20) / aFuel.mSpecialValue) / Math.max(1, aFuel.mSpecialValue / 1000)); - - if(super.depleteInput(liquid)) { - - if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_SEC))) { - super.mEUt = 0; - super.mEfficiency = 0; - return false; - } - - super.mEUt = EU_PER_TICK; - super.mMaxProgresstime = 20; - super.mEfficiencyIncrease = 80; - if(super.mEfficiency == getMaxEfficiency(null)) { - super.addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", STEAM_PER_SEC)); - } - return true; - } - } - } - } - } - - super.mEUt = 0; - super.mEfficiency = 0; - return false; - } + + super.mEUt = 0; + super.mEfficiency = 0; + return false; + } @Override public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { this.mCasing = 0; - if(!checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0)) - return false; + if (!checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0)) return false; - return (this.mCasing >= 12 && - this.mMaintenanceHatches.size() == 1 && - this.mInputHatches.size() >= 2 - ); + return (this.mCasing >= 12 && this.mMaintenanceHatches.size() == 1 && this.mInputHatches.size() >= 2); } - @Override - public int getMaxEfficiency(ItemStack stack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack stack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack stack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack stack) { - return false; - } + @Override + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack stack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack stack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } @Override public void construct(ItemStack itemStack, boolean b) { diff --git a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java b/src/main/java/common/tileentities/GTMTE_SpaceElevator.java index 3469528f78..cabf4552d6 100644 --- a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java +++ b/src/main/java/common/tileentities/GTMTE_SpaceElevator.java @@ -9,19 +9,17 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; +import java.util.ArrayList; +import java.util.HashSet; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.input.Keyboard; import util.Vector3i; import util.Vector3ic; -import java.util.ArrayList; -import java.util.HashSet; - public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { private static final Block BASE_BLOCK = Blocks.spaceElevatorStructure; @@ -29,7 +27,7 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { private static final Block TETHER_BLOCK = Blocks.spaceElevatorTether; private static final int BASE_META = 0; private static final int COIL_HOLDER_META = 1; - private final static String glassNameBorosilicate = "BW_GlasBlocks"; + private static final String glassNameBorosilicate = "BW_GlasBlocks"; private static final int HATCH_OVERLAY_ID = 16; // Scan positions for capacitor banks @@ -47,7 +45,9 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { super(aID, aName, aNameRegional); } - public GTMTE_SpaceElevator(String aName) { super(aName); } + public GTMTE_SpaceElevator(String aName) { + super(aName); + } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) { @@ -56,8 +56,8 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { @Override public String[] getDescription() { - return new String[]{"Disabled"}; - /* + return new String[] {"Disabled"}; + /* final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); b.addInfo("Access for your Space Station!") .addInfo("Check out the wiki on my github if you are having trouble with the structure") @@ -82,20 +82,30 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { - ITexture[] sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, - Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + public ITexture[] getTexture( + IGregTechTileEntity aBaseMetaTileEntity, + byte aSide, + byte aFacing, + byte aColorIndex, + boolean aActive, + boolean aRedstone) { + ITexture[] sTexture = new ITexture[] { + new GT_RenderedTexture( + Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) + }; if (aSide == aFacing && aActive) { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, - Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; + sTexture = new ITexture[] { + new GT_RenderedTexture( + Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, + Dyes.getModulation(-1, Dyes._NULL.mRGBa)) + }; } return sTexture; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "MultiblockDisplay.png"); + return new GT_GUIContainer_MultiMachine( + aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); } @Override @@ -127,7 +137,7 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { @Override public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) { // Make sure the controller is either facing up or down - if(thisController.getFrontFacing() > 1) { + if (thisController.getFrontFacing() > 1) { return false; } @@ -135,17 +145,16 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { final Vector3ic forgeDirection = new Vector3i( ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX, ForgeDirection.getOrientation(thisController.getBackFacing()).offsetY, - ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ - ); + ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ); boolean formationChecklist = true; int minCasingAmount = 320; int firstCoilMeta = -1; capacitors.clear(); // Base floor - for(int X = -7; X <= 7; X++){ - for(int Y = -7; Y <= 7; Y++){ - if(X == 0 && Y == 0){ + for (int X = -7; X <= 7; X++) { + for (int Y = -7; Y <= 7; Y++) { + if (X == 0 && Y == 0) { continue; // Skip controller } @@ -154,8 +163,9 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); // Tries to add TE as either of those kinds of hatches. - // The number is the texture index number for the texture that needs to be painted over the hatch texture - if ( !super.addMaintenanceToMachineList(currentTE, HATCH_OVERLAY_ID) + // The number is the texture index number for the texture that needs to be painted over the hatch + // texture + if (!super.addMaintenanceToMachineList(currentTE, HATCH_OVERLAY_ID) && !this.addEnergyInputToMachineList(currentTE, HATCH_OVERLAY_ID)) { // If it's not a hatch, is it the right casing for this machine? Check block and block meta. @@ -171,34 +181,39 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } System.out.println(""); // Capacitor banks - for(int bank = 0; bank < 4; bank++) { - for(int Z = 1; Z <= 5; Z++) { - for(int scan = 0; scan < 5; scan++){ - final Vector3ic offset = rotateOffsetVector(forgeDirection, + for (int bank = 0; bank < 4; bank++) { + for (int Z = 1; Z <= 5; Z++) { + for (int scan = 0; scan < 5; scan++) { + final Vector3ic offset = rotateOffsetVector( + forgeDirection, bankOffsetsX[bank] + scanOffsetsX[scan], bankOffsetsY[bank] + scanOffsetsY[scan], Z); - if(Z == 1 || Z == 5) { + if (Z == 1 || Z == 5) { // Check for casings - if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == BASE_BLOCK + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == BASE_BLOCK && thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == BASE_META) { minCasingAmount--; } else { formationChecklist = false; } } else { - if(scan == 4){ + if (scan == 4) { // Check for capacitors - final TileEntity te = thisController.getTileEntityOffset(offset.x(), offset.y(), offset.z()); - if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CAP_BLOCK - && te instanceof TE_SpaceElevatorCapacitor) { + final TileEntity te = + thisController.getTileEntityOffset(offset.x(), offset.y(), offset.z()); + if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CAP_BLOCK + && te instanceof TE_SpaceElevatorCapacitor) { capacitors.add((TE_SpaceElevatorCapacitor) te); } else { formationChecklist = false; } } else { // Check for Glass - if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameBorosilicate)) { + if (!thisController + .getBlockOffset(offset.x(), offset.y(), offset.z()) + .getUnlocalizedName() + .equals(glassNameBorosilicate)) { formationChecklist = false; } } @@ -212,11 +227,11 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { // Coils - if(minCasingAmount > 0) { + if (minCasingAmount > 0) { formationChecklist = false; } - for(TE_SpaceElevatorCapacitor cap : capacitors){ + for (TE_SpaceElevatorCapacitor cap : capacitors) { cap.setIsDamaged(false); } @@ -228,9 +243,10 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { final ArrayList<String> ll = new ArrayList<>(); ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); - ll.add("Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) - ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET - : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); + ll.add("Maintenance Status: " + + ((super.getRepairStatus() == super.getIdealStatus()) + ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET + : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); ll.add("---------------------------------------------"); final String[] a = new String[ll.size()]; @@ -243,14 +259,22 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } @Override - public int getMaxEfficiency(ItemStack stack) { return 10000; } + public int getMaxEfficiency(ItemStack stack) { + return 10000; + } @Override - public int getPollutionPerTick(ItemStack stack) { return 0; } + public int getPollutionPerTick(ItemStack stack) { + return 0; + } @Override - public int getDamageToComponent(ItemStack stack) { return 0; } + public int getDamageToComponent(ItemStack stack) { + return 0; + } @Override - public boolean explodesOnComponentBreak(ItemStack stack) { return false; } + public boolean explodesOnComponentBreak(ItemStack stack) { + return false; + } } diff --git a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java b/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java index fc2579604a..8c992f8cb0 100644 --- a/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java +++ b/src/main/java/common/tileentities/GTMTE_TFFTMultiHatch.java @@ -1,6 +1,5 @@ package common.tileentities; -import client.GTTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -8,6 +7,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; +import java.util.HashMap; import kekztech.MultiFluidHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -18,16 +18,16 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; -import java.util.HashMap; - public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { private static final HashMap<Integer, Integer> vals = new HashMap<>(); + static { vals.put(3, 2000); vals.put(5, 20000); vals.put(7, 200000); } + private static final int INV_SLOT_COUNT = 2; private MultiFluidHandler mfh; @@ -35,10 +35,10 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { public GTMTE_TFFTMultiHatch(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, INV_SLOT_COUNT, new String[] { - "All-in-one access for the T.F.F.T", - "Right-click with a screwdriver to toggle auto-output", - "Throughput: " + vals.get(aTier) + "L/s per fluid"} - ); + "All-in-one access for the T.F.F.T", + "Right-click with a screwdriver to toggle auto-output", + "Throughput: " + vals.get(aTier) + "L/s per fluid" + }); } public GTMTE_TFFTMultiHatch(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -67,14 +67,16 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - //return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_ON)}; - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL)}; + // return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_ON)}; + return new ITexture[] {aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_STEEL)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - //return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_OFF)}; - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE)}; + // return new ITexture[]{aBaseTexture, new GT_RenderedTexture(GTTexture.MULTI_HATCH_OFF)}; + return new ITexture[] { + aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE) + }; } @Override @@ -101,7 +103,7 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide() && mfh != null) { - if(outputting && (aTick % 20 == 0)) { + if (outputting && (aTick % 20 == 0)) { doAutoOutputPerSecond(aBaseMetaTileEntity); } } @@ -114,14 +116,15 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { */ private void doAutoOutputPerSecond(IGregTechTileEntity aBaseMetaTileEntity) { final ForgeDirection outSide = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()); - final TileEntity adjacentTE = aBaseMetaTileEntity.getTileEntityOffset(outSide.offsetX, outSide.offsetY, outSide.offsetZ); - if(adjacentTE instanceof IFluidHandler) { + final TileEntity adjacentTE = + aBaseMetaTileEntity.getTileEntityOffset(outSide.offsetX, outSide.offsetY, outSide.offsetZ); + if (adjacentTE instanceof IFluidHandler) { final IFluidHandler adjFH = (IFluidHandler) adjacentTE; // Cycle through fluids - for(int i = 0; i < mfh.getDistinctFluids(); i++) { + for (int i = 0; i < mfh.getDistinctFluids(); i++) { final FluidStack fluidCopy = mfh.getFluidCopy(i); // Make sure the adjacent IFluidHandler can accept this fluid - if(adjFH.canFill(outSide.getOpposite(), fluidCopy.getFluid())) { + if (adjFH.canFill(outSide.getOpposite(), fluidCopy.getFluid())) { // Limit to output rate fluidCopy.amount = Math.min(fluidCopy.amount, vals.get(super.mTier)); @@ -136,7 +139,6 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { mfh.pullFluid(fluidCopy, true); } } - } } @@ -166,16 +168,15 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { */ @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - if(mfh != null) { + if (mfh != null) { final FluidStack drain = mfh.getFluidCopy(0); - if(drain != null) { + if (drain != null) { // If there's no integrated circuit in the T.F.F.T. controller, output slot 0 final byte selectedSlot = (mfh.getSelectedFluid() == -1) ? 0 : mfh.getSelectedFluid(); return new FluidStack( drain.getFluid(), - mfh.pullFluid(new FluidStack(drain.getFluid(), maxDrain), selectedSlot, doDrain) - ); + mfh.pullFluid(new FluidStack(drain.getFluid(), maxDrain), selectedSlot, doDrain)); } } return null; @@ -183,14 +184,13 @@ public class GTMTE_TFFTMultiHatch extends GT_MetaTileEntity_Hatch { @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { - if (mfh == null) - return null; + if (mfh == null) return null; FluidStack[] fluids = mfh.getAllFluids(); int length = fluids.length; int maxCapcity = mfh.getCapacity(); FluidTankInfo[] tankInfo = new FluidTankInfo[length]; for (int i = 0; i < length; i++) { - tankInfo[i] = new FluidTankInfo(fluids[i],maxCapcity); + tankInfo[i] = new FluidTankInfo(fluids[i], maxCapcity); } return tankInfo; } diff --git a/src/main/java/common/tileentities/TE_IchorJar.java b/src/main/java/common/tileentities/TE_IchorJar.java index 1baa06a969..b5e85a9f2b 100644 --- a/src/main/java/common/tileentities/TE_IchorJar.java +++ b/src/main/java/common/tileentities/TE_IchorJar.java @@ -3,8 +3,8 @@ package common.tileentities; import thaumcraft.common.tiles.TileJarFillable; public class TE_IchorJar extends TileJarFillable { - - public TE_IchorJar() { - super.maxAmount = 4096; - } + + public TE_IchorJar() { + super.maxAmount = 4096; + } } diff --git a/src/main/java/common/tileentities/TE_IchorVoidJar.java b/src/main/java/common/tileentities/TE_IchorVoidJar.java index 6644461a88..9046b2bc33 100644 --- a/src/main/java/common/tileentities/TE_IchorVoidJar.java +++ b/src/main/java/common/tileentities/TE_IchorVoidJar.java @@ -3,8 +3,8 @@ package common.tileentities; import thaumcraft.common.tiles.TileJarFillableVoid; public class TE_IchorVoidJar extends TileJarFillableVoid { - - public TE_IchorVoidJar() { - super.maxAmount = 4096; - } + + public TE_IchorVoidJar() { + super.maxAmount = 4096; + } } diff --git a/src/main/java/common/tileentities/TE_ItemProxyCable.java b/src/main/java/common/tileentities/TE_ItemProxyCable.java index f4caab3d36..ac080ceab2 100644 --- a/src/main/java/common/tileentities/TE_ItemProxyCable.java +++ b/src/main/java/common/tileentities/TE_ItemProxyCable.java @@ -4,118 +4,155 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; public class TE_ItemProxyCable extends TileEntity { - - private static final float THICKNESS = 0.5F; - private byte connections = 0; - private byte connectionAllowed = 63; - private String idCache = null; - - public TE_ItemProxyCable() { - } + private static final float THICKNESS = 0.5F; + private byte connections = 0; + private byte connectionAllowed = 63; + private String idCache = null; - @Override - public void updateEntity() { - // Check all 6 sides and connect the conduit if it is allowed to - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj().getTileEntity( - super.xCoord + side.offsetX, - super.yCoord + side.offsetY, - super.zCoord + side.offsetZ); - if(te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - setConnection(side, cable.isConnectionAllowed(side.getOpposite())); - } else { - setConnection(side, false); - } - } - } - - public static float getThickness() { - return THICKNESS; - } - - /** - * Builds a simple unique identifier for this TileEntity by appending - * the x, y, and z coordinates in a string. - * - * @return unique identifier for this TileEntity - */ - public String getIdentifier() { - if(idCache == null) { - idCache = "" + super.xCoord + super.yCoord + super.zCoord; - return idCache; - } else { - return idCache; - } - } - - /** - * 0 0 0 0 0 0 0 0 = 0 -> no connection </br> - * 0 0 0 0 0 0 0 1 = 1 -> down </br> - * 0 0 0 0 0 0 1 0 = 2 -> up </br> - * 0 0 0 0 0 1 0 0 = 4 -> north </br> - * 0 0 0 0 1 0 0 0 = 8 -> south </br> - * 0 0 0 1 0 0 0 0 = 16 -> west </br> - * 0 0 1 0 0 0 0 0 = 32 -> east </br> - * - * @param side - * The side for which to set the connection status. - * @param connected - * Whether this side should be connected or not - * @return - * True if the connection was allowed - */ - public boolean setConnection(ForgeDirection side, boolean connected) { - if(isConnectionAllowed(side)){ - switch(side) { - case DOWN: connections = (byte) ((connected) ? connections | 1 : connections ^ 1); break; - case UP: connections = (byte) ((connected) ? connections | 2 : connections ^ 2); break; - case NORTH: connections = (byte) ((connected) ? connections | 4 : connections ^ 4); break; - case SOUTH: connections = (byte) ((connected) ? connections | 8 : connections ^ 8); break; - case WEST: connections = (byte) ((connected) ? connections | 16 : connections ^ 16); break; - case EAST: connections = (byte) ((connected) ? connections | 32 : connections ^ 32); break; - default: return false; - } - return true; - } else { - return false; - } - } - - public boolean isConnected(ForgeDirection side) { - switch(side) { - case DOWN: return (connections & 1) == 1; - case UP: return (connections & 2) == 2; - case NORTH: return (connections & 4) == 4; - case SOUTH: return (connections & 8) == 8; - case WEST: return (connections & 16) == 16; - case EAST: return (connections & 32) == 32; - default: return false; - } - } + public TE_ItemProxyCable() {} - public void setConnectionAllowed(ForgeDirection side, boolean allowed) { - switch(side) { - case DOWN: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 1 : connectionAllowed ^ 1); break; - case UP: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 2 : connectionAllowed ^ 2); break; - case NORTH: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 4 : connectionAllowed ^ 4); break; - case SOUTH: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 8 : connectionAllowed ^ 8); break; - case WEST: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 16 : connectionAllowed ^ 16); break; - case EAST: connectionAllowed = (byte) ((allowed) ? connectionAllowed | 32 : connectionAllowed ^ 32); break; - default: break; - } - } + @Override + public void updateEntity() { + // Check all 6 sides and connect the conduit if it is allowed to + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + final TileEntity te = super.getWorldObj() + .getTileEntity( + super.xCoord + side.offsetX, super.yCoord + side.offsetY, super.zCoord + side.offsetZ); + if (te instanceof TE_ItemProxyCable) { + final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; + setConnection(side, cable.isConnectionAllowed(side.getOpposite())); + } else { + setConnection(side, false); + } + } + } - public boolean isConnectionAllowed(ForgeDirection side) { - switch(side) { - case DOWN: return (connectionAllowed & 1) == 1; - case UP: return (connectionAllowed & 2) == 2; - case NORTH: return (connectionAllowed & 4) == 4; - case SOUTH: return (connectionAllowed & 8) == 8; - case WEST: return (connectionAllowed & 16) == 16; - case EAST: return (connectionAllowed & 32) == 32; - default: return false; - } - } + public static float getThickness() { + return THICKNESS; + } + + /** + * Builds a simple unique identifier for this TileEntity by appending + * the x, y, and z coordinates in a string. + * + * @return unique identifier for this TileEntity + */ + public String getIdentifier() { + if (idCache == null) { + idCache = "" + super.xCoord + super.yCoord + super.zCoord; + return idCache; + } else { + return idCache; + } + } + + /** + * 0 0 0 0 0 0 0 0 = 0 -> no connection </br> + * 0 0 0 0 0 0 0 1 = 1 -> down </br> + * 0 0 0 0 0 0 1 0 = 2 -> up </br> + * 0 0 0 0 0 1 0 0 = 4 -> north </br> + * 0 0 0 0 1 0 0 0 = 8 -> south </br> + * 0 0 0 1 0 0 0 0 = 16 -> west </br> + * 0 0 1 0 0 0 0 0 = 32 -> east </br> + * + * @param side + * The side for which to set the connection status. + * @param connected + * Whether this side should be connected or not + * @return + * True if the connection was allowed + */ + public boolean setConnection(ForgeDirection side, boolean connected) { + if (isConnectionAllowed(side)) { + switch (side) { + case DOWN: + connections = (byte) ((connected) ? connections | 1 : connections ^ 1); + break; + case UP: + connections = (byte) ((connected) ? connections | 2 : connections ^ 2); + break; + case NORTH: + connections = (byte) ((connected) ? connections | 4 : connections ^ 4); + break; + case SOUTH: + connections = (byte) ((connected) ? connections | 8 : connections ^ 8); + break; + case WEST: + connections = (byte) ((connected) ? connections | 16 : connections ^ 16); + break; + case EAST: + connections = (byte) ((connected) ? connections | 32 : connections ^ 32); + break; + default: + return false; + } + return true; + } else { + return false; + } + } + + public boolean isConnected(ForgeDirection side) { + switch (side) { + case DOWN: + return (connections & 1) == 1; + case UP: + return (connections & 2) == 2; + case NORTH: + return (connections & 4) == 4; + case SOUTH: + return (connections & 8) == 8; + case WEST: + return (connections & 16) == 16; + case EAST: + return (connections & 32) == 32; + default: + return false; + } + } + + public void setConnectionAllowed(ForgeDirection side, boolean allowed) { + switch (side) { + case DOWN: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 1 : connectionAllowed ^ 1); + break; + case UP: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 2 : connectionAllowed ^ 2); + break; + case NORTH: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 4 : connectionAllowed ^ 4); + break; + case SOUTH: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 8 : connectionAllowed ^ 8); + break; + case WEST: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 16 : connectionAllowed ^ 16); + break; + case EAST: + connectionAllowed = (byte) ((allowed) ? connectionAllowed | 32 : connectionAllowed ^ 32); + break; + default: + break; + } + } + + public boolean isConnectionAllowed(ForgeDirection side) { + switch (side) { + case DOWN: + return (connectionAllowed & 1) == 1; + case UP: + return (connectionAllowed & 2) == 2; + case NORTH: + return (connectionAllowed & 4) == 4; + case SOUTH: + return (connectionAllowed & 8) == 8; + case WEST: + return (connectionAllowed & 16) == 16; + case EAST: + return (connectionAllowed & 32) == 32; + default: + return false; + } + } } diff --git a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java b/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java index 1eca1ff3df..88a8ef8bda 100644 --- a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java +++ b/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java @@ -1,7 +1,6 @@ package common.tileentities; import java.util.HashSet; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; @@ -11,169 +10,168 @@ import net.minecraftforge.common.util.ForgeDirection; public class TE_ItemProxyEndpoint extends TileEntity implements ISidedInventory { - private byte channel = -1; - private IInventory proxyInventory = null; - private int tickCounter = 0; - - public TE_ItemProxyEndpoint() { - channel = 0; - } - - public void setChannel(byte channel) { - this.channel = channel; - } - - public int getChannel() { return channel; } - - @Override - public void updateEntity() { - if(tickCounter == 20) { - if(channel != -1) { - proxyInventory = searchSource(); - } - tickCounter = 0; - } - tickCounter++; - } - - private TE_ItemProxySource searchSource() { - - final HashSet<TE_ItemProxySource> sources = new HashSet<>(); - final HashSet<String> visited = new HashSet<>(); - - for(ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj().getTileEntity( - super.xCoord + next.offsetX, - super.yCoord + next.offsetY, - super.zCoord + next.offsetZ); - if(te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - if(cable.isConnected(next.getOpposite())) { - searchSourceRecursive(sources, visited, next.getOpposite(), cable); - } - } - } - - if(sources.isEmpty()) { - return null; - } else { - return sources.iterator().next(); - } - - } - - private void searchSourceRecursive(HashSet<TE_ItemProxySource> sources, HashSet<String> visited, - ForgeDirection from, TE_ItemProxyCable nextTarget) { - - if(!visited.contains(nextTarget.getIdentifier())) { - visited.add(nextTarget.getIdentifier()); - - for(ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { - if(next != from) { - final TileEntity te = super.getWorldObj().getTileEntity( - nextTarget.xCoord + next.offsetX, - nextTarget.yCoord + next.offsetY, - nextTarget.zCoord + next.offsetZ); - if(te instanceof TE_ItemProxyCable) { - final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; - if(cable.isConnected(next.getOpposite())) { - searchSourceRecursive(sources, visited, next.getOpposite(), cable); - } - } else if (te instanceof TE_ItemProxySource) { - sources.add((TE_ItemProxySource) te); - } - } - } - } - } - - @Override - public int getSizeInventory() { - return 1; - } - - @Override - public ItemStack getStackInSlot(int slot) { - if(proxyInventory != null && slot == 0) { - return proxyInventory.getStackInSlot(channel); - } else { - return null; - } - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - if(proxyInventory != null && slot == 0) { - return proxyInventory.decrStackSize(channel, amount); - } else { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return (proxyInventory != null) ? proxyInventory.getStackInSlotOnClosing(channel) : null; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) { - if(proxyInventory != null && slot == 0) { - proxyInventory.setInventorySlotContents(channel, itemStack); - } - } - - @Override - public String getInventoryName() { - return (proxyInventory != null) ? "Connected: " + proxyInventory.getInventoryName() : "Untethered Proxy"; - } - - @Override - public boolean hasCustomInventoryName() { - return true; - } - - @Override - public int getInventoryStackLimit() { - return (proxyInventory != null) ? proxyInventory.getInventoryStackLimit() : 0; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return true; - } - - @Override - public void openInventory() { - - } - - @Override - public void closeInventory() { - - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemStack) { - if(proxyInventory != null && slot == 0) { - return proxyInventory.isItemValidForSlot(channel, itemStack); - } else { - return false; - } - } - - @Override - public int[] getAccessibleSlotsFromSide(int side) { - return new int[]{0}; - } - - @Override - public boolean canInsertItem(int slot, ItemStack itemStack, int side) { - return isItemValidForSlot(slot, itemStack); - } - - @Override - public boolean canExtractItem(int slot, ItemStack itemStack, int side) { - return slot == 0; - } - + private byte channel = -1; + private IInventory proxyInventory = null; + private int tickCounter = 0; + + public TE_ItemProxyEndpoint() { + channel = 0; + } + + public void setChannel(byte channel) { + this.channel = channel; + } + + public int getChannel() { + return channel; + } + + @Override + public void updateEntity() { + if (tickCounter == 20) { + if (channel != -1) { + proxyInventory = searchSource(); + } + tickCounter = 0; + } + tickCounter++; + } + + private TE_ItemProxySource searchSource() { + + final HashSet<TE_ItemProxySource> sources = new HashSet<>(); + final HashSet<String> visited = new HashSet<>(); + + for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { + final TileEntity te = super.getWorldObj() + .getTileEntity( + super.xCoord + next.offsetX, super.yCoord + next.offsetY, super.zCoord + next.offsetZ); + if (te instanceof TE_ItemProxyCable) { + final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; + if (cable.isConnected(next.getOpposite())) { + searchSourceRecursive(sources, visited, next.getOpposite(), cable); + } + } + } + + if (sources.isEmpty()) { + return null; + } else { + return sources.iterator().next(); + } + } + + private void searchSourceRecursive( + HashSet<TE_ItemProxySource> sources, + HashSet<String> visited, + ForgeDirection from, + TE_ItemProxyCable nextTarget) { + + if (!visited.contains(nextTarget.getIdentifier())) { + visited.add(nextTarget.getIdentifier()); + + for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { + if (next != from) { + final TileEntity te = super.getWorldObj() + .getTileEntity( + nextTarget.xCoord + next.offsetX, + nextTarget.yCoord + next.offsetY, + nextTarget.zCoord + next.offsetZ); + if (te instanceof TE_ItemProxyCable) { + final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; + if (cable.isConnected(next.getOpposite())) { + searchSourceRecursive(sources, visited, next.getOpposite(), cable); + } + } else if (te instanceof TE_ItemProxySource) { + sources.add((TE_ItemProxySource) te); + } + } + } + } + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public ItemStack getStackInSlot(int slot) { + if (proxyInventory != null && slot == 0) { + return proxyInventory.getStackInSlot(channel); + } else { + return null; + } + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + if (proxyInventory != null && slot == 0) { + return proxyInventory.decrStackSize(channel, amount); + } else { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return (proxyInventory != null) ? proxyInventory.getStackInSlotOnClosing(channel) : null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemStack) { + if (proxyInventory != null && slot == 0) { + proxyInventory.setInventorySlotContents(channel, itemStack); + } + } + + @Override + public String getInventoryName() { + return (proxyInventory != null) ? "Connected: " + proxyInventory.getInventoryName() : "Untethered Proxy"; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public int getInventoryStackLimit() { + return (proxyInventory != null) ? proxyInventory.getInventoryStackLimit() : 0; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + return true; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemStack) { + if (proxyInventory != null && slot == 0) { + return proxyInventory.isItemValidForSlot(channel, itemStack); + } else { + return false; + } + } + + @Override + public int[] getAccessibleSlotsFromSide(int side) { + return new int[] {0}; + } + + @Override + public boolean canInsertItem(int slot, ItemStack itemStack, int side) { + return isItemValidForSlot(slot, itemStack); + } + + @Override + public boolean canExtractItem(int slot, ItemStack itemStack, int side) { + return slot == 0; + } } diff --git a/src/main/java/common/tileentities/TE_ItemProxySource.java b/src/main/java/common/tileentities/TE_ItemProxySource.java index a960a7b914..15a93ed91a 100644 --- a/src/main/java/common/tileentities/TE_ItemProxySource.java +++ b/src/main/java/common/tileentities/TE_ItemProxySource.java @@ -1,7 +1,5 @@ package common.tileentities; -import java.util.UUID; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -9,104 +7,100 @@ import net.minecraft.tileentity.TileEntity; public class TE_ItemProxySource extends TileEntity implements IInventory { - private ItemStack[] slots = new ItemStack[16]; - private String idCache = null; - - /** - * Builds a simple unique identifier for this TileEntity by appending - * the x, y, and z coordinates in a string. - * - * @return unique identifier for this TileEntity - */ - public String getIdentifier() { - if(idCache == null) { - idCache = "" + super.xCoord + super.yCoord + super.zCoord; - return idCache; - } else { - return idCache; - } - } - - @Override - public int getSizeInventory() { - return slots.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return slots[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - if(slots[slot] != null) { - - ItemStack copy; - - if(slots[slot].stackSize == amount) { - copy = slots[slot]; - slots[slot] = null; - super.markDirty(); - return copy; - } else { - copy = slots[slot].splitStack(amount); - if(slots[slot].stackSize == 0) { - slots[slot] = null; - } - return copy; - } - - } else { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return null; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack itemStack) { - slots[slot] = itemStack; - if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { - itemStack.stackSize = getInventoryStackLimit(); - } - super.markDirty(); - } - - @Override - public String getInventoryName() { - return "Item Proxy Source"; - } - - @Override - public boolean hasCustomInventoryName() { - return true; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return true; - } - - @Override - public void openInventory() { - - } - - @Override - public void closeInventory() { - - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemStack) { - return true; - } + private ItemStack[] slots = new ItemStack[16]; + private String idCache = null; + + /** + * Builds a simple unique identifier for this TileEntity by appending + * the x, y, and z coordinates in a string. + * + * @return unique identifier for this TileEntity + */ + public String getIdentifier() { + if (idCache == null) { + idCache = "" + super.xCoord + super.yCoord + super.zCoord; + return idCache; + } else { + return idCache; + } + } + + @Override + public int getSizeInventory() { + return slots.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return slots[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + if (slots[slot] != null) { + + ItemStack copy; + + if (slots[slot].stackSize == amount) { + copy = slots[slot]; + slots[slot] = null; + super.markDirty(); + return copy; + } else { + copy = slots[slot].splitStack(amount); + if (slots[slot].stackSize == 0) { + slots[slot] = null; + } + return copy; + } + + } else { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack itemStack) { + slots[slot] = itemStack; + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { + itemStack.stackSize = getInventoryStackLimit(); + } + super.markDirty(); + } + + @Override + public String getInventoryName() { + return "Item Proxy Source"; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + return true; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemStack) { + return true; + } } diff --git a/src/main/java/common/tileentities/TE_TFFTMultiHatch.java b/src/main/java/common/tileentities/TE_TFFTMultiHatch.java index de274bb15e..2e55e600d3 100644 --- a/src/main/java/common/tileentities/TE_TFFTMultiHatch.java +++ b/src/main/java/common/tileentities/TE_TFFTMultiHatch.java @@ -11,58 +11,58 @@ import net.minecraftforge.fluids.IFluidHandler; @Deprecated public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler { - - public static final int BASE_OUTPUT_PER_SECOND = 2000; // L/s - - private byte facings = 0x0; - - private MultiFluidHandler mfh; - private int tickCounter = 0; - private boolean autoOutput = false; - - public boolean hasFacingOnSide(byte side) { - final byte key = (byte) Math.pow(0x2, side); - return (facings & key) == key; - } - - public void setFacingToSide(byte side) { - facings = (byte) Math.pow(0x2, side); - } - - public void setMultiFluidHandler(MultiFluidHandler mfh) { - this.mfh = mfh; - } - - public void toggleAutoOutput() { - autoOutput = !autoOutput; - } - - public boolean isOutputting() { - return autoOutput; - } - - @Override - public void updateEntity() { - // Removed deprecated code - } - - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - // Removed deprecated code - return 0; - } - - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - // Removed deprecated code - return null; - } - - /** - * Drains fluid out of 0th internal tank. + + public static final int BASE_OUTPUT_PER_SECOND = 2000; // L/s + + private byte facings = 0x0; + + private MultiFluidHandler mfh; + private int tickCounter = 0; + private boolean autoOutput = false; + + public boolean hasFacingOnSide(byte side) { + final byte key = (byte) Math.pow(0x2, side); + return (facings & key) == key; + } + + public void setFacingToSide(byte side) { + facings = (byte) Math.pow(0x2, side); + } + + public void setMultiFluidHandler(MultiFluidHandler mfh) { + this.mfh = mfh; + } + + public void toggleAutoOutput() { + autoOutput = !autoOutput; + } + + public boolean isOutputting() { + return autoOutput; + } + + @Override + public void updateEntity() { + // Removed deprecated code + } + + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + // Removed deprecated code + return 0; + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + // Removed deprecated code + return null; + } + + /** + * Drains fluid out of 0th internal tank. * If the TFFT Controller contains an Integrated Circuit, drain fluid * from the slot equal to the circuit configuration. - * + * * @param from * Orientation the fluid is drained to. * @param maxDrain @@ -72,67 +72,41 @@ public class TE_TFFTMultiHatch extends TileEntity implements IFluidHandler { * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - // Removed deprecated code - return null; - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - // Removed deprecated code - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - // Removed deprecated code - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - // Removed deprecated code - return null; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - nbt.setBoolean("autoOutput", autoOutput); - nbt.setByte("facings", facings); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - autoOutput = nbt.getBoolean("autoOutput"); - facings = nbt.getByte("facings"); - } - - - - - - - - - - - - - - - - - - - - - - - - - - + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + // Removed deprecated code + return null; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + // Removed deprecated code + return false; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + // Removed deprecated code + return false; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + // Removed deprecated code + return null; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setBoolean("autoOutput", autoOutput); + nbt.setByte("facings", facings); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + autoOutput = nbt.getBoolean("autoOutput"); + facings = nbt.getByte("facings"); + } } diff --git a/src/main/java/common/tileentities/TE_ThaumiumReinforcedJar.java b/src/main/java/common/tileentities/TE_ThaumiumReinforcedJar.java index 23b19495ae..e54324220f 100644 --- a/src/main/java/common/tileentities/TE_ThaumiumReinforcedJar.java +++ b/src/main/java/common/tileentities/TE_ThaumiumReinforcedJar.java @@ -3,8 +3,8 @@ package common.tileentities; import thaumcraft.common.tiles.TileJarFillable; public class TE_ThaumiumReinforcedJar extends TileJarFillable { - - public TE_ThaumiumReinforcedJar() { - super.maxAmount = 256; - } + + public TE_ThaumiumReinforcedJar() { + super.maxAmount = 256; + } } diff --git a/src/main/java/common/tileentities/TE_ThaumiumReinforcedVoidJar.java b/src/main/java/common/tileentities/TE_ThaumiumReinforcedVoidJar.java index c648d4be00..dd0166fe6e 100644 --- a/src/main/java/common/tileentities/TE_ThaumiumReinforcedVoidJar.java +++ b/src/main/java/common/tileentities/TE_ThaumiumReinforcedVoidJar.java @@ -3,8 +3,8 @@ package common.tileentities; import thaumcraft.common.tiles.TileJarFillableVoid; public class TE_ThaumiumReinforcedVoidJar extends TileJarFillableVoid { - - public TE_ThaumiumReinforcedVoidJar() { - super.maxAmount = 256; - } + + public TE_ThaumiumReinforcedVoidJar() { + super.maxAmount = 256; + } } diff --git a/src/main/java/kekztech/GuiHandler.java b/src/main/java/kekztech/GuiHandler.java index 97d4350b71..56c7a8b102 100644 --- a/src/main/java/kekztech/GuiHandler.java +++ b/src/main/java/kekztech/GuiHandler.java @@ -10,32 +10,35 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { - - public static final int ITEM_PROXY_SOURCE = 0; - public static final int ITEM_PROXY_ENDPOINT = 1; - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te != null) { - switch(ID) { - case ITEM_PROXY_SOURCE: return new Container_ItemProxySource(te, player); - case ITEM_PROXY_ENDPOINT: return new Container_ItemProxyEndpoint(te, player); - } - } - return null; - } - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - final TileEntity te = world.getTileEntity(x, y, z); - if(te != null) { - switch(ID) { - case ITEM_PROXY_SOURCE: return new Gui_ItemProxySource(te, player); - case ITEM_PROXY_ENDPOINT: return new Gui_ItemProxyEndpoint(te, player); - } - } - return null; - } + public static final int ITEM_PROXY_SOURCE = 0; + public static final int ITEM_PROXY_ENDPOINT = 1; + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te != null) { + switch (ID) { + case ITEM_PROXY_SOURCE: + return new Container_ItemProxySource(te, player); + case ITEM_PROXY_ENDPOINT: + return new Container_ItemProxyEndpoint(te, player); + } + } + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + final TileEntity te = world.getTileEntity(x, y, z); + if (te != null) { + switch (ID) { + case ITEM_PROXY_SOURCE: + return new Gui_ItemProxySource(te, player); + case ITEM_PROXY_ENDPOINT: + return new Gui_ItemProxyEndpoint(te, player); + } + } + return null; + } } diff --git a/src/main/java/kekztech/Items.java b/src/main/java/kekztech/Items.java index 50e56ced00..2444eb2fe9 100644 --- a/src/main/java/kekztech/Items.java +++ b/src/main/java/kekztech/Items.java @@ -2,94 +2,100 @@ package kekztech; import common.items.MetaItem_CraftingComponent; import common.items.MetaItem_ReactorComponent; +import java.util.Arrays; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import util.Util; -import java.util.Arrays; - public enum Items { - /* - // Heat Vents - T1HeatVent(0,0), T2HeatVent(1,0), T3HeatVent(2,0), T4HeatVent(3,0), - T1ComponentHeatVent(4,0), T2ComponentHeatVent(5,0), T3ComponentHeatVent(6,0), T4ComponentHeatVent(7,0), - T1OverclockedHeatVent(8,0), T2OverclockedHeatVent(9,0), T3OverclockedHeatVent(10,0), T4OverclockedHeatVent(11,0), - // Heat Exchanger - T1HeatExchanger(12,0), T2HeatExchanger(13,0), T3HeatExchanger(14,0), T4HeatExchanger(15,0), - // Fuel Rods - UraniumFuelRod(16,0), UraniumDualFuelRod(17,0), UraniumQuadFuelRod(18,0), - ThoriumFuelRod(19,0), ThoriumDualFuelRod(20,0), ThoriumQuadFuelRod(21,0), - MOXFuelRod(22,0), MOXDualFuelRod(23,0), MOXQuadFuelRod(24,0), - NaquadahFuelRod(25,0), NaquadahDualFuelRod(26,0), NaquadahQuadFuelRod(27,0), - Th_MOXFuelRod(28,0), Th_MOXDualFuelRod(29,0), Th_MOXQuadFuelRod(30,0), - // Depleted Fuel Rods - DepletedUraniumFuelRod(31,0), DepletedUraniumDualFuelRod(32,0), DepletedUraniumQuadFuelRod(33,0), - DepletedThoriumFuelRod(34,0), DepletedThoriumDualFuelRod(35,0), DepletedThoriumQuadFuelRod(36,0), - DepletedMOXFuelRod(37,0), DepletedMOXDualFuelRod(38,0), DepletedMOXQuadFuelRod(39,0), - DepletedNaquadahFuelRod(40,0), DepletedNaquadahDualFuelRod(41,0), DepletedNaquadahQuadFuelRod(42,0), - Th_DepletedMOXFuelRod(43,0), Th_DepletedMOXDualFuelRod(44,0), Th_DepletedMOXQuadFuelRod(45,0), - // Neutron Reflectors - T1NeutronReflector(46,0), T2NeutronReflector(47,0), - // Coolant Cells - HeliumCoolantCell360k(48,0), NaKCoolantCell360k(49,0), - - // Heat Pipes - CopperHeatPipe(0,1), SilverHeatPipe(1,1), BoronArsenideHeatPipe(2,1), DiamondHeatPipe(3,1), - BoronArsenideDust(4,1), IsotopicallyPureDiamondDust(5,1), AmineCarbamiteDust(6,1), - BoronArsenideCrystal(7,1), IsotopicallyPureDiamondCrystal(8,1), - */ - // Ceramics - YSZCeramicDust(9,1), GDCCeramicDust(10,1), - YttriaDust(11,1), ZirconiaDust(12,1), CeriaDust(13,1), - YSZCeramicPlate(14,1), GDCCeramicPlate(15,1), - // Error Item - Error(0,1), - // Configurator - Configurator(0, 1); - - static { - YttriaDust.setOreDictName("dustYttriumOxide"); - ZirconiaDust.setOreDictName("dustCubicZirconia"); - } - - private final int metaID; - private final int identifier; - - Items(int metaID, int identifier) { - this.metaID = metaID; - this.identifier = identifier; - } - - public int getMetaID() { - return metaID; - } - - String OreDictName; + /* + // Heat Vents + T1HeatVent(0,0), T2HeatVent(1,0), T3HeatVent(2,0), T4HeatVent(3,0), + T1ComponentHeatVent(4,0), T2ComponentHeatVent(5,0), T3ComponentHeatVent(6,0), T4ComponentHeatVent(7,0), + T1OverclockedHeatVent(8,0), T2OverclockedHeatVent(9,0), T3OverclockedHeatVent(10,0), T4OverclockedHeatVent(11,0), + // Heat Exchanger + T1HeatExchanger(12,0), T2HeatExchanger(13,0), T3HeatExchanger(14,0), T4HeatExchanger(15,0), + // Fuel Rods + UraniumFuelRod(16,0), UraniumDualFuelRod(17,0), UraniumQuadFuelRod(18,0), + ThoriumFuelRod(19,0), ThoriumDualFuelRod(20,0), ThoriumQuadFuelRod(21,0), + MOXFuelRod(22,0), MOXDualFuelRod(23,0), MOXQuadFuelRod(24,0), + NaquadahFuelRod(25,0), NaquadahDualFuelRod(26,0), NaquadahQuadFuelRod(27,0), + Th_MOXFuelRod(28,0), Th_MOXDualFuelRod(29,0), Th_MOXQuadFuelRod(30,0), + // Depleted Fuel Rods + DepletedUraniumFuelRod(31,0), DepletedUraniumDualFuelRod(32,0), DepletedUraniumQuadFuelRod(33,0), + DepletedThoriumFuelRod(34,0), DepletedThoriumDualFuelRod(35,0), DepletedThoriumQuadFuelRod(36,0), + DepletedMOXFuelRod(37,0), DepletedMOXDualFuelRod(38,0), DepletedMOXQuadFuelRod(39,0), + DepletedNaquadahFuelRod(40,0), DepletedNaquadahDualFuelRod(41,0), DepletedNaquadahQuadFuelRod(42,0), + Th_DepletedMOXFuelRod(43,0), Th_DepletedMOXDualFuelRod(44,0), Th_DepletedMOXQuadFuelRod(45,0), + // Neutron Reflectors + T1NeutronReflector(46,0), T2NeutronReflector(47,0), + // Coolant Cells + HeliumCoolantCell360k(48,0), NaKCoolantCell360k(49,0), + + // Heat Pipes + CopperHeatPipe(0,1), SilverHeatPipe(1,1), BoronArsenideHeatPipe(2,1), DiamondHeatPipe(3,1), + BoronArsenideDust(4,1), IsotopicallyPureDiamondDust(5,1), AmineCarbamiteDust(6,1), + BoronArsenideCrystal(7,1), IsotopicallyPureDiamondCrystal(8,1), + */ + // Ceramics + YSZCeramicDust(9, 1), + GDCCeramicDust(10, 1), + YttriaDust(11, 1), + ZirconiaDust(12, 1), + CeriaDust(13, 1), + YSZCeramicPlate(14, 1), + GDCCeramicPlate(15, 1), + // Error Item + Error(0, 1), + // Configurator + Configurator(0, 1); + + static { + YttriaDust.setOreDictName("dustYttriumOxide"); + ZirconiaDust.setOreDictName("dustCubicZirconia"); + } + + private final int metaID; + private final int identifier; + + Items(int metaID, int identifier) { + this.metaID = metaID; + this.identifier = identifier; + } + + public int getMetaID() { + return metaID; + } + + String OreDictName; + + private void registerOreDict() { + OreDictionary.registerOre(getOreDictName(), getNonOreDictedItemStack(1)); + } - private void registerOreDict(){ - OreDictionary.registerOre(getOreDictName(),getNonOreDictedItemStack(1)); - } + public static void registerOreDictNames() { + Arrays.stream(Items.values()).filter(e -> e.getOreDictName() != null).forEach(Items::registerOreDict); + } - public static void registerOreDictNames(){ - Arrays.stream(Items.values()).filter(e -> e.getOreDictName() != null).forEach(Items::registerOreDict); - } + public ItemStack getNonOreDictedItemStack(int amount) { + return identifier == 0 + ? new ItemStack(MetaItem_ReactorComponent.getInstance(), amount, this.getMetaID()) + : new ItemStack(MetaItem_CraftingComponent.getInstance(), amount, this.getMetaID()); + } - public ItemStack getNonOreDictedItemStack(int amount){ - return identifier == 0 ? new ItemStack(MetaItem_ReactorComponent.getInstance(),amount,this.getMetaID()) : - new ItemStack(MetaItem_CraftingComponent.getInstance(),amount,this.getMetaID()); - } + public ItemStack getOreDictedItemStack(int amount) { + return this.getOreDictName() != null + ? Util.getStackofAmountFromOreDict(this.getOreDictName(), amount) + : identifier == 0 + ? new ItemStack(MetaItem_ReactorComponent.getInstance(), amount, this.getMetaID()) + : new ItemStack(MetaItem_CraftingComponent.getInstance(), amount, this.getMetaID()); + } - public ItemStack getOreDictedItemStack(int amount){ - return this.getOreDictName() != null ? Util.getStackofAmountFromOreDict(this.getOreDictName(),amount) : - identifier == 0 ? new ItemStack(MetaItem_ReactorComponent.getInstance(),amount,this.getMetaID()) : - new ItemStack(MetaItem_CraftingComponent.getInstance(),amount,this.getMetaID()); - } - - public String getOreDictName() { - return OreDictName; - } + public String getOreDictName() { + return OreDictName; + } - public void setOreDictName(String oreDictName) { - OreDictName = oreDictName; - } + public void setOreDictName(String oreDictName) { + OreDictName = oreDictName; + } } diff --git a/src/main/java/kekztech/KekzCore.java b/src/main/java/kekztech/KekzCore.java index f0d77ce5fa..ba1869ef08 100644 --- a/src/main/java/kekztech/KekzCore.java +++ b/src/main/java/kekztech/KekzCore.java @@ -1,68 +1,58 @@ package kekztech; -import client.renderer.TESR_SECapacitor; -import client.renderer.TESR_SETether; -import common.Blocks; import common.CommonProxy; -import common.Recipes; -import common.Researches; import common.tileentities.*; -import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameRegistry; -import common.items.ErrorItem; -import common.items.MetaItem_CraftingComponent; -import common.items.MetaItem_ReactorComponent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * My GT-Meta-IDs are: 13101 - 13500 - * + * * @author kekzdealer * */ -@Mod(modid = KekzCore.MODID, name = KekzCore.NAME, version = KekzCore.VERSION, - dependencies = - "required-after:IC2;" - + "required-after:gregtech;" - + "required-after:tectech;" - + "required-after:Thaumcraft;" - + "required-after:ThaumicTinkerer;" - + "after:bartworks;" - + "after:dreamcraft" - ) +@Mod( + modid = KekzCore.MODID, + name = KekzCore.NAME, + version = KekzCore.VERSION, + dependencies = "required-after:IC2;" + + "required-after:gregtech;" + + "required-after:tectech;" + + "required-after:Thaumcraft;" + + "required-after:ThaumicTinkerer;" + + "after:bartworks;" + + "after:dreamcraft") public class KekzCore { - - public static final String NAME = "KekzTech"; - public static final String MODID = "kekztech"; - public static final String VERSION = "GRADLETOKEN_VERSION"; - public static final Logger LOGGER = LogManager.getLogger(NAME); + public static final String NAME = "KekzTech"; + public static final String MODID = "kekztech"; + public static final String VERSION = "GRADLETOKEN_VERSION"; + + public static final Logger LOGGER = LogManager.getLogger(NAME); + + @Mod.Instance("kekztech") + public static KekzCore instance; + + @SidedProxy(clientSide = "client.ClientProxy", serverSide = "kekztech.ServerProxy") + public static CommonProxy proxy; - @Mod.Instance("kekztech") - public static KekzCore instance; + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) { + proxy.preInit(event); + } - @SidedProxy(clientSide = "client.ClientProxy", serverSide = "kekztech.ServerProxy") - public static CommonProxy proxy; + @Mod.EventHandler + public void init(FMLInitializationEvent event) { + proxy.init(event); + } - @Mod.EventHandler - public void preInit(FMLPreInitializationEvent event) { - proxy.preInit(event); - } - - @Mod.EventHandler - public void init(FMLInitializationEvent event) { - proxy.init(event); - } - - @Mod.EventHandler - public void postInit(FMLPostInitializationEvent event) { - proxy.postInit(event); - } + @Mod.EventHandler + public void postInit(FMLPostInitializationEvent event) { + proxy.postInit(event); + } } diff --git a/src/main/java/kekztech/MultiFluidHandler.java b/src/main/java/kekztech/MultiFluidHandler.java index 399f9faa8b..232931b6fc 100644 --- a/src/main/java/kekztech/MultiFluidHandler.java +++ b/src/main/java/kekztech/MultiFluidHandler.java @@ -1,421 +1,397 @@ package kekztech; +import java.util.ArrayList; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class MultiFluidHandler { - private final FluidStack[] fluids; - private final int maxDistinctFluids; - private final int capacityPerFluid; - - private boolean locked = true; - private boolean doVoidExcess = false; - private byte fluidSelector = -1; - - public MultiFluidHandler(int maxDistinctFluids, int capacityPerFluid, FluidStack[] fluidsToAdd) { - this.maxDistinctFluids = maxDistinctFluids; - this.fluids = new FluidStack[maxDistinctFluids]; - if(fluidsToAdd != null) { - int tFluidLengt = (maxDistinctFluids <fluidsToAdd.length) ? maxDistinctFluids:fluidsToAdd.length; - for (int i = 0; i < tFluidLengt; i++) { - this.fluids[i] = fluidsToAdd[i]; - } - } - this.capacityPerFluid = capacityPerFluid; - } - - /** - * Initialize a new MultiFluidHandler object with the given parameters - * @param maxDistinctFluids - * How many different fluids can be stored - * @param capacityPerFluid - * How much capacity each fluid should have - * @param fluidsToAdd - * Fluids to add immediately - * @return - * A new instance - */ - public static MultiFluidHandler newInstance(int maxDistinctFluids, int capacityPerFluid, FluidStack...fluidsToAdd) { - return new MultiFluidHandler(maxDistinctFluids, capacityPerFluid, fluidsToAdd); - } - - /** - * Deep copy a MultiFluidHandler instance with a new capacity - * @param toCopy - * The MultiFluidHandler that should be copied - * @param capacityPerFluid - * How much capacity each fluid should have - * @return - * A new instance - */ - public static MultiFluidHandler newAdjustedInstance(MultiFluidHandler toCopy, int capacityPerFluid) { - return new MultiFluidHandler(toCopy.maxDistinctFluids, capacityPerFluid, toCopy.fluids); - } - - /** - * Lock internal tanks in case T.F.F.T is not running. - * - * @param state - * Lock state. - */ - public void setLock(boolean state) { - locked = state; - } - - public void setDoVoidExcess(boolean doVoidExcess) { this.doVoidExcess = doVoidExcess; } - - /** - * Used to tell the MFH if a fluid is selected by - * an Integrated Circuit in the controller. - * If the Integrate Circuit configuration exceeds - * the number of stored fluid, the configuration will be ignored. - * - * @param fluidSelector - * Selected fluid or -1 if no fluid is selected - */ - public void setFluidSelector(byte fluidSelector) { - this.fluidSelector = fluidSelector < fluids.length ? fluidSelector : -1; - } - - /** - * - * @return - * Selected fluid or -1 if no fluid is selected - */ - public byte getSelectedFluid() { - return fluidSelector; - } - - public FluidStack[] getAllFluids() { - return fluids; - } - - public int getFluidPosistion(FluidStack aFluid) { - - for (int i = 0; i < fluids.length; i++) - { - FluidStack tFluid = fluids[i]; - if (tFluid != null && tFluid.isFluidEqual(aFluid)) - return i; - } - return -1; - } - - public boolean contains(FluidStack aFluid) { - if (locked) - return false; - return getFluidPosistion(aFluid)>=0; - } - - public int countFluids() - { - int tCount = 0; - for (int i = 0; i < fluids.length; i++) { - if (fluids[i] != null) - tCount++; - } - return tCount; - } - - - public int getCapacity() { - return capacityPerFluid; - } - public int getMaxDistinctFluids() { - return maxDistinctFluids; - } - - /** - * Returns a deep copy of the the FluidStack in the requested slot - * @param slot - * requested slot - * @return - * deep copy of the requested FluidStack - */ - public FluidStack getFluidCopy(int slot) { - if (slot >= fluids.length) - return null; - if (!locked - && fluids.length > 0 - && slot >= 0 - && slot < maxDistinctFluids) - { - FluidStack tFluid = fluids[slot]; - if (tFluid != null) - return tFluid.copy(); - } - return null; - } - - /** - * Returns the amount of different fluids currently stored. - * @return - * amount of different fluids currently stored (0-25) - */ - public int getDistinctFluids() { - int distinctFluids = 0; - for (FluidStack f : fluids) { - if (f != null) - distinctFluids++; - } - return distinctFluids; - } - - /** - * Helper method to save a MultiFluidHandler to NBT data - * @param nbt - * The NBT Tag to write to - * @return - * Updated NBT Tag - */ - public NBTTagCompound saveNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - nbt.setInteger("capacityPerFluid", getCapacity()); - nbt.setInteger("maxDistinctFluids",this.maxDistinctFluids); - int c = 0; - for(FluidStack f : fluids) { - if (f == null) - { - c++; - continue; - } - nbt.setTag( String.valueOf(c), f.writeToNBT(new NBTTagCompound())); - c++; - } - return nbt; - } - - /** - * Helper method to initialize a MultiFluidHandler from NBT data - * @param nbt - * The NBT Tag to read from - * @return - * A new Instance - */ - static public MultiFluidHandler loadNBTData(NBTTagCompound nbt) { - nbt = (nbt == null) ? new NBTTagCompound() : nbt; - - final int capacityPerFluid = nbt.getInteger("capacityPerFluid"); - final NBTTagCompound fluidsTag = (NBTTagCompound) nbt.getTag("fluids"); - int distinctFluids = nbt.getInteger("maxDistinctFluids"); - if (!nbt.hasKey("maxDistinctFluids")) - distinctFluids = 25;// adding it so it doesent break on upgrading - final FluidStack[] loadedFluids = new FluidStack[distinctFluids]; - - if (fluidsTag != null) - { - for (int i = 0; i < distinctFluids; i++) { - final NBTTagCompound fluidNBT = (NBTTagCompound) fluidsTag.getTag("" + i); - if(fluidNBT == null) { - loadedFluids[i] = null; - } else { - loadedFluids[i] = FluidStack.loadFluidStackFromNBT(fluidNBT); - } - } - } - return new MultiFluidHandler(distinctFluids, capacityPerFluid, loadedFluids); - } - - public ArrayList<String> getInfoData() { - final ArrayList<String> lines = new ArrayList<>(fluids.length); - lines.add(EnumChatFormatting.YELLOW + "Stored Fluids:" + EnumChatFormatting.RESET); - for(int i = 0; i < fluids.length; i++) { - FluidStack tFluid = fluids[i]; - if (tFluid == null) { - lines.add(i + " - " + "null" + ": " - + "0" + "L (" - + "0" + "%)"); - } else { - lines.add(i + " - " + tFluid.getLocalizedName() + ": " - + tFluid.amount + "L (" - + (Math.round(100.0f * tFluid.amount / getCapacity())) + "%)"); - } - } - - return lines; - } - - /** - * Fill fluid into a tank. - * - * @param push - * Fluid type and quantity to be inserted. - * @param doPush - * If false, fill will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) filled. - */ - public int pushFluid(FluidStack push, boolean doPush) { - if(locked) { - return 0; - } - int empty = getNullSlot(); - int fluidCount = countFluids(); - if(fluidCount >= maxDistinctFluids && !contains(push)) { - // Already contains 25 fluids and this isn't one of them - return 0; - } else if (empty < maxDistinctFluids && !contains(push)) { - // Add new fluid - final int fit = Math.min(getCapacity(), push.amount); - if(doPush) { - if (empty == -1) - return 0; - else - fluids[empty] = new FluidStack(push.getFluid(), fit); - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } else { - // Add to existing fluids - int index = getFluidPosistion(push); - if (index < 0) - return 0; - final FluidStack existing = fluids[index]; - final int fit = Math.min(getCapacity() - existing.amount, push.amount); - if(doPush) { - existing.amount += fit; - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } - } - - - public int getNullSlot() - { - for (int i = 0; i < fluids.length; i++) { - if (fluids[i] == null) - return i; - } - return -1; - } - - /** - * Fill fluid into the specified tank. - * - * @param push - * Fluid type and quantity to be inserted. - * @param slot - * Tank the fluid should go into. - * @param doPush - * If false, fill will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) filled. - */ - public int pushFluid(FluidStack push, int slot, boolean doPush) { - if(locked) { - return 0; - } - FluidStack tFluid = fluids[slot]; - if(slot < 0 || slot >= maxDistinctFluids) { - // Invalid slot - return 0; - } - if((tFluid != null) && !tFluid.equals(push)) { - // Selected slot is taken by a non-matching fluid - return 0; - } else { - int fit = 0; - // Add to existing fluid - if (tFluid == null) { - fit = Math.min(getCapacity(),push.amount); - fluids[slot] = new FluidStack(push.getFluid(), fit); - } else { - fit = Math.min(getCapacity() - tFluid.amount, push.amount); - if(doPush) { - tFluid.amount += fit; - } - } - // If doVoidExcess, pretend all of it fit - return doVoidExcess ? push.amount : fit; - } - } - - /** - * Drains fluid out of the internal tanks. - * - * @param pull - * Fluid type and quantity to be pulled. - * @param doPull - * If false, drain will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) pulled. - */ - public int pullFluid(FluidStack pull, boolean doPull) { - if (locked) { - return 0; - } else { - int tIndex = getFluidPosistion(pull); - if (tIndex < 0) - return 0; - FluidStack src = fluids[tIndex]; - final int rec = Math.min(pull.amount, src.amount); - if (doPull) { - src.amount -= rec; - } - if (src.amount == 0) { - fluids[tIndex]= null; - } - return rec; - } - } - - /** - * Drains fluid out of the specified internal tank. - * - * @param pull - * Fluid type and quantity to be pulled. - * @param slot - * Tank fluid should be drained from. - * @param doPull - * If false, drain will only be simulated. - * @return Amount of fluid that was (or would have been, if simulated) pulled. - */ - public int pullFluid(FluidStack pull, int slot, boolean doPull) { - if(locked || slot >= fluids.length) { - return 0; - } - if(slot < 0 || slot >= maxDistinctFluids) { - return 0; - } - FluidStack tFluid = fluids[slot]; - if(tFluid == null || !tFluid.equals(pull)) { - return 0; - } else { - final int rec = Math.min(pull.amount, tFluid.amount); - if(doPull) { - tFluid.amount -= rec; - } - if(tFluid.amount == 0) { - fluids[slot] = null; - } - return rec; - } - } - - /** - * Test whether the given fluid type and quantity can be inserted into the internal tanks. - * @param push - * Fluid type and quantity to be tested - * @return True if there is sufficient space - */ - public boolean couldPush(FluidStack push) { - if(locked) { - return false; - } - int tFluidIndex = getFluidPosistion(push); - int fluidCount = countFluids(); - if(fluidCount >= maxDistinctFluids && !contains(push)) { - return false; - } else if (fluidCount < maxDistinctFluids && !contains(push)) { - return Math.min(getCapacity(), push.amount) > 0; - } else { - final int remcap = getCapacity() - fluids[tFluidIndex].amount; - return doVoidExcess || (Math.min(remcap, push.amount) > 0); - } - } + private final FluidStack[] fluids; + private final int maxDistinctFluids; + private final int capacityPerFluid; + + private boolean locked = true; + private boolean doVoidExcess = false; + private byte fluidSelector = -1; + + public MultiFluidHandler(int maxDistinctFluids, int capacityPerFluid, FluidStack[] fluidsToAdd) { + this.maxDistinctFluids = maxDistinctFluids; + this.fluids = new FluidStack[maxDistinctFluids]; + if (fluidsToAdd != null) { + int tFluidLengt = (maxDistinctFluids < fluidsToAdd.length) ? maxDistinctFluids : fluidsToAdd.length; + for (int i = 0; i < tFluidLengt; i++) { + this.fluids[i] = fluidsToAdd[i]; + } + } + this.capacityPerFluid = capacityPerFluid; + } + + /** + * Initialize a new MultiFluidHandler object with the given parameters + * @param maxDistinctFluids + * How many different fluids can be stored + * @param capacityPerFluid + * How much capacity each fluid should have + * @param fluidsToAdd + * Fluids to add immediately + * @return + * A new instance + */ + public static MultiFluidHandler newInstance( + int maxDistinctFluids, int capacityPerFluid, FluidStack... fluidsToAdd) { + return new MultiFluidHandler(maxDistinctFluids, capacityPerFluid, fluidsToAdd); + } + + /** + * Deep copy a MultiFluidHandler instance with a new capacity + * @param toCopy + * The MultiFluidHandler that should be copied + * @param capacityPerFluid + * How much capacity each fluid should have + * @return + * A new instance + */ + public static MultiFluidHandler newAdjustedInstance(MultiFluidHandler toCopy, int capacityPerFluid) { + return new MultiFluidHandler(toCopy.maxDistinctFluids, capacityPerFluid, toCopy.fluids); + } + + /** + * Lock internal tanks in case T.F.F.T is not running. + * + * @param state + * Lock state. + */ + public void setLock(boolean state) { + locked = state; + } + + public void setDoVoidExcess(boolean doVoidExcess) { + this.doVoidExcess = doVoidExcess; + } + + /** + * Used to tell the MFH if a fluid is selected by + * an Integrated Circuit in the controller. + * If the Integrate Circuit configuration exceeds + * the number of stored fluid, the configuration will be ignored. + * + * @param fluidSelector + * Selected fluid or -1 if no fluid is selected + */ + public void setFluidSelector(byte fluidSelector) { + this.fluidSelector = fluidSelector < fluids.length ? fluidSelector : -1; + } + + /** + * + * @return + * Selected fluid or -1 if no fluid is selected + */ + public byte getSelectedFluid() { + return fluidSelector; + } + + public FluidStack[] getAllFluids() { + return fluids; + } + + public int getFluidPosistion(FluidStack aFluid) { + + for (int i = 0; i < fluids.length; i++) { + FluidStack tFluid = fluids[i]; + if (tFluid != null && tFluid.isFluidEqual(aFluid)) return i; + } + return -1; + } + + public boolean contains(FluidStack aFluid) { + if (locked) return false; + return getFluidPosistion(aFluid) >= 0; + } + + public int countFluids() { + int tCount = 0; + for (int i = 0; i < fluids.length; i++) { + if (fluids[i] != null) tCount++; + } + return tCount; + } + + public int getCapacity() { + return capacityPerFluid; + } + + public int getMaxDistinctFluids() { + return maxDistinctFluids; + } + + /** + * Returns a deep copy of the the FluidStack in the requested slot + * @param slot + * requested slot + * @return + * deep copy of the requested FluidStack + */ + public FluidStack getFluidCopy(int slot) { + if (slot >= fluids.length) return null; + if (!locked && fluids.length > 0 && slot >= 0 && slot < maxDistinctFluids) { + FluidStack tFluid = fluids[slot]; + if (tFluid != null) return tFluid.copy(); + } + return null; + } + + /** + * Returns the amount of different fluids currently stored. + * @return + * amount of different fluids currently stored (0-25) + */ + public int getDistinctFluids() { + int distinctFluids = 0; + for (FluidStack f : fluids) { + if (f != null) distinctFluids++; + } + return distinctFluids; + } + + /** + * Helper method to save a MultiFluidHandler to NBT data + * @param nbt + * The NBT Tag to write to + * @return + * Updated NBT Tag + */ + public NBTTagCompound saveNBTData(NBTTagCompound nbt) { + nbt = (nbt == null) ? new NBTTagCompound() : nbt; + + nbt.setInteger("capacityPerFluid", getCapacity()); + nbt.setInteger("maxDistinctFluids", this.maxDistinctFluids); + int c = 0; + for (FluidStack f : fluids) { + if (f == null) { + c++; + continue; + } + nbt.setTag(String.valueOf(c), f.writeToNBT(new NBTTagCompound())); + c++; + } + return nbt; + } + + /** + * Helper method to initialize a MultiFluidHandler from NBT data + * @param nbt + * The NBT Tag to read from + * @return + * A new Instance + */ + public static MultiFluidHandler loadNBTData(NBTTagCompound nbt) { + nbt = (nbt == null) ? new NBTTagCompound() : nbt; + + final int capacityPerFluid = nbt.getInteger("capacityPerFluid"); + final NBTTagCompound fluidsTag = (NBTTagCompound) nbt.getTag("fluids"); + int distinctFluids = nbt.getInteger("maxDistinctFluids"); + if (!nbt.hasKey("maxDistinctFluids")) distinctFluids = 25; // adding it so it doesent break on upgrading + final FluidStack[] loadedFluids = new FluidStack[distinctFluids]; + + if (fluidsTag != null) { + for (int i = 0; i < distinctFluids; i++) { + final NBTTagCompound fluidNBT = (NBTTagCompound) fluidsTag.getTag("" + i); + if (fluidNBT == null) { + loadedFluids[i] = null; + } else { + loadedFluids[i] = FluidStack.loadFluidStackFromNBT(fluidNBT); + } + } + } + return new MultiFluidHandler(distinctFluids, capacityPerFluid, loadedFluids); + } + + public ArrayList<String> getInfoData() { + final ArrayList<String> lines = new ArrayList<>(fluids.length); + lines.add(EnumChatFormatting.YELLOW + "Stored Fluids:" + EnumChatFormatting.RESET); + for (int i = 0; i < fluids.length; i++) { + FluidStack tFluid = fluids[i]; + if (tFluid == null) { + lines.add(i + " - " + "null" + ": " + "0" + "L (" + "0" + "%)"); + } else { + lines.add(i + " - " + tFluid.getLocalizedName() + ": " + + tFluid.amount + "L (" + + (Math.round(100.0f * tFluid.amount / getCapacity())) + "%)"); + } + } + + return lines; + } + + /** + * Fill fluid into a tank. + * + * @param push + * Fluid type and quantity to be inserted. + * @param doPush + * If false, fill will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) filled. + */ + public int pushFluid(FluidStack push, boolean doPush) { + if (locked) { + return 0; + } + int empty = getNullSlot(); + int fluidCount = countFluids(); + if (fluidCount >= maxDistinctFluids && !contains(push)) { + // Already contains 25 fluids and this isn't one of them + return 0; + } else if (empty < maxDistinctFluids && !contains(push)) { + // Add new fluid + final int fit = Math.min(getCapacity(), push.amount); + if (doPush) { + if (empty == -1) return 0; + else fluids[empty] = new FluidStack(push.getFluid(), fit); + } + // If doVoidExcess, pretend all of it fit + return doVoidExcess ? push.amount : fit; + } else { + // Add to existing fluids + int index = getFluidPosistion(push); + if (index < 0) return 0; + final FluidStack existing = fluids[index]; + final int fit = Math.min(getCapacity() - existing.amount, push.amount); + if (doPush) { + existing.amount += fit; + } + // If doVoidExcess, pretend all of it fit + return doVoidExcess ? push.amount : fit; + } + } + + public int getNullSlot() { + for (int i = 0; i < fluids.length; i++) { + if (fluids[i] == null) return i; + } + return -1; + } + + /** + * Fill fluid into the specified tank. + * + * @param push + * Fluid type and quantity to be inserted. + * @param slot + * Tank the fluid should go into. + * @param doPush + * If false, fill will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) filled. + */ + public int pushFluid(FluidStack push, int slot, boolean doPush) { + if (locked) { + return 0; + } + FluidStack tFluid = fluids[slot]; + if (slot < 0 || slot >= maxDistinctFluids) { + // Invalid slot + return 0; + } + if ((tFluid != null) && !tFluid.equals(push)) { + // Selected slot is taken by a non-matching fluid + return 0; + } else { + int fit = 0; + // Add to existing fluid + if (tFluid == null) { + fit = Math.min(getCapacity(), push.amount); + fluids[slot] = new FluidStack(push.getFluid(), fit); + } else { + fit = Math.min(getCapacity() - tFluid.amount, push.amount); + if (doPush) { + tFluid.amount += fit; + } + } + // If doVoidExcess, pretend all of it fit + return doVoidExcess ? push.amount : fit; + } + } + + /** + * Drains fluid out of the internal tanks. + * + * @param pull + * Fluid type and quantity to be pulled. + * @param doPull + * If false, drain will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) pulled. + */ + public int pullFluid(FluidStack pull, boolean doPull) { + if (locked) { + return 0; + } else { + int tIndex = getFluidPosistion(pull); + if (tIndex < 0) return 0; + FluidStack src = fluids[tIndex]; + final int rec = Math.min(pull.amount, src.amount); + if (doPull) { + src.amount -= rec; + } + if (src.amount == 0) { + fluids[tIndex] = null; + } + return rec; + } + } + + /** + * Drains fluid out of the specified internal tank. + * + * @param pull + * Fluid type and quantity to be pulled. + * @param slot + * Tank fluid should be drained from. + * @param doPull + * If false, drain will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) pulled. + */ + public int pullFluid(FluidStack pull, int slot, boolean doPull) { + if (locked || slot >= fluids.length) { + return 0; + } + if (slot < 0 || slot >= maxDistinctFluids) { + return 0; + } + FluidStack tFluid = fluids[slot]; + if (tFluid == null || !tFluid.equals(pull)) { + return 0; + } else { + final int rec = Math.min(pull.amount, tFluid.amount); + if (doPull) { + tFluid.amount -= rec; + } + if (tFluid.amount == 0) { + fluids[slot] = null; + } + return rec; + } + } + + /** + * Test whether the given fluid type and quantity can be inserted into the internal tanks. + * @param push + * Fluid type and quantity to be tested + * @return True if there is sufficient space + */ + public boolean couldPush(FluidStack push) { + if (locked) { + return false; + } + int tFluidIndex = getFluidPosistion(push); + int fluidCount = countFluids(); + if (fluidCount >= maxDistinctFluids && !contains(push)) { + return false; + } else if (fluidCount < maxDistinctFluids && !contains(push)) { + return Math.min(getCapacity(), push.amount) > 0; + } else { + final int remcap = getCapacity() - fluids[tFluidIndex].amount; + return doVoidExcess || (Math.min(remcap, push.amount) > 0); + } + } } diff --git a/src/main/java/kekztech/ServerProxy.java b/src/main/java/kekztech/ServerProxy.java index 0291cf687f..ac366a54fd 100644 --- a/src/main/java/kekztech/ServerProxy.java +++ b/src/main/java/kekztech/ServerProxy.java @@ -2,6 +2,4 @@ package kekztech; import common.CommonProxy; -public class ServerProxy extends CommonProxy { - -} +public class ServerProxy extends CommonProxy {} diff --git a/src/main/java/reactor/ButtonSlot.java b/src/main/java/reactor/ButtonSlot.java index 94c259d403..2c059e363a 100644 --- a/src/main/java/reactor/ButtonSlot.java +++ b/src/main/java/reactor/ButtonSlot.java @@ -1,14 +1,11 @@ -package reactor;
-
-import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.Slot;
-
-public class ButtonSlot extends Slot {
-
- public ButtonSlot(IInventory playerIventory, int slotID, int posX, int posY) {
- super(playerIventory, slotID, posX, posY);
-
-
- }
-
-}
+package reactor; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +public class ButtonSlot extends Slot { + + public ButtonSlot(IInventory playerIventory, int slotID, int posX, int posY) { + super(playerIventory, slotID, posX, posY); + } +} diff --git a/src/main/java/reactor/Reactor.java b/src/main/java/reactor/Reactor.java index f6f955b230..024daf102b 100644 --- a/src/main/java/reactor/Reactor.java +++ b/src/main/java/reactor/Reactor.java @@ -5,5 +5,4 @@ public class Reactor { private long energyPerSecond; private long heat; private long maxHeat; - } diff --git a/src/main/java/reactor/items/CoolantCell.java b/src/main/java/reactor/items/CoolantCell.java index abfc9ad88f..8b78881f48 100644 --- a/src/main/java/reactor/items/CoolantCell.java +++ b/src/main/java/reactor/items/CoolantCell.java @@ -1,15 +1,10 @@ -package reactor.items;
-
-public class CoolantCell {
-
- public static String TYPE = "CoolantCell";
-
- public static String[] RESOURCE_NAME = {
- "HeliumCoolantCell360k", "NaKCoolantCell360k"
- };
-
- public static int[] HEAT_CAPACITY = {
- 360000, 360000
- };
-
-}
+package reactor.items; + +public class CoolantCell { + + public static String TYPE = "CoolantCell"; + + public static String[] RESOURCE_NAME = {"HeliumCoolantCell360k", "NaKCoolantCell360k"}; + + public static int[] HEAT_CAPACITY = {360000, 360000}; +} diff --git a/src/main/java/reactor/items/FuelRod.java b/src/main/java/reactor/items/FuelRod.java index 9642412f9d..0df756dfc2 100644 --- a/src/main/java/reactor/items/FuelRod.java +++ b/src/main/java/reactor/items/FuelRod.java @@ -1,78 +1,75 @@ -package reactor.items;
-
-public class FuelRod {
-
- public static final int METAOFFSET = 17;
- public static final int METAOFFSET_DEPLETED = 29;
-
- public static final String TYPE = "FuelRod";
- public static final String TYPE_DEPLETED = "DepletedFuelRod";
- public static final String LIFETIME = "LIFETIME";
- public static final String PULSES = "PULSES";
- public static final String HEAT_PER_SECOND = "HEAT_PER_SECOND";
- public static final String HEAT_PER_PULSE = "HEAT_PER_PULSE";
- public static final String HEAT_BOOST_RATE = "HEAT_BOOST_RATE";
- public static final String EU_PER_TICK = "EU_PER_TICK";
- public static final String EU_PER_PULSE = "EU_PER_PULSE";
-
-
- public static final String[] RESOURCE_NAME = {
- "UraniumFuelRod", "UraniumDualFuelRod", "UraniumQuadFuelRod",
- "ThoriumFuelRod", "ThoriumDualFuelRod", "ThoriumQuadFuelRod",
- "MOXFuelRod", "MOXDualFuelRod", "MOXQuadFuelRod",
- "NaquadahFuelRod", "NaquadahDualFuelRod", "NaquadahQuadFuelRod",
- "Th_MOXFuelRod", "Th_MOXDualFuelRod", "Th_MOXQuadFuelRod"
- };
-
- public static final String[] RESOURCE_NAME_DEPLETED = {
- "DepletedUraniumFuelRod", "DepletedUraniumDualFuelRod", "DepletedUraniumQuadFuelRod",
- "DepletedThoriumFuelRod", "DepletedThoriumDualFuelRod", "DepletedThoriumQuadFuelRod",
- "DepletedMOXFuelRod", "DepletedMOXDualFuelRod", "DepletedMOXQuadFuelRod",
- "DepletedNaquadahFuelRod", "DepletedNaquadahDualFuelRod", "DepletedNaquadahQuadFuelRod",
- "Th_DepletedMOXFuelRod", "Th_DepletedMOXDualFuelRod", "Th_DepletedMOXQuadFuelRod"
- };
-
- public static final int[] VALUES_LIFETIME = {
- 20000, 20000, 20000, 100000, 100000, 100000,
- 10000, 10000, 10000, 100000, 100000, 100000,
- 50000, 50000, 50000
- };
-
- public static final int[] VALUES_PULSES = {
- 1, 2, 4, 1, 2, 4,
- 1, 2, 4, 1, 2, 4,
- 1, 2, 4
- };
-
- public static final int[] VALUES_HEAT_PER_SECOND = {
- 4, 24, 96, 1, 6, 24,
- 4, 24, 96, 80, 480, 1920,
- 1, 6, 24
- };
-
- public static final int[] VALUES_HEAT_PER_PULSE = {
- 4, 4, 4, 1, 1, 1,
- 4, 4, 4, 80, 80, 80,
- 1, 1, 1
-
- };
-
- public static final double[] VALUES_HEAT_BOOST_RATE = {
- 1, 1, 1, 1, 1, 1,
- 5, 5, 5, 1, 1, 1,
- 2, 2, 2
- };
-
- public static final int[] VALUES_EU_PER_TICK = {
- 50, 200, 600, 10, 40, 120,
- 50, 200, 600, 100, 400, 1200,
- 10, 40, 120
- };
-
- public static final int[] VALUES_EU_PER_PULSE = {
- 50, 50, 50, 10, 10, 10,
- 50, 50, 50, 100, 100, 100,
- 10, 10, 10
- };
-
-}
+package reactor.items; + +public class FuelRod { + + public static final int METAOFFSET = 17; + public static final int METAOFFSET_DEPLETED = 29; + + public static final String TYPE = "FuelRod"; + public static final String TYPE_DEPLETED = "DepletedFuelRod"; + public static final String LIFETIME = "LIFETIME"; + public static final String PULSES = "PULSES"; + public static final String HEAT_PER_SECOND = "HEAT_PER_SECOND"; + public static final String HEAT_PER_PULSE = "HEAT_PER_PULSE"; + public static final String HEAT_BOOST_RATE = "HEAT_BOOST_RATE"; + public static final String EU_PER_TICK = "EU_PER_TICK"; + public static final String EU_PER_PULSE = "EU_PER_PULSE"; + + public static final String[] RESOURCE_NAME = { + "UraniumFuelRod", "UraniumDualFuelRod", "UraniumQuadFuelRod", + "ThoriumFuelRod", "ThoriumDualFuelRod", "ThoriumQuadFuelRod", + "MOXFuelRod", "MOXDualFuelRod", "MOXQuadFuelRod", + "NaquadahFuelRod", "NaquadahDualFuelRod", "NaquadahQuadFuelRod", + "Th_MOXFuelRod", "Th_MOXDualFuelRod", "Th_MOXQuadFuelRod" + }; + + public static final String[] RESOURCE_NAME_DEPLETED = { + "DepletedUraniumFuelRod", "DepletedUraniumDualFuelRod", "DepletedUraniumQuadFuelRod", + "DepletedThoriumFuelRod", "DepletedThoriumDualFuelRod", "DepletedThoriumQuadFuelRod", + "DepletedMOXFuelRod", "DepletedMOXDualFuelRod", "DepletedMOXQuadFuelRod", + "DepletedNaquadahFuelRod", "DepletedNaquadahDualFuelRod", "DepletedNaquadahQuadFuelRod", + "Th_DepletedMOXFuelRod", "Th_DepletedMOXDualFuelRod", "Th_DepletedMOXQuadFuelRod" + }; + + public static final int[] VALUES_LIFETIME = { + 20000, 20000, 20000, 100000, 100000, 100000, + 10000, 10000, 10000, 100000, 100000, 100000, + 50000, 50000, 50000 + }; + + public static final int[] VALUES_PULSES = { + 1, 2, 4, 1, 2, 4, + 1, 2, 4, 1, 2, 4, + 1, 2, 4 + }; + + public static final int[] VALUES_HEAT_PER_SECOND = { + 4, 24, 96, 1, 6, 24, + 4, 24, 96, 80, 480, 1920, + 1, 6, 24 + }; + + public static final int[] VALUES_HEAT_PER_PULSE = { + 4, 4, 4, 1, 1, 1, + 4, 4, 4, 80, 80, 80, + 1, 1, 1 + }; + + public static final double[] VALUES_HEAT_BOOST_RATE = { + 1, 1, 1, 1, 1, 1, + 5, 5, 5, 1, 1, 1, + 2, 2, 2 + }; + + public static final int[] VALUES_EU_PER_TICK = { + 50, 200, 600, 10, 40, 120, + 50, 200, 600, 100, 400, 1200, + 10, 40, 120 + }; + + public static final int[] VALUES_EU_PER_PULSE = { + 50, 50, 50, 10, 10, 10, + 50, 50, 50, 100, 100, 100, + 10, 10, 10 + }; +} diff --git a/src/main/java/reactor/items/HeatExchanger.java b/src/main/java/reactor/items/HeatExchanger.java index d85ed325ca..ec4dbce8e7 100644 --- a/src/main/java/reactor/items/HeatExchanger.java +++ b/src/main/java/reactor/items/HeatExchanger.java @@ -1,23 +1,14 @@ -package reactor.items;
-
-public class HeatExchanger {
-
- public static String TYPE = "HeatExchanger";
-
- public static String[] RESOURCE_NAME = {
- "T1HeatExchanger", "T2HeatExchanger", "T3HeatExchanger", "T4HeatExchanger"
- };
-
- public static int[] HEAT_CAPACITY = {
- 2000, 8000, 32000, 128000
- };
-
- public static int[] COMPONENT_EXCHANGE_RATE = {
- 12, 24, 96, 384
- };
-
- public static int[] HULL_EXCHANGE_RATE = {
- 4, 8, 32, 128
- };
-
-}
+package reactor.items; + +public class HeatExchanger { + + public static String TYPE = "HeatExchanger"; + + public static String[] RESOURCE_NAME = {"T1HeatExchanger", "T2HeatExchanger", "T3HeatExchanger", "T4HeatExchanger"}; + + public static int[] HEAT_CAPACITY = {2000, 8000, 32000, 128000}; + + public static int[] COMPONENT_EXCHANGE_RATE = {12, 24, 96, 384}; + + public static int[] HULL_EXCHANGE_RATE = {4, 8, 32, 128}; +} diff --git a/src/main/java/reactor/items/HeatVent.java b/src/main/java/reactor/items/HeatVent.java index 1ae0388de3..100de26d04 100644 --- a/src/main/java/reactor/items/HeatVent.java +++ b/src/main/java/reactor/items/HeatVent.java @@ -1,44 +1,42 @@ -package reactor.items;
-
-public class HeatVent {
-
- public static final String TYPE = "HeatVent";
- public static final String HEAT = "HEAT";
- public static final String RESOURCE_NAME = "RESOURCE_NAME";
- public static final String HEAT_CAPACITY = "HEAT_CAPACITY";
- public static final String COMPONENT_VENT_RATE = "COMPONENT_VENT_RATE";
- public static final String HULL_DRAW_RATE = "HULL_DRAW_RATE";
- public static final String SELF_COOL_RATE = "SELF_COOL_RATE";
-
-
- public static String[] RESOURCE_NAMES = {
- "T1HeatVent", "T2HeatVent", "T3HeatVent", "T4HeatVent",
- "T1ComponentHeatVent", "T2ComponentHeatVent", "T3ComponentHeatVent", "T4ComponentHeatVent",
- "T1OverclockedHeatVent", "T2OverclockedHeatVent", "T3OverclockedHeatVent", "T4OverclockedHeatVent"
- };
-
- public static int[] HEAT_CAPACITIES = {
- 1000, 4000, 8000, 32000,
- 1000, 4000, 8000, 32000,
- 1000, 4000, 8000, 32000
- };
-
- public static int[] COMPONENT_VENT_RATES = {
- 0, 0, 0, 0,
- 6, 12, 48, 96,
- 0, 0, 0, 0
- };
-
- public static int[] HULL_DRAW_RATES = {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 18, 36, 144, 288
- };
-
- public static int[] SELF_COOL_RATES = {
- 6, 12, 48, 96,
- 0, 0, 0, 0,
- 10, 20, 80, 160
- };
-
-}
+package reactor.items; + +public class HeatVent { + + public static final String TYPE = "HeatVent"; + public static final String HEAT = "HEAT"; + public static final String RESOURCE_NAME = "RESOURCE_NAME"; + public static final String HEAT_CAPACITY = "HEAT_CAPACITY"; + public static final String COMPONENT_VENT_RATE = "COMPONENT_VENT_RATE"; + public static final String HULL_DRAW_RATE = "HULL_DRAW_RATE"; + public static final String SELF_COOL_RATE = "SELF_COOL_RATE"; + + public static String[] RESOURCE_NAMES = { + "T1HeatVent", "T2HeatVent", "T3HeatVent", "T4HeatVent", + "T1ComponentHeatVent", "T2ComponentHeatVent", "T3ComponentHeatVent", "T4ComponentHeatVent", + "T1OverclockedHeatVent", "T2OverclockedHeatVent", "T3OverclockedHeatVent", "T4OverclockedHeatVent" + }; + + public static int[] HEAT_CAPACITIES = { + 1000, 4000, 8000, 32000, + 1000, 4000, 8000, 32000, + 1000, 4000, 8000, 32000 + }; + + public static int[] COMPONENT_VENT_RATES = { + 0, 0, 0, 0, + 6, 12, 48, 96, + 0, 0, 0, 0 + }; + + public static int[] HULL_DRAW_RATES = { + 0, 0, 0, 0, + 0, 0, 0, 0, + 18, 36, 144, 288 + }; + + public static int[] SELF_COOL_RATES = { + 6, 12, 48, 96, + 0, 0, 0, 0, + 10, 20, 80, 160 + }; +} diff --git a/src/main/java/reactor/items/NeutronReflector.java b/src/main/java/reactor/items/NeutronReflector.java index 773f34ee49..3d18413104 100644 --- a/src/main/java/reactor/items/NeutronReflector.java +++ b/src/main/java/reactor/items/NeutronReflector.java @@ -1,15 +1,10 @@ -package reactor.items;
-
-public class NeutronReflector {
-
- public static String TYPE = "NeutronReflector";
-
- public static String[] RESOURCE_NAME = {
- "T1NeutronReflector", "T2NeutronReflector"
- };
-
- public static int[] DURABILITY = {
- 512000, 2147483647
- };
-
-}
+package reactor.items; + +public class NeutronReflector { + + public static String TYPE = "NeutronReflector"; + + public static String[] RESOURCE_NAME = {"T1NeutronReflector", "T2NeutronReflector"}; + + public static int[] DURABILITY = {512000, 2147483647}; +} diff --git a/src/main/java/util/Util.java b/src/main/java/util/Util.java index 8ccf3313ac..b9af3a06dc 100644 --- a/src/main/java/util/Util.java +++ b/src/main/java/util/Util.java @@ -1,51 +1,49 @@ package util; +import common.items.ErrorItem; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - -import common.items.ErrorItem; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; public class Util { - - public static ItemStack getStackofAmountFromOreDict(String oredictName, final int amount){ - final ArrayList<ItemStack> list = OreDictionary.getOres(oredictName); - if(!list.isEmpty()) { - final ItemStack ret = list.get(0).copy(); - ret.stackSize = amount; - return ret; - } - System.err.println("Failed to find " + oredictName + " in OreDict"); - return new ItemStack(ErrorItem.getInstance(), amount); - } - - public static ItemStack[] toItemStackArray(List<ItemStack> stacksList) { - if(stacksList.size() == 0) { - return null; - } - - ItemStack[] ret = new ItemStack[stacksList.size()]; - Iterator<ItemStack> iterator = stacksList.iterator(); - for(int i = 0; i < ret.length; i++ ) { - ret[i] = iterator.next(); - } - return ret; - } - - public static FluidStack[] toFluidStackArray(List<FluidStack> stacksList) { - if(stacksList.size() == 0) { - return null; - } - - FluidStack[] ret = new FluidStack[stacksList.size()]; - Iterator<FluidStack> iterator = stacksList.iterator(); - for(int i = 0; i < ret.length; i++ ) { - ret[i] = iterator.next(); - } - return ret; - } - + + public static ItemStack getStackofAmountFromOreDict(String oredictName, final int amount) { + final ArrayList<ItemStack> list = OreDictionary.getOres(oredictName); + if (!list.isEmpty()) { + final ItemStack ret = list.get(0).copy(); + ret.stackSize = amount; + return ret; + } + System.err.println("Failed to find " + oredictName + " in OreDict"); + return new ItemStack(ErrorItem.getInstance(), amount); + } + + public static ItemStack[] toItemStackArray(List<ItemStack> stacksList) { + if (stacksList.size() == 0) { + return null; + } + + ItemStack[] ret = new ItemStack[stacksList.size()]; + Iterator<ItemStack> iterator = stacksList.iterator(); + for (int i = 0; i < ret.length; i++) { + ret[i] = iterator.next(); + } + return ret; + } + + public static FluidStack[] toFluidStackArray(List<FluidStack> stacksList) { + if (stacksList.size() == 0) { + return null; + } + + FluidStack[] ret = new FluidStack[stacksList.size()]; + Iterator<FluidStack> iterator = stacksList.iterator(); + for (int i = 0; i < ret.length; i++) { + ret[i] = iterator.next(); + } + return ret; + } } diff --git a/src/main/java/util/Vector3i.java b/src/main/java/util/Vector3i.java index 5281c2dacc..6b35d14787 100644 --- a/src/main/java/util/Vector3i.java +++ b/src/main/java/util/Vector3i.java @@ -1,32 +1,30 @@ -package util;
-
-public class Vector3i implements Vector3ic {
-
- public int x, y, z;
-
- public Vector3i() {
- x = 1;
- y = 1;
- z = 1;
- }
-
- public Vector3i(int x, int y, int z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-
- public int x() {
- return x;
- }
-
- public int y() {
- return y;
- }
-
- public int z() {
- return z;
- }
-
-
-}
+package util; + +public class Vector3i implements Vector3ic { + + public int x, y, z; + + public Vector3i() { + x = 1; + y = 1; + z = 1; + } + + public Vector3i(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public int x() { + return x; + } + + public int y() { + return y; + } + + public int z() { + return z; + } +} diff --git a/src/main/java/util/Vector3ic.java b/src/main/java/util/Vector3ic.java index 8c73c858a3..ea9a429d6f 100644 --- a/src/main/java/util/Vector3ic.java +++ b/src/main/java/util/Vector3ic.java @@ -1,8 +1,10 @@ -package util;
-
-public interface Vector3ic {
-
- public int x();
- public int y();
- public int z();
-}
+package util; + +public interface Vector3ic { + + public int x(); + + public int y(); + + public int z(); +} |