aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tileentities
diff options
context:
space:
mode:
authorkekzdealer <kekzdealer@gmail.com>2019-10-09 02:43:07 +0200
committerkekzdealer <kekzdealer@gmail.com>2019-10-09 02:43:07 +0200
commit820ca984d2dea005a126ef585661503f8cc992f5 (patch)
treebca38b81b17c435e493bf8030fad31ffe5d6d9bc /src/main/java/tileentities
parent187fbf985078ee89f12a287a6754f2023c5e16be (diff)
downloadGT5-Unofficial-820ca984d2dea005a126ef585661503f8cc992f5.tar.gz
GT5-Unofficial-820ca984d2dea005a126ef585661503f8cc992f5.tar.bz2
GT5-Unofficial-820ca984d2dea005a126ef585661503f8cc992f5.zip
improved T.F.F.T code; Prepared for MultiHatch
Diffstat (limited to 'src/main/java/tileentities')
-rw-r--r--src/main/java/tileentities/GTMTE_FluidMultiStorage.java1021
-rw-r--r--src/main/java/tileentities/GTMTE_ModularNuclearReactor.java380
-rw-r--r--src/main/java/tileentities/GTMTE_SOFuelCellMK1.java656
-rw-r--r--src/main/java/tileentities/GTMTE_SOFuelCellMK2.java656
-rw-r--r--src/main/java/tileentities/TFFTMultiHatch.java138
5 files changed, 1487 insertions, 1364 deletions
diff --git a/src/main/java/tileentities/GTMTE_FluidMultiStorage.java b/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
index a11dcdda8a..32d17d1cf5 100644
--- a/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
+++ b/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
@@ -1,518 +1,503 @@
-package tileentities;
-
-import java.util.ArrayList;
-import blocks.Block_TFFTCasing;
-import blocks.Block_TFFTStorageFieldBlockT1;
-import blocks.Block_TFFTStorageFieldBlockT2;
-import blocks.Block_TFFTStorageFieldBlockT3;
-import blocks.Block_TFFTStorageFieldBlockT4;
-import gregtech.api.enums.Textures.BlockIcons;
-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_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
-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;
-
-public class GTMTE_FluidMultiStorage extends GT_MetaTileEntity_MultiBlockBase {
-
- private final String glassNameAE2 = "tile.appliedenergistics2.BlockQuartzGlass";
- private final String glassNameStained = "tile.stainedGlass";
- private final Block CASING = Block_TFFTCasing.getInstance();
- private final Block STORAGE_FIELD1 = Block_TFFTStorageFieldBlockT1.getInstance();
- private final Block STORAGE_FIELD2 = Block_TFFTStorageFieldBlockT2.getInstance();
- private final Block STORAGE_FIELD3 = Block_TFFTStorageFieldBlockT3.getInstance();
- private final Block STORAGE_FIELD4 = Block_TFFTStorageFieldBlockT4.getInstance();
- private final int CASING_TEXTURE_ID = 176;
-
- private final ArrayList<FluidStack> fluidList = new ArrayList<>();
- private int capacityPerFluid = 0;
- private int runningCost = 0;
- private boolean doVoidExcess = false;
-
- public GTMTE_FluidMultiStorage(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
-
- public GTMTE_FluidMultiStorage(String aName) {
- super(aName);
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
- return new GTMTE_FluidMultiStorage(super.mName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] {
- "High-Tech fluid tank that can hold up to 25 different fluids",
- "Has 1/25th of the total capacity as capacity for each fluid",
- "Rightclicking the controller with a screwdriver will turn on excess voiding",
- "Fluid storage amount and running cost depends on the storage field blocks used",
- "Tier I: 500,000L per block, 0.5EU/t",
- "Tier II: 4,000,000L per block, 1EU/t",
- "Tier III: 16,000,000L per block, 2EU/t",
- "Tier IV: 64,000,000L per block, 4EU/t",
- "------------------------------------------",
- "Note on hatch locking:",
- "Use an integrated circuit in the GUI slot to limit which fluid is outputted",
- "The number of a stored fluid can be obtained through the Tricorder.",
- "------------------------------------------",
- "Dimensions: 5x9x5 (WxHxL)",
- "Structure:",
- " Controller: Top center",
- " Energy Hatch: Any top or bottom casing",
- " Inner 3x7x3 tube are Storage Field Blocks",
- " Outer 5x7x5 glass shell is AE2 Quartz Glass or Vanilla Stained Glass",
- " Maintenance Hatch: Any top or bottom casing",
- " I/O Hatches: Instead of any casing or glass, have to touch storage field"
- };
- }
-
- @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) {
-
- this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000;
- this.mEfficiencyIncrease = 10000;
- this.mEUt = runningCost;
- super.mMaxProgresstime = 10;
-
- // Suck in fluids
- final ArrayList<FluidStack> storedFluids = super.getStoredFluids();
- if(storedFluids.size() > 0) {
- for(FluidStack fluidStack : storedFluids) {
-
- // check if fluid is already in the tank
- boolean foundFluid = false;
- for(FluidStack fs : fluidList) {
- if(GT_Utility.areFluidsEqual(fluidStack, fs)) {
- // figure out how much can be input
- final int possibleInput = Math.min(capacityPerFluid - fs.amount, fluidStack.amount);
- fs.amount += possibleInput;
- final FluidStack tempStack = fluidStack.copy();
- tempStack.amount = possibleInput;
- super.depleteInput(tempStack);
- foundFluid = true;
- break;
- }
- }
- if(foundFluid) {
- continue;
- }
- // fluid wasn't already in the tank - allocate new
- if(fluidList.size() < 25) {
- System.out.println("added " + fluidStack.getUnlocalizedName() + " to new stack");
- final FluidStack drainStack = fluidStack.copy();
- drainStack.amount = fluidStack.amount;
- super.depleteInput(drainStack);
- fluidList.add(drainStack);
- }
- }
-
- // void excess if that is turned on
- if(doVoidExcess) {
- for(GT_MetaTileEntity_Hatch_Input inputHatch : super.mInputHatches) {
- inputHatch.setDrainableStack(null);
- }
- }
- }
-
- // Push out fluids
- if(guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) {
- final int config = guiSlotItem.getItemDamage();
- final FluidStack storedFluid = fluidList.get(config);
- if(storedFluid == null) {
- return true;
- }
- // figure out how much can be output
- 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
- possibleOutput = Math.min(possibleOutput, storedFluid.amount);
- final FluidStack tempStack = storedFluid.copy();
- tempStack.amount = possibleOutput;
-
- super.addOutput(tempStack);
- storedFluid.amount -= possibleOutput;
- // remove fluid from the tank if it has amount of zero
- if(storedFluid.amount < 1) {
- fluidList.remove(config);
- }
- } else {
- for(FluidStack storedFluid : fluidList) {
- // figure out how much can be output
- 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
- possibleOutput = Math.min(possibleOutput, storedFluid.amount);
- final FluidStack tempStack = storedFluid.copy();
- tempStack.amount = possibleOutput;
-
- super.addOutput(tempStack);
- storedFluid.amount -= possibleOutput;
- // remove fluid from the tank if it has amount of zero
- if(storedFluid.amount < 1) {
- fluidList.remove(storedFluid);
- }
- }
- }
-
- return true;
- }
-
- 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;
-
- // Front slice
- for(int X = -2; X <= 2; X++) {
- for(int Y = -2; Y <= 2; Y++) {
- if(X == 0 && Y == 0) {
- continue; // is controller
- }
-
- // Get next TE
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
- 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)) {
-
- // 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;
- }
- }
- }
- }
- }
-
- // Middle three slices
- 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 += 500000.0f;
- } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals(STORAGE_FIELD2.getUnlocalizedName())) {
- runningCostAcc += 1.0f;
- fluidCapacityAcc += 4000000.0f;
- } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals(STORAGE_FIELD3.getUnlocalizedName())) {
- runningCostAcc += 2.0f;
- fluidCapacityAcc += 16000000.0f;
- } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals(STORAGE_FIELD4.getUnlocalizedName())) {
- runningCostAcc += 4.0f;
- fluidCapacityAcc += 64000000.0f;
- } else {
- formationChecklist = false;
- }
- continue;
- }
-
- // Get next TE
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,z
-
- // Corner allows only glass or casings
- 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(glassNameAE2)
- || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameStained)
- || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING)) {
- formationChecklist = false; // do nothing yet
- }
- } 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)) {
-
- // 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 if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameAE2)
- || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameStained)) {
- // do nothing lol
- } else {
- formationChecklist = false;
- }
- }
- }
- }
- }
- }
-
- // Front slice
- 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);
- 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)) {
-
- // 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) {
- System.out.println("At least one energy hatch is required!");
- formationChecklist = false;
- }
-
- if(this.mMaintenanceHatches.size() < 1) {
- System.out.println("You need a maintenance hatch to do maintenance.");
- }
-
- if(minCasingAmount > 0) {
- formationChecklist = false;
- }
-
- if(formationChecklist) {
- runningCost = (int) Math.round(-runningCostAcc);
- capacityPerFluid = (int) Math.round(fluidCapacityAcc / 25.0f);
- }
-
- return formationChecklist;
- }
-
- @Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if(doVoidExcess) {
- doVoidExcess = false;
- aPlayer.addChatComponentMessage(new ChatComponentText("Auto-voiding turned off"));
- } else {
- doVoidExcess = true;
- aPlayer.addChatComponentMessage(new ChatComponentText("Auto-voiding turned on"));
- }
- }
-
- @Override
- public String[] getInfoData() {
- final String[] lines = new String[fluidList.size() + 7];
- lines[0] = EnumChatFormatting.YELLOW + "Stored Fluids:" + EnumChatFormatting.RESET;
- for(int i = 0; i < fluidList.size(); i++) {
- lines[i + 1] = i + " - " + fluidList.get(i).getLocalizedName() + ": "
- + fluidList.get(i).amount + "L ("
- + (Math.round(100.0f * fluidList.get(i).amount / capacityPerFluid)) + "%)";
- }
- lines[fluidList.size() + 1] = EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET;
- lines[fluidList.size() + 2] = "Auto-voiding: " + doVoidExcess;
- lines[fluidList.size() + 3] = "Per-Fluid Capacity: " + capacityPerFluid + "L";
- lines[fluidList.size() + 4] = "Running Cost: " + (-super.mEUt) + "EU/t";
- lines[fluidList.size() + 5] = "Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus())
- ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET
- : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET);
- lines[fluidList.size() + 6] = "---------------------------------------------";
- return lines;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound nbt) {
- nbt = (nbt == null) ? new NBTTagCompound() : nbt;
-
- nbt.setInteger("capacityPerFluid", capacityPerFluid);
- nbt.setInteger("runningCost", runningCost);
- nbt.setBoolean("doVoidExcess", doVoidExcess);
- for(int i = 0; i < fluidList.size(); i++) {
- nbt.setTag("" + i, fluidList.get(i).writeToNBT(new NBTTagCompound()));
- }
-
- super.saveNBTData(nbt);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound nbt) {
- nbt = (nbt == null) ? new NBTTagCompound() : nbt;
-
- capacityPerFluid = nbt.getInteger("capacityPerFluid");
- runningCost = nbt.getInteger("runningCost");
- doVoidExcess = nbt.getBoolean("doVoidExcess");
- fluidList.clear();
- for(int i = 0; i < 25; i++) {
- final NBTTagCompound fnbt = (NBTTagCompound) nbt.getTag("" + i);
- if(fnbt == null) {
- break;
- }
- fluidList.add(FluidStack.loadFluidStackFromNBT(fnbt));
- }
-
- 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;
- }
-}
+package tileentities;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import blocks.Block_TFFTCasing;
+import blocks.Block_TFFTStorageFieldBlockT1;
+import blocks.Block_TFFTStorageFieldBlockT2;
+import blocks.Block_TFFTStorageFieldBlockT3;
+import blocks.Block_TFFTStorageFieldBlockT4;
+import gregtech.api.enums.Textures.BlockIcons;
+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_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+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;
+
+public class GTMTE_FluidMultiStorage extends GT_MetaTileEntity_MultiBlockBase {
+
+ private final String glassNameAE2 = "tile.appliedenergistics2.BlockQuartzGlass";
+ private final String glassNameStained = "tile.stainedGlass";
+ private final Block CASING = Block_TFFTCasing.getInstance();
+ private final Block STORAGE_FIELD1 = Block_TFFTStorageFieldBlockT1.getInstance();
+ private final Block STORAGE_FIELD2 = Block_TFFTStorageFieldBlockT2.getInstance();
+ private final Block STORAGE_FIELD3 = Block_TFFTStorageFieldBlockT3.getInstance();
+ private final Block STORAGE_FIELD4 = Block_TFFTStorageFieldBlockT4.getInstance();
+ private final int CASING_TEXTURE_ID = 176;
+
+ private MultiFluidHandler mfh;
+
+ private int runningCost = 0;
+ private boolean doVoidExcess = false;
+
+ public GTMTE_FluidMultiStorage(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GTMTE_FluidMultiStorage(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
+ return new GTMTE_FluidMultiStorage(super.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "High-Tech fluid tank that can hold up to 25 different fluids",
+ "Has 1/25th of the total capacity as capacity for each fluid",
+ "Rightclicking the controller with a screwdriver will turn on excess voiding",
+ "Fluid storage amount and running cost depends on the storage field blocks used",
+ "Tier I: 500,000L per block, 0.5EU/t",
+ "Tier II: 4,000,000L per block, 1EU/t",
+ "Tier III: 16,000,000L per block, 2EU/t",
+ "Tier IV: 64,000,000L per block, 4EU/t",
+ "------------------------------------------",
+ "Note on hatch locking:",
+ "Use an integrated circuit in the GUI slot to limit which fluid is outputted",
+ "The number of a stored fluid can be obtained through the Tricorder.",
+ "------------------------------------------",
+ "Dimensions: 5x9x5 (WxHxL)",
+ "Structure:",
+ " Controller: Top center",
+ " Energy Hatch: Any top or bottom casing",
+ " Inner 3x7x3 tube are Storage Field Blocks",
+ " Outer 5x7x5 glass shell is AE2 Quartz Glass or Vanilla Stained Glass",
+ " Maintenance Hatch: Any top or bottom casing",
+ " I/O Hatches: Instead of any casing or glass, have to touch storage field"
+ };
+ }
+
+ @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) {
+
+ this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000;
+ this.mEfficiencyIncrease = 10000;
+ this.mEUt = runningCost;
+ super.mMaxProgresstime = 10;
+
+ // TODO skip all of the currently existing code in here when there are only multi hatches
+
+ // Suck in fluids
+ final ArrayList<FluidStack> inputHatchFluids = super.getStoredFluids();
+ if(inputHatchFluids.size() > 0) {
+
+ for(FluidStack fluidStack : inputHatchFluids) {
+
+ final int pushed = mfh.pushFluid(fluidStack);
+ final FluidStack toDeplete = fluidStack.copy();
+ toDeplete.amount = pushed;
+ super.depleteInput(toDeplete);
+ }
+
+ // Void excess if that is turned on
+ if(doVoidExcess) {
+ for(GT_MetaTileEntity_Hatch_Input inputHatch : super.mInputHatches) {
+ inputHatch.setDrainableStack(null);
+ }
+ }
+ }
+
+ // TODO output seems to ignore circuit
+ // Push out fluids
+ if(guiSlotItem != null && guiSlotItem.getUnlocalizedName().equals("gt.integrated_circuit")) {
+ final int config = guiSlotItem.getItemDamage();
+ final FluidStack storedFluid = mfh.getFluid(config);
+ // 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;
+ possibleOutput = mfh.pullFluid(tempStack, config);
+ super.addOutput(tempStack);
+
+ } else {
+ final Iterator<FluidStack> storageIterator = mfh.getFluids().iterator();
+ while(storageIterator.hasNext()) {
+ FluidStack storedFluid = storageIterator.next();
+ // 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;
+ // TODO possible concurrent modification exception as pullFluid calls remove() without an iterator
+ possibleOutput = mfh.pullFluid(tempStack);
+ super.addOutput(tempStack);
+ }
+ }
+
+ return true;
+ }
+
+ 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) {
+ try {
+ // 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;
+
+ // Front slice
+ for(int X = -2; X <= 2; X++) {
+ for(int Y = -2; Y <= 2; Y++) {
+ if(X == 0 && Y == 0) {
+ continue; // is controller
+ }
+
+ // Get next TE
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
+ 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)) {
+
+ // 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;
+ }
+ }
+ }
+ }
+ }
+
+ // Middle three slices
+ 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 += 500000.0f;
+ } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals(STORAGE_FIELD2.getUnlocalizedName())) {
+ runningCostAcc += 1.0f;
+ fluidCapacityAcc += 4000000.0f;
+ } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals(STORAGE_FIELD3.getUnlocalizedName())) {
+ runningCostAcc += 2.0f;
+ fluidCapacityAcc += 16000000.0f;
+ } else if(thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals(STORAGE_FIELD4.getUnlocalizedName())) {
+ runningCostAcc += 4.0f;
+ fluidCapacityAcc += 64000000.0f;
+ } else {
+ formationChecklist = false;
+ }
+ continue;
+ }
+
+ // Get next TE
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,z
+
+ // Corner allows only glass or casings
+ 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(glassNameAE2)
+ || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameStained)
+ || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CASING)) {
+ formationChecklist = false; // do nothing yet
+ }
+ } 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)) {
+
+ // 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 if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameAE2)
+ || thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName().equals(glassNameStained)) {
+ // do nothing lol
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Front slice
+ 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);
+ 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)) {
+
+ // 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) {
+ System.out.println("At least one energy hatch is required!");
+ formationChecklist = false;
+ }
+
+ if(this.mMaintenanceHatches.size() < 1) {
+ System.out.println("You need a maintenance hatch to do maintenance.");
+ formationChecklist = false;
+ }
+
+ if(minCasingAmount > 0) {
+ formationChecklist = false;
+ }
+
+ if(formationChecklist) {
+ runningCost = (int) Math.round(-runningCostAcc);
+ // Update MultiFluidHandler in case storage cells have been changed
+ // TODO update multihatch refs
+ final int capacityPerFluid = (int) Math.round(fluidCapacityAcc / 25.0f);
+ if(mfh == null) {
+ mfh = new MultiFluidHandler(capacityPerFluid);
+ } else {
+ if(mfh.getCapacity() != capacityPerFluid) {
+ mfh = new MultiFluidHandler(capacityPerFluid, mfh.getFluids());
+ }
+ }
+ }
+
+ return formationChecklist;
+ } catch (Exception ex) {
+ System.err.println("CAUGHT CHECKMACHINE EXCEPTION");
+ }
+ return false;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if(doVoidExcess) {
+ doVoidExcess = false;
+ aPlayer.addChatComponentMessage(new ChatComponentText("Auto-voiding turned off"));
+ } else {
+ doVoidExcess = true;
+ aPlayer.addChatComponentMessage(new ChatComponentText("Auto-voiding turned on"));
+ }
+ }
+
+ @Override
+ public String[] getInfoData() {
+ final ArrayList<String> ll = mfh.getInfoData();
+
+ ll.add("Auto-voiding: " + doVoidExcess);
+ ll.add("Per-Fluid Capacity: " + mfh.getCapacity() + "L");
+ ll.add("Running Cost: " + (-super.mEUt) + "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("capacityPerFluid", mfh.getCapacity());
+ nbt.setInteger("runningCost", runningCost);
+ nbt.setBoolean("doVoidExcess", doVoidExcess);
+ mfh.getAsNBTTag(nbt);
+
+ super.saveNBTData(nbt);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound nbt) {
+ nbt = (nbt == null) ? new NBTTagCompound() : nbt;
+
+ runningCost = nbt.getInteger("runningCost");
+ doVoidExcess = nbt.getBoolean("doVoidExcess");
+
+ final ArrayList<FluidStack> fluidList = new ArrayList<>();
+ for(int i = 0; i < 25; i++) {
+ final NBTTagCompound fnbt = (NBTTagCompound) nbt.getTag("" + i);
+ if(fnbt == null) {
+ break;
+ }
+ fluidList.add(FluidStack.loadFluidStackFromNBT(fnbt));
+ }
+
+ mfh = new MultiFluidHandler(nbt.getInteger("capacityPerFluid"), fluidList);
+
+ 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/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
index 8ed2b7d67a..f0d529ee54 100644
--- a/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
+++ b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
@@ -1,190 +1,190 @@
-package tileentities;
-
-import container.GUIContainer_ModularNuclearReactor;
-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 {
-
- final Block CASING = GregTech_API.sBlockCasings3;
- final int CASING_META = 12;
- final int CASING_TEXTURE_ID = 44;
-
- 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[] {
- "DO NOT CHEAT IN THIS MACHINE",
- "I'm not quite finished yet",
- "------------------------------------------",
- "Dimensions: 5x5x5 (WxHxL)",
- "Structure:",
- " Controller: Front center",
- " 80x Radiation Proof Machine Casing (at least)",
- " Dynamo Hatch: ONLY in EU-mode, at least one",
- " Input Bus, Output Bus: Optional but required for automation",
- " Input Hatch, Output Hatch: ONLY in Coolant-Mode, at least one each"
- };
- }
-
- @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.CASING_BLOCKS[CASING_TEXTURE_ID],
- new GT_RenderedTexture(aActive ?
- Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
- : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
- : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 GUIContainer_ModularNuclearReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
- "MultiblockDisplay.png");
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack stack) {
- return true;
- }
-
- @Override
- public boolean checkRecipe(ItemStack stack) {
- return false;
- }
-
- @Override
- public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) {
-
- final byte SIDE_LENGTH = 5;
- final byte MAX_OFFSET = (byte) Math.floor(SIDE_LENGTH / 2);
- final int XDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX * MAX_OFFSET;
- final int ZDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ * MAX_OFFSET;
-
- int minCasingAmount = 92;
- boolean checklist = true; // if this is still true at the end, machine is good to go :)
-
- for (int leftToRight = -MAX_OFFSET; leftToRight <= MAX_OFFSET; leftToRight++) {
-
- for (int frontToBack = -MAX_OFFSET; frontToBack <= MAX_OFFSET; frontToBack++) {
-
- for (int thisY = -MAX_OFFSET; thisY <= MAX_OFFSET; thisY++) {
-
- // Center 3x3x3 air cube
- if((leftToRight > -2 && leftToRight < 2) && (frontToBack > -2 && frontToBack < 2) && (thisY > -2 && thisY < 2)) {
- if(!thisController.getAirOffset(XDIR_BACKFACE + leftToRight, thisY, ZDIR_BACKFACE + frontToBack)) {
- checklist = false;
- }
- } else if (!(XDIR_BACKFACE + leftToRight == 0 && ZDIR_BACKFACE + frontToBack == 0 && thisY == 0)) { // Make sure this isn't the controller
- // Get next TE
- final int THIS_X = XDIR_BACKFACE + leftToRight;
- final int THIS_Z = ZDIR_BACKFACE + frontToBack;
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(THIS_X, thisY, THIS_Z);// x, y ,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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addDynamoToMachineList(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(THIS_X, thisY, THIS_Z) == CASING) && (thisController.getMetaIDOffset(THIS_X, thisY, THIS_Z) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- checklist = false;
- }
- }
- }
- }
- }
- }
-
- if(minCasingAmount > 0) {
- checklist = false;
- }
-
- if(euMode) {
- if(this.mDynamoHatches.size() == 0) {
- System.out.println("Dynamo hatches are required in EU mode!");
- checklist = false;
- }
- if(this.mInputHatches.size() > 0) {
- System.out.println("Input hatches are only allowed in coolant mode!");
- checklist = false;
- }
- if(this.mOutputHatches.size() > 0) {
- System.out.println("Output hatches are only allowed in coolant mode!");
- checklist = false;
- }
- } else {
- if(this.mDynamoHatches.size() > 0) {
- System.out.println("Dynamo hatches are only allowed in EU mode!");
- checklist = false;
- }
- if(this.mInputHatches.size() == 0) {
- System.out.println("Coolant input hatches are required in coolant mode!");
- checklist = false;
- }
- if(this.mOutputHatches.size() == 0) {
- System.out.println("Hot coolant output hatches are required in coolant mode!");
- checklist = false;
- }
- }
-
- if(this.mMaintenanceHatches.size() < 1) {
- System.out.println("You need a maintenance hatch to do maintenance.");
- }
-
- 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 tileentities;
+
+import container.GUIContainer_ModularNuclearReactor;
+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 {
+
+ final Block CASING = GregTech_API.sBlockCasings3;
+ final int CASING_META = 12;
+ final int CASING_TEXTURE_ID = 44;
+
+ 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[] {
+ "DO NOT CHEAT IN THIS MACHINE",
+ "I'm not quite finished yet",
+ "------------------------------------------",
+ "Dimensions: 5x5x5 (WxHxL)",
+ "Structure:",
+ " Controller: Front center",
+ " 80x Radiation Proof Machine Casing (at least)",
+ " Dynamo Hatch: ONLY in EU-mode, at least one",
+ " Input Bus, Output Bus: Optional but required for automation",
+ " Input Hatch, Output Hatch: ONLY in Coolant-Mode, at least one each"
+ };
+ }
+
+ @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.CASING_BLOCKS[CASING_TEXTURE_ID],
+ new GT_RenderedTexture(aActive ?
+ Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
+ : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
+ : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 GUIContainer_ModularNuclearReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(),
+ "MultiblockDisplay.png");
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity thisController, ItemStack guiSlotItem) {
+
+ final byte SIDE_LENGTH = 5;
+ final byte MAX_OFFSET = (byte) Math.floor(SIDE_LENGTH / 2);
+ final int XDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetX * MAX_OFFSET;
+ final int ZDIR_BACKFACE = ForgeDirection.getOrientation(thisController.getBackFacing()).offsetZ * MAX_OFFSET;
+
+ int minCasingAmount = 92;
+ boolean checklist = true; // if this is still true at the end, machine is good to go :)
+
+ for (int leftToRight = -MAX_OFFSET; leftToRight <= MAX_OFFSET; leftToRight++) {
+
+ for (int frontToBack = -MAX_OFFSET; frontToBack <= MAX_OFFSET; frontToBack++) {
+
+ for (int thisY = -MAX_OFFSET; thisY <= MAX_OFFSET; thisY++) {
+
+ // Center 3x3x3 air cube
+ if((leftToRight > -2 && leftToRight < 2) && (frontToBack > -2 && frontToBack < 2) && (thisY > -2 && thisY < 2)) {
+ if(!thisController.getAirOffset(XDIR_BACKFACE + leftToRight, thisY, ZDIR_BACKFACE + frontToBack)) {
+ checklist = false;
+ }
+ } else if (!(XDIR_BACKFACE + leftToRight == 0 && ZDIR_BACKFACE + frontToBack == 0 && thisY == 0)) { // Make sure this isn't the controller
+ // Get next TE
+ final int THIS_X = XDIR_BACKFACE + leftToRight;
+ final int THIS_Z = ZDIR_BACKFACE + frontToBack;
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(THIS_X, thisY, THIS_Z);// x, y ,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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addDynamoToMachineList(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(THIS_X, thisY, THIS_Z) == CASING) && (thisController.getMetaIDOffset(THIS_X, thisY, THIS_Z) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ checklist = false;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(minCasingAmount > 0) {
+ checklist = false;
+ }
+
+ if(euMode) {
+ if(this.mDynamoHatches.size() == 0) {
+ System.out.println("Dynamo hatches are required in EU mode!");
+ checklist = false;
+ }
+ if(this.mInputHatches.size() > 0) {
+ System.out.println("Input hatches are only allowed in coolant mode!");
+ checklist = false;
+ }
+ if(this.mOutputHatches.size() > 0) {
+ System.out.println("Output hatches are only allowed in coolant mode!");
+ checklist = false;
+ }
+ } else {
+ if(this.mDynamoHatches.size() > 0) {
+ System.out.println("Dynamo hatches are only allowed in EU mode!");
+ checklist = false;
+ }
+ if(this.mInputHatches.size() == 0) {
+ System.out.println("Coolant input hatches are required in coolant mode!");
+ checklist = false;
+ }
+ if(this.mOutputHatches.size() == 0) {
+ System.out.println("Hot coolant output hatches are required in coolant mode!");
+ checklist = false;
+ }
+ }
+
+ if(this.mMaintenanceHatches.size() < 1) {
+ System.out.println("You need a maintenance hatch to do maintenance.");
+ }
+
+ 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/tileentities/GTMTE_SOFuelCellMK1.java b/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
index 45a86c992a..461046a2c3 100644
--- a/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
+++ b/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
@@ -1,328 +1,328 @@
-package tileentities;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import blocks.Block_YSZUnit;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.Textures;
-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_MultiBlockBase;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import util.Vector3i;
-import util.Vector3ic;
-
-public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_MultiBlockBase {
-
- private final Block CASING = GregTech_API.sBlockCasings4;
- private final int CASING_META = 1;
- private final int CASING_TEXTURE_ID = 49;
-
- private final int OXYGEN_PER_TICK = 20;
- private final int EU_PER_TICK = 1024;
- private final int STEAM_PER_TICK = 900;
-
- public GTMTE_SOFuelCellMK1(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
-
- }
-
- public GTMTE_SOFuelCellMK1(String aName) {
- super(aName);
-
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
- return new GTMTE_SOFuelCellMK1(super.mName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] {
- "Oxidizes gas fuels to generate electricity without polluting the environment",
- "Consumes 29,480EU worth of fuel with up to 97% efficiency each second",
- "Steam production requires the SOFC to heat up completely first",
- "Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_TICK + "L/t Steam",
- "Additionally requires " + OXYGEN_PER_TICK + "L/t Oxygen gas",
- "------------------------------------------",
- "Dimensions: 3x3x5 (WxHxL)",
- "Structure:",
- " Controller: Front center",
- " Dynamo Hatch: Back center",
- " 3x YSZ Ceramic Electrolyte Unit: Center 1x1x3",
- " 12x Clean Stainless Steel Machine Casing (at least)",
- " 6x Reinforced Glass: Touching the Electrolyte Units on the horizontal sides",
- " Maintenance Hatch, I/O Hatches: Instead of any casing"
- };
- }
-
- @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.CASING_BLOCKS[CASING_TEXTURE_ID],
- new GT_RenderedTexture(aActive ?
- Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
- : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
- : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 / aFuel.mSpecialValue;
-
- if(super.depleteInput(liquid)) {
-
- if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_TICK))) {
- super.mEUt = 0;
- super.mEfficiency = 0;
- return false;
- }
-
- super.mEUt = EU_PER_TICK;
- super.mProgresstime = 1;
- super.mMaxProgresstime = 1;
- super.mEfficiencyIncrease = 5;
- if(super.mEfficiency == getMaxEfficiency(null)) {
- super.addOutput(GT_ModHandler.getSteam(STEAM_PER_TICK));
- }
- return true;
- }
- }
- }
- }
- }
-
- super.mEUt = 0;
- super.mEfficiency = 0;
- return false;
- }
-
- 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 = 12;
- boolean formationChecklist = true; // if this is still true at the end, machine is good to go :)
-
- // Front slice
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- if(X == 0 && Y == 0) {
- continue; // is controller
- }
-
- // Get next TE
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
- IGregTechTileEntity currentTE =
- 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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
-
- // Middle three slices
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- for(int Z = -1; Z >= -3; Z--) {
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z);
- if(X == 0 && Y == 0) {
- if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals(Block_YSZUnit.getInstance().getUnlocalizedName())) {
- formationChecklist = false;
- }
- continue;
- }
- if(Y == 0 && (X == -1 || X == 1)) {
- if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals("blockAlloyGlass")) {
- formationChecklist = false;
- }
- continue;
- }
- // Get next TE
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
- }
-
- // Back slice
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- // Get next TE
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -4);
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addDynamoToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
-
- if(minCasingAmount > 0) {
- formationChecklist = false;
- }
-
- if(this.mDynamoHatches.size() != 1) {
- System.out.println("Exactly one dynamo hatch is required!");
- formationChecklist = false;
- }
- if(this.mInputHatches.size() < 2) {
- System.out.println("At least two input hatches are required!");
- formationChecklist = false;
- }
-
- if(this.mMaintenanceHatches.size() < 1) {
- System.out.println("You need a maintenance hatch to do maintenance.");
- }
-
- return formationChecklist;
- }
-
- @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 tileentities;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import blocks.Block_YSZUnit;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+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_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import util.Vector3i;
+import util.Vector3ic;
+
+public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_MultiBlockBase {
+
+ private final Block CASING = GregTech_API.sBlockCasings4;
+ private final int CASING_META = 1;
+ private final int CASING_TEXTURE_ID = 49;
+
+ private final int OXYGEN_PER_TICK = 20;
+ private final int EU_PER_TICK = 1024;
+ private final int STEAM_PER_TICK = 900;
+
+ public GTMTE_SOFuelCellMK1(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+
+ }
+
+ public GTMTE_SOFuelCellMK1(String aName) {
+ super(aName);
+
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
+ return new GTMTE_SOFuelCellMK1(super.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "Oxidizes gas fuels to generate electricity without polluting the environment",
+ "Consumes 29,480EU worth of fuel with up to 97% efficiency each second",
+ "Steam production requires the SOFC to heat up completely first",
+ "Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_TICK + "L/t Steam",
+ "Additionally requires " + OXYGEN_PER_TICK + "L/t Oxygen gas",
+ "------------------------------------------",
+ "Dimensions: 3x3x5 (WxHxL)",
+ "Structure:",
+ " Controller: Front center",
+ " Dynamo Hatch: Back center",
+ " 3x YSZ Ceramic Electrolyte Unit: Center 1x1x3",
+ " 12x Clean Stainless Steel Machine Casing (at least)",
+ " 6x Reinforced Glass: Touching the Electrolyte Units on the horizontal sides",
+ " Maintenance Hatch, I/O Hatches: Instead of any casing"
+ };
+ }
+
+ @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.CASING_BLOCKS[CASING_TEXTURE_ID],
+ new GT_RenderedTexture(aActive ?
+ Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
+ : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
+ : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 / aFuel.mSpecialValue;
+
+ if(super.depleteInput(liquid)) {
+
+ if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_TICK))) {
+ super.mEUt = 0;
+ super.mEfficiency = 0;
+ return false;
+ }
+
+ super.mEUt = EU_PER_TICK;
+ super.mProgresstime = 1;
+ super.mMaxProgresstime = 1;
+ super.mEfficiencyIncrease = 5;
+ if(super.mEfficiency == getMaxEfficiency(null)) {
+ super.addOutput(GT_ModHandler.getSteam(STEAM_PER_TICK));
+ }
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ super.mEUt = 0;
+ super.mEfficiency = 0;
+ return false;
+ }
+
+ 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 = 12;
+ boolean formationChecklist = true; // if this is still true at the end, machine is good to go :)
+
+ // Front slice
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ if(X == 0 && Y == 0) {
+ continue; // is controller
+ }
+
+ // Get next TE
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
+ IGregTechTileEntity currentTE =
+ 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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+
+ // Middle three slices
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ for(int Z = -1; Z >= -3; Z--) {
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z);
+ if(X == 0 && Y == 0) {
+ if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals(Block_YSZUnit.getInstance().getUnlocalizedName())) {
+ formationChecklist = false;
+ }
+ continue;
+ }
+ if(Y == 0 && (X == -1 || X == 1)) {
+ if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals("blockAlloyGlass")) {
+ formationChecklist = false;
+ }
+ continue;
+ }
+ // Get next TE
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+ }
+
+ // Back slice
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ // Get next TE
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -4);
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addDynamoToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+
+ if(minCasingAmount > 0) {
+ formationChecklist = false;
+ }
+
+ if(this.mDynamoHatches.size() != 1) {
+ System.out.println("Exactly one dynamo hatch is required!");
+ formationChecklist = false;
+ }
+ if(this.mInputHatches.size() < 2) {
+ System.out.println("At least two input hatches are required!");
+ formationChecklist = false;
+ }
+
+ if(this.mMaintenanceHatches.size() < 1) {
+ System.out.println("You need a maintenance hatch to do maintenance.");
+ }
+
+ return formationChecklist;
+ }
+
+ @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/tileentities/GTMTE_SOFuelCellMK2.java b/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
index 9b8c9ca7b3..3708ef8cc4 100644
--- a/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
+++ b/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
@@ -1,328 +1,328 @@
-package tileentities;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import blocks.Block_GDCUnit;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.Textures;
-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_MultiBlockBase;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
-import util.Vector3i;
-import util.Vector3ic;
-
-public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_MultiBlockBase {
-
- final Block CASING = GregTech_API.sBlockCasings4;
- final int CASING_META = 0;
- final int CASING_TEXTURE_ID = 48;
-
- private final int OXYGEN_PER_TICK = 100;
- private final int EU_PER_TICK = 24576; // 100% Efficiency, 3A IV
- private final int STEAM_PER_TICK = 4800; // SH Steam (10,800EU/t @ 150% Efficiency)
-
- public GTMTE_SOFuelCellMK2(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
-
- }
-
- public GTMTE_SOFuelCellMK2(String aName) {
- super(aName);
-
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
- return new GTMTE_SOFuelCellMK2(super.mName);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] {
- "Oxidizes gas fuels to generate electricity without polluting the environment",
- "Consumes 442,200EU worth of fuel with up to 160% efficiency each second",
- "Steam production requires the SOFC to heat up completely first",
- "Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_TICK + "L/t Superheated Steam",
- "Additionally requires " + OXYGEN_PER_TICK + "L/t Oxygen gas",
- "------------------------------------------",
- "Dimensions: 3x3x5 (WxHxL)",
- "Structure:",
- " Controller front center",
- " Dynamo Hatch back center",
- " 3x GDC Ceramic Electrolyte Unit (center 1x1x3)",
- " 12x Robust Tungstensteel Machine Casing (at least)",
- " 6x Reinforced Glass: Touching the Electrolyte Units on the horizontal sides",
- " Maintenance Hatch, I/O Hatches: Instead of any casing"
- };
- }
-
- @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.CASING_BLOCKS[CASING_TEXTURE_ID],
- new GT_RenderedTexture(aActive ?
- Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
- : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
- : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 / aFuel.mSpecialValue;
-
- if(super.depleteInput(liquid)) {
-
- if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_TICK))) {
- super.mEUt = 0;
- super.mEfficiency = 0;
- return false;
- }
-
- super.mEUt = EU_PER_TICK;
- super.mProgresstime = 1;
- super.mMaxProgresstime = 1;
- super.mEfficiencyIncrease = 20;
- if(super.mEfficiency == getMaxEfficiency(null)) {
- super.addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", STEAM_PER_TICK));
- }
- return true;
- }
- }
- }
- }
- }
-
- super.mEUt = 0;
- super.mEfficiency = 0;
- return false;
- }
-
- 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 = 12;
- boolean formationChecklist = true; // if this is still true at the end, machine is good to go :)
-
- // Front slice
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- if(X == 0 && Y == 0) {
- continue; // is controller
- }
-
- // Get next TE
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
- IGregTechTileEntity currentTE =
- 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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
-
- // Middle three slices
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- for(int Z = -1; Z >= -3; Z--) {
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z);
- if(X == 0 && Y == 0) {
- if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals(Block_GDCUnit.getInstance().getUnlocalizedName())) {
- formationChecklist = false;
- }
- continue;
- }
- if(Y == 0 && (X == -1 || X == 1)) {
- if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
- .equals("blockAlloyGlass")) {
- formationChecklist = false;
- }
- continue;
- }
- // Get next TE
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
- }
-
- // Back slice
- for(int X = -1; X <= 1; X++) {
- for(int Y = -1; Y <= 1; Y++) {
- // Get next TE
- final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -4);
- IGregTechTileEntity currentTE =
- thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
- if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
- && !super.addDynamoToMachineList(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)
- && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
- // Seems to be valid casing. Decrement counter.
- minCasingAmount--;
- } else {
- formationChecklist = false;
- }
- }
- }
- }
-
- if(minCasingAmount > 0) {
- formationChecklist = false;
- }
-
- if(this.mDynamoHatches.size() != 1) {
- System.out.println("Exactly one dynamo hatch is required!");
- formationChecklist = false;
- }
- if(this.mInputHatches.size() < 2) {
- System.out.println("At least two input hatches are required!");
- formationChecklist = false;
- }
-
- if(this.mMaintenanceHatches.size() < 1) {
- System.out.println("You need a maintenance hatch to do maintenance.");
- }
-
- return formationChecklist;
- }
-
- @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 tileentities;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import blocks.Block_GDCUnit;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+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_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import util.Vector3i;
+import util.Vector3ic;
+
+public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_MultiBlockBase {
+
+ final Block CASING = GregTech_API.sBlockCasings4;
+ final int CASING_META = 0;
+ final int CASING_TEXTURE_ID = 48;
+
+ private final int OXYGEN_PER_TICK = 100;
+ private final int EU_PER_TICK = 24576; // 100% Efficiency, 3A IV
+ private final int STEAM_PER_TICK = 4800; // SH Steam (10,800EU/t @ 150% Efficiency)
+
+ public GTMTE_SOFuelCellMK2(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+
+ }
+
+ public GTMTE_SOFuelCellMK2(String aName) {
+ super(aName);
+
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity var1) {
+ return new GTMTE_SOFuelCellMK2(super.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "Oxidizes gas fuels to generate electricity without polluting the environment",
+ "Consumes 442,200EU worth of fuel with up to 160% efficiency each second",
+ "Steam production requires the SOFC to heat up completely first",
+ "Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_TICK + "L/t Superheated Steam",
+ "Additionally requires " + OXYGEN_PER_TICK + "L/t Oxygen gas",
+ "------------------------------------------",
+ "Dimensions: 3x3x5 (WxHxL)",
+ "Structure:",
+ " Controller front center",
+ " Dynamo Hatch back center",
+ " 3x GDC Ceramic Electrolyte Unit (center 1x1x3)",
+ " 12x Robust Tungstensteel Machine Casing (at least)",
+ " 6x Reinforced Glass: Touching the Electrolyte Units on the horizontal sides",
+ " Maintenance Hatch, I/O Hatches: Instead of any casing"
+ };
+ }
+
+ @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.CASING_BLOCKS[CASING_TEXTURE_ID],
+ new GT_RenderedTexture(aActive ?
+ Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE
+ : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}
+ : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[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 / aFuel.mSpecialValue;
+
+ if(super.depleteInput(liquid)) {
+
+ if(!super.depleteInput(Materials.Oxygen.getGas(OXYGEN_PER_TICK))) {
+ super.mEUt = 0;
+ super.mEfficiency = 0;
+ return false;
+ }
+
+ super.mEUt = EU_PER_TICK;
+ super.mProgresstime = 1;
+ super.mMaxProgresstime = 1;
+ super.mEfficiencyIncrease = 20;
+ if(super.mEfficiency == getMaxEfficiency(null)) {
+ super.addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", STEAM_PER_TICK));
+ }
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ super.mEUt = 0;
+ super.mEfficiency = 0;
+ return false;
+ }
+
+ 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 = 12;
+ boolean formationChecklist = true; // if this is still true at the end, machine is good to go :)
+
+ // Front slice
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ if(X == 0 && Y == 0) {
+ continue; // is controller
+ }
+
+ // Get next TE
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0);
+ IGregTechTileEntity currentTE =
+ 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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+
+ // Middle three slices
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ for(int Z = -1; Z >= -3; Z--) {
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, Z);
+ if(X == 0 && Y == 0) {
+ if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals(Block_GDCUnit.getInstance().getUnlocalizedName())) {
+ formationChecklist = false;
+ }
+ continue;
+ }
+ if(Y == 0 && (X == -1 || X == 1)) {
+ if(!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName()
+ .equals("blockAlloyGlass")) {
+ formationChecklist = false;
+ }
+ continue;
+ }
+ // Get next TE
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+ }
+
+ // Back slice
+ for(int X = -1; X <= 1; X++) {
+ for(int Y = -1; Y <= 1; Y++) {
+ // Get next TE
+ final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, -4);
+ IGregTechTileEntity currentTE =
+ thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z());// x, y ,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 (TAE for GT++)
+ if ( !super.addMaintenanceToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addInputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addOutputToMachineList(currentTE, CASING_TEXTURE_ID)
+ && !super.addDynamoToMachineList(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)
+ && (thisController.getMetaIDOffset(offset.x(), offset.y(), offset.z()) == CASING_META)) {
+ // Seems to be valid casing. Decrement counter.
+ minCasingAmount--;
+ } else {
+ formationChecklist = false;
+ }
+ }
+ }
+ }
+
+ if(minCasingAmount > 0) {
+ formationChecklist = false;
+ }
+
+ if(this.mDynamoHatches.size() != 1) {
+ System.out.println("Exactly one dynamo hatch is required!");
+ formationChecklist = false;
+ }
+ if(this.mInputHatches.size() < 2) {
+ System.out.println("At least two input hatches are required!");
+ formationChecklist = false;
+ }
+
+ if(this.mMaintenanceHatches.size() < 1) {
+ System.out.println("You need a maintenance hatch to do maintenance.");
+ }
+
+ return formationChecklist;
+ }
+
+ @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/tileentities/TFFTMultiHatch.java b/src/main/java/tileentities/TFFTMultiHatch.java
new file mode 100644
index 0000000000..2ce6f6985f
--- /dev/null
+++ b/src/main/java/tileentities/TFFTMultiHatch.java
@@ -0,0 +1,138 @@
+package tileentities;
+
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.objects.GT_RenderedTexture;
+import kekztech.MultiFluidHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class TFFTMultiHatch extends GT_MetaTileEntity_Hatch {
+
+ private MultiFluidHandler multiFluidHandler;
+
+ public TFFTMultiHatch(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3,
+ new String[]{"Exclusive fluid I/O for the T.F.F.T", "Capacity: " + 8000 * (aTier + 1) + "L"}, new ITexture[0]);
+ }
+
+ public TFFTMultiHatch(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ public TFFTMultiHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE_IN)};
+ }
+
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE_IN)};
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new TFFTMultiHatch(this.mName, this.mTier, this.mDescriptionArray, this.mTextures);
+ }
+
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ } else {
+ return true;
+ }
+ }
+
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (multiFluidHandler != null) ? multiFluidHandler.couldPush(aFluid) : false;
+ }
+
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ public int getCapacity() {
+ return (multiFluidHandler != null) ? multiFluidHandler.getCapacity() : 0;
+ }
+
+ public int getTankPressure() {
+ return -100;
+ }
+
+ public void setMultiFluidHandler(MultiFluidHandler multiFluidHandler) {
+ this.multiFluidHandler = multiFluidHandler;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}