aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java8
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java6
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java85
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java107
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java109
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java352
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java87
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java137
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java74
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java194
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java149
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java46
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java11
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java772
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java451
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java134
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java669
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java33
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java376
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java99
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java7
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java319
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java19
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java269
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java18
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java19
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java64
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java3
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java566
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java69
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java25
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java26
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java163
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java99
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java1045
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java100
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java1050
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java13
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java170
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java262
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java79
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java1043
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java70
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java1052
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java92
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java121
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java207
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java498
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java75
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java144
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java50
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java551
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java83
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java14
80 files changed, 9717 insertions, 2820 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 091ee734e6..fe0be2f126 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -90,8 +90,8 @@ public class Meta_GT_Proxy {
GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity.");
if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) {
- GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
- throw new RuntimeException("");
+ GT_Log.err.println("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
}
//Gotta set it here so that we don't try call gregtech too early.
@@ -104,7 +104,7 @@ public class Meta_GT_Proxy {
StaticFields59.mGT6StylePipes = false;
}
- GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity.");
+ GT_Log.out.println("GT++ Mod: Registering custom BaseMetaTileEntities.");
GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP");
GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2");
CoverManager.generateCustomCovers();
@@ -361,6 +361,7 @@ public class Meta_GT_Proxy {
GT_Log.err
.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
throw new RuntimeException(e);
}
}
@@ -396,6 +397,7 @@ public class Meta_GT_Proxy {
GT_Log.err
.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
throw new RuntimeException(e);
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
index 419b5f3d30..13eb045748 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java
@@ -21,7 +21,7 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks4() {
super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 13 || i == 14 || i == 15) {
+ if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 12 || i == 13 || i == 14 || i == 15) {
continue;
}
TAE.registerTexture(3, i, new GT_CopiedBlockTexture(this, 6, i));
@@ -87,7 +87,7 @@ extends GregtechMetaCasingBlocksAbstract {
case 8:
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
case 9:
- return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
case 10:
if (aSide <2) {
return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
index 3d15e5cf58..fe247e24a4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -34,7 +34,8 @@ extends GregtechMetaCasingBlocksAbstract {
TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 4));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Sturdy Printer Casing"); // Unused
TAE.registerTexture(1, 10, new GT_CopiedBlockTexture(this, 6, 5));
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Forge Casing"); // Forge Hammer Casing
+ TAE.registerTexture(1, 11, new GT_CopiedBlockTexture(this, 6, 6));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); // Unused
@@ -51,6 +52,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3));
GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4));
GregtechItemList.Casing_IndustrialAutoChisel.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_IndustrialForgeHammer.set(new ItemStack(this, 1, 6));
}
@Override
@@ -74,6 +76,8 @@ extends GregtechMetaCasingBlocksAbstract {
return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon();
case 5:
return TexturesGtBlock.Casing_Machine_Metal_Sheet_I.getIcon();
+ case 6:
+ return TexturesGtBlock.TEXTURE_TECH_PANEL_H.getIcon();
}
}
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
index 5a5c923d10..a9c8a1e9bc 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings.java
@@ -2,21 +2,24 @@ package gtPlusPlus.xmod.gregtech.common.blocks;
import java.util.List;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;
import gregtech.api.util.GT_LanguageManager;
import gregtech.common.blocks.GT_Material_Casings;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbstract {
-
-
- public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
public SpecialCasingItemBlock(Block par1) {
super(par1);
@@ -49,9 +52,9 @@ public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbs
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Thermally Insulated Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Flotation Cell Casings");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Reinforced Engine Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Molecular Containment Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "High Voltage Current Capacitor");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Particle Containment Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
@@ -66,37 +69,53 @@ public class GregtechMetaSpecialMultiCasings extends GregtechMetaCasingBlocksAbs
GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 8));
GregtechItemList.Casing_Flotation_Cell.set(new ItemStack(this, 1, 9));
GregtechItemList.Casing_Reinforced_Engine_Casing.set(new ItemStack(this, 1, 10));
+ GregtechItemList.Casing_Molecular_Transformer_1.set(new ItemStack(this, 1, 11));
+ GregtechItemList.Casing_Molecular_Transformer_2.set(new ItemStack(this, 1, 12));
+ GregtechItemList.Casing_Molecular_Transformer_3.set(new ItemStack(this, 1, 13));
}
-
- public IIcon getIcon(int aSide, int aMeta) {
-
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ return LargeTurbineTextureHandler.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, this);
+ }
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return getStaticIcon((byte) aSide, (byte) aMeta);
+ }
+
+ public static IIcon getStaticIcon(final byte aSide, final byte aMeta) {
switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.Casing_Redox_1.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
+ case 2:
+ return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
+ case 4:
+ return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
+ case 6:
+ return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
+ case 7:
+ return TexturesGtBlock.Casing_Material_Stellite.getIcon();
+ case 8:
+ return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
+ case 9:
+ return TexturesGtBlock.TEXTURE_CASING_FLOTATION.getIcon();
+ case 10:
+ return TexturesGtBlock.Casing_Material_Talonite.getIcon();
+ case 11:
+ return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon();
+ case 12:
+ return TexturesGtBlock.Casing_Redox_5.getIcon();
+ case 13:
+ return TexturesGtBlock.TEXTURE_MAGIC_PANEL_B.getIcon();
- case 0:
- return TexturesGtBlock.Casing_Redox_1.getIcon();
- case 1:
- return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon();
- case 2:
- return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
- case 3:
- return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
- case 4:
- return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
- case 5:
- return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
- case 6:
- return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon();
- case 7:
- return TexturesGtBlock.Casing_Material_Stellite.getIcon();
- case 8:
- return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon();
- case 9:
- return TexturesGtBlock.TEXTURE_CASING_FLOTATION.getIcon();
- case 10:
- return TexturesGtBlock.Casing_Material_Talonite.getIcon();
-
}
-
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java
new file mode 100644
index 0000000000..a80b788aa1
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMultiCasings2.java
@@ -0,0 +1,107 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Textures;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+
+
+public class GregtechMetaSpecialMultiCasings2 extends GregtechMetaCasingBlocksAbstract {
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public SpecialCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 4) {
+ aList.add("Provides quantum stability");
+ }
+ if (aMeta >= 4 && aMeta < 8) {
+ aList.add("Provides quantum modulation");
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaSpecialMultiCasings2() {
+ super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.3", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08)
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Resonance Chamber I");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Resonance Chamber II");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Resonance Chamber III");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Resonance Chamber IV");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Modulator I");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Modulator II");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Modulator III");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Modulator IV");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.ResonanceChamber_I.set(new ItemStack(this, 1, 0));
+ GregtechItemList.ResonanceChamber_II.set(new ItemStack(this, 1, 1));
+ GregtechItemList.ResonanceChamber_III.set(new ItemStack(this, 1, 2));
+ GregtechItemList.ResonanceChamber_IV.set(new ItemStack(this, 1, 3));
+ GregtechItemList.Modulator_I.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Modulator_II.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Modulator_III.set(new ItemStack(this, 1, 6));
+ GregtechItemList.Modulator_IV.set(new ItemStack(this, 1, 7));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) {
+ return getStaticIcon((byte) aSide, (byte) aWorld.getBlockMetadata(xCoord, yCoord, zCoord));
+ }
+
+ @Override
+ public IIcon getIcon(final int aSide, final int aMeta) {
+ return getStaticIcon((byte) aSide, (byte) aMeta);
+ }
+
+ public static IIcon getStaticIcon(final byte aSide, final byte aMeta) {
+ switch (aMeta) {
+ case 0:
+ return TexturesGtBlock.Casing_Resonance_1.getIcon();
+ case 1:
+ return TexturesGtBlock.Casing_Resonance_2.getIcon();
+ case 2:
+ return TexturesGtBlock.Casing_Resonance_3.getIcon();
+ case 3:
+ return TexturesGtBlock.Casing_Resonance_4.getIcon();
+ case 4:
+ return TexturesGtBlock.Casing_Modulator_1.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Modulator_2.getIcon();
+ case 6:
+ return TexturesGtBlock.Casing_Modulator_3.getIcon();
+ case 7:
+ return TexturesGtBlock.Casing_Modulator_4.getIcon();
+
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.getIcon();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
index 8b372dff0c..e6ccc419e0 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -247,6 +247,16 @@ public class TexturesGtBlock {
public static final CustomIcon Casing_Redox_6 = new CustomIcon("redox/redox6");
//public static final CustomIcon Casing_Redox_7 = new CustomIcon("redox/redox7");
//public static final CustomIcon Casing_Redox_8 = new CustomIcon("redox/redox8");
+
+ // Special Block 2
+ public static final CustomIcon Casing_Resonance_1 = new CustomIcon("special/block_1");
+ public static final CustomIcon Casing_Resonance_2 = new CustomIcon("special/block_2");
+ public static final CustomIcon Casing_Resonance_3 = new CustomIcon("special/block_3");
+ public static final CustomIcon Casing_Resonance_4 = new CustomIcon("special/block_4");
+ public static final CustomIcon Casing_Modulator_1 = new CustomIcon("special/block_5");
+ public static final CustomIcon Casing_Modulator_2 = new CustomIcon("special/block_6");
+ public static final CustomIcon Casing_Modulator_3 = new CustomIcon("special/block_7");
+ public static final CustomIcon Casing_Modulator_4 = new CustomIcon("special/block_8");
//Centrifuge Casing
private static final CustomIcon Internal_Casing_Centrifuge = new CustomIcon("TileEntities/MACHINE_CASING_CENTRIFUGE");
@@ -392,10 +402,79 @@ public class TexturesGtBlock {
public static final CustomIcon Overlay_FluidReactor_Top_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE");
//Crafting Overlays
- private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting");
- public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze;
- private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting");
- public static final CustomIcon Overlay_Crafting_Steel = Internal_Overlay_Crafting_Steel;
+ public static final CustomIcon Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting");
+ public static final CustomIcon Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting");
+
+ public static final CustomIcon Casing_Workbench_Crafting_Overlay = new CustomIcon("TileEntities/gt4/bronze_top_crafting");
+ public static final CustomIcon Casing_Workbench_Top = new CustomIcon("TileEntities/gt4/bronze_top");
+ public static final CustomIcon Casing_Workbench_Side = new CustomIcon("TileEntities/gt4/bronze_side");
+ public static final CustomIcon Casing_Workbench_Bottom = new CustomIcon("TileEntities/gt4/bronze_bottom");
+ public static final CustomIcon Casing_Adv_Workbench_Crafting_Overlay = new CustomIcon("TileEntities/gt4/machine_top_crafting");
+ public static final CustomIcon Casing_Adv_Workbench_Top = new CustomIcon("TileEntities/gt4/machine_top");
+ public static final CustomIcon Casing_Adv_Workbench_Side = new CustomIcon("TileEntities/gt4/machine_side");
+ public static final CustomIcon Casing_Adv_Workbench_Bottom = new CustomIcon("TileEntities/gt4/machine_bottom");
+
+
+ public static final CustomIcon Casing_Redstone_Top_Off = new CustomIcon("TileEntities/gt4/redstone/machine_top_redstone_off");
+ public static final CustomIcon Casing_Redstone_Top_Main_Off = new CustomIcon("TileEntities/gt4/redstone/machine_top_redstone_main_off");
+ public static final CustomIcon Casing_Redstone_Top_On = new CustomIcon("TileEntities/gt4/redstone/machine_top_redstone_on");
+ public static final CustomIcon Casing_Redstone_Top_Main_On = new CustomIcon("TileEntities/gt4/redstone/machine_top_redstone_main_on");
+
+ public static final CustomIcon Casing_Redstone_Side_Off = new CustomIcon("TileEntities/gt4/redstone/machine_side_redstone_off");
+ public static final CustomIcon Casing_Redstone_Side_Main_Off = new CustomIcon("TileEntities/gt4/redstone/machine_side_redstone_main_off");
+ public static final CustomIcon Casing_Redstone_Side_On = new CustomIcon("TileEntities/gt4/redstone/machine_side_redstone_on");
+ public static final CustomIcon Casing_Redstone_Side_Main_On = new CustomIcon("TileEntities/gt4/redstone/machine_side_redstone_main_on");
+
+ public static final CustomIcon Casing_Redstone_Bottom_Off = new CustomIcon("TileEntities/gt4/redstone/machine_bottom_redstone_off");
+ public static final CustomIcon Casing_Redstone_Bottom_Main_Off = new CustomIcon("TileEntities/gt4/redstone/machine_bottom_redstone_main_off");
+ public static final CustomIcon Casing_Redstone_Bottom_On = new CustomIcon("TileEntities/gt4/redstone/machine_bottom_redstone_on");
+ public static final CustomIcon Casing_Redstone_Bottom_Main_On = new CustomIcon("TileEntities/gt4/redstone/machine_bottom_redstone_main_on");
+
+
+ public static final CustomIcon Casing_Electric_Auto_Workbench_Side = new CustomIcon("TileEntities/gt4/OVERLAY_SIDE_CABINET");
+ public static final CustomIcon Casing_Computer_Cube = new CustomIcon("TileEntities/gt4/computer");
+
+ public static final CustomIcon Casing_CropHarvester_Cutter = new CustomIcon("TileEntities/gt4/OVERLAY_CROP");
+ public static final CustomIcon Casing_CropHarvester_Boxes = new CustomIcon("TileEntities/gt4/OVERLAY_BOXES");
+
+ public static final CustomIcon Casing_InventoryManagaer_Cyan = new CustomIcon("TileEntities/gt4/OVERLAY_CYAN");
+ public static final CustomIcon Casing_InventoryManagaer_Green = new CustomIcon("TileEntities/gt4/OVERLAY_GREEN");
+ public static final CustomIcon Casing_InventoryManagaer_Purple = new CustomIcon("TileEntities/gt4/OVERLAY_PURPLE");
+ public static final CustomIcon Casing_InventoryManagaer_Red = new CustomIcon("TileEntities/gt4/OVERLAY_RED");
+ public static final CustomIcon Casing_InventoryManagaer_Yellow = new CustomIcon("TileEntities/gt4/OVERLAY_YELLOW");
+ public static final CustomIcon Casing_InventoryManagaer_Blue = new CustomIcon("TileEntities/gt4/OVERLAY_BLUE");
+
+ public static final CustomIcon Casing_InventoryManagaer_Cyan_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_CYAN_REDSTONE");
+ public static final CustomIcon Casing_InventoryManagaer_Green_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_GREEN_REDSTONE");
+ public static final CustomIcon Casing_InventoryManagaer_Purple_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_PURPLE_REDSTONE");
+ public static final CustomIcon Casing_InventoryManagaer_Red_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_RED_REDSTONE");
+ public static final CustomIcon Casing_InventoryManagaer_Yellow_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_YELLOW_REDSTONE");
+ public static final CustomIcon Casing_InventoryManagaer_Blue_Redstone = new CustomIcon("TileEntities/gt4/OVERLAY_BLUE_REDSTONE");
+
+ private static final CustomIcon Casing_Test_1 = new CustomIcon("number/1");
+ private static final CustomIcon Casing_Test_2 = new CustomIcon("number/2");
+ private static final CustomIcon Casing_Test_3 = new CustomIcon("number/3");
+ private static final CustomIcon Casing_Test_4 = new CustomIcon("number/4");
+ private static final CustomIcon Casing_Test_5 = new CustomIcon("number/5");
+ private static final CustomIcon Casing_Test_6 = new CustomIcon("number/6");
+ private static final CustomIcon Casing_Test_7 = new CustomIcon("number/7");
+ private static final CustomIcon Casing_Test_8 = new CustomIcon("number/8");
+ private static final CustomIcon Casing_Test_9 = new CustomIcon("number/9");
+ private static final CustomIcon Casing_Test_10 = new CustomIcon("number/10");
+ private static final CustomIcon Casing_Test_11 = new CustomIcon("number/11");
+ private static final CustomIcon Casing_Test_12 = new CustomIcon("number/12");
+ private static final CustomIcon Casing_Test_13 = new CustomIcon("number/13");
+ private static final CustomIcon Casing_Test_14 = new CustomIcon("number/14");
+ private static final CustomIcon Casing_Test_15 = new CustomIcon("number/15");
+ private static final CustomIcon Casing_Test_16 = new CustomIcon("number/16");
+
+ public static final CustomIcon[] TEST_NUMBER = new CustomIcon[] {
+ Casing_Test_1, Casing_Test_2, Casing_Test_3, Casing_Test_4,
+ Casing_Test_5, Casing_Test_6, Casing_Test_7, Casing_Test_8,
+ Casing_Test_9, Casing_Test_10, Casing_Test_11, Casing_Test_12,
+ Casing_Test_13, Casing_Test_14, Casing_Test_15, Casing_Test_16
+
+ };
//Covers
private static final CustomIcon Internal_Overlay_Overflow_Valve = new CustomIcon("iconsets/OVERLAY_OVERFLOW_VALVE");
@@ -421,6 +500,20 @@ public class TexturesGtBlock {
// Catalyst Bus
private static final CustomIcon Internal_Overlay_Bus_Catalyst = new CustomIcon("iconsets/OVERLAY_CATALYSTS");
public static final CustomIcon Overlay_Bus_Catalyst = Internal_Overlay_Bus_Catalyst;
+
+
+ public static final CustomIcon Overlay_Cobble = new CustomIcon("iconsets/OVERLAY_COBBLE");
+ public static final CustomIcon Overlay_Connector = new CustomIcon("iconsets/OVERLAY_CONNECTOR");
+ public static final CustomIcon Overlay_Fire = new CustomIcon("iconsets/OVERLAY_FIRE");
+ public static final CustomIcon Overlay_Grinder = new CustomIcon("iconsets/OVERLAY_GRINDER");
+ public static final CustomIcon Overlay_GT_Logo = new CustomIcon("iconsets/OVERLAY_GT");
+ public static final CustomIcon Overlay_Ice = new CustomIcon("iconsets/OVERLAY_ICE");
+ public static final CustomIcon Overlay_Implosion = new CustomIcon("iconsets/OVERLAY_IMPLOSION");
+ // Lapo Orb Hatch
+ public static final CustomIcon Overlay_Hatch_Lapo_Orb = new CustomIcon("iconsets/OVERLAY_LAPO");
+ // Data Orb Hatch
+ public static final CustomIcon Overlay_Hatch_Data_Orb = new CustomIcon("iconsets/OVERLAY_DATA_ORB");
+
// RTG Hatch
private static final CustomIcon Internal_Overlay_Hatch_RTG_Off = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_OFF");
public static final CustomIcon Overlay_Hatch_RTG_Off = Internal_Overlay_Hatch_RTG_Off;
@@ -472,8 +565,9 @@ public class TexturesGtBlock {
public static final CustomIcon TEXTURE_METAL_PANEL_G = new CustomIcon("metro/TEXTURE_METAL_PANEL_G");
public static final CustomIcon TEXTURE_METAL_PANEL_H = new CustomIcon("metro/TEXTURE_METAL_PANEL_H");
public static final CustomIcon TEXTURE_METAL_PANEL_I = new CustomIcon("metro/TEXTURE_METAL_PANEL_I");
-
+
public static final CustomIcon TEXTURE_MAGIC_PANEL_A = new CustomIcon("metro/TEXTURE_MAGIC_A");
+ public static final CustomIcon TEXTURE_MAGIC_PANEL_B = new CustomIcon("metro/TEXTURE_MAGIC_B");
public static final CustomIcon TEXTURE_ORGANIC_PANEL_A = new CustomIcon("metro/TEXTURE_ORGANIC_PANEL_A");
public static final CustomIcon TEXTURE_ORGANIC_PANEL_A_GLOWING = new CustomIcon("metro/TEXTURE_ORGANIC_PANEL_A_GLOWING");
@@ -496,6 +590,11 @@ public class TexturesGtBlock {
public static final CustomIcon TEXTURE_TECH_PANEL_B = new CustomIcon("metro/TEXTURE_TECH_PANEL_B");
public static final CustomIcon TEXTURE_TECH_PANEL_C = new CustomIcon("metro/TEXTURE_TECH_PANEL_C");
public static final CustomIcon TEXTURE_TECH_PANEL_D = new CustomIcon("metro/TEXTURE_TECH_PANEL_D");
+ public static final CustomIcon TEXTURE_TECH_PANEL_E = new CustomIcon("metro/TEXTURE_TECH_PANEL_E");
+ public static final CustomIcon TEXTURE_TECH_PANEL_F = new CustomIcon("metro/TEXTURE_TECH_PANEL_F");
+ public static final CustomIcon TEXTURE_TECH_PANEL_G = new CustomIcon("metro/TEXTURE_TECH_PANEL_G");
+ public static final CustomIcon TEXTURE_TECH_PANEL_H = new CustomIcon("metro/TEXTURE_TECH_PANEL_H");
+ public static final CustomIcon TEXTURE_TECH_PANEL_I = new CustomIcon("metro/TEXTURE_TECH_PANEL_I");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE = new CustomIcon("TileEntities/DecayablesChest_bottom");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE_ALT = new CustomIcon("TileEntities/DecayablesChest_top");
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java
index c3d6a655c3..7169861340 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java
@@ -1,180 +1,237 @@
-/*
package gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.IBlockAccess;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU9;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE1;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE2;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE3;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE4;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE6;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE7;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE8;
+import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE9;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
-import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
public class LargeTurbineTextureHandler {
- */
-/**
+ /**
* LP Turbines
- *//*
-
- private static CustomIcon aTex1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_1");
- private static CustomIcon aTex1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_1");
- private static CustomIcon aTex2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_2");
- private static CustomIcon aTex2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_2");
- private static CustomIcon aTex3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_3");
- private static CustomIcon aTex3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_3");
- private static CustomIcon aTex4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_4");
- private static CustomIcon aTex4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_4");
- private static CustomIcon aTex5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_5");
- private static CustomIcon aTex5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_5");
- private static CustomIcon aTex6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_6");
- private static CustomIcon aTex6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_6");
- private static CustomIcon aTex7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_7");
- private static CustomIcon aTex7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_7");
- private static CustomIcon aTex8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_8");
- private static CustomIcon aTex8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_8");
- private static CustomIcon aTex9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_9");
- private static CustomIcon aTex9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_9");
-
- private static CustomIcon frontFace_0 = (aTex1);
- private static CustomIcon frontFaceActive_0 = (aTex1_Active);
- private static CustomIcon frontFace_1 = (aTex2);
- private static CustomIcon frontFaceActive_1 = (aTex2_Active);
- private static CustomIcon frontFace_2 = (aTex3);
- private static CustomIcon frontFaceActive_2 = (aTex3_Active);
- private static CustomIcon frontFace_3 = (aTex4);
- private static CustomIcon frontFaceActive_3 = (aTex4_Active);
- public static CustomIcon frontFace_4 = (aTex5);
- public static CustomIcon frontFaceActive_4 = (aTex5_Active);
- private static CustomIcon frontFace_5 = (aTex6);
- private static CustomIcon frontFaceActive_5 = (aTex6_Active);
- private static CustomIcon frontFace_6 = (aTex7);
- private static CustomIcon frontFaceActive_6 = (aTex7_Active);
- private static CustomIcon frontFace_7 = (aTex8);
- private static CustomIcon frontFaceActive_7 = (aTex8_Active);
- private static CustomIcon frontFace_8 = (aTex9);
- private static CustomIcon frontFaceActive_8 = (aTex9_Active);
+ */
- CustomIcon[] OVERLAY_LP_TURBINE = new CustomIcon[]{
- frontFace_0,
- frontFace_1,
- frontFace_2,
- frontFace_3,
- frontFace_4,
- frontFace_5,
- frontFace_6,
- frontFace_7,
- frontFace_8
+ public static BlockIcons[] OVERLAY_LP_TURBINE = new BlockIcons[]{
+ LARGETURBINE_ST1,
+ LARGETURBINE_ST2,
+ LARGETURBINE_ST3,
+ LARGETURBINE_ST4,
+ LARGETURBINE_ST5,
+ LARGETURBINE_ST6,
+ LARGETURBINE_ST7,
+ LARGETURBINE_ST8,
+ LARGETURBINE_ST9,
};
- CustomIcon[] OVERLAY_LP_TURBINE_ACTIVE = new CustomIcon[]{
- frontFaceActive_0,
- frontFaceActive_1,
- frontFaceActive_2,
- frontFaceActive_3,
- frontFaceActive_4,
- frontFaceActive_5,
- frontFaceActive_6,
- frontFaceActive_7,
- frontFaceActive_8
+ public static BlockIcons[] OVERLAY_LP_TURBINE_ACTIVE = new BlockIcons[]{
+ LARGETURBINE_ST_ACTIVE1,
+ LARGETURBINE_ST_ACTIVE2,
+ LARGETURBINE_ST_ACTIVE3,
+ LARGETURBINE_ST_ACTIVE4,
+ LARGETURBINE_ST_ACTIVE5,
+ LARGETURBINE_ST_ACTIVE6,
+ LARGETURBINE_ST_ACTIVE7,
+ LARGETURBINE_ST_ACTIVE8,
+ LARGETURBINE_ST_ACTIVE9,
};
-
- */
-/**
+ /**
* HP Turbines
- *//*
-
- private static CustomIcon aTexHP1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_1");
- private static CustomIcon aTexHP1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_1");
- private static CustomIcon aTexHP2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_2");
- private static CustomIcon aTexHP2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_2");
- private static CustomIcon aTexHP3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_3");
- private static CustomIcon aTexHP3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_3");
- private static CustomIcon aTexHP4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_4");
- private static CustomIcon aTexHP4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_4");
- private static CustomIcon aTexHP5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_5");
- private static CustomIcon aTexHP5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_5");
- private static CustomIcon aTexHP6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_6");
- private static CustomIcon aTexHP6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_6");
- private static CustomIcon aTexHP7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_7");
- private static CustomIcon aTexHP7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_7");
- private static CustomIcon aTexHP8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_8");
- private static CustomIcon aTexHP8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_8");
- private static CustomIcon aTexHP9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_9");
- private static CustomIcon aTexHP9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_9");
+ */
- private static CustomIcon frontFaceHP_0 = (aTexHP1);
- private static CustomIcon frontFaceHPActive_0 = (aTexHP1_Active);
- private static CustomIcon frontFaceHP_1 = (aTexHP2);
- private static CustomIcon frontFaceHPActive_1 = (aTexHP2_Active);
- private static CustomIcon frontFaceHP_2 = (aTexHP3);
- private static CustomIcon frontFaceHPActive_2 = (aTexHP3_Active);
- private static CustomIcon frontFaceHP_3 = (aTexHP4);
- private static CustomIcon frontFaceHPActive_3 = (aTexHP4_Active);
- public static CustomIcon frontFaceHP_4 = (aTexHP5);
- public static CustomIcon frontFaceHPActive_4 = (aTexHP5_Active);
- private static CustomIcon frontFaceHP_5 = (aTexHP6);
- private static CustomIcon frontFaceHPActive_5 = (aTexHP6_Active);
- private static CustomIcon frontFaceHP_6 = (aTexHP7);
- private static CustomIcon frontFaceHPActive_6 = (aTexHP7_Active);
- private static CustomIcon frontFaceHP_7 = (aTexHP8);
- private static CustomIcon frontFaceHPActive_7 = (aTexHP8_Active);
- private static CustomIcon frontFaceHP_8 = (aTexHP9);
- private static CustomIcon frontFaceHPActive_8 = (aTexHP9_Active);
-
- CustomIcon[] OVERLAY_HP_TURBINE = new CustomIcon[]{
- frontFaceHP_0,
- frontFaceHP_1,
- frontFaceHP_2,
- frontFaceHP_3,
- frontFaceHP_4,
- frontFaceHP_5,
- frontFaceHP_6,
- frontFaceHP_7,
- frontFaceHP_8
+ public static BlockIcons[] OVERLAY_HP_TURBINE = new BlockIcons[]{
+ LARGETURBINE_TI1,
+ LARGETURBINE_TI2,
+ LARGETURBINE_TI3,
+ LARGETURBINE_TI4,
+ LARGETURBINE_TI5,
+ LARGETURBINE_TI6,
+ LARGETURBINE_TI7,
+ LARGETURBINE_TI8,
+ LARGETURBINE_TI9,
};
- CustomIcon[] OVERLAY_HP_TURBINE_ACTIVE = new CustomIcon[]{
- frontFaceHPActive_0,
- frontFaceHPActive_1,
- frontFaceHPActive_2,
- frontFaceHPActive_3,
- frontFaceHPActive_4,
- frontFaceHPActive_5,
- frontFaceHPActive_6,
- frontFaceHPActive_7,
- frontFaceHPActive_8
+ public static BlockIcons[] OVERLAY_HP_TURBINE_ACTIVE = new BlockIcons[]{
+ LARGETURBINE_TI_ACTIVE1,
+ LARGETURBINE_TI_ACTIVE2,
+ LARGETURBINE_TI_ACTIVE3,
+ LARGETURBINE_TI_ACTIVE4,
+ LARGETURBINE_TI_ACTIVE5,
+ LARGETURBINE_TI_ACTIVE6,
+ LARGETURBINE_TI_ACTIVE7,
+ LARGETURBINE_TI_ACTIVE8,
+ LARGETURBINE_TI_ACTIVE9,
+ };
+
+ /**
+ * Gas Turbines
+ */
+
+ public static BlockIcons[] OVERLAY_GAS_TURBINE = new BlockIcons[]{
+ LARGETURBINE_SS1,
+ LARGETURBINE_SS2,
+ LARGETURBINE_SS3,
+ LARGETURBINE_SS4,
+ LARGETURBINE_SS5,
+ LARGETURBINE_SS6,
+ LARGETURBINE_SS7,
+ LARGETURBINE_SS8,
+ LARGETURBINE_SS9,
};
+ public static BlockIcons[] OVERLAY_GAS_TURBINE_ACTIVE = new BlockIcons[]{
+ LARGETURBINE_SS_ACTIVE1,
+ LARGETURBINE_SS_ACTIVE2,
+ LARGETURBINE_SS_ACTIVE3,
+ LARGETURBINE_SS_ACTIVE4,
+ LARGETURBINE_SS_ACTIVE5,
+ LARGETURBINE_SS_ACTIVE6,
+ LARGETURBINE_SS_ACTIVE7,
+ LARGETURBINE_SS_ACTIVE8,
+ LARGETURBINE_SS_ACTIVE9,
+ };
+
+ /**
+ * Plasma Turbines
+ */
+
+ public static BlockIcons[] OVERLAY_PLASMA_TURBINE = new BlockIcons[]{
+ LARGETURBINE_TU1,
+ LARGETURBINE_TU2,
+ LARGETURBINE_TU3,
+ LARGETURBINE_TU4,
+ LARGETURBINE_TU5,
+ LARGETURBINE_TU6,
+ LARGETURBINE_TU7,
+ LARGETURBINE_TU8,
+ LARGETURBINE_TU9,
+ };
+ public static BlockIcons[] OVERLAY_PLASMA_TURBINE_ACTIVE = new BlockIcons[]{
+ LARGETURBINE_TU_ACTIVE1,
+ LARGETURBINE_TU_ACTIVE2,
+ LARGETURBINE_TU_ACTIVE3,
+ LARGETURBINE_TU_ACTIVE4,
+ LARGETURBINE_TU_ACTIVE5,
+ LARGETURBINE_TU_ACTIVE6,
+ LARGETURBINE_TU_ACTIVE7,
+ LARGETURBINE_TU_ACTIVE8,
+ LARGETURBINE_TU_ACTIVE9,
+ };
- public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks4 thisBlock) {
+ public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaSpecialMultiCasings i) {
final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
- //7 - shaft
- //8 LP
- //9 HP
+ //0 shaft
+ //1 LP
+ //2 HP
+ //3 Gas
+ //4 Plasma
- CustomIcon[] mGetCurrentTextureSet = null, mGetCurrentTextureSet_ACTIVE = null;
+ BlockIcons[] mGetCurrentTextureSet = null;
+ BlockIcons[] mGetCurrentTextureSet_ACTIVE = null;
- if (tMeta <= 6 || tMeta >= 10) {
- return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ if (tMeta <= 0 || tMeta >= 5) {
+ return GregtechMetaSpecialMultiCasings.getStaticIcon((byte) aSide, (byte) tMeta);
}
else {
- if (tMeta == 8) {
+ if (tMeta == 1) {
mGetCurrentTextureSet = OVERLAY_LP_TURBINE;
mGetCurrentTextureSet_ACTIVE = OVERLAY_LP_TURBINE_ACTIVE;
}
- else if (tMeta == 9) {
+ else if (tMeta == 2) {
mGetCurrentTextureSet = OVERLAY_HP_TURBINE;
mGetCurrentTextureSet_ACTIVE = OVERLAY_HP_TURBINE_ACTIVE;
}
+ else if (tMeta == 3) {
+ mGetCurrentTextureSet = OVERLAY_GAS_TURBINE;
+ mGetCurrentTextureSet_ACTIVE = OVERLAY_GAS_TURBINE_ACTIVE;
+ }
+ else if (tMeta == 4) {
+ mGetCurrentTextureSet = OVERLAY_PLASMA_TURBINE;
+ mGetCurrentTextureSet_ACTIVE = OVERLAY_PLASMA_TURBINE_ACTIVE;
+ }
if (mGetCurrentTextureSet == null || mGetCurrentTextureSet_ACTIVE == null) {
- return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ return GregtechMetaSpecialMultiCasings.getStaticIcon((byte) aSide, (byte) tMeta);
}
@@ -283,28 +340,26 @@ public class LargeTurbineTextureHandler {
}
}
}
- return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta);
+ return GregtechMetaSpecialMultiCasings.getStaticIcon((byte) aSide, (byte) tMeta);
}
- public boolean isUsingAnimatedTexture(TileEntity tTileEntity) {
+ public static boolean isUsingAnimatedTexture(TileEntity tTileEntity) {
boolean aVal = true;
- */
-/*IGregTechTileEntity aTile;
+ IGregTechTileEntity aTile;
if (tTileEntity instanceof IGregTechTileEntity) {
aTile = (IGregTechTileEntity) tTileEntity;
if (aTile != null) {
final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity();
if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
- aVal = ((GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity).isControllerActive();
- Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status");
+ aVal = ((GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity).getBaseMetaTileEntity().isActive();
+ //Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status");
}
}
- } *//*
-
+ }
return aVal;
}
- public GT_MetaTileEntity_Hatch_Turbine isTurbineHatch(final IGregTechTileEntity aTileEntity) {
+ public static GT_MetaTileEntity_Hatch_Turbine isTurbineHatch(final IGregTechTileEntity aTileEntity) {
if (aTileEntity != null) {
final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
@@ -315,4 +370,3 @@ public class LargeTurbineTextureHandler {
}
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java
deleted file mode 100644
index ca7cbca5f8..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_Generic_3x3.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.blueprint;
-
-import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockBlueprint;
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer;
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-
-public class Blueprint_Generic_3x3 extends MultiblockBlueprint {
-
- public Blueprint_Generic_3x3(Pair<Block, Integer> aCasing, int aTextureID) {
- super(3, 3, 3, 10, aTextureID);
-
- // Top/Bottom
- MultiblockLayer a0 = new MultiblockLayer(3, 3);
- Block aCasingBlock_1 = aCasing.getKey();
- int aMeta = aCasing.getValue();
- a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 0, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 1, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 0, 2, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 0, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 1, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 1, 2, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 0, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 1, true);
- a0.addBlockForPos(aCasingBlock_1, aMeta, 2, 2, true);
- a0.lock(true);
-
- //Layer one
- MultiblockLayer a1 = new MultiblockLayer(3, 3);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 0, true);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 1, true);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 0, 2, true);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 1, 0, true);
- a1.addBlockForPos(Blocks.air, 0, 1, 1, true);
- a1.addController(1, 2);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 0, true);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 1, true);
- a1.addBlockForPos(aCasingBlock_1, aMeta, 2, 2, true);
- a1.lock(true);
-
- this.setLayer(a0, 0);
- this.setLayer(a1, 1);
- this.setLayer(a0, 2);
- }
-
- @Override
- public int getMinimumInputBus() {
- return 0;
- }
-
- @Override
- public int getMinimumInputHatch() {
- return 0;
- }
-
- @Override
- public int getMinimumOutputBus() {
- return 0;
- }
-
- @Override
- public int getMinimumOutputHatch() {
- return 0;
- }
-
- @Override
- public int getMinimumInputEnergy() {
- return 1;
- }
-
- @Override
- public int getMinimumOutputEnergy() {
- return 0;
- }
-
- @Override
- public int getMinimumMaintHatch() {
- return 1;
- }
-
- @Override
- public int getMinimumMufflers() {
- return 1;
- }
-
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java
deleted file mode 100644
index 3551172904..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.blueprint;
-
-import gregtech.api.enums.TAE;
-import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockBlueprint;
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer;
-import net.minecraft.block.Block;
-
-public class Blueprint_LFTR extends MultiblockBlueprint {
-
- public Blueprint_LFTR() {
- super(7, 4, 7, 10, TAE.GTPP_INDEX(12));
-
-
- Block aCasingMain = ModBlocks.blockCasingsMisc;
- int aMetaCasingMain = 12;
- int aMetaCasingSecondary = 13;
-
-
-
- /**
- * First Layer (All edges can be Hatches, controller is centered in the front)
- */
-
- MultiblockLayer a0 = new MultiblockLayer(7, 7);
- for (int i = 0; i < 7; i++) {
- a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true);
- }
- for (int i = 0; i < 7; i++) {
- for (int u = 1; u < 6; u++) {
- a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, i == 0 ? true : i == 6 ? true : false);
- }
- }
- for (int i = 0; i < 7; i++) {
- if (i != 3) {
- a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true);
- }
- else {
- a0.addController(i, 6);
- }
- }
- a0.lock(true);
-
-
-
-
- /**
- * Middle Layer(s)
- */
-
- MultiblockLayer a1 = new MultiblockLayer(7, 7);
- for (int i = 0; i < 7; i++) {
- a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 0, false);
- }
- for (int i = 0; i < 7; i++) {
- for (int u = 1; u < 6; u++) {
- if (i == 0 || i == 6)
- a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, u, false);
- }
- }
- for (int i = 0; i < 7; i++) {
- a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 6, false);
-
- }
- a1.lock(true);
-
-
- /**
- * Top Layer (All edges can be Hatches, Mufflers required in inner 3x3)
- */
-
- MultiblockLayer a2 = new MultiblockLayer(7, 7);
- for (int i = 0; i < 7; i++) {
- a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true);
- }
- for (int i = 0; i < 7; i++) {
- for (int u = 1; u < 6; u++) {
- if ((i == 2 || i == 3 || i == 4) && (u == 2 || u ==3 || u == 4)) {
- a2.addMuffler(aCasingMain, aMetaCasingMain, i, u);
- }
- else {
- a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, true);
- }
- }
- }
- for (int i = 0; i < 7; i++) {
- a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true);
- }
- a2.lock(true);
-
- this.setLayer(a0, 0);
- this.setLayer(a1, 1);
- this.setLayer(a1, 2);
- this.setLayer(a2, 3);
- }
-
- @Override
- public int getMinimumInputBus() {
- return 0;
- }
-
- @Override
- public int getMinimumInputHatch() {
- return 4;
- }
-
- @Override
- public int getMinimumOutputBus() {
- return 0;
- }
-
- @Override
- public int getMinimumOutputHatch() {
- return 4;
- }
-
- @Override
- public int getMinimumInputEnergy() {
- return 0;
- }
-
- @Override
- public int getMinimumOutputEnergy() {
- return 4;
- }
-
- @Override
- public int getMinimumMaintHatch() {
- return 1;
- }
-
- @Override
- public int getMinimumMufflers() {
- return 4;
- }
-
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java
new file mode 100644
index 0000000000..bd2df1b8ff
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputerCube_Setup.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.xmod.gregtech.common.computer;
+
+import static gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube.sReactorList;
+
+import java.util.ArrayList;
+
+import Ic2ExpReactorPlanner.ComponentFactory;
+import gregtech.api.enums.ItemList;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.util.GT_ModHandler;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bartworks.BW_Utils;
+import gtPlusPlus.xmod.goodgenerator.GG_Utils;
+import net.minecraft.item.ItemStack;
+
+public class GT_ComputerCube_Setup {
+
+ public static void init() {
+ Logger.INFO("[Reactor Simulator] Added " + ComponentFactory.getComponentCount() + " components to ComponentFactory.");
+ if (sReactorList == null) {
+ sReactorList = new ArrayList<GT_ItemStack>();
+
+ String[] aIc2Items = new String[]{
+ "reactorUraniumSimple", "reactorUraniumDual", "reactorUraniumQuad", /*"reactorIsotopeCell",*/ "reactorReflector", "reactorReflectorThick", "reactorCoolantSimple",
+ "reactorCoolantTriple", "reactorCoolantSix", "reactorCondensator", "reactorCondensatorLap", "reactorPlating", "reactorPlatingHeat", "reactorPlatingExplosive", "reactorVent",
+ "reactorVentCore", "reactorVentGold", "reactorVentSpread", "reactorVentDiamond", "reactorHeatSwitch", "reactorHeatSwitchCore", "reactorHeatSwitchSpread",
+ "reactorHeatSwitchDiamond", /*"reactorHeatpack",*/
+ };
+
+ for (String aItem : aIc2Items) {
+ ItemStack aStack = GT_ModHandler.getIC2Item(aItem, 1);
+ if (!ItemUtils.checkForInvalidItems(aStack)) {
+ Logger.INFO("Unable to find IC2 Item: " + aItem);
+ CORE.crash("Unable to find IC2 Item: " + aItem);
+ }
+ else {
+ sReactorList.add(new GT_ItemStack(aStack.copy()));
+ }
+ }
+
+ ItemList[] aGtItems = new ItemList[]{
+ ItemList.Neutron_Reflector, ItemList.Moxcell_1, ItemList.Moxcell_2, ItemList.Moxcell_4, /*ItemList.Uraniumcell_1, ItemList.Uraniumcell_2, ItemList.Uraniumcell_4,*/
+ ItemList.NaquadahCell_1, ItemList.NaquadahCell_2, ItemList.NaquadahCell_4, ItemList.ThoriumCell_1, ItemList.ThoriumCell_2, ItemList.ThoriumCell_4, ItemList.MNqCell_1,
+ ItemList.MNqCell_2, ItemList.MNqCell_4, ItemList.Reactor_Coolant_He_1, ItemList.Reactor_Coolant_He_3, ItemList.Reactor_Coolant_He_6, ItemList.Reactor_Coolant_NaK_1,
+ ItemList.Reactor_Coolant_NaK_3, ItemList.Reactor_Coolant_NaK_6, ItemList.Reactor_Coolant_Sp_1, ItemList.Reactor_Coolant_Sp_2, ItemList.Reactor_Coolant_Sp_3,
+ ItemList.Reactor_Coolant_Sp_6
+ };
+
+ for (ItemList aItem : aGtItems) {
+ sReactorList.add(new GT_ItemStack(aItem.get(1)));
+ }
+
+ if (LoadedMods.BartWorks) {
+ ArrayList<ItemStack> aBartReactorItems = BW_Utils.getAll(1);
+ for (ItemStack aReactorItem : aBartReactorItems) {
+ sReactorList.add(new GT_ItemStack(aReactorItem));
+ }
+ }
+
+ if (LoadedMods.GoodGenerator) {
+ ArrayList<ItemStack> aGlodReactorItems = GG_Utils.getAll(1);
+ for (ItemStack aReactorItem : aGlodReactorItems) {
+ sReactorList.add(new GT_ItemStack(aReactorItem));
+ }
+ }
+ Logger.INFO("[Reactor Simulator] Added " + sReactorList.size() + " components to GT_TileEntity_ComputerCube.");
+
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java
new file mode 100644
index 0000000000..fedb4e6028
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java
@@ -0,0 +1,194 @@
+package gtPlusPlus.xmod.gregtech.common.computer;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.item.ItemStack;
+
+public class GT_Computercube_Description {
+ public static ArrayList<GT_Computercube_Description> sDescriptions = new ArrayList<GT_Computercube_Description>();
+
+ public String[] mDescription;
+
+ public ItemStack[] mStacks;
+
+ public GT_Computercube_Description(String[] aDescription, ItemStack[] aStacks) {
+ this.mDescription = aDescription;
+ this.mStacks = aStacks;
+ sDescriptions.add(this);
+ }
+
+ public static void addStandardDescriptions() {
+ Logger.INFO("Adding Default Description Set of the Computer Cube");
+ new GT_Computercube_Description(new String[] {
+ "Lightning Rod", "Also known as the Bane of", "Alblaka. The Lightning Rod", "enables you to gain Energy", "from Lightning! To set it up", "you just need the Block", "itself, 4 HV-Transformers", "and a crapton of Ironfences,", "which you then place on top", "of it. After that you have to",
+ "wait for a Thunderstorm and", "when you are lucky you get", "2.5 MFSU of Energy out of", "it. If a Rod is high enough", "then Rain is also enough to", "get stroke, but with less", "probability ofcourse." }, new ItemStack[] {
+ GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), ItemList.Machine_IV_LightningRod.get(1), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Quantum Chest", "You want to store tons of", "Materials into your Chests", "but you hate the Item limit", "of them? Not anymore! The", "Quantum Chest is able to", "store an INFINITE* amount", "of one single Item type per", "Chest.", "This Chest stores your Items",
+ "like Data and ever has a", "Stack of the Item ready for", "extraction. It is compatible", "with any Item that doesnt", "have a NBT-Tag. You ask what", "NBT is? I know it, thats enough.", "Up to 2147483391*" }, new ItemStack[] {
+ ItemList.Quantum_Chest_IV.get(1), ItemList.Quantum_Chest_EV.get(1), ItemList.Quantum_Chest_HV.get(1), ItemList.Quantum_Chest_MV.get(1), ItemList.Quantum_Chest_LV.get(1), null,
+ null, null, null, null, null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Quantum Tank", "You want to store tons of", "Fluids into your Tanks", "but you hate the capacity", "of them? Not anymore! The", "Quantum Tank is able to", "store an INFINITE* amount", "of one single Fluid type per", "Tank.", "This Tank stores your Fluids",
+ "like Data and ever has a", "Stack of the Fluid ready for", "extraction. It is compatible", "with any Fluid. ", "You ask what", "NBT is? I know it, thats enough.", "* = 2147483391" }, new ItemStack[] {
+ ItemList.Quantum_Tank_IV.get(1), ItemList.Quantum_Tank_EV.get(1), ItemList.Quantum_Tank_HV.get(1), ItemList.Quantum_Tank_MV.get(1), ItemList.Quantum_Tank_LV.get(1), null,
+ null, null, null, null, null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Computer Cube", "The Device you are", "currently using. This Computer", "is running the G.L.A.D.-OS,", "which is containing many", "usefull Apps:", "- Reactor Planner", "- Seedbag Scanner", "- Recipelists for GT-Devices", "- ",
+ "- ", "- ", "- ", "- ", "And the Description List you", "are currently reading.", "~This Device has private Access~" }, new ItemStack[] {
+ null, null, null, null, GregtechItemList.Gregtech_Computer_Cube_Machine.get(1), null, null, null, null, null,
+ null, null, null, null });
+ /* new GT_Computercube_Description(new String[] {
+ "UUM-Assembler", "It's like an automatic", "Crafting Table just for UUM", "It can store 20 UUM-Recipes", "and produces those on demand", "It costs 512EU per used piece", "of Universal-Usable-Matter(TM).", "The integrated Quantum Chest", "allows it to store all your", "UUM inside it.",
+ "Top and Bottom are for Input,", "while the Output is on the", "Sides. The Output is designed,", "to work with RP-Managers, so", "build it into your recursive", "Autocraftingsystem.", "" }, new ItemStack[] {
+ null, null, null, GT_ModHandler.getIC2Item("matter", 1), new ItemStack(GregTech_API.sBlockList[1], 1, 5), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Sonictron", "You like Music? Then the", "Sonictron 9001 is your best", "choice! You can compose Alarms,", "Doorbell Sounds or boring", "Elevator Music, with the 64 Slots", "inside it. Just leftclick them", "to switch the Sound, rightclick", "them to switch the modulation", "and shiftclick to remove it.",
+ "Then apply Redstone to play", "With the mobile Version you can", "play sounds everywhere, after", "you copied them from a normal", "Sonictron via rightclicking", "Sneakrightclicking pastes", "Emits Redstone when finished." }, new ItemStack[] {
+ null, null, null, GregTech_API.getGregTechItem(32, 1, 0), new ItemStack(GregTech_API.sBlockList[1], 1, 6), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "L.E.S.U.", "The unlaggiest Multiblock ever!", "One Controllerblock, and as many", "'stupid' Storageblocks as you want.", "To use it, place one Controller", "and then place the LESU-Storages", "adjacent to it or other placed", "LESU-Storages. The Tier (max EU/t)", "of it depends on the amount of", "adjacent Storages. The",
+ "Storageblocks are NOT TileEntities,", "what means that they cause as much", "Lag as a random Dirtblock. And the", "Controller Block only checks ONCE", "for the Storages, so no", "Blockiterationlag, AT. ALL. Anyone,", "who says that they lag gets murdered!" }, new ItemStack[] {
+ null, null, null, new ItemStack(GregTech_API.sBlockList[0], 1, 6), new ItemStack(GregTech_API.sBlockList[1], 1, 7), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "I.D.S.U.", "The Interdimensional Storage Unit", "is a Device, which is like a", "wireless, crossdimensional and", "enderchestlike EU-Storage Block", "", "Every Player has one Network of", "these. The ID is determined by", "the Hashcode of the Name from the", "first Player, who opens it's GUI",
+ "", "It stores up to 1 Billion EU", "and emits EV. But you need at", "least two of them for Energy", "Transfer", "", "" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 8), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "A.E.S.U.", "The Adjustable Energy Storage Unit", "is like 10 MFSU and has an", "adjustable Output between 0 and", "2048EU/t. You could use it as a", "Transformer. It is Tier-IV, so", "it's basically needed to charge", "Energy Orbs and Lapotron Packs", "", "Not much else to say about it.",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 9), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Charge-O-Mat", "An automatable Charging Bench", "It puts (de-)charged Tools into", "the right Outputslots, which are", "accessible on the Sides of it.", "", "The Energy Orb inside stores enough", "to charge your QSuit almost instantly", "", "This is a Tier-V Charging Station",
+ "even when the Max-IN/OUT is only", "2048EU/t. It also charges your Armor", "when you are standing close to it.", "", "If you apply Redstone, then it", "decharges instead.", "" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 10), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Centrifuge", "This is a Machine to seperate", "Isotopes.", "", "It has a maximum Consumption Rate", "of 5EU/t, and its Maxinput is", "32EU/t. The time it needs depends", "on the Recipe you use.", "", "It needs Tin Cells for some Recipes,",
+ "which you put in the Top Left Slot", "", "Top = Input", "Bottom = Tin Cells", "Side = Output", "", "You can pipe Lava into this Device" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 11), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Electrolyzer", "This is a Machine to seperate", "Molecules and electrolyze", "Watercells.", "", "It has a maximum Consumption Rate", "of 128EU/t, and its Maxinput is", "128EU/t. The time it needs depends", "on the Recipe you use.", "",
+ "It needs Tin Cells for some Recipes,", "which you put in the Bottom Left Slot", "", "Top = Input", "Bottom = Tin Cells", "Side = Output", "" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 25), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Grinder", "This Machines purpose is to", "macerate and grind Ores.", "It can ONLY grind Ores, don't", "try regular Macerator Recipes.", "It has a fixed Consumption Rate", "of 128EU/t, and its Maxinput is", "128EU/t. The time it needs is", "5 seconds per Ore Block", "It needs Water for most Recipes,",
+ "which you put in the Bottom Left Slot", "Top = Input", "Bottom = Water", "Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] {
+ null, new ItemStack(Block.field_71943_B, 1), new ItemStack(GregTech_API.sBlockList[0], 1, 14), new ItemStack(GregTech_API.sBlockList[0], 1, 13), new ItemStack(GregTech_API.sBlockList[1], 1, 28), null, null, null, null, null,
+ null, null, null, null });*/
+ new GT_Computercube_Description(new String[] {
+ "Electric Blast Furnace", "You may know the Blast Furnace", "of Railcraft. This one works", "similar, as it can also produce", "Steel out of Iron and Coal.", "", "Its heat Capacity depends on the", "used Machine Casings for building", "it. The better they are, the more", "Heat it can achieve.",
+ "", "Top = Input 1", "Bottom = Input 2", "Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] {
+ null, null, null, ItemList.Casing_HeatProof.get(1), ItemList.Machine_Multi_BlastFurnace.get(1), ItemList.Casing_Coil_Cupronickel.get(1), ItemList.Casing_Coil_Kanthal.get(1), ItemList.Casing_Coil_Nichrome.get(1), ItemList.Casing_Coil_TungstenSteel.get(1), ItemList.Casing_Coil_HSSG.get(1),
+ ItemList.Casing_Coil_HSSS.get(1), ItemList.Casing_Coil_Naquadah.get(1), ItemList.Casing_Coil_NaquadahAlloy.get(1), null });
+ /* new GT_Computercube_Description(new String[] {
+ "Sawmill", "This Device turns your Logs", "into more Planks, than a normal", "Steve can produce with his Hands.", "", "Its byproduct, Wood Pulp, can be", "compressed into special Planks,", "which are burning like Charcoal.", "", "It needs Water for most Recipes,",
+ "which you put in the Bottom Left Slot", "Top = Input", "Water Sides = Water", "Saw Side = Output", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] {
+ null, null, GT_MetaItem_Material.instance.getStack(15, 1), GT_MetaItem_Dust.instance.getStack(15, 1), new ItemStack(GregTech_API.sBlockList[1], 1, 32), null, null, null, null, null,
+ null, null, null, null });*/
+ new GT_Computercube_Description(new String[] {
+ "Implosion Compressor", "You need to turn Dusts back", "into Gems? Or do you just want", "to make Iridium Plates?", "With a bit ITNT you can achieve", "that in this Device!", "", "We strongly recommend to use", "Flint Dust instead of Flints", "for making the ITNT.",
+ "", "Top = Input", "Explosion Sides = Output", "ITNT Side = ITNT Input", "Its a lagfree Multiblock Structure,", "so you need a special Machine Casing", "for this Device. (see GUI)" }, new ItemStack[] {
+ null, null, null, GT_ModHandler.getIC2Item("industrialTnt", 1, new ItemStack(net.minecraft.init.Blocks.tnt, 1)), ItemList.Machine_Multi_ImplosionCompressor.get(1), null, null, null, null, null,
+ null, null, null, null });
+ /* new GT_Computercube_Description(new String[] {
+ "Superconductor", "Expensive, but superconducting", "nearly infinite EU/p and it has", "no Cableloss!", "Do not confuse this with the", "Superconductor Item!", "", "Supercondensator", "This is a special kind of Transformer", "It allows you to convert anything down",
+ "to 8192 EU/t, what is like a normal HVT.", "But if you apply Redstone to it then it", "outputs friggin 1000000EU/t!!!", "", "You also need it for the Fusion Reactor.", "Some Machines will require that high", "Voltage in a short period of time." }, new ItemStack[] {
+ null, null, GregTech_API.getGregTechItem(3, 1, 2), new ItemStack(GregTech_API.sBlockList[1], 1, 12), new ItemStack(GregTech_API.sBlockList[1], 1, 15), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Player Detector", "This nice little Device is able", "to detect Players in a Range of", "16-Spherical Meters and a", "EU-Consumption of 2.5EU/t.", "", "It can be switched to 3 Diffrent", "Modes, to detect YOURSELF, OTHERS", "and ALL Players by Rightclicking it.", "",
+ "It doesnt detect regular Mobs.", "", "", "", "", "", "~This Device has private Access~" }, new ItemStack[] {
+ null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 13), null, null, null, null, null,
+ null, null, null, null });*/
+ new GT_Computercube_Description(new String[] {
+ "Matter Fabricator", "The Matter Fabricator is nothing", "else than a Mass Fabricator, which", "can ONLY run on Scrap and other", "Amplifiers.", "", "With the Default Config it is 100", "times more expensive than normal.", "Of course you can set the Config", "to 166666, to get your normal",
+ "Massfabricationrate back, or you", "could make Mass Fabrication even", "cheaper, if you really want to", "make Mass Fabrication that easy", "", "", "" }, new ItemStack[] {
+ null, null, null, GT_Utility.getFluidDisplayStack(FluidUtils.getUUM(1), false), ItemList.Machine_LV_Massfab.get(1), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Electric Autocrafting Tables", "These are Crafting Tables for the", "common need of autocrafting in", "Factories. One Craft needs 5000EU to", "be performed, so you have actually to", "lay Wires to it. This Table is", "unique as its also able, to give you", "the used Capsulecellcontainers, made", "by Industrial Corp, back.", "You may use that behaviour to",
+ "craft anything releated to chemics,", "like the 2xKNO3-Recipe for Saltpeter.", "The 5 Modes are the following:", "1. Craft Recipe, 2. All 5 Modes", "3. Craft all as single Items", "4. 2x2-Grid and 5. a 3x3-Grid.", "It accepts only 32EU/p as Input." }, new ItemStack[] {
+ null, null, null, null, GregtechItemList.GT4_Electric_Auto_Workbench_LV.get(1), null, null, null, null, null,
+ null, null, null, null });
+ /* new GT_Computercube_Description(new String[] {
+ "Automation with GregTech", "Translocators and Buffers are the", "newest Way to automate your Machines.", "Screw Buildcraft, these EU-wasting", "Devices are much more awesome.", "They output 32EU/t to their directed", "IN- and OUT-puts, making them usefull", "for things, like saving wires.", "Translocators are taking Stuff from", "the Block at their green Inputfacing",
+ "and putting it into the Block at the", "red Outputfacing. Buffers do the same,", "but the grab Items from their own", "Inventory, what makes them usefull", "as Pipe-replacement.", "Buffers also have Redstone Intelligence,", "which you can configure in their GUI." }, new ItemStack[] {
+ null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 19), new ItemStack(GregTech_API.sBlockList[1], 1, 18), new ItemStack(GregTech_API.sBlockList[1], 1, 17), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Silver Ore", "It's rarity is similar to Gold", "Silver can be used, to make", "Circuits cheaper, or you can use", "it for Redpowerstuff.", "", "", "", "", "",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ null, null, GT_OreDictUnificator.get("dustSilver", 1), GregTech_API.getGregTechItem(0, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 1), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Sapphires and Rubys", "These spawn exactly like Emeralds.", "But Rubies are found in Deserts,", "while Sapphires can be found in", "Oceans.", "", "They currently make only a cheaper", "Recipe for Energycrystals and", "Lapotroncrystals, but they are", "Redpower Compatible.",
+ "", "They also sometimes drop random", "other Gems, like Garnet for Ruby", "or green Sapphire for Sapphire", "in addition.", "", "" }, new ItemStack[] {
+ null, GregTech_API.getGregTechItem(0, 1, 32), new ItemStack(GregTech_API.sBlockList[2], 1, 3), GregTech_API.getGregTechItem(0, 1, 33), new ItemStack(GregTech_API.sBlockList[2], 1, 4), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Bauxite Ore", "The Stuff out of which you can", "produce Aluminium and also", "Titanium.", "You find this Ore in Plains and", "Forests.", "", "If you think Aluminium is useless", "then note, that mobs NEVER spawn", "ontop of an Aluminium Block",
+ "(Same applies also for Silver-,", "Gem- and Iridium Blocks)", "Production Chain:", "macerating Bauxite Ore", "electrolyzing 24 Bauxite Dust", "smelting Aluminium Dust in a", "Blast Furnace" }, new ItemStack[] {
+ new ItemStack(GregTech_API.sBlockList[0], 1, 7), GregTech_API.getGregTechItem(0, 1, 18), GregTech_API.getGregTechItem(1, 1, 18), GregTech_API.getGregTechItem(1, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 5), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Titanium", "Produced by centrifuging Bauxitedust", "as a byproduct, this Material can make", "anything much more resistant against", "damage, like Explosions.", "Blocks made of Titaniumingots have a", "large Blastresistance", "", "It can also be used to craft tons of", "mixed Metal Ingots",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ new ItemStack(GregTech_API.sBlockList[0], 1, 8), GregTech_API.getGregTechItem(0, 1, 19), GregTech_API.getGregTechItem(1, 1, 19), GregTech_API.getGregTechItem(1, 1, 17), new ItemStack(GregTech_API.sBlockList[2], 1, 5), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Iridium Ore", "You can find it only when you", "stripmine very large Areas with", "Quarries and such. There is only", "one in every 5th-10th Chunk.", "It's even more rare in Oceans!", "", "Some people disable the UUM-Recipe", "for Iridium, for making getting it", "an Achievement.",
+ "", "However Iridium Ore contains traces", "of Platinum, so it's best to use the", "Industrial Grinder for this Ore.", "", "", "" }, new ItemStack[] {
+ null, null, GT_OreDictUnificator.get("plateAlloyIridium", 1), GT_ModHandler.getIC2Item("iridiumOre", 1), new ItemStack(GregTech_API.sBlockList[2], 1, 2), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Helium Coolant Cell", "These are just cheaper, than the", "Water based Coolant Cells, and can", "also hold six times more Heat.", "", "Helium Cells can also be used for", "making Luminators and Mininglasers", "", "", "",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ GregTech_API.getGregTechItem(2, 1, 6), GregTech_API.getGregTechItem(2, 1, 3), GregTech_API.getGregTechItem(34, 1, 0), GregTech_API.getGregTechItem(35, 1, 0), GregTech_API.getGregTechItem(36, 1, 0), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Destructopack", "Open its GUI via rightclick and", "dump all the useless Stuff from", "your Inventory into it, instead of", "littering Items into the World.", "", "", "", "", "",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ null, null, null, null, GregTech_API.getGregTechItem(33, 1, 0), null, null, null, null, null,
+ null, null, null, null });*/
+ new GT_Computercube_Description(new String[] {
+ "Data Orbs", "They store Data.", "", "Rightclick on a Computer Cube, to", "extract a Reactorplan", "", "Sneak-Rightclick on it, to insert", "a Reactorplan", "", "Works also with Sonictrons",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ null, null, null, null, ItemList.Tool_DataOrb.get(1), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Energy Orbs", "100 Million EU in one Orb!", "", "This is a Tier-IV-Energystorage", "So a MFSU is not enough for it!", "", "Use it to create a Lapotron Pack,", "which is like an ultimate Lap Pack!", "", "",
+ "", "", "", "", "", "", "" }, new ItemStack[] {
+ null, null, null, null, ItemList.Energy_LapotronicOrb.get(1), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Iridium Neutron Reflector", "It's used for Fusion Reactor Coils,", "and works like a normal one", "inside a Reactor, but it's also", "INDESTRUCTIBLE*.", "", "", "", "", "",
+ "", "", "", "", "", "", "* = for weardown" }, new ItemStack[] {
+ null, null, null, null, ItemList.Neutron_Reflector.get(1), null, null, null, null, null,
+ null, null, null, null });
+ /*new GT_Computercube_Description(new String[] {
+ "Rock Cutter", "You want to get whole Blocks, but", "your Drill is not enchantable?", "The Rock Cutter has an awesome", "SilkTouch-III-Function!", "", "It works like a Drill, but you", "get the whole Block instead of", "'macerated' Ores!", "",
+ "Put those Blocks into a Macerator", "and double your Diamond Income!", "", "Or better. Use the Industrial", "Grinder to get even more", "Resources!", "" }, new ItemStack[] {
+ null, null, null, null, GregTech_API.getGregTechItem(46, 1, 0), null, null, null, null, null,
+ null, null, null, null });
+ new GT_Computercube_Description(new String[] {
+ "Tesla Staff", "This completly untested PvP-Weapon", "destroys electric Armor in one hit", "", "The Energy Orb inside it must be", "fully charged to let this work.", "", "We are not responsible for any", "Electrocution Damage to yourself,", "while using it.",
+ "", "We also dont even know, if this", "Weapon has any effect AT ALL.", "", "", "", "" }, new ItemStack[] {
+ null, null, null, null, GregTech_API.getGregTechItem(47, 1, 0), null, null, null, null, null,
+ null, null, null, null });*/
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java
new file mode 100644
index 0000000000..e0bedb5d18
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Simulator.java
@@ -0,0 +1,149 @@
+package gtPlusPlus.xmod.gregtech.common.computer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import Ic2ExpReactorPlanner.AutomationSimulator;
+import Ic2ExpReactorPlanner.Reactor;
+import Ic2ExpReactorPlanner.SimulationData;
+import Ic2ExpReactorPlanner.components.ReactorItem;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube;
+
+public class GT_Computercube_Simulator {
+
+ private static final HashMap<Integer, Pair<Integer, Integer>> sSlotPositions = new HashMap<Integer, Pair<Integer, Integer>>();
+
+ static {
+ int aSlot = 4;
+ for (int column = 0; column < 6; column++) {
+ for (int row = 0; row < 9; row++) {
+ sSlotPositions.put(aSlot++, new Pair<Integer, Integer>(row, column));
+ }
+ }
+ }
+
+ private final Reactor reactor = new Reactor();
+
+ public AutomationSimulator simulator = null;
+ /**
+ * The reactor that was last simulated.
+ */
+ public Reactor simulatedReactor = null;
+
+ private String currentReactorCode = null;
+
+ private String currentReactorOldCode = null;
+
+ private ArrayList<String> output = new ArrayList<String>();
+
+ private final GT_TileEntity_ComputerCube mTile;
+
+ public GT_Computercube_Simulator(GT_TileEntity_ComputerCube aTile) {
+ mTile = aTile;
+ }
+
+ public void slotClick(int aSlot, GT_ItemStack aStack) {
+
+ /*if (selection != null) {
+ componentToPlace = ComponentFactory.createComponent(selection.getActionCommand());
+ if (componentToPlace != null) {
+ componentToPlace.setInitialHeat(((Number)componentHeatSpinner.getValue()).intValue());
+ componentToPlace.setAutomationThreshold(((Number)placingThresholdSpinner.getValue()).intValue());
+ componentToPlace.setReactorPause(((Number)placingReactorPauseSpinner.getValue()).intValue());
+ }
+ }*/
+ if (aSlot >= 4 && aSlot < 58) {
+ Pair<Integer, Integer> aSpot = sSlotPositions.get(aSlot);
+ ReactorItem aItem;
+ if (aStack == null) {
+ aItem = null;
+ }
+ else {
+
+ Logger.INFO("Using lookup key: "+ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData);
+ aItem = ReactorItem.sComponentMap.get(ItemUtils.getModId(aStack.toStack())+"."+aStack.mItem.getUnlocalizedName()+"."+aStack.mMetaData);
+
+ }
+ int aRow = aSpot.getKey();
+ int aColumn = aSpot.getValue();
+ Logger.INFO("Putting "+(aItem == null ? "null" : aItem.name)+" at x:"+aRow+", y:"+aColumn);
+ reactor.setComponentAt(aColumn, aRow, aItem);
+ currentReactorCode = reactor.getCode();
+ currentReactorOldCode = reactor.getOldCode();
+ Logger.INFO("Code: "+currentReactorCode);
+ }
+ //maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat()));
+ //heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1);
+ //heatSpinnerModel.setValue(Math.min(((Number)heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1));
+ //temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int) (reactor.getMaxHeat() * 0.4), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0)));
+ }
+
+ public void simulate() {
+ /*if (Utils.isClient()) {
+ return;
+ }*/
+ if (simulator != null && simulator.isRunning()) {
+ Logger.INFO("Simulator Running, Stopping.");
+ simulator.cancel();
+ }
+ Logger.INFO("Starting Simulator.");
+ mTile.mHeat = 0;
+ mTile.mEU = 0;
+ currentReactorCode = reactor.getCode();
+ currentReactorOldCode = reactor.getOldCode();
+ output.clear();
+ simulatedReactor = new Reactor();
+ simulatedReactor.setCode(reactor.getCode());
+ Logger.INFO("Making new AutomationSimulator.");
+ simulator = new AutomationSimulator(simulatedReactor, output, mTile);
+ Logger.INFO("Starting AutomationSimulator.process().");
+ simulator.process();
+ Logger.INFO("Done.");
+
+ SimulationData aData = simulator.getData();
+ if (aData != null && aData.totalReactorTicks > 0) {
+ mTile.mEU = aData.avgEUoutput * aData.totalReactorTicks;
+ mTile.mEUOut = aData.avgEUoutput;
+ mTile.mHeat = aData.avgHUoutput;
+ mTile.mMaxHeat = aData.maxHUoutput;
+ mTile.mExplosionStrength = aData.explosionPower;
+ mTile.mHEM = (float) aData.hullHeating;
+ mTile.mProgress = aData.totalReactorTicks;
+ }
+
+ for (String s : output) {
+ Logger.INFO(" "+s);
+ }
+ }
+
+ public ArrayList<String> getOutputData() {
+ return output;
+ }
+
+ private void clearGrid() {
+ reactor.clearGrid();
+ /*for (int i = 0; i < reactorButtons.length; i++) {
+ for (int j = 0; j < reactorButtons[i].length; j++) {
+ reactorButtons[i][j].setIcon(null);
+ reactorButtons[i][j].setToolTipText(null);
+ reactorButtonPanels[i][j].setBackground(Color.LIGHT_GRAY);
+ }
+ }*/
+ output.clear();
+ /*materialsArea.setText(reactor.getMaterials().toString());
+ componentListArea.setText(reactor.getComponentList().toString());
+ maxHeatLabel.setText(formatI18n("UI.MaxHeatSpecific", reactor.getMaxHeat()));
+ heatSpinnerModel.setMaximum(reactor.getMaxHeat() - 1);
+ heatSpinnerModel.setValue(Math.min(((Number) heatSpinnerModel.getValue()).intValue(), reactor.getMaxHeat() - 1));
+ temperatureEffectsLabel.setText(formatI18n("UI.TemperatureEffectsSpecific", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0)));
+ lockCode = true;
+ codeField.setText(null);
+ lockCode = false;*/
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
index 70c7b2da23..be9db74eef 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java
@@ -6,17 +6,11 @@ import java.util.UUID;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-
import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
import gregtech.common.items.GT_MetaGenerated_Item_01;
import gregtech.common.items.GT_MetaGenerated_Item_02;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.api.objects.minecraft.BlockPos;
@@ -25,14 +19,16 @@ import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.NBTUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaWirelessCharger;
-import ic2.api.info.Info;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
public class ChargingHelper {
- private static Map<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<EntityPlayer, Pair<GregtechMetaWirelessCharger, Byte>>();
+ private static Map<String, Pair<GregtechMetaWirelessCharger, Byte>> mValidPlayers = new HashMap<String, Pair<GregtechMetaWirelessCharger, Byte>>();
protected static Map<BlockPos, GregtechMetaWirelessCharger> mChargerMap = new HashMap<BlockPos, GregtechMetaWirelessCharger>();
private int mTickTimer = 0;
private final int mTickMultiplier = 20;
@@ -58,7 +54,7 @@ public class ChargingHelper {
long mVoltage = 0;
long mEuStored = 0;
- if (!mChargerMap.isEmpty() && mValidPlayers.containsKey(mPlayerMan)){
+ if (!mChargerMap.isEmpty() && mValidPlayers.containsKey(mPlayerMan.getDisplayName())){
InventoryPlayer mPlayerInventory = mPlayerMan.inventory;
ItemStack[] mArmourContents = mPlayerInventory.armorInventory.clone();
ItemStack[] mInventoryContents = mPlayerInventory.mainInventory.clone();
@@ -70,30 +66,30 @@ public class ChargingHelper {
mEuStored = mEntityTemp.getEUVar();
if (mVoltage > 0 && mEuStored >= mVoltage){
- Map<EntityPlayer, UUID> LR = mEntityTemp.getLongRangeMap();
- Map<UUID, EntityPlayer> LO = mEntityTemp.getLocalMap();
+ Map<String, UUID> LR = mEntityTemp.getLongRangeMap();
+ Map<String, UUID> LO = mEntityTemp.getLocalMap();
long mStartingEu = mEntityTemp.getEUVar();
long mCurrentEu = mEntityTemp.getEUVar();
long mEuUsed = 0;
if (mEntityTemp.getMode() == 0){
- if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ if (!LR.isEmpty() && LR.containsKey(mPlayerMan.getDisplayName())){
mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
}
}
else if (mEntityTemp.getMode() == 1){
- if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ if (!LO.isEmpty() && LO.containsKey(mPlayerMan.getDisplayName())){
mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
}
}
else {
- if (!LR.isEmpty() && LR.containsKey(mPlayerMan)){
+ if (!LR.isEmpty() && LR.containsKey(mPlayerMan.getDisplayName())){
mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
}
- if (!LO.isEmpty() && LO.containsValue(mPlayerMan)){
+ if (!LO.isEmpty() && LO.containsKey(mPlayerMan.getDisplayName())){
mCurrentEu = chargeItems(mEntityTemp, mArmourContents, mPlayerMan);
mCurrentEu = chargeItems(mEntityTemp, mInventoryContents, mPlayerMan);
}
@@ -136,13 +132,13 @@ public class ChargingHelper {
catch (Throwable t){
//Utils.LOG_WARNING("State of Wireless Charger changed in an invalid way, this prevented a crash.");
-
- if (!mChargerMap.isEmpty()){
- for (GregtechMetaWirelessCharger r : mChargerMap.values()){
- if (r == null){
- mChargerMap.remove(r);
+ if (!mChargerMap.isEmpty()){
+ for (BlockPos aPos : mChargerMap.keySet()) {
+ GregtechMetaWirelessCharger r = mChargerMap.get(aPos);
+ if (r == null || r.getBaseMetaTileEntity().isInvalidTileEntity()){
+ mChargerMap.remove(aPos);
}
- }
+ }
}
//t.printStackTrace();
}
@@ -163,7 +159,7 @@ public class ChargingHelper {
}
}
else {
- return false;
+ return true;
}
}
@@ -189,14 +185,14 @@ public class ChargingHelper {
return false;
}
Logger.WARNING("trying to map new player");
- if (mValidPlayers.containsKey(mPlayer)){
+ if (mValidPlayers.containsKey(mPlayer.getDisplayName())){
Logger.WARNING("Key contains player already?");
return false;
}
else {
Logger.WARNING("key not found, adding");
Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
- if (mValidPlayers.put(mPlayer, mEntry) == null){
+ if (mValidPlayers.put(mPlayer.getDisplayName(), mEntry) == null){
Logger.WARNING("Added a Player to the Tick Map.");
return true;
}
@@ -212,7 +208,7 @@ public class ChargingHelper {
return false;
}
Logger.WARNING("trying to remove player from map");
- if (mValidPlayers.containsKey(mPlayer)){
+ if (mValidPlayers.containsKey(mPlayer.getDisplayName())){
Logger.WARNING("key found, removing");
Pair<GregtechMetaWirelessCharger, Byte> mEntry = new Pair<GregtechMetaWirelessCharger, Byte>(mEntity, (byte) mEntity.getMode());
if (mValidPlayers.remove(mPlayer, mEntry)){
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java
deleted file mode 100644
index e53a7e4738..0000000000
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.requirements;
-
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements;
-
-public class RequirementsBasicCubic extends MultiblockRequirements {
-
- public RequirementsBasicCubic( ) {
- super(0, null);
- }
-
-}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java
new file mode 100644
index 0000000000..7b223f8245
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java
@@ -0,0 +1,772 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.automation;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures;
+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_BasicTank;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_Container_ElectricAutoWorkbench;
+import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_GUIContainer_ElectricAutoWorkbench;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_BasicTank {
+
+ public int mMode = 0, mCurrentSlot = 0, mThroughPut = 0, mTicksUntilNextUpdate = 20;
+ public boolean mLastCraftSuccessful = false;
+ protected String mLocalName;
+
+ public GT_MetaTileEntity_ElectricAutoWorkbench(final int aID, final int aTier, final String aDescription) {
+ super(aID, "basicmachine.automation.autoworkbench.0"+aTier, "Auto Workbench ("+GT_Values.VN[aTier]+")", aTier, 30, aDescription);
+ mLocalName = "Auto Workbench ("+GT_Values.VN[aTier]+")";
+ }
+
+ public GT_MetaTileEntity_ElectricAutoWorkbench(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 30, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_ElectricAutoWorkbench(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_ElectricAutoWorkbench(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 19;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return !isOutputFacing(aSide);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return mThroughPut % 2 == 0 ? GT_Values.V[mTier] : 0;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]);
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 30;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ElectricAutoWorkbench(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mMode", mMode);
+ aNBT.setInteger("mThroughPut", mThroughPut);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mMode = aNBT.getInteger("mMode");
+ mThroughPut = aNBT.getInteger("mThroughPut");
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return aSide != getBaseMetaTileEntity().getFrontFacing() && aSide != getBaseMetaTileEntity().getBackFacing();
+ }
+
+ private static final int MAX_MODES = 10;
+
+ public void switchModeForward() {
+ mMode = (mMode + 1) % MAX_MODES;
+ switchMode();
+ }
+
+ public void switchModeBackward() {
+ mMode--;
+ if (mMode < 0) mMode = MAX_MODES-1;
+ switchMode();
+ }
+
+ private void switchMode() {
+ mInventory[28] = null;
+ }
+
+ public void switchThrough() {
+ mThroughPut = (mThroughPut + 1) % 4;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().getUniversalEnergyStored() >= (mMode==5||mMode==6?128:2048) && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || --mTicksUntilNextUpdate<1)) {
+ mTicksUntilNextUpdate = 32;
+
+ for (byte i = 19; i < 28; i++) {
+ if (mInventory[i] != null && mInventory[i].isItemStackDamageable() && mInventory[i].getItem().hasContainerItem()) {
+ mInventory[i].setItemDamage(OreDictionary.WILDCARD_VALUE);
+ }
+ }
+
+ if (mInventory[18] == null) {
+ for (byte i = 0; i < 18 && mFluid != null; i++) {
+ ItemStack tOutput = GT_Utility.fillFluidContainer(mFluid, mInventory[i], false, true);
+ if (tOutput != null) {
+ for (byte j = 0; j < 9; j++) {
+ if (mInventory[j] == null || (GT_Utility.areStacksEqual(tOutput, mInventory[j]) && mInventory[j].stackSize + tOutput.stackSize <= tOutput.getMaxStackSize())) {
+ mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount * tOutput.stackSize;
+ getBaseMetaTileEntity().decrStackSize(i, 1);
+ if (mInventory[j] == null) {
+ mInventory[j] = tOutput;
+ } else {
+ mInventory[j].stackSize++;
+ }
+ if (mFluid.amount <= 0) mFluid = null;
+ break;
+ }
+ }
+ }
+ }
+
+ ItemStack[] tRecipe = new ItemStack[9];
+ ItemStack tTempStack = null, tOutput = null;
+
+ if (mInventory[17] != null && mThroughPut < 2 && mMode != 0) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[17];
+ mInventory[17] = null;
+ }
+ } else {
+ if (!mLastCraftSuccessful) {
+ mCurrentSlot = (mCurrentSlot+1)%18;
+ for (int i = 0; i < 17 && mInventory[mCurrentSlot] == null; i++)
+ mCurrentSlot = (mCurrentSlot+1)%18;
+ }
+ switch (mMode) {
+ case 0:
+ if (mInventory[mCurrentSlot] != null && !isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2 && mCurrentSlot < 8) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ for (int i = 0; i < 9; i++) {
+ tRecipe[i] = mInventory[i+19];
+ if (tRecipe[i] != null) {
+ tRecipe[i] = GT_Utility.copy(tRecipe[i]);
+ tRecipe[i].stackSize = 1;
+ }
+ }
+ break;
+ case 1:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ tRecipe[1] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ } else break;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ tRecipe[2] = tTempStack;
+ tRecipe[5] = tTempStack;
+ tRecipe[6] = tTempStack;
+ tRecipe[7] = tTempStack;
+ tRecipe[8] = tTempStack;
+ } else break;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 2:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 3:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 4:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = tTempStack;
+ tRecipe[2] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ tRecipe[5] = tTempStack;
+ tRecipe[6] = tTempStack;
+ tRecipe[7] = tTempStack;
+ tRecipe[8] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 5:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+
+ tOutput = GT_OreDictUnificator.get(true, tTempStack);
+
+ if (tOutput != null && GT_Utility.areStacksEqual(tOutput, tTempStack)) tOutput = null;
+
+ if (tOutput == null) {
+ tRecipe[0] = null;
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ }
+ break;
+ case 6:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ } else if (OrePrefixes.dustSmall.contains(mInventory[mCurrentSlot])) {
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ } else if (OrePrefixes.dustTiny.contains(mInventory[mCurrentSlot])) {
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = tTempStack;
+ tRecipe[2] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ tRecipe[5] = tTempStack;
+ tRecipe[6] = tTempStack;
+ tRecipe[7] = tTempStack;
+ tRecipe[8] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ } else {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 7:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) || !OrePrefixes.nugget.contains(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = tTempStack;
+ tRecipe[2] = tTempStack;
+ tRecipe[3] = tTempStack;
+ tRecipe[4] = tTempStack;
+ tRecipe[5] = tTempStack;
+ tRecipe[6] = tTempStack;
+ tRecipe[7] = tTempStack;
+ tRecipe[8] = tTempStack;
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ break;
+ case 8:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot]) || mInventory[mCurrentSlot].getItemDamage() <= 0 || !mInventory[mCurrentSlot].getItem().isRepairable()) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ tTempStack = GT_Utility.copy(mInventory[mCurrentSlot]);
+ tTempStack.stackSize = 1;
+ for (int i = mCurrentSlot + 1; i < 18; i++) {
+ if (mInventory[i] != null && mInventory[i].getItem() == tTempStack.getItem() && mInventory[mCurrentSlot].getItemDamage()+mInventory[i].getItemDamage()>tTempStack.getMaxDamage()) {
+ tRecipe[0] = tTempStack;
+ tRecipe[1] = GT_Utility.copy(mInventory[i]);
+ if (GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null) {
+ if (mInventory[18] == null) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ case 9:
+ if (isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(mInventory[mCurrentSlot])) {
+ if (mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mCurrentSlot];
+ mInventory[mCurrentSlot] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ break;
+ }
+ for (byte i = 0, j = 0; i < 18 && j < 9 && (j < 2 || GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe) == null); i++) {
+ tRecipe[j] = mInventory[(mCurrentSlot+i)%18];
+ if (tRecipe[j] != null) {
+ tRecipe[j] = GT_Utility.copy(tRecipe[j]);
+ tRecipe[j].stackSize = 1;
+ j++;
+ }
+ }
+ if (tRecipe[1] == null) tRecipe[0] = null;
+ break;
+ }
+ }
+
+ if (tOutput == null) tOutput = GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), tRecipe);
+
+ if (tOutput != null || mMode == 0) mInventory[28] = tOutput;
+
+ if (tOutput == null) {
+ mLastCraftSuccessful = false;
+ } else {
+ if ((tTempStack = GT_OreDictUnificator.get(true, tOutput)) != null) {
+ tTempStack.stackSize = tOutput.stackSize;
+ tOutput = tTempStack;
+ }
+
+ mInventory[28] = GT_Utility.copy(tOutput);
+ ArrayList<ItemStack> tList = recipeContent(tRecipe), tContent = benchContent();
+ if (tList.size() > 0 && tContent.size() > 0) {
+
+ boolean success = (mMode==6||mMode==7||mInventory[17]==null);
+ for (byte i = 0; i < tList.size() && success; i++) {
+ success = false;
+ for (byte j = 0; j < tContent.size() && !success; j++) {
+ if (GT_Utility.areStacksEqual(tList.get(i), tContent.get(j))) {
+ if (tList.get(i).stackSize <= tContent.get(j).stackSize) {
+ success = true;
+ }
+ }
+ }
+ }
+
+ if (success) {
+ mLastCraftSuccessful = true;
+
+ for (byte i = 8; i > -1; i--) {
+ for (byte j = 17; j > -1; j--) {
+ if (tRecipe[i] != null && mInventory[j] != null) {
+ if (GT_Utility.areStacksEqual(tRecipe[i], mInventory[j])) {
+ ItemStack tStack = GT_Utility.getContainerItem(mInventory[j], true);
+ if (tStack != null) {
+ getBaseMetaTileEntity().decrStackSize(j, 1);
+ if (!tStack.isItemStackDamageable() || tStack.getItemDamage() < tStack.getMaxDamage()) {
+ for (byte k = 9; k < 18; k++) {
+ if (mInventory[k] == null) {
+ mInventory[k] = GT_Utility.copy(tStack);
+ break;
+ } else if (GT_Utility.areStacksEqual(mInventory[k], tStack) && mInventory[k].stackSize + tStack.stackSize <= tStack.getMaxStackSize()) {
+ mInventory[k].stackSize += tStack.stackSize;
+ break;
+ }
+ }
+ }
+ } else {
+ getBaseMetaTileEntity().decrStackSize(j, 1);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ mInventory[18] = GT_Utility.copy(tOutput);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(mMode==5||mMode==6||mMode==7?128:2048, true);
+ mTicksUntilNextUpdate = 1;
+ } else {
+ mLastCraftSuccessful = false;
+ if (mInventory[mMode==0?8:17] != null && mInventory[18] == null && mThroughPut < 2) {
+ mInventory[18] = mInventory[mMode==0?8:17];
+ mInventory[mMode==0?8:17] = null;
+ mTicksUntilNextUpdate = 1;
+ }
+ }
+ }
+
+ if (mInventory[18] == null && mThroughPut < 2) {
+ for (byte i = 0; i < 8; i++) {
+ for (byte j = i; ++j < 9;) {
+ if (GT_Utility.areStacksEqual(mInventory[i], mInventory[j]) && mInventory[i].getMaxStackSize() > 8) {
+ mInventory[18] = mInventory[j];
+ mInventory[j] = null;
+ mTicksUntilNextUpdate = 1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (mThroughPut < 2) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), getBaseMetaTileEntity().getIInventoryAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), getBaseMetaTileEntity().getFrontFacing(), null, false, (byte)64, (byte)1, (byte)64, (byte)1)*10, true);
+ }
+ }
+ }
+
+ private boolean isItemTypeOrItsEmptyLiquidContainerInCraftingGrid(ItemStack aStack) {
+ if (aStack == null) return true;
+ for (byte i = 19; i < 28; i++) {
+ if (mInventory[i] != null) {
+ if (GT_Utility.areStacksEqual(mInventory[i], aStack)) return true;
+ if (GT_Utility.areStacksEqual(GT_Utility.getContainerForFilledItem(mInventory[i], true), aStack)) return true;
+ }
+ }
+ return false;
+ }
+
+ private ArrayList<ItemStack> recipeContent(ItemStack[] tRecipe) {
+ ArrayList<ItemStack> tList = new ArrayList<ItemStack>();
+ for (byte i = 0; i < 9; i++) {
+ if (tRecipe[i] != null) {
+ boolean temp = false;
+ for (byte j = 0; j < tList.size(); j++) {
+ if (GT_Utility.areStacksEqual(tRecipe[i], tList.get(j))) {
+ tList.get(j).stackSize++;
+ temp = true;
+ break;
+ }
+ }
+ if (!temp) tList.add(GT_Utility.copy(1, tRecipe[i]));
+ }
+ }
+ return tList;
+ }
+
+ private ArrayList<ItemStack> benchContent() {
+ ArrayList<ItemStack> tList = new ArrayList<ItemStack>();
+ for (byte i = 0; i < 18; i++) {
+ if (mInventory[i] != null) {
+ boolean temp = false;
+ for (byte j = 0; j < tList.size(); j++) {
+ if (GT_Utility.areStacksEqual(mInventory[i], mInventory[j])) {
+ tList.get(j).stackSize += mInventory[i].stackSize;
+ temp = true;
+ break;
+ }
+ }
+ if (!temp) tList.add(GT_Utility.copy(mInventory[i]));
+ }
+ }
+ return tList;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return mMode==0?aIndex>=10:aIndex>=18;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return mMode==0?aIndex<9:aIndex<18;
+ }
+
+ /*@Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return 112;
+ if (GT_Utility.getOppositeSide(aSide) == aFacing)
+ return 113;
+ return 114;
+ }*/
+
+ @Override
+ public int getCapacity() {
+ return 16000;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return -100;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ "Automatic Crafting Table Mk III",
+ //this.mDescription,
+ CORE.GT_Tooltip };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getBack(i);
+ rTextures[7][i + 1] = this.getBottom(i);
+ rTextures[8][i + 1] = this.getTop(i);
+ rTextures[9][i + 1] = this.getSides(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return this.mTextures[0][aColorIndex + 1];
+ }
+ else if (GT_Utility.getOppositeSide(aSide) == aFacing) {
+ return this.mTextures[1][aColorIndex + 1];
+ }
+ else {
+ return this.mTextures[4][aColorIndex + 1];
+ }
+ /*return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];*/
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) };
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay)};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java
new file mode 100644
index 0000000000..732996de71
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java
@@ -0,0 +1,451 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.automation;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_Container_ElectricInventoryManager;
+import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_GUIContainer_ElectricInventoryManager;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntity_TieredMachineBlock {
+
+ public int[] mSlotRange = new int[4];
+ public boolean mWorkedLastTick = false;
+ protected String mLocalName;
+
+ public GT_MetaTileEntity_ElectricInventoryManager(final int aID, final int aTier, final String aDescription) {
+ super(aID, "basicmachine.automation.inventorymanager.0" + aTier, "Electric Inventory Manager (" + GT_Values.VN[aTier] + ")", aTier, 16, aDescription);
+ mLocalName = "Auto Workbench (" + GT_Values.VN[aTier] + ")";
+ }
+
+ public GT_MetaTileEntity_ElectricInventoryManager(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 16, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_ElectricInventoryManager(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_ElectricInventoryManager(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]);
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 4;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 4;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 3;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return !isOutputFacing(aSide);
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ for (int i = 0; i < mSlotRange.length; i++) {
+ if (aSide == getRangeDirection(i) && getRangeEnergy(i)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 16;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ElectricInventoryManager(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mSlotRange0", mSlotRange[0]);
+ aNBT.setInteger("mSlotRange1", mSlotRange[1]);
+ aNBT.setInteger("mSlotRange2", mSlotRange[2]);
+ aNBT.setInteger("mSlotRange3", mSlotRange[3]);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mSlotRange[0] = aNBT.getInteger("mSlotRange0");
+ mSlotRange[1] = aNBT.getInteger("mSlotRange1");
+ mSlotRange[2] = aNBT.getInteger("mSlotRange2");
+ mSlotRange[3] = aNBT.getInteger("mSlotRange3");
+ }
+
+ public void iterateRangeDirection(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~7) | (((mSlotRange[aIndex] & 7) + 1) % 6);
+ }
+
+ public void switchRangeEnergy(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~8) | ((mSlotRange[aIndex] & 8) > 0 ? 0 : 8);
+ }
+
+ public void iterateSlot1Direction(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~112) | (((((mSlotRange[aIndex] & 112) >> 4) + 1) % 6) << 4);
+ }
+
+ public void iterateSlot2Direction(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~896) | (((((mSlotRange[aIndex] & 896) >> 7) + 1) % 6) << 7);
+ }
+
+ public void iterateSlot3Direction(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~7168) | (((((mSlotRange[aIndex] & 7168) >> 10) + 1) % 6) << 10);
+ }
+
+ public void switchSlot1InOut(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~8192) | ((mSlotRange[aIndex] & 8192) > 0 ? 0 : 8192);
+ }
+
+ public void switchSlot2InOut(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~16384) | ((mSlotRange[aIndex] & 16384) > 0 ? 0 : 16384);
+ }
+
+ public void switchSlot3InOut(int aIndex) {
+ mSlotRange[aIndex] = (mSlotRange[aIndex] & ~32768) | ((mSlotRange[aIndex] & 32768) > 0 ? 0 : 32768);
+ }
+
+ public byte getRangeDirection(int aIndex) {
+ return (byte) (mSlotRange[aIndex] & 7);
+ }
+
+ public byte getSlot1Direction(int aIndex) {
+ return (byte) ((mSlotRange[aIndex] & 112) >> 4);
+ }
+
+ public byte getSlot2Direction(int aIndex) {
+ return (byte) ((mSlotRange[aIndex] & 896) >> 7);
+ }
+
+ public byte getSlot3Direction(int aIndex) {
+ return (byte) ((mSlotRange[aIndex] & 7168) >> 10);
+ }
+
+ public boolean getRangeEnergy(int aIndex) {
+ return (mSlotRange[aIndex] & 8) > 0;
+ }
+
+ public boolean getSlot1InOut(int aIndex) {
+ return (mSlotRange[aIndex] & 8192) > 0;
+ }
+
+ public boolean getSlot2InOut(int aIndex) {
+ return (mSlotRange[aIndex] & 16384) > 0;
+ }
+
+ public boolean getSlot3InOut(int aIndex) {
+ return (mSlotRange[aIndex] & 32768) > 0;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().getUniversalEnergyStored() >= 5000
+ && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || getBaseMetaTileEntity().getTimer() % 100 == 0 || mWorkedLastTick || getBaseMetaTileEntity().hasInventoryBeenModified())) {
+ mWorkedLastTick = false;
+
+ IInventory[] tTileEntities = new IInventory[]{
+ getBaseMetaTileEntity().getIInventoryAtSide((byte) 0), getBaseMetaTileEntity().getIInventoryAtSide((byte) 1), getBaseMetaTileEntity().getIInventoryAtSide((byte) 2),
+ getBaseMetaTileEntity().getIInventoryAtSide((byte) 3), getBaseMetaTileEntity().getIInventoryAtSide((byte) 4), getBaseMetaTileEntity().getIInventoryAtSide((byte) 5), null, null
+ };
+
+ int tCost = 0;
+
+ for (int i = 0; i < 4; i++) {
+ if (tTileEntities[getRangeDirection(i)] != null) {
+ ArrayList<ItemStack> tList = new ArrayList<ItemStack>();
+ ItemStack tStack;
+ tList.add(null);
+
+ tStack = mInventory[3 + i * 3 + 0];
+ if (tStack == null) {
+ if (getSlot1InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot1Direction(i), getSlot1Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot1Direction(i), getSlot1Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ else {
+ tList.set(0, tStack);
+ if (getSlot1InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot1Direction(i), getSlot1Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot1Direction(i), getSlot1Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ }
+
+ tStack = mInventory[3 + i * 3 + 1];
+ if (tStack == null) {
+ if (getSlot2InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot2Direction(i), getSlot2Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot2Direction(i), getSlot2Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ else {
+ tList.set(0, tStack);
+ if (getSlot2InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot2Direction(i), getSlot2Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot2Direction(i), getSlot2Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ }
+
+ tStack = mInventory[3 + i * 3 + 2];
+ if (tStack == null) {
+ if (getSlot3InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot3Direction(i), getSlot3Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot3Direction(i), getSlot3Direction(i), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ else {
+ tList.set(0, tStack);
+ if (getSlot3InOut(i))
+ tCost += 5
+ * GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntities[getRangeDirection(i)], getSlot3Direction(i), getSlot3Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost += 5
+ * GT_Utility.moveOneItemStack(tTileEntities[getRangeDirection(i)], getBaseMetaTileEntity(), getSlot3Direction(i), getSlot3Direction(i), tList, false, (byte) tStack.stackSize, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
+ }
+
+ if (tCost > 0) {
+ mWorkedLastTick = true;
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCost, true);
+ }
+ }
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "It's simpler than you think. I promise.", this.mDescription, CORE.GT_Tooltip
+ };
+ }
+
+ /*@Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ switch (aSide) {
+ case 0: return 113 + (aRedstone?8:0);
+ case 1: return 112 + (aRedstone?8:0);
+ case 2: return 116 + (aRedstone?8:0);
+ case 3: return 213 + (aRedstone?8:0);
+ case 4: return 212 + (aRedstone?8:0);
+ case 5: return 117 + (aRedstone?8:0);
+ }
+ return 0;
+ }*/
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[16][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getBottom(i);
+ rTextures[1][i + 1] = this.getTop(i);
+ rTextures[2][i + 1] = this.getNegativeZ(i);
+ rTextures[3][i + 1] = this.getPositiveZ(i);
+ rTextures[4][i + 1] = this.getNegativeX(i);
+ rTextures[5][i + 1] = this.getPositiveX(i);
+ rTextures[6][i + 1] = this.getBottomRedstone(i);
+ rTextures[7][i + 1] = this.getTopRedstone(i);
+ rTextures[8][i + 1] = this.getNegativeZRedstone(i);
+ rTextures[9][i + 1] = this.getPositiveZRedstone(i);
+ rTextures[10][i + 1] = this.getNegativeXRedstone(i);
+ rTextures[11][i + 1] = this.getPositiveXRedstone(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[!aRedstone ? aSide : aSide + 6][aColorIndex < 0 ? 0 : aColorIndex];
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red)
+ };
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Green)
+ };
+ }
+
+ public ITexture[] getNegativeZ(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Blue)
+ };
+ }
+
+ public ITexture[] getPositiveZ(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Cyan)
+ };
+ }
+
+ public ITexture[] getNegativeX(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Purple)
+ };
+ }
+
+ public ITexture[] getPositiveX(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Yellow)
+ };
+ }
+
+ public ITexture[] getBottomRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red_Redstone)
+ };
+ }
+
+ public ITexture[] getTopRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Green_Redstone)
+ };
+ }
+
+ public ITexture[] getNegativeZRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Blue_Redstone)
+ };
+ }
+
+ public ITexture[] getPositiveZRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Cyan_Redstone)
+ };
+ }
+
+ public ITexture[] getNegativeXRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Purple_Redstone)
+ };
+ }
+
+ public ITexture[] getPositiveXRedstone(final byte aColor) {
+ return new ITexture[]{
+ Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Yellow_Redstone)
+ };
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
index a62a5d16c8..087da7465d 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -5,18 +5,13 @@ import static gregtech.api.enums.GT_Values.V;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
-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.EnumChatFormatting;
import gregtech.api.enums.GT_Values;
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.objects.GT_RenderedTexture;
-
+import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
@@ -26,34 +21,36 @@ import gtPlusPlus.core.util.sys.KeyboardUtils;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
+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.EnumChatFormatting;
+import net.minecraft.world.World;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
*
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
+ * This is the main construct for my Basic Machines such as the Automatic
+ * Extractor Extend this class to make a simple Machine
*/
public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
-
- public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier,
- final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ private int mVoltageTier = 3;
+
+ public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
super(aName, aTier, aDescription, aTextures, aSlotCount);
// TODO Auto-generated constructor stub
}
- public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName,
- final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
}
@Override
public String[] getDescription() {
- return new String[] {this.mDescription,
- "Use Screwdriver to change voltage",
- "Hold Shift while using Screwdriver to change amperage",
- EnumChatFormatting.GREEN+"CREATIVE MACHINE",
- CORE.GT_Tooltip};
+ return new String[]{this.mDescription, "Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN
+ + "CREATIVE MACHINE", CORE.GT_Tooltip};
}
/*
@@ -64,29 +61,35 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel;
CustomIcon g = TexturesGtBlock.Casing_Material_Grisium;
CustomIcon k;
- boolean j = MathUtils.isNumberEven(this.mTier);
+ boolean j = MathUtils.isNumberEven(this.mVoltageTier);
final ITexture[][][] rTextures = new ITexture[2][17][];
- k = j ? g : h;
+ k = j ? g : h;
for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(k) };
- rTextures[1][i + 1] = new ITexture[] {
- new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]
- : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] };
+ rTextures[0][i + 1] = new ITexture[]{new GT_RenderedTexture(k)};
+ rTextures[1][i
+ + 1] = new ITexture[]{new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mVoltageTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mVoltageTier]};
}
return rTextures;
}
@Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity,
- final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive,
- final boolean aRedstone) {
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
}
@Override
+ protected void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ final long tempStorage = this.getBaseMetaTileEntity().getStoredEU();
+ final double c = ((double) tempStorage / this.maxEUStore()) * 100;
+ final double roundOff = Math.round(c * 100.00) / 100.00;
+ PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mVoltageTier]+"v ("+roundOff+"%)");
+ PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut())+"A");
+
+ }
+
+ @Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription,
- this.mTextures, this.mInventory.length);
+ return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
}
@Override
@@ -101,43 +104,49 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public long maxEUInput() {
- return V[this.mTier];
+ return V[mVoltageTier];
}
@Override
public long maxEUOutput() {
- return V[this.mTier];
+ return V[mVoltageTier];
}
@Override
public long maxAmperesIn() {
- return 16;
+ return aCurrentOutputAmperage;
}
@Override
public long maxAmperesOut() {
- return 16;
+ return aCurrentOutputAmperage;
}
- @Override public int getProgresstime() {return Integer.MAX_VALUE;}
- @Override public int maxProgresstime() {return Integer.MAX_VALUE;}
- @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+ @Override
+ public int getProgresstime() {
+ return Integer.MAX_VALUE;
+ }
+ @Override
+ public int maxProgresstime() {
+ return Integer.MAX_VALUE;
+ }
+ @Override
+ public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ return true;
+ }
@Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return null;
}
@Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return null;
}
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
- this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
if (aBaseMetaTileEntity.isServerSide()) {
aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
}
@@ -156,12 +165,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public String[] getInfoData() {
String[] infoData = super.getInfoData();
- return new String[] {
- infoData[0],
- "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: "+this.mTier,
- infoData[1],
- infoData[2]
- };
+ return new String[]{infoData[0], "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: " + this.mVoltageTier, infoData[1], infoData[2]};
}
@Override
@@ -171,59 +175,59 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setByte("mTier", this.mTier);
+ aNBT.setInteger("mVoltageTier", this.mVoltageTier);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
+ this.mVoltageTier = aNBT.getInteger("mVoltageTier");
super.loadNBTData(aNBT);
- this.mTier = aNBT.getByte("mTier");
}
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (KeyboardUtils.isShiftKeyDown()) {
- super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
}
else {
- if (this.mTier < (CORE.GTNH ? GT_Values.V.length-1 : 9)) {
- this.mTier++;
+ if (this.mVoltageTier < (GT_Values.VN[9].equals("UHV") ? GT_Values.V.length - 1 : 9)) {
+ this.mVoltageTier++;
}
else {
- this.mTier = 0;
+ this.mVoltageTier = 0;
}
this.markDirty();
try {
- Field field = ReflectionUtils.getField(this.getClass(), "mTextures");
+ Field field = ReflectionUtils.getField(this.getClass(), "mTextures");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
ITexture[][][] V = getTextureSet(null);
if (V != null) {
- Logger.REFLECTION("Got Valid Textures.");
+ Logger.REFLECTION("Got Valid Textures.");
if (this.getBaseMetaTileEntity().isClientSide()) {
- Logger.REFLECTION("Clientside Call.");
+ Logger.REFLECTION("Clientside Call.");
Logger.REFLECTION("Refreshing Textures on buffer.");
field.set(this, V);
Logger.REFLECTION("Refreshed Textures on buffer.");
}
else {
- Logger.REFLECTION("Serverside Call.");
+ Logger.REFLECTION("Serverside Call.");
}
}
else {
- Logger.REFLECTION("Bad mTextures setter.");
- }
+ Logger.REFLECTION("Bad mTextures setter.");
+ }
}
catch (Throwable t) {
- //Bad refresh.
+ // Bad refresh.
t.printStackTrace();
Logger.REFLECTION("Bad mTextures setter.");
}
- PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+".");
- }
-
+ PlayerUtils.messagePlayer(aPlayer, "Now running at " + GT_Values.VOLTAGE_NAMES[this.mVoltageTier] + ".");
+ }
+
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java
new file mode 100644
index 0000000000..01d5ef88c8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java
@@ -0,0 +1,669 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_Container_CropHarvestor;
+import gtPlusPlus.xmod.gregtech.api.gui.basic.GT_GUIContainer_CropHarvestor;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import ic2.api.crops.CropCard;
+import ic2.api.crops.ICropTile;
+import ic2.core.item.DamageHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank {
+
+ protected String mLocalName;
+
+ private static final int SLOT_WEEDEX_1 = 1;
+ private static final int SLOT_WEEDEX_2 = 2;
+ private static final int SLOT_FERT_1 = 3;
+ private static final int SLOT_FERT_4 = 6;
+ private static final int SLOT_OUTPUT_START = 7;
+
+ public boolean mModeAlternative = false;
+
+ public GT_MetaTileEntity_CropHarvestor(final int aID, final int aTier, final String aDescription) {
+ super(aID, "basicmachine.cropharvester.0"+aTier, "Crop Manager ("+GT_Values.VN[aTier]+")", aTier, 21, aDescription);
+ mLocalName = "Crop Manager ("+GT_Values.VN[aTier]+")";
+ }
+
+ public GT_MetaTileEntity_CropHarvestor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 21, aDescription, aTextures);
+ mLocalName = "Crop Manager ("+GT_Values.VN[aTier]+")";
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity, mLocalName);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 8;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return GT_Values.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[this.mTier] * (this.mTier * GT_Values.V[this.mTier]);
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public int getCapacity() {
+ return 32000 * mTier;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return -100;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_CropHarvestor(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 21;
+ }
+
+ private static final int getRange(int aTier) {
+ switch(aTier) {
+ case 1:
+ return 1;
+ case 2:
+ return 5;
+ case 3:
+ return 9;
+ case 4:
+ return 13;
+ case 5:
+ return 17;
+ case 6:
+ return 21;
+ case 7:
+ return 25;
+ case 8:
+ return 29;
+ case 9:
+ return 33;
+ default:
+ return 0;
+ }
+ }
+
+ private HashSet<ICropTile> mCropCache = new HashSet<ICropTile>();
+ private boolean mInvalidCache = false;
+
+ public boolean doesInventoryHaveSpace() {
+ for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory(); i++) {
+ if (this.mInventory[i] == null || this.mInventory[i].stackSize < 64) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public long powerUsage() {
+ return this.maxEUInput() / 8;
+ }
+
+ public long powerUsageSecondary() {
+ return this.maxEUInput() / 32;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork() && (getBaseMetaTileEntity().hasWorkJustBeenEnabled() || aTick % 100 == 0)) {
+ if (this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU()) {
+
+ int aTileX = this.getBaseMetaTileEntity().getXCoord();
+ int aTileY = this.getBaseMetaTileEntity().getXCoord();
+ int aTileZ = this.getBaseMetaTileEntity().getXCoord();
+
+ int aRadius = 10 + getRange(mTier);
+ int aSide = (aRadius-1)/2;
+ ArrayList<ItemStack> aAllDrops = new ArrayList<ItemStack>();
+
+ if (mCropCache.isEmpty() || aTick % 1200 == 0 || mInvalidCache) {
+ if (!mCropCache.isEmpty()) {
+ mCropCache.clear();
+ }
+ //Logger.INFO("Looking for crops.");
+ for (int y = 0; y <= 2; y++) {
+ for (int x = (-aSide); x <= aSide; x++) {
+ for (int z = (-aSide); z <= aSide; z++) {
+ TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, y, z);
+ if (tTileEntity != null && tTileEntity instanceof ICropTile) {
+ ICropTile tCrop = (ICropTile) tTileEntity;
+ mCropCache.add(tCrop);
+ }
+ }
+ }
+ }
+ }
+
+ //Process Cache
+ if (doesInventoryHaveSpace()) {
+ for (ICropTile tCrop : mCropCache) {
+ if (tCrop == null) {
+ mInvalidCache = true;
+ break;
+ }
+ CropCard aCrop = tCrop.getCrop();
+ if (aCrop != null) {
+ //Logger.INFO("Found "+aCrop.displayName()+" at offset "+x+", "+y+", "+z);
+ if (!aCrop.canGrow(tCrop) && aCrop.canBeHarvested(tCrop)) {
+ if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsage(), true)) {
+ ItemStack[] aHarvest = tCrop.harvest_automated(true);
+ if (aHarvest != null && aHarvest.length > 0) {
+ for (ItemStack aStack : aHarvest) {
+ if (aStack.stackSize > 0) {
+ if (mTier * 5 > MathUtils.randInt(1, 100)) {
+ aStack.stackSize += Math.floor(tCrop.getGain()/10);
+ Logger.INFO("Bonus output given for "+aCrop.displayName());
+ }
+ Logger.INFO("Harvested "+aCrop.displayName());
+ aAllDrops.add(aStack);
+ }
+ }
+ }
+ }
+ }
+ if (this.mModeAlternative) {
+ processSecondaryFunctions(tCrop);
+ }
+ }
+ }
+
+ if (!aAllDrops.isEmpty()) {
+ Logger.INFO("Handling "+aAllDrops.size()+" Harvests");
+ Iterator<ItemStack> iter = aAllDrops.iterator();
+ while (iter.hasNext()) {
+ ItemStack aDrop = iter.next();
+ if (ItemUtils.checkForInvalidItems(aDrop)) {
+
+ for (int i = SLOT_OUTPUT_START; i < this.getSizeInventory(); i++) {
+ if (this.mInventory[i] != null) {
+ //Logger.INFO("Slot "+i+" contains "+this.mInventory[i].getDisplayName());
+ if (GT_Utility.areStacksEqual(aDrop, mInventory[i], false)) {
+ //Same
+ if (mInventory[i].stackSize < 64 && (mInventory[i].stackSize + aDrop.stackSize <= 64)) {
+ //can merge
+ //Logger.INFO("Slot "+i+" size: "+mInventory[i].stackSize+" + Drop Size: "+aDrop.stackSize+" = "+(mInventory[i].stackSize + aDrop.stackSize));
+ mInventory[i].stackSize += aDrop.stackSize;
+ break;
+ }
+ else if (mInventory[i].stackSize < 64 && (mInventory[i].stackSize + aDrop.stackSize > 64)) {
+ //can merge
+ //Logger.INFO("Slot "+i+" size: "+mInventory[i].stackSize+" + Drop Size: "+aDrop.stackSize+" = "+(mInventory[i].stackSize + aDrop.stackSize));
+ int aRemainder = mInventory[i].stackSize + aDrop.stackSize - 64;
+ Logger.INFO("Remainder: "+aRemainder+", Continuing.");
+ mInventory[i].stackSize = 64;
+ aDrop.stackSize = aRemainder;
+ continue;
+ }
+ else {
+ //Logger.INFO("Slot "+i+" size: 64, Continuing.");
+ continue;
+ }
+ }
+ }
+ else {
+ //Logger.INFO("Slot "+i+" is empty, setting to "+aDrop.getDisplayName()+" x"+aDrop.stackSize);
+ this.mInventory[i] = aDrop;
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean hasFertilizer() {
+ for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) {
+ if (this.mInventory[i] != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean consumeFertilizer(boolean aSimulate) {
+ if (hasFertilizer()) {
+ for (int i = SLOT_FERT_1; i <= SLOT_FERT_4; i++) {
+ if (this.mInventory[i] != null) {
+ consume(i, 1, aSimulate);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean hasWeedEX() {
+ for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) {
+ if (this.mInventory[i] != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean consumeWeedEX(boolean aSimulate) {
+ if (hasWeedEX()) {
+ for (int i = SLOT_WEEDEX_1; i <= SLOT_WEEDEX_2; i++) {
+ if (this.mInventory[i] != null) {
+ damage(i, 1, aSimulate);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void processSecondaryFunctions(ICropTile aCrop) {
+ if (!mModeAlternative) {
+ return;
+ }
+ if (hasFertilizer() && consumeFertilizer(true) && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyFertilizer(aCrop)) {
+ if (consumeFertilizer(false)) {
+ //Logger.INFO("Consumed Fert.");
+ }
+ }
+ if (this.getFluidAmount() > 0 && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyHydration(aCrop)) {
+ //Logger.INFO("Consumed Water.");
+ }
+ if (hasWeedEX() && consumeWeedEX(true) && this.getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU() && getBaseMetaTileEntity().decreaseStoredEnergyUnits(powerUsageSecondary(), true) && applyWeedEx(aCrop)) {
+ if (consumeWeedEX(false)) {
+ //Logger.INFO("Consumed Weed-EX.");
+ }
+ }
+ }
+
+
+ public boolean applyWeedEx(ICropTile aCrop) {
+ if (aCrop.getWeedExStorage() < 150) {
+ aCrop.setWeedExStorage(aCrop.getWeedExStorage() + 50);
+ boolean triggerDecline;
+ triggerDecline = aCrop.getWorld().rand.nextInt(3) == 0;
+ if (aCrop.getCrop() != null && aCrop.getCrop().isWeed(aCrop) && aCrop.getWeedExStorage() >= 75 && triggerDecline) {
+ switch (aCrop.getWorld().rand.nextInt(5)) {
+ case 0 :
+ if (aCrop.getGrowth() > 0) {
+ aCrop.setGrowth((byte) (aCrop.getGrowth() - 1));
+ }
+ case 1 :
+ if (aCrop.getGain() > 0) {
+ aCrop.setGain((byte) (aCrop.getGain() - 1));
+ }
+ default :
+ if (aCrop.getResistance() > 0) {
+ aCrop.setResistance((byte) (aCrop.getResistance() - 1));
+ }
+ }
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean applyFertilizer(ICropTile aCrop) {
+ if (aCrop.getNutrientStorage() >= 100) {
+ return false;
+ } else {
+ //Logger.INFO("Current Nutrient: "+aCrop.getNutrientStorage()+" for "+aCrop.getCrop().displayName());
+ aCrop.setNutrientStorage(100);
+ return true;
+ }
+ }
+
+ public boolean applyHydration(ICropTile aCrop) {
+ if (aCrop.getHydrationStorage() >= 200 || this.getFluidAmount() == 0) {
+ //Logger.INFO("Hydration Max");
+ return false;
+ } else {
+ int apply = 200 - aCrop.getHydrationStorage();
+ if (this.getFluidAmount() >= 0) {
+ int drain = 0;
+ if (this.getFluidAmount() >= apply) {
+ drain = apply;
+ }
+ else {
+ drain = this.getFluidAmount();
+ }
+ this.mFluid.amount -= drain;
+ if (this.mFluid.amount <= 0) {
+ this.mFluid = null;
+ }
+ //Logger.INFO("Did Hydrate");
+ aCrop.setHydrationStorage(aCrop.getHydrationStorage() + drain);
+ return true;
+ }
+ else {
+ //Logger.INFO("No water?");
+ return false;
+ }
+ }
+ }
+
+ public boolean consume(int aSlot, int amount, boolean simulate) {
+ ItemStack stack = this.mInventory[aSlot];
+ if (stack != null && stack.stackSize >= amount) {
+ int currentAmount = Math.min(amount, stack.stackSize);
+ amount -= currentAmount;
+ if (!simulate) {
+ if (stack.stackSize == currentAmount) {
+ this.mInventory[aSlot] = null;
+ } else {
+ stack.stackSize -= currentAmount;
+ }
+ }
+ else {
+ return amount >= 0;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public ItemStack damage(int aSlot, int amount, boolean simulate) {
+ ItemStack ret = null;
+ int damageApplied = 0;
+ ItemStack stack = this.mInventory[aSlot];
+ Item item = stack.getItem();
+ if (stack != null && item.isDamageable() && (ret == null
+ || stack.getItem() == ret.getItem() && ItemStack.areItemStackTagsEqual(stack, ret))) {
+ if (simulate) {
+ stack = stack.copy();
+ }
+ int maxDamage = DamageHandler.getMaxDamage(stack);
+ while (amount > 0 && stack.stackSize > 0) {
+ int currentAmount = Math.min(amount, maxDamage - DamageHandler.getDamage(stack));
+ DamageHandler.damage(stack, currentAmount, null);
+ damageApplied += currentAmount;
+ amount -= currentAmount;
+ if (DamageHandler.getDamage(stack) >= maxDamage) {
+ --stack.stackSize;
+ DamageHandler.setDamage(stack, 0);
+ }
+
+ if (ret == null) {
+ ret = stack.copy();
+ }
+ }
+ if (stack.stackSize == 0 && !simulate) {
+ this.mInventory[aSlot] = null;
+ }
+ }
+
+ if (ret != null) {
+ int i = DamageHandler.getMaxDamage(ret);
+ ret.stackSize = damageApplied / i;
+ DamageHandler.setDamage(ret, damageApplied % i);
+ }
+ return ret;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aStack != null && aIndex >= SLOT_OUTPUT_START && aIndex < this.getSizeInventory();
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (aStack != null) {
+ if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) {
+ return aIndex >= SLOT_FERT_1 && aIndex <= SLOT_FERT_4;
+ }
+ else if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) {
+ return aIndex >= SLOT_WEEDEX_1 && aIndex <= SLOT_WEEDEX_2;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String[] getDescription() {
+ int aRadius = 10 + getRange(mTier);
+ int aSide = (aRadius-1)/2;
+ return new String[] {
+ this.mDescription,
+ "Secondary mode can Hydrate/Fertilize/Weed-EX",
+ "Consumes "+powerUsage()+"eu per harvest",
+ "Consumes "+powerUsageSecondary()+"eu per secondary operation",
+ "Can harvest 2 blocks above",
+ "Radius: "+aSide+" each side ("+aRadius+"x3x"+aRadius+")",
+ "Has "+(mTier * 5)+"% chance for extra drops",
+ "Holds "+this.getCapacity()+"L of Water",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return true;
+ }
+
+ /*@Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return 118+(aRedstone?8:0);
+ if (GT_Utility.getOppositeSide(aSide) == aFacing)
+ return 113+(aRedstone?8:0);
+
+ int tIndex = 128+(aRedstone?8:0);
+
+ switch (aFacing) {
+ case 0:
+ return tIndex+64;
+ case 1:
+ return tIndex+32;
+ case 2: switch (aSide) {
+ case 0: return tIndex+32;
+ case 1: return tIndex+32;
+ case 4: return tIndex+16;
+ case 5: return tIndex+48;
+ }
+ case 3: switch (aSide) {
+ case 0: return tIndex+64;
+ case 1: return tIndex+64;
+ case 4: return tIndex+48;
+ case 5: return tIndex+16;
+ }
+ case 4: switch (aSide) {
+ case 0: return tIndex+16;
+ case 1: return tIndex+16;
+ case 2: return tIndex+48;
+ case 3: return tIndex+16;
+ }
+ case 5: switch (aSide) {
+ case 0: return tIndex+48;
+ case 1: return tIndex+48;
+ case 2: return tIndex+16;
+ case 3: return tIndex+48;
+ }
+ }
+ return tIndex;
+ } */
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getBack(i);
+ rTextures[7][i + 1] = this.getBottom(i);
+ rTextures[8][i + 1] = this.getTop(i);
+ rTextures[9][i + 1] = this.getSides(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == 0 || aSide == 1) {
+ return this.mTextures[3][aColorIndex + 1];
+ }
+ else {
+ return this.mTextures[4][aColorIndex + 1];
+ }
+ /*return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];*/
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes)};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Boxes)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_CropHarvester_Cutter)};
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mModeAlternative", mModeAlternative);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mModeAlternative = aNBT.getBoolean("mModeAlternative");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
index c5e33c088d..92cbddfdba 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -66,11 +66,11 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
return this.mCurrentDimension;
}
- public Map<UUID, EntityPlayer> getLocalMap(){
+ public Map<String, UUID> getLocalMap(){
return this.mLocalChargingMap;
}
- public Map<EntityPlayer, UUID> getLongRangeMap(){
+ public Map<String, UUID> getLongRangeMap(){
return this.mWirelessChargingMap;
}
@@ -372,9 +372,8 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
super.onFirstTick(aBaseMetaTileEntity);
}
-
- private Map<EntityPlayer, UUID> mWirelessChargingMap = new HashMap<EntityPlayer, UUID>();
- private Map<UUID, EntityPlayer> mLocalChargingMap = new HashMap<UUID, EntityPlayer>();
+ private Map<String, UUID> mWirelessChargingMap = new HashMap<String, UUID>();
+ private Map<String, UUID> mLocalChargingMap = new HashMap<String, UUID>();
private boolean isValidPlayer(EntityPlayer aPlayer) {
BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
@@ -412,7 +411,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
if (isValidPlayer(mTemp) && !mLocalChargingMap.containsKey(mTemp.getPersistentID())){
- mLocalChargingMap.put(mTemp.getPersistentID(), mTemp);
+ mLocalChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
//PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
}
@@ -430,8 +429,8 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) <= tempRange){
if (!mWirelessChargingMap.containsKey(mTemp)){
- if (mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
- mWirelessChargingMap.put(mTemp, mTemp.getPersistentID());
+ if (isValidPlayer(mTemp)) {
+ mWirelessChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Long-Range].");
}
@@ -538,15 +537,29 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
}
if (this.mMode == 2){
- PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Mixed Mode | Local: "+this.mTier*10+"m | Long: "+tempRange+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLocalMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, "Local: "+name);
+ }
+ for (String name : this.getLongRangeMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, "Long: "+name);
+ }
}
else if (this.mMode == 1){
PlayerUtils.messagePlayer(aPlayer, "Local Mode: "+this.mTier*20+"m");
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLocalMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, ""+name);
+ }
}
else {
PlayerUtils.messagePlayer(aPlayer, "Long-range Mode: "+tempRange+"m");
-
+ PlayerUtils.messagePlayer(aPlayer, "Players with access:");
+ for (String name : this.getLongRangeMap().keySet()) {
+ PlayerUtils.messagePlayer(aPlayer, ""+name);
+ }
}
return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
index b8f24d6c5e..7e7ecfa390 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java
@@ -1,16 +1,36 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.*;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.TAE;
+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.interfaces.tileentity.IHasWorldObjectAndCoords;
-import gregtech.api.metatileentity.implementations.*;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
@@ -19,19 +39,23 @@ import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.ItemStackData;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
+public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_AmazonPackager> {
private long mVoltage;
private byte mTier;
private int mCasing;
+
+ private ItemStack mSchematicCache;;
+ private ItemStack mInputCache;
+ private ItemStack mOutputCache;
+ private GT_Recipe mCachedRecipe;
+
private IStructureDefinition<GMTE_AmazonPackager> STRUCTURE_DEFINITION = null;
@Override
@@ -67,24 +91,24 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GMTE_AmazonPackager>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CCC", "CCC"},
- {"C~C", "C-C", "CCC"},
- {"CCC", "CCC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
}))
.addElement(
'C',
ofChain(
ofHatchAdder(
GMTE_AmazonPackager::addAmazonPackagerList, TAE.getIndexFromPage(2, 9), 1
- ),
+ ),
onElementPass(
x -> ++x.mCasing,
ofBlock(
ModBlocks.blockCasings3Misc, 9
+ )
)
)
)
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -116,25 +140,25 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Amazon Warehouse")
- .addInfo("This Multiblock is used for EXTREME packaging requirements")
- .addInfo("Dust Schematics are inserted into the input busses")
- .addInfo("If inserted into the controller, it is shared across all busses")
- .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot")
- .addInfo("Uncomparably fast compared to a single packager of the same tier")
- .addInfo("Only uses 75% of the eu/t normally required")
- .addInfo("Processes five items per voltage tier")
- .addPollutionAmount(getPollutionPerSecond(null))
- .addSeparator()
- .beginStructureBlock(3, 3, 3, true)
- .addController("Front center")
- .addCasingInfo("Supply Depot Casings", 10)
- .addInputBus("Any casing", 1)
- .addOutputBus("Any casing", 1)
- .addEnergyHatch("Any casing", 1)
- .addMaintenanceHatch("Any casing", 1)
- .addMufflerHatch("Any casing", 1)
- .toolTipFinisher("GT++");
+ .addInfo("Controller Block for the Amazon Warehouse")
+ .addInfo("This Multiblock is used for EXTREME packaging requirements")
+ .addInfo("Dust Schematics are inserted into the input busses")
+ .addInfo("If inserted into the controller, it is shared across all busses")
+ .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot")
+ .addInfo("Uncomparably fast compared to a single packager of the same tier")
+ .addInfo("Only uses 75% of the eu/t normally required")
+ .addInfo("Processes 16 items per voltage tier")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Supply Depot Casings", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher("GT++");
return tt;
}
@@ -146,9 +170,9 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 1)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 9)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
}
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 1))};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(2, 9))};
}
@@ -164,20 +188,20 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
}
}
+ private static final FluidStack[] sNoFluids = new FluidStack[] {};
+
@Override
public boolean checkRecipe(ItemStack aStack) {
-
+
//Just the best place to check this~
initFields();
-
+
ArrayList<ItemStack> tItems = getStoredInputs();
if (this.getGUIItemStack() != null) {
tItems.add(this.getGUIItemStack());
}
- ArrayList<FluidStack> tFluids = getStoredFluids();
ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
- FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
- boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000);
+ boolean state = checkRecipeGeneric(tItemInputs, sNoFluids, 16 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000);
if (state) {
@@ -204,7 +228,7 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
}
}
}
-
+
return mCompleted != null && mCompleted.size() > 0;
}
}
@@ -262,6 +286,282 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase {
return false;
}
+ private ItemStack getSchematic(ItemStack[] aInputs) {
+ for (ItemStack aStack : aInputs) {
+ if (ItemList.Schematic_Dust.isStackEqual(aStack) || ItemList.Schematic_1by1.isStackEqual(aStack) || ItemList.Schematic_2by2.isStackEqual(aStack) || ItemList.Schematic_3by3.isStackEqual(aStack)) {
+ return aStack;
+ }
+ }
+ return null;
+ }
+
+ private ItemStack getRecipeInput(ItemStack[] aInputs) {
+ for (ItemStack aStack : aInputs) {
+ if (!ItemList.Schematic_Dust.isStackEqual(aStack) && !ItemList.Schematic_1by1.isStackEqual(aStack) && !ItemList.Schematic_2by2.isStackEqual(aStack) && !ItemList.Schematic_3by3.isStackEqual(aStack)) {
+ return aStack;
+ }
+ }
+ return null;
+ }
+
+ private boolean hasValidCache(ItemStack aStack, ItemStack aSchematic, boolean aClearOnFailure) {
+ if (mSchematicCache != null && mInputCache != null && mOutputCache != null && mCachedRecipe != null) {
+ if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSchematic, mSchematicCache)) {
+ return true;
+ }
+ }
+ // clear cache if it was invalid
+ if (aClearOnFailure) {
+ mSchematicCache = null;
+ mInputCache = null;
+ mOutputCache = null;
+ mCachedRecipe = null;
+ }
+ return false;
+ }
+
+ private void cacheItem(ItemStack aSchematic, ItemStack aInputItem, ItemStack aOutputItem, GT_Recipe aRecipe) {
+ mSchematicCache = aSchematic.copy();
+ mInputCache = aInputItem.copy();
+ mOutputCache = aOutputItem.copy();
+ mCachedRecipe = aRecipe;
+ }
+
+ private GT_Recipe generatePackageRecipe(ItemStack aSchematic, ItemStack aInput) {
+ boolean tIsCached = hasValidCache(aInput, aSchematic, true);
+ if (tIsCached) {
+ ItemStack tOutput = mOutputCache.copy();
+ if (tOutput != null) {
+ if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) && GT_Utility.areStacksEqual(tOutput, mOutputCache)) {
+ int aRequiredInputSize = 0;
+ if (ItemList.Schematic_Dust.isStackEqual(aSchematic)) {
+ if (OrePrefixes.dustTiny.contains(aInput)) {
+ aRequiredInputSize = 9;
+ }
+ if (OrePrefixes.dustSmall.contains(aInput)) {
+ aRequiredInputSize = 4;
+ }
+ if (OrePrefixes.dust.contains(aInput)) {
+ aRequiredInputSize = 1;
+ }
+ }
+ if (ItemList.Schematic_1by1.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 1;
+ }
+ if (ItemList.Schematic_2by2.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 4;
+ }
+ if (ItemList.Schematic_3by3.isStackEqual(aSchematic)) {
+ aRequiredInputSize = 9;
+ }
+ if (aInput.stackSize >= aRequiredInputSize) {
+ log("Using Cached Recipe. Require: "+aRequiredInputSize+", Found: "+aInput.stackSize);
+ return mCachedRecipe;
+ }
+ else {
+ log("Not enough input");
+ }
+ }
+ }
+ }
+ // We can package this
+ GT_Recipe aRecipe = lookupRecipe();
+ log("Looking up new recipe");
+ if (aRecipe != null) {
+ // Cache it
+ aInput = aInput != null ? aInput : getRecipeInput(aRecipe.mInputs);
+ cacheItem(aSchematic, aInput, aRecipe.mOutputs[0], aRecipe);
+ if (hasValidCache(aInput, aSchematic, false)) {
+ log("Caching Recipe");
+ return aRecipe;
+ }
+ }
+ return null;
+ }
+
+ private GT_Recipe lookupRecipe() {
+ ArrayList<ItemStack> aItems = getStoredInputs();
+ if (this.getGUIItemStack() != null) {
+ aItems.add(this.getGUIItemStack());
+ }
+ ItemStack[] aItemInputs = aItems.toArray(new ItemStack[aItems.size()]);
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false, false,
+ gregtech.api.enums.GT_Values.V[mTier], sNoFluids, aItemInputs);
+
+ if (tRecipe != null) {
+ return tRecipe;
+ }
+ return null;
+ }
+
+
+
+
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ ItemStack aInput = getRecipeInput(aItemInputs);
+ ItemStack aSchematic = getSchematic(aItemInputs);
+ GT_Recipe tRecipe = generatePackageRecipe(aSchematic, aInput);
+
+ ItemStack[] aRealInputs = new ItemStack[] {aSchematic, aInput};
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, sNoFluids, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ mCachedRecipe = null;
+ log("BAD RETURN - 3 - Reset Cached Recipe");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ if (isPerpectOC) this.mMaxProgresstime /= 4;
+ else this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
public boolean allowPutStack(final ItemStack aStack, ItemStack schematicStack) {
//If Schematic Static is not 1x1, 2x2, 3x3
if (!ItemList.Schematic_1by1.isStackEqual((Object) schematicStack) && !ItemList.Schematic_2by2.isStackEqual((Object) schematicStack) && !ItemList.Schematic_3by3.isStackEqual((Object) schematicStack)) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
index 7ddf16b36f..b5c07ecd95 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java
@@ -1,18 +1,13 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc;
-import static gregtech.api.enums.GT_Values.*;
+import static gregtech.api.enums.GT_Values.W;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
@@ -23,21 +18,28 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.entity.EntityTeslaTowerLightning;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase<GregtechMTE_TeslaTower> {
private Block casingBlock;
private int casingMeta;
@@ -49,12 +51,12 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
private int xLoc, yLoc, zLoc;
protected int mRange;
- */
-/**
+
+ /**
* Machine Mode,
* {@value false} Attacks all entities,
* {@value true} Only attacks players.
- *//*
+ */
protected volatile boolean mMode = false;
@@ -88,7 +90,7 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
return null;
}
- @Override
+ /*@Override
public String[] getTooltip() {
String casings = getCasingBlockItem().get(0).getDisplayName();
return new String[]{
@@ -102,13 +104,33 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
"1x3x1 " + MaterialUtils.getMaterialName(getFrameMaterial()) + " Frame Boxes (Each pillar side and on top)",
"1x Maintenance Hatch (One of base casings)",
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"};
+ }*/
+
+ @Override
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Tesla Defence Tower Mk3200")
+ .addInfo("Enemies within "+this.mRange+"m are blasted with a high energy plasma.")
+ .addInfo("This uses 5,000,000EU per blast.")
+ .addInfo("Can screwdriver to toggle mode between Players and all Entities.")
+ .addSeparator()
+ .beginStructureBlock(1, 7, 1, false)
+ .addController("Top Middle")
+ .addCasingInfo("Casing", 360)
+ .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1)
+ .addInputBus("Any 4 dot hint (min 1)", 4)
+ .addInputHatch("Any 4 dot hint(min 1)", 4)
+ .addOutputHatch("Any 4 dot hint(min 1)", 4)
+ .addEnergyHatch("Any 4 dot hint(min 1)", 4)
+ .addMaintenanceHatch("Any 4 dot hint(min 1)", 4)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
}
private final void initFields() {
casingBlock = ModBlocks.blockCasings2Misc;
casingMeta = getCasingBlockItem().get(0).getItemDamage();
- int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
- frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
casingTextureIndex = getCasingTextureIndex();
mRange = 50;
}
@@ -144,26 +166,24 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
@Override
public boolean checkRecipe(ItemStack aStack) {
- */
-/*if (!isEnergyEnough()) {
+
+ if (!isEnergyEnough()) {
this.mProgresstime = 0;
this.mMaxProgresstime = 20;
this.getBaseMetaTileEntity().setActive(false);
stopMachine();
}
- else {*//*
-*/
-/*
+ else {
this.mProgresstime = 1;
this.mMaxProgresstime = 100;
- this.getBaseMetaTileEntity().setActive(true);*//*
+ this.getBaseMetaTileEntity().setActive(true);
- //}
+ }
return false;
}
@Override
- public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
updateCoordinates();
//check base layer
for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
@@ -414,16 +434,6 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase {
return GregtechItemList.Casing_TeslaTower;
}
- protected Materials getFrameMaterial() {
- */
-/*casingBlock = getCasingBlockItem().getBlock();
- casingMeta = getCasingBlockItem().get(0).getItemDamage();
- int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
- frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
- *//*
-return Materials.get("TungstenCarbide");
- }
-
protected int getCasingTextureIndex() {
return TAE.GTPP_INDEX(30);
}
@@ -474,6 +484,17 @@ return Materials.get("TungstenCarbide");
return 0;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
index df01d01679..36139bcdec 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java
@@ -34,7 +34,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialAlloySmelter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialAlloySmelter> {
public static int CASING_TEXTURE_ID;
private HeatingCoilLevel mHeatingCapacity;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
index eae867d11d..5fa68d5129 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java
@@ -50,12 +50,10 @@ public class GregtechMetaTileEntity_IndustrialArcFurnace extends GregtechMeta_Mu
public GregtechMetaTileEntity_IndustrialArcFurnace(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
}
public GregtechMetaTileEntity_IndustrialArcFurnace(final String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
}
@Override
@@ -70,9 +68,6 @@ public class GregtechMetaTileEntity_IndustrialArcFurnace extends GregtechMeta_Mu
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 3);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for Industrial Arc Furnace")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
index 8802a7148b..12c4dbd5d5 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java
@@ -28,8 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCentrifuge
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCentrifuge> {
private boolean mIsAnimated;
private static ITexture frontFace;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
index 63dd3d62dc..982b054d34 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -24,8 +24,8 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCokeOven
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCokeOven extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCokeOven> {
+
private int mLevel = 0;
private int mCasing;
private int mCasing1;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
index bf5f8aaeaf..7532f67bf8 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java
@@ -27,8 +27,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialCuttingMachine
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialCuttingMachine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialCuttingMachine> {
private boolean mCuttingMode = true;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
index 44552ea2f7..4147f58e36 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
@@ -39,7 +39,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialDehydrator> {
private static int CASING_TEXTURE_ID;
private static String mCasingName = "Vacuum Casing";
@@ -51,13 +51,11 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
public GregtechMetaTileEntity_IndustrialDehydrator(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
}
public GregtechMetaTileEntity_IndustrialDehydrator(String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(3, 10);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -66,9 +64,6 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 10);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Vacuum Furnace")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
index f6613980ca..d233c00cc7 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java
@@ -22,8 +22,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialElectrolyzer
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialElectrolyzer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialElectrolyzer> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialElectrolyzer> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
index a5c7f62578..a9105a27cc 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java
@@ -27,8 +27,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialExtruder
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialExtruder extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialExtruder> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialExtruder> STRUCTURE_DEFINITION = null;
@@ -82,7 +81,7 @@ extends GregtechMeta_MultiBlockBase {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialExtruder>builder()
.addShape(mName, transpose(new String[][]{
{"CCC", "CCC", "CCC", "CCC", "CCC"},
- {"C~C", "C-C", "C-C", "C-C", "CMC"},
+ {"C~C", "C-C", "C-C", "C-C", "CCC"},
{"CCC", "CCC", "CCC", "CCC", "CCC"},
}))
.addElement(
@@ -99,12 +98,6 @@ extends GregtechMeta_MultiBlockBase {
)
)
)
- .addElement(
- 'M',
- ofHatchAdder(
- GregtechMetaTileEntity_IndustrialExtruder::addIndustrialExtruderMufflerList, getCasingTextureIndex(), 2
- )
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -141,19 +134,6 @@ extends GregtechMeta_MultiBlockBase {
return false;
}
- public final boolean addIndustrialExtruderMufflerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- } else {
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity);
- }
- }
- return false;
- }
-
@Override
public String getSound() {
return GregTech_API.sSoundList.get(Integer.valueOf(203));
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
new file mode 100644
index 0000000000..2b0345af78
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
@@ -0,0 +1,319 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.*;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.TAE;
+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.*;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialForgeHammer> {
+
+ private int mCasing;
+ private int mAnvil;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> STRUCTURE_DEFINITION = null;
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialForgeHammer(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ setAnvilBlocks();
+ return new GregtechMetaTileEntity_IndustrialForgeHammer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Forge Hammer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Industrial Forge Hammer")
+ .addInfo("Speed: 100% x Anvil Tier | Eu Usage: 100% | Parallel: Tier x 8")
+ .addInfo("T1 - Vanilla Anvil");
+ if (LoadedMods.Railcraft) {
+ tt.addInfo("T2 - Steel Anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ tt.addInfo("T3 - Dark Steel Anvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ tt.addInfo("T3 - Thaumic Anvil");
+ tt.addInfo("T4 - Void Anvil");
+ }
+ tt.addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front Center")
+ .addCasingInfo("Forge Casing", 10)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ Map<Block, Integer> aBlockMap = new HashMap<Block, Integer>();
+ aBlockMap.put(sAnvil, 0);
+ if (LoadedMods.Railcraft) {
+ aBlockMap.put(sSteelAnvil, 0);
+ }
+ if (LoadedMods.EnderIO) {
+ aBlockMap.put(sDarkSteelAnvil, 0);
+ }
+ if (LoadedMods.ThaumicBases) {
+ aBlockMap.put(sThaumiumAnvil, 0);
+ aBlockMap.put(sVoidAnvil, 0);
+ }
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialForgeHammer>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "CAC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement('C', ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1 ),
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 6)
+ )
+ )
+ )
+ .addElement('A', onElementPass(x -> ++x.mAnvil, ofBlocksFlat(aBlockMap, sAnvil, 0)))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ setAnvilBlocks();
+ buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ setAnvilBlocks();
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public final boolean addIndustrialForgeHammerList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(1);
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(1, 11)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(1, 11))};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "MaterialPress";
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sHammerRecipes;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ Block aAnvil = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getBackFacing());
+ if (aAnvil != null) {
+ int aAnvilTier = getAnvilTier(aAnvil);
+ if (aAnvilTier > 0) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), new FluidStack[]{}, getMaxParallelRecipes() * aAnvilTier, 100, 100, 10000)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialForgeHammer;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 1;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ private static Block sAnvil;
+ private static Block sSteelAnvil;
+ private static Block sDarkSteelAnvil;
+ private static Block sThaumiumAnvil;
+ private static Block sVoidAnvil;
+
+ private static void setAnvilBlocks() {
+ if (sAnvil == null) {
+ sAnvil = Blocks.anvil;
+ if (LoadedMods.Railcraft) {
+ sSteelAnvil = GameRegistry.findBlock("Railcraft", "anvil");
+ }
+ if (LoadedMods.EnderIO) {
+ sDarkSteelAnvil = GameRegistry.findBlock("EnderIO", "blockDarkSteelAnvil");
+ }
+ if (LoadedMods.ThaumicBases) {
+ sThaumiumAnvil = GameRegistry.findBlock("thaumicbases", "thaumicAnvil");
+ sVoidAnvil = GameRegistry.findBlock("thaumicbases", "voidAnvil");
+ }
+ }
+ }
+
+ public static boolean isBlockAnvil(Block aBlock) {
+ setAnvilBlocks();
+ if (sAnvil == aBlock) {
+ return true;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return true;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock || sVoidAnvil == aBlock) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static int getAnvilTier(Block aBlock) {
+ if (isBlockAnvil(aBlock)) {
+ if (sAnvil == aBlock) {
+ return 1;
+ }
+ if (LoadedMods.Railcraft) {
+ if (sSteelAnvil == aBlock) {
+ return 2;
+ }
+ }
+ if (LoadedMods.EnderIO) {
+ if (sDarkSteelAnvil == aBlock) {
+ return 3;
+ }
+ }
+ if (LoadedMods.ThaumicBases) {
+ if (sThaumiumAnvil == aBlock) {
+ return 3;
+ }
+ if (sVoidAnvil == aBlock) {
+ return 4;
+ }
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ setAnvilBlocks();
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
index b6e072b653..743714319d 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java
@@ -25,8 +25,8 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialMacerator
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMacerator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMacerator> {
+
private int mCasing;
private int mPerLayer;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialMacerator> STRUCTURE_DEFINITION = null;
@@ -145,13 +145,16 @@ extends GregtechMeta_MultiBlockBase {
public final boolean addIndustrialMaceratorBottomList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
@@ -161,11 +164,19 @@ extends GregtechMeta_MultiBlockBase {
public final boolean addIndustrialMaceratorMidList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
index 5e405d426d..0aceed47be 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java
@@ -27,12 +27,11 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialMixer
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMixer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMixer> {
public static int CASING_TEXTURE_ID;
- public static String mCasingName = "Advanced Blast Furnace Casing";
- public static String mCasingName2 = "Advanced Blast Furnace Casing";
+ public static String mCasingName = "Multi-Use Casing";
+ public static String mCasingName2 = "Titanium Turbine Casing";
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialMixer> STRUCTURE_DEFINITION = null;
@@ -40,15 +39,11 @@ extends GregtechMeta_MultiBlockBase {
public GregtechMetaTileEntity_IndustrialMixer(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
}
public GregtechMetaTileEntity_IndustrialMixer(final String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 2);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
}
@Override
@@ -63,14 +58,6 @@ extends GregtechMeta_MultiBlockBase {
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 2);
- }
- if (mCasingName2.toLowerCase().contains(".name")) {
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockCasings4, 11);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Industrial Mixer")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
new file mode 100644
index 0000000000..df1cc14658
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java
@@ -0,0 +1,269 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
+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_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaTileEntity_IndustrialMolecularTransformer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMolecularTransformer> {
+
+ private static final int CASING_TEXTURE_ID = 48;
+ private int mCasing = 0;
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialMolecularTransformer(final String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialMolecularTransformer(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Molecular Transformer";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Changes the structure of items to produce new ones")
+ .addInfo("Speed: 100% | Eu Usage: 100%")
+ .addInfo("This multiblock cannot be overclocked")
+ .addInfo("Maximum 1x of each bus/hatch.")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(7, 7, 7, false)
+ .addController("Top Center")
+ .addCasingInfo("Robust Tungstensteel Machine Casing", 40)
+ .addCasingInfo("Tungstensteel Coils", 16)
+ .addCasingInfo("Molecular Containment Casing", 52)
+ .addCasingInfo("High Voltage Current Capacitor", 32)
+ .addCasingInfo("Particle Containment Casing", 4)
+ .addCasingInfo("Resonance Chamber I", 5)
+ .addCasingInfo("Modulator I", 4)
+ .addInputBus("Any Robust Tungstensteel Machine Casing", 1)
+ .addOutputBus("Any Robust Tungstensteel Machine Casing", 1)
+ .addEnergyHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .addMaintenanceHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .addMufflerHatch("Any Robust Tungstensteel Machine Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> STRUCTURE_DEFINITION = null;
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialMolecularTransformer> getStructureDefinition() {
+ STRUCTURE_DEFINITION = null;
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialMolecularTransformer>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {" ", " ", " xxx ", " x~x ", " xxx ", " ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" ", " xxx ", " xyyyx ", " xyzyx ", " xyyyx ", " xxx ", " "},
+ {" t ", " ttxtt ", " tyyyt ", "txyzyxt", " tyyyt ", " ttxtt ", " t "},
+ {" c ", " ccecc ", " cxfxc ", "cefefec", " cxfxc ", " ccecc ", " c "},
+ {" h ", " hhhhh ", " hhhhh ", "hhhhhhh", " hhhhh ", " hhhhh ", " h "},
+ }))
+
+ .addElement('x', ofBlock(getCasingBlock(), getCasingMeta()))
+ .addElement('y', ofBlock(getCasingBlock(), getCasingMeta2()))
+ .addElement('z', ofBlock(getCasingBlock(), getCasingMeta3()))
+ .addElement('e', ofBlock(getCasingBlock2(), 0))
+ .addElement('f', ofBlock(getCasingBlock2(), 4))
+ .addElement('c', ofBlock(getCoilBlock(), 3))
+ .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_IndustrialMolecularTransformer::addGenericHatch, getCasingTextureIndex(), 1),
+ onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock3(), getTungstenCasingMeta()))
+ )))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 3, 3, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0);
+ if (this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 1 || this.mEnergyHatches.size() != 1) {
+ return false;
+ }
+ return aDidBuild && mCasing >= 40 && checkHatch();
+ }
+
+ protected static int getCasingTextureIndex() {
+ return CASING_TEXTURE_ID;
+ }
+
+ protected static Block getCasingBlock() {
+ return ModBlocks.blockSpecialMultiCasings;
+ }
+
+ protected static Block getCasingBlock2() {
+ return ModBlocks.blockSpecialMultiCasings2;
+ }
+
+ protected static Block getCasingBlock3() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ protected static Block getCoilBlock() {
+ return GregTech_API.sBlockCasings5;
+ }
+
+ protected static int getCasingMeta() {
+ return 11;
+ }
+
+ protected static int getCasingMeta2() {
+ return 12;
+ }
+
+ protected static int getCasingMeta3() {
+ return 13;
+ }
+
+ protected static int getTungstenCasingMeta() {
+ return 0;
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ log("Bad Hatch");
+ return false;
+ }
+
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(44)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "VacuumFreezer";
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sMolecularTransformerRecipes;
+ }
+
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(1, 100, 100);
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 100;
+ }
+
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer;
+ }
+
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
index 76fc51b413..8f5d3bf5e4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java
@@ -35,8 +35,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialMultiMachine
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialMultiMachine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialMultiMachine> {
protected int mInternalMode = 0;
protected GT_Recipe[] mLastRecipeExtended = new GT_Recipe[9];
@@ -56,7 +55,7 @@ extends GregtechMeta_MultiBlockBase {
static {
for (int id = 0; id < 9; id++) {
- String aNEI = GT_LanguageManager.getTranslation(getRecipeMap(id).mUnlocalizedName);
+ String aNEI = getRecipeMap(id).mNEIName;
aToolTipNames[id] = aNEI != null ? aNEI : "BAD NEI NAME (Report to Github)";
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
index 007d1a0d0f..069e00f55c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -29,7 +29,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialPlatePress> {
private boolean mFormingMode = false;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
index c5450fec5b..b3219f661b 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java
@@ -1,9 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.Random;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -11,9 +15,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
+import gregtech.api.util.*;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -21,12 +23,8 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GregtechMetaTileEntity_IndustrialSifter
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialSifter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialSifter> {
+
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialSifter> STRUCTURE_DEFINITION = null;
@@ -63,7 +61,7 @@ extends GregtechMeta_MultiBlockBase {
.addCasingInfo("Sieve Grate", 18)
.addCasingInfo("Sieve Casings", 35)
.addInputBus("Any Casing", 1)
- .addOutputBus("Any Casing", 1)
+ .addOutputBus("Any Casing (x4)", 1)
.addEnergyHatch("Any Casing", 1)
.addMaintenanceHatch("Any Casing", 1)
.addMufflerHatch("Any Casing", 1)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
index 01b887694a..a473196c43 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java
@@ -24,8 +24,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialThermalCentrifuge
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialThermalCentrifuge extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialThermalCentrifuge> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialThermalCentrifuge> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
index 1f63995651..e59b6d3207 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java
@@ -28,7 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialVacuumFreezer> {
public static int CASING_TEXTURE_ID;
public static String mCryoFuelName = "Gelid Cryotheum";
@@ -44,18 +44,12 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta
super(aID, aName, aNameRegional);
mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
- mCryoFuelName = mFuelStack.getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
public GregtechMetaTileEntity_IndustrialVacuumFreezer(final String aName) {
super(aName);
mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 10);
- mCryoFuelName = mFuelStack.getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
@@ -69,17 +63,6 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends GregtechMeta
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 10);
- }
- if (mCryoFuelName.toLowerCase().contains(".")) {
- mCryoFuelName = FluidUtils.getFluidStack("cryotheum", 1).getLocalizedName();
- }
- if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Advanced Vacuum Freezer")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
index 168d4ff6d6..616459dd1f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -1,15 +1,28 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.enums.TAE;
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.*;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -31,14 +44,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
-public class GregtechMetaTileEntity_IndustrialWashPlant
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialWashPlant extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWashPlant> {
- private boolean mChemicalMode = false;
+ private int mMode = 0;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialWashPlant> STRUCTURE_DEFINITION = null;
@@ -57,15 +65,15 @@ extends GregtechMeta_MultiBlockBase {
@Override
public String getMachineType() {
- return "Ore Washer, Chemical Bath";
+ return "Ore Washer, Simple Washer, Chemical Bath";
}
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Industrial Ore Washing Plant")
- .addInfo("Can be configured with a screwdriver to also process Chemical Bathing")
+ .addInfo("Controller Block for the Industrial Wash Plant")
+ .addInfo("Can be configured with a screwdriver to also do Simple Washer and process Chemical Bathing")
.addInfo("400% faster than using single block machines of the same voltage")
.addInfo("Processes four item per voltage tier")
.addInfo("Always requires an Input Hatch full of water to refill structure")
@@ -171,7 +179,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return mChemicalMode ? GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes : GT_Recipe.GT_Recipe_Map.sOreWasherRecipes;
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sOreWasherRecipes : mMode == 1 ? GTPP_Recipe_Map.sSimpleWasherRecipes : GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes;
}
@Override
@@ -199,7 +207,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public int getPollutionPerSecond(final ItemStack aStack) {
- if (this.mChemicalMode) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath;
+ if (mMode == 2) return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath;
return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialWashPlant_ModeWasher;
}
@@ -311,24 +319,42 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
- aNBT.setBoolean("mChemicalMode", mChemicalMode);
+ aNBT.setInteger("mMode", mMode);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
- mChemicalMode = aNBT.getBoolean("mChemicalMode");
+ if (aNBT.hasKey("mChemicalMode")) {
+ boolean aTempMode = aNBT.getBoolean("mChemicalMode");
+ if (aTempMode) {
+ mMode = 2;
+ }
+ else {
+ mMode = 0;
+ }
+ aNBT.removeTag("mChemicalMode");
+ }
+ if (aNBT.hasKey("mMode")) {
+ mMode = aNBT.getInteger("mMode");
+ }
super.loadNBTData(aNBT);
}
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- mChemicalMode = Utils.invertBoolean(mChemicalMode);
- if (mChemicalMode){
- PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode.");
+ mMode++;
+ if (mMode > 2) {
+ mMode = 0;
}
- else {
+ if (mMode == 0){
PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Ore Washer Mode.");
+ }
+ else if (mMode == 1){
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Simple Washer Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Wash Plant is now running in Chemical Bath Mode.");
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
index ccce25d925..9ea113ec01 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java
@@ -24,8 +24,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_IndustrialWireMill
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialWireMill extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialWireMill> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_IndustrialWireMill> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
index ecd6616855..e86f98ef66 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
@@ -50,7 +50,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IsaMill> {
protected boolean boostEu = false;
private int mCasing;
@@ -486,7 +486,7 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
// Based on the Processing Array. A bit overkill, but very flexible.
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
index 8c9e886e94..43f4b337c6 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
@@ -1,7 +1,9 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
@@ -14,12 +16,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.LangUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -29,12 +32,11 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_Adv_AssemblyLine
- extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_AssemblyLine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_AssemblyLine> {
- public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
-
- public static String[] mCasingName = new String[5];
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ public static String[] mCasingName = new String[5];
private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
private final int META_BaseCasing = 0; //4
private final int META_ContainmentCasing = 15; //3
@@ -42,46 +44,54 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
private final int META_PipeCasing = 1; //4
private final int META_IntegralCasing = 6; //0
private final int META_ContainmentChamberCasing = 2; //4
-
-
- public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
+
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
- }
+ }
- public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
- super(aName);
- }
+ public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
+ super(aName);
+ }
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
- }
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
+ }
+
+ /* public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ return new String[]{
+ "Advanced Integrated Assembly Line"
+ };
+ }*/
+
+ @Override
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
- public String[] getTooltip() {
- if (mCasingName[0].toLowerCase().contains(".name")) {
- mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
- }
- if (mCasingName[1].toLowerCase().contains(".name")) {
- mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
- }
- if (mCasingName[2].toLowerCase().contains(".name")) {
- mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
- }
- if (mCasingName[3].toLowerCase().contains(".name")) {
- mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
- }
- if (mCasingName[4].toLowerCase().contains(".name")) {
- mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
- }
- return new String[]{
- "Advanced Integrated Assembly Line"
- };
- }
-
private Block getCasing(int casingID) {
if (casingID == 1) {
return ModBlocks.blockCasingsMisc;
@@ -100,155 +110,151 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
}
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
- }
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)};
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return null;
- }
-
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- public boolean checkRecipe(ItemStack aStack) {
- if(GT_Values.D1)System.out.println("Start ALine recipe check");
- ArrayList<ItemStack> tDataStickList = getDataItems(2);
- if (tDataStickList.size() == 0) return false;
- if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
-
- ItemStack tStack[] = new ItemStack[15];
- FluidStack[] tFluids = new FluidStack[4];
- boolean findRecipe = false;
- nextDS:for (ItemStack tDataStick : tDataStickList){
- NBTTagCompound tTag = tDataStick.getTagCompound();
- if (tTag == null) continue;
- for (int i = 0; i < 15; i++) {
- int count = tTag.getInteger("a"+i);
- if (!tTag.hasKey("" + i) && count <= 0) continue;
- if (mInputBusses.get(i) == null) {
- continue nextDS;
- }
-
- ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
- boolean flag = true;
- if (count > 0) {
- for (int j = 0; j < count; j++) {
- tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
- if (tStack[i] == null) continue;
- if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
- if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
- flag = false;
- break;
- }
- }
- }
- if (flag) {
- tStack[i] = GT_Utility.loadItem(tTag, "" + i);
- if (tStack[i] == null) {
- flag = false;
- continue;
- }
- if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
- if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
- flag = false;
- }
- }
- if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
- if (flag) continue nextDS;
- }
-
- if(GT_Values.D1)System.out.println("All Items done, start fluid check");
- for (int i = 0; i < 4; i++) {
- if (!tTag.hasKey("f" + i)) continue;
- tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
- if (tFluids[i] == null) continue;
- if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
- if (mInputHatches.get(i) == null) {
- continue nextDS;
- }
- FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
- if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
- if(GT_Values.D1)System.out.println(i+" not accepted");
- continue nextDS;
- }
- if(GT_Values.D1)System.out.println(i+" accepted");
- }
-
- if(GT_Values.D1)System.out.println("Input accepted, check other values");
- if (!tTag.hasKey("output")) continue;
- mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
- if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
- continue;
-
- if (!tTag.hasKey("time")) continue;
- mMaxProgresstime = tTag.getInteger("time");
- if (mMaxProgresstime <= 0) continue;
-
- if (!tTag.hasKey("eu")) continue;
- mEUt = tTag.getInteger("eu");
-
- if(GT_Values.D1)System.out.println("Find avaiable recipe");
- findRecipe = true;
- break;
- }
- if (!findRecipe) return false;
-
- if(GT_Values.D1)System.out.println("All checked start consuming inputs");
- for (int i = 0; i < 15; i++) {
- if (tStack[i] == null) continue;
- ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
- stackInSlot.stackSize -= tStack[i].stackSize;
- }
-
- for (int i = 0; i < 4; i++) {
- if (tFluids[i] == null) continue;
- mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
- if (mInputHatches.get(i).mFluid.amount <= 0) {
- mInputHatches.get(i).mFluid = null;
- }
- }
- if(GT_Values.D1)System.out.println("Check overclock");
-
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- if (mEUt <= 16) {
- this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
- } else {
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
- }
- if (this.mEUt > 0) {
- this.mEUt = -this.mEUt;
- }
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
- updateSlots();
- if(GT_Values.D1)System.out.println("Recipe sucessfull");
- return true;
- }
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 20) {
- GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
- }
- }
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ if(GT_Values.D1)System.out.println("Start ALine recipe check");
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.size() == 0) return false;
+ if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+
+ ItemStack tStack[] = new ItemStack[15];
+ FluidStack[] tFluids = new FluidStack[4];
+ boolean findRecipe = false;
+ nextDS:for (ItemStack tDataStick : tDataStickList){
+ NBTTagCompound tTag = tDataStick.getTagCompound();
+ if (tTag == null) continue;
+ for (int i = 0; i < 15; i++) {
+ int count = tTag.getInteger("a"+i);
+ if (!tTag.hasKey("" + i) && count <= 0) continue;
+ if (mInputBusses.get(i) == null) {
+ continue nextDS;
+ }
+
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ boolean flag = true;
+ if (count > 0) {
+ for (int j = 0; j < count; j++) {
+ tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
+ if (tStack[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ break;
+ }
+ }
+ }
+ if (flag) {
+ tStack[i] = GT_Utility.loadItem(tTag, "" + i);
+ if (tStack[i] == null) {
+ flag = false;
+ continue;
+ }
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ }
+ }
+ if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
+ if (flag) continue nextDS;
+ }
+
+ if(GT_Values.D1)System.out.println("All Items done, start fluid check");
+ for (int i = 0; i < 4; i++) {
+ if (!tTag.hasKey("f" + i)) continue;
+ tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
+ if (tFluids[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
+ if (mInputHatches.get(i) == null) {
+ continue nextDS;
+ }
+ FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if(GT_Values.D1)System.out.println(i+" not accepted");
+ continue nextDS;
+ }
+ if(GT_Values.D1)System.out.println(i+" accepted");
+ }
+
+ if(GT_Values.D1)System.out.println("Input accepted, check other values");
+ if (!tTag.hasKey("output")) continue;
+ mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
+ if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
+ continue;
+
+ if (!tTag.hasKey("time")) continue;
+ mMaxProgresstime = tTag.getInteger("time");
+ if (mMaxProgresstime <= 0) continue;
+
+ if (!tTag.hasKey("eu")) continue;
+ mEUt = tTag.getInteger("eu");
+
+ if(GT_Values.D1)System.out.println("Find avaiable recipe");
+ findRecipe = true;
+ break;
+ }
+ if (!findRecipe) return false;
+
+ if(GT_Values.D1)System.out.println("All checked start consuming inputs");
+ for (int i = 0; i < 15; i++) {
+ if (tStack[i] == null) continue;
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ stackInSlot.stackSize -= tStack[i].stackSize;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (tFluids[i] == null) continue;
+ mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
+ if (mInputHatches.get(i).mFluid.amount <= 0) {
+ mInputHatches.get(i).mFluid = null;
+ }
+ }
+ if(GT_Values.D1)System.out.println("Check overclock");
+
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ if (mEUt <= 16) {
+ this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = -this.mEUt;
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ updateSlots();
+ if(GT_Values.D1)System.out.println("Recipe sucessfull");
+ return true;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
+ }
+ }
public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
@@ -314,7 +320,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
if (aOwnerName != null && aOwnerName.length() > 0) {
aOwner = PlayerUtils.getPlayer(aOwnerName);
}
-
+
if (aShieldingCount != 128) {
log("Not enough "+mCasingName[4]+"s, require 128.");
if (aOwner != null) {
@@ -365,18 +371,18 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
- }
- return false;
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
}
public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
@@ -394,7 +400,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
if (aY == 0 && x == 0 && z == 0) {
continue;
}
-
+
Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
@@ -485,7 +491,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
+
public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
int aCasingCount = 0;
for (int x = -1; x < 2; x++) {
@@ -511,7 +517,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
+
public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
int aCasingCount = 0;
for (int x = -2; x < 3; x++) {
@@ -539,67 +545,65 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
}
return aCasingCount;
}
-
- */
-/**
- * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
- *//*
-
- private boolean isCorrectDataItem(ItemStack aStack, int state){
- if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
- if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
- if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
- return false;
- }
-
- */
-/**
- * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
- *//*
-
- public ArrayList<ItemStack> getDataItems(int state) {
- ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
- rList.add(mInventory[1]);
- }
- for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
- if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
- && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
- rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
- }
- }
- }
- return rList;
- }
-
- public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- if (aTileEntity == null) return false;
- IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) return false;
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
- return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
- }
- return false;
- }
-
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
@Override
public boolean hasSlotInGUI() {
@@ -625,5 +629,35 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine
public int getEuDiscountForParallelism() {
return 0;
}
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ log("Fixing Bad Facing. (GT Bug)");
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IStructureDefinition getStructureDefinition() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean checkMachine(
+ IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack
+ ) {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
-*/
+
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
index 1ebe328e6d..055c591047 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -34,7 +34,7 @@ import net.minecraftforge.fluids.FluidStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional;
-public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_DistillationTower> {
private byte mMode = 0;
private boolean mUpgraded = false;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
index ce54aef282..e00bbbf730 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java
@@ -40,7 +40,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_EBF> {
public static int CASING_TEXTURE_ID;
public static String mHotFuelName = "Blazing Pyrotheum";
@@ -56,17 +56,11 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
public GregtechMetaTileEntity_Adv_EBF(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
}
public GregtechMetaTileEntity_Adv_EBF(String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11);
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
}
@Override
@@ -80,34 +74,25 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11);
- }
- if (mHotFuelName.toLowerCase().contains(".")) {
- mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName();
- }
- if (mHatchName.toLowerCase().contains(".name")) {
- mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Factory Grade Advanced Blast Furnace")
- .addInfo("Speed: 120% | Eu Usage: 90% | Parallel: 8")
- .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation")
- .addInfo("Constructed exactly the same as a normal EBF")
- .addPollutionAmount(getPollutionPerSecond(null))
- .addSeparator()
- .addController("Bottom center")
- .addCasingInfo(mCasingName, 9)
- .addInputHatch("Any Casing", 1)
- .addInputBus("Any Casing", 1)
- .addOutputBus("Any Casing", 1)
- .addOutputHatch("Any Casing", 1)
- .addStructureHint(mHatchName, 1)
- .addEnergyHatch("Any Casing", 1)
- .addMufflerHatch("Any Casing", 1)
- .addMaintenanceHatch("Any Casing", 1)
- .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ .addInfo("Factory Grade Advanced Blast Furnace")
+ .addInfo("Speed: 120% | Eu Usage: 90% | Parallel: 8")
+ .addInfo("Consumes 10L of " + mHotFuelName + " per second during operation")
+ .addInfo("Constructed exactly the same as a normal EBF")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .addController("Bottom center")
+ .addCasingInfo(mCasingName, 9)
+ .addInputHatch("Any Casing", 1)
+ .addInputBus("Any Casing", 1)
+ .addOutputBus("Any Casing", 1)
+ .addOutputHatch("Any Casing", 1)
+ .addStructureHint(mHatchName, 1)
+ .addEnergyHatch("Any Casing", 1)
+ .addMufflerHatch("Any Casing", 1)
+ .addMaintenanceHatch("Any Casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
return tt;
}
@@ -116,31 +101,31 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_Adv_EBF>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CCC", "CCC"},
- {"HHH", "H-H", "HHH"},
- {"HHH", "H-H", "HHH"},
- {"C~C", "CCC", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ {"HHH", "H-H", "HHH"},
+ {"HHH", "H-H", "HHH"},
+ {"C~C", "CCC", "CCC"},
}))
.addElement(
'C',
ofChain(
ofHatchAdder(
GregtechMetaTileEntity_Adv_EBF::addAdvEBFList, CASING_TEXTURE_ID, 1
- ),
+ ),
onElementPass(
x -> ++x.mCasing,
ofBlock(
ModBlocks.blockCasings3Misc, 11
+ )
)
)
)
- )
.addElement(
'H',
ofCoil(
GregtechMetaTileEntity_Adv_EBF::setCoilLevel, GregtechMetaTileEntity_Adv_EBF::getCoilLevel
+ )
)
- )
.build();
}
return STRUCTURE_DEFINITION;
@@ -298,7 +283,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
int tHeatCapacityDivTiers = (int) (mHeatingCapacity.getHeat() - tRecipe.mSpecialValue) / 900;
if (tHeatCapacityDivTiers > 0)
- tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
+ tRecipeEUt = (int) (tRecipeEUt * (Math.pow(0.95, tHeatCapacityDivTiers)));
float tTotalEUt = 0.0f;
int parallelRecipes = 0;
@@ -443,7 +428,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase
}
}
}
-
+
}
@Override
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
index 56206f8178..e5f42ffdca 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java
@@ -98,6 +98,11 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus
}
@Override
+ public int overclock(int mStartEnergy) {
+ return (mStartEnergy < 160000000) ? 16 : ((mStartEnergy < 320000000) ? 8 : (mStartEnergy < 640000000) ? 4 : 1);
+ }
+
+ @Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
ITexture[] sTexture;
@@ -150,4 +155,24 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus
}
return true;
}
+
+ @Override
+ public String[] getInfoData() {
+ String tier = "IV";
+ float plasmaOut = 0;
+ int powerRequired = 0;
+ if (this.mLastRecipe != null) {
+ powerRequired = this.mLastRecipe.mEUt;
+ if (this.mLastRecipe.getFluidOutput(0) != null) {
+ plasmaOut = (float)this.mLastRecipe.getFluidOutput(0).amount / (float)this.mLastRecipe.mDuration;
+ }
+ }
+
+ return new String[]{
+ "Fusion Reactor MK "+tier,
+ "EU Required: "+powerRequired+"EU/t",
+ "Stored EU: "+mEUStore+" / "+maxEUStore(),
+ "Plasma Output: "+plasmaOut+"L/t"};
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
index aff614184a..e2dfd8d3c3 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java
@@ -1,43 +1,36 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.GregTech_API.sBlockCasings4;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
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.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
+import gregtech.api.util.*;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.item.ItemStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.GregTech_API.sBlockCasings4;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+public class GregtechMetaTileEntity_Adv_Implosion extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_Implosion> {
-public class GregtechMetaTileEntity_Adv_Implosion
-extends GregtechMeta_MultiBlockBase {
-
- private String mCasingName;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Adv_Implosion> STRUCTURE_DEFINITION = null;
public GregtechMetaTileEntity_Adv_Implosion(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
}
public GregtechMetaTileEntity_Adv_Implosion(String aName) {
super(aName);
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -51,9 +44,6 @@ extends GregtechMeta_MultiBlockBase {
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.contains("gt.blockcasings")) {
- mCasingName = ItemList.Casing_RobustTungstenSteel.get(1).getDisplayName();
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Factory Grade Advanced Implosion Compressor")
@@ -63,7 +53,7 @@ extends GregtechMeta_MultiBlockBase {
.addSeparator()
.beginStructureBlock(3, 3, 3, true)
.addController("Front center")
- .addCasingInfo(mCasingName, 10)
+ .addCasingInfo("Robust TungstenSteel Casing", 10)
.addInputBus("Any casing", 1)
.addOutputBus("Any casing", 1)
.addEnergyHatch("Any casing", 1)
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java
new file mode 100644
index 0000000000..92190521cd
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java
@@ -0,0 +1,163 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.GregTech_API.sBlockCasings1;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase;
+import net.minecraft.item.ItemStack;
+
+public class GregtechMetaTileEntity_SteamCompressor extends GregtechMeta_SteamMultiBase {
+
+ private String mCasingName = "Bronze Plated Bricks";
+ private IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> STRUCTURE_DEFINITION = null;
+ private int mCasing;
+
+ public GregtechMetaTileEntity_SteamCompressor(String aName) {
+ super(aName);
+ }
+
+ public GregtechMetaTileEntity_SteamCompressor(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) {
+ return new GregtechMetaTileEntity_SteamCompressor(this.mName);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlay() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR);
+ }
+
+ @Override
+ protected GT_RenderedTexture getFrontOverlayActive() {
+ return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Compressor";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the Steam Macerator")
+ .addInfo("Macerates " + getMaxParallelRecipes() + " ores at a time")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo(mCasingName, 14)
+ .addStructureHint("Input Bus (Steam)", 1)
+ .addStructureHint("Output Bus (Steam)", 1)
+ .addStructureHint("Steam Hatch", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamCompressor>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_SteamCompressor::addSteamMultiList, 10, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ sBlockCasings1, 10
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addSteamMultiList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 31040){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ fixAllMaintenanceIssue();
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 14;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 8;
+ }
+
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sCompressorRecipes;
+ }
+
+ @Override
+ public ItemStack[] getOutputItems(GT_Recipe aRecipe) {
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[1];
+ for (int h = 0; h < 1; h++) {
+ if (aRecipe.getOutput(h) != null) {
+ tOutputItems[h] = aRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+ return tOutputItems;
+ }
+
+ @Override
+ public int getOutputCount(ItemStack[] aOutputs) {
+ return 1;
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
index eae51e5c1d..6ee78b0a95 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java
@@ -36,7 +36,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase {
+public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase<GT4Entity_AutoCrafter> {
private MODE mMachineMode = MODE.ASSEMBLY;
private byte mTier = 1;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
index 65474d38ed..fdf6b4be91 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
@@ -16,20 +16,23 @@ import gregtech.api.util.*;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.general.ItemLavaFilter;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.MISC_MATERIALS;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GT4Entity_ThermalBoiler
-extends GregtechMeta_MultiBlockBase
-{
+public class GT4Entity_ThermalBoiler extends GregtechMeta_MultiBlockBase<GT4Entity_ThermalBoiler> {
+
private int mCasing;
private IStructureDefinition<GT4Entity_ThermalBoiler> STRUCTURE_DEFINITION = null;
private int mSuperEfficencyIncrease = 0;
@@ -72,6 +75,9 @@ extends GregtechMeta_MultiBlockBase
}
private static Item mLavaFilter;
+ private static Fluid mLava = null;
+ private static Fluid mPahoehoe = null;
+ private static Fluid mSolarSaltHot = null;
@Override
public boolean checkRecipe(ItemStack aStack) {
@@ -80,6 +86,17 @@ extends GregtechMeta_MultiBlockBase
if (mLavaFilter == null) {
mLavaFilter = ItemList.Component_LavaFilter.getItem();
}
+ if (mLava == null) {
+ mLava = FluidRegistry.LAVA;
+ }
+ if (mPahoehoe == null) {
+ mPahoehoe = FluidUtils.getPahoehoeLava(1).getFluid();
+ }
+ if (mSolarSaltHot == null) {
+ mSolarSaltHot = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid();
+ }
+
+
//Try reload new Lava Filter
if (aStack == null) {
@@ -94,43 +111,51 @@ extends GregtechMeta_MultiBlockBase
for (GT_Recipe tRecipe : GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.mRecipeList) {
FluidStack tFluid = tRecipe.mFluidInputs[0];
if (tFluid != null) {
- if (depleteInput(tFluid)) {
- this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2));
- this.mEUt = getEUt();
- this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
-
- int loot_MAXCHANCE = 100000;
- if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
-
- if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
- }
- if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) };
- }
- if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) };
- }
- if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) };
- }
- if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) };
- }
- if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) };
- }
-
+
+ if (tFluid.getFluid() == mLava || tFluid.getFluid() == mPahoehoe) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2));
+ this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
+
+ int loot_MAXCHANCE = 100000;
+ if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
+ if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
+ }
+ if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) };
+ }
+ if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) };
+ }
+ if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) };
+ }
+ if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) };
+ }
+ if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) };
+ }
+ }
+ //Give Obsidian without Lava Filter
+ if (tFluid.getFluid() == mLava){
+ if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) {
+ this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) };
+ }
+ }
+ return true;
}
- //Give Obsidian without Lava Filter
- if (tFluid.isFluidEqual(GT_ModHandler.getLava(86))){
- if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) {
- this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) };
+ }
+ else if (tFluid.getFluid() == mSolarSaltHot) {
+ if (depleteInput(tFluid)) {
+ this.mMaxProgresstime = tRecipe.mDuration;
+ this.mEfficiency = 10000;
+ for (FluidStack aOutput : tRecipe.mFluidOutputs) {
+ this.addOutput(FluidUtils.getFluidStack(aOutput, aOutput.amount));
}
+ return true;
}
-
-
- return true;
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
index 326cc01de7..1e3e84328e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java
@@ -1,77 +1,61 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
-import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
-import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Element;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
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;
+import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.api.objects.data.Triplet;
-import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gregtech.common.items.behaviors.Behaviour_DataOrb;
+import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.recipe.common.CI;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ElementalDataOrbHolder;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase {
-
- private int mSolidCasingTier = 0;
- private int mMachineCasingTier = 0;
- private int mPipeCasingTier = 0;
- private int mCoilTier = 0;
- private int checkCoil;
- private int[] checkCasing = new int[8];
- private int checkMachine;
- private int checkPipe;
- private int maxTierOfHatch;
- private int mCasing;
- private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
+public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase<GregtechMTE_ElementalDuplicator> {
private ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder> mReplicatorDataOrbHatches = new ArrayList<GT_MetaTileEntity_Hatch_ElementalDataOrbHolder>();
-
- private static final HashMap<Integer, Triplet<Block, Integer, Integer>> mTieredBlockRegistry = new HashMap<Integer, Triplet<Block, Integer, Integer>>();
+ private static final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 3);
+ private int mCasing = 0;
public GregtechMTE_ElementalDuplicator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -81,28 +65,6 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
super(aName);
}
- public static boolean registerMachineCasingForTier(int aTier, Block aBlock, int aMeta, int aCasingTextureID) {
- int aSize = mTieredBlockRegistry.size();
- int aSize2 = aSize;
- Triplet<Block, Integer, Integer> aCasingData = new Triplet<Block, Integer, Integer>(aBlock, aMeta, aCasingTextureID);
- if (mTieredBlockRegistry.containsKey(aTier)) {
- CORE.crash("Tried to register a Machine casing for tier "+aTier+" to the Chemical Plant, however this tier already contains one.");
- }
- mTieredBlockRegistry.put(aTier, aCasingData);
- aSize = mTieredBlockRegistry.size();
- return aSize > aSize2;
- }
-
- private static int getCasingTextureIdForTier(int aTier) {
- if (!mTieredBlockRegistry.containsKey(aTier)) {
- return 10;
- }
- int aCasingID = mTieredBlockRegistry.get(aTier).getValue_3();
- //Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier);
- return aCasingID;
- }
-
- @Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
return new GregtechMTE_ElementalDuplicator(this.mName);
}
@@ -114,433 +76,467 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
+
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("Controller Block for the Industrial Replication Machine")
- .addInfo("Now replication is less painful")
- .addInfo("Please read to user manual for more information on construction & usage")
- .addSeparator()
- .addController("Bottom Center")
- .addStructureHint("Catalyst Housing", 1)
- .addInputBus("Bottom Casing", 1)
- .addOutputBus("Bottom Casing", 1)
- .addInputHatch("Bottom Casing", 1)
- .addOutputHatch("Bottom Casing", 1)
- .addEnergyHatch("Bottom Casing", 1)
- .addMaintenanceHatch("Bottom Casing", 1)
- .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ .addInfo("Produces Elemental Material from UU Matter")
+ .addInfo("Speed: 100% | Eu Usage: 100% | Parallel: 8 * Tier")
+ .addInfo("This multiblock cannot be overclocked")
+ .addInfo("Maximum 1x of each bus/hatch.")
+ .addInfo("Does not require both Output Hatch & Bus")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(9, 6, 9, true)
+ .addController("Top Center")
+ .addCasingInfo("Elemental Confinement Shell", 138)
+ .addCasingInfo("Matter Fabricator Casing", 24)
+ .addCasingInfo("Containment Casing", 24)
+ .addCasingInfo("Matter Generation Coil", 24)
+ .addCasingInfo("High Voltage Current Capacitor", 20)
+ .addCasingInfo("Resonance Chamber III", 24)
+ .addCasingInfo("Modulator III", 16)
+ .addOtherStructurePart("Data Orb Repository", "1x", 1)
+ .addInputHatch("Any 1 dot hint", 1)
+ .addOutputBus("Any 1 dot hint", 1)
+ .addOutputHatch("Any 1 dot hint", 1)
+ .addEnergyHatch("Any 1 dot hint", 1)
+ .addMaintenanceHatch("Any 1 dot hint", 1)
+ .addMufflerHatch("Any 1 dot hint", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
return tt;
}
- public void setMachineMeta(int meta) {
- checkMachine = meta;
- }
- public int getMachineMeta() {
- return checkMachine;
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private IStructureDefinition<GregtechMTE_ElementalDuplicator> STRUCTURE_DEFINITION = null;
+
+ @Override
+ public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
+
+ // h = Hatch
+ // c = Casing
+
+ // a = MF Casing 1
+ // b = Matter Gen Coil
+
+ // d = Current Capacitor
+ // e = Particle
+
+ // f = Resonance III
+ // g = Modulator III
+
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccch~hccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cec ", " e e ", " e e ", "c d c", "e ddd e", "c d c", " e e ", " e e ", " cec "},
+ {" cac ", " abfba ", " abfgfba ", "cbfgdgfbc", "afgdddgfa", "cbfgdgfbc", " abfgfba ", " abfba ", " cac "},
+ {" ccc ", " ccccc ", " ccccccc ", "ccchhhccc", "ccchhhccc", "ccchhhccc", " ccccccc ", " ccccc ", " ccc "},
+ }))
+
+
+ .addElement('a', ofBlock(getCasingBlock4(), getCasingMeta6()))
+ .addElement('b', ofBlock(getCasingBlock4(), getCasingMeta7()))
+
+ .addElement('d', ofBlock(getCasingBlock2(), getCasingMeta2()))
+ .addElement('e', ofBlock(getCasingBlock2(), getCasingMeta3()))
+
+ .addElement('f', ofBlock(getCasingBlock3(), getCasingMeta4()))
+ .addElement('g', ofBlock(getCasingBlock3(), getCasingMeta5()))
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMTE_ElementalDuplicator::addGenericHatch, getCasingTextureIndex(), 1),
+ onElementPass(x -> ++x.mCasing, ofBlock(getCasingBlock(), getCasingMeta()))
+ )))
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
}
- public void setPipeMeta(int meta) {
- checkPipe = meta;
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN , stackSize, hintsOnly, 4, 4, 0);
}
- public int getPipeMeta() {
- return checkPipe;
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0);
+ if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() !=0) || this.mEnergyHatches.size() != 1 || this.mReplicatorDataOrbHatches.size() != 1) {
+ return false;
+ }
+ log("Casings: "+mCasing);
+ return aDidBuild && mCasing >= 138 && checkHatch();
+ }
+
+ protected static int getCasingTextureIndex() {
+ return CASING_TEXTURE_ID;
}
- public void setCoilMeta(int meta) {
- checkCoil = meta;
+ protected static Block getCasingBlock() {
+ return ModBlocks.blockCasings5Misc;
}
- public int getCoilMeta() {
- return checkCoil;
+ protected static Block getCasingBlock2() {
+ return ModBlocks.blockSpecialMultiCasings;
}
- public int coilTier(int meta) {
- switch (meta) {
- case 0: return 1;
- case 1: return 2;
- case 2: return 3;
- case 3: return 4;
- case 4: return 5;
- case 5: return 7;
- case 6: return 8;
- case 7: return 10;
- case 8: return 11;
- case 9: return 6;
- case 10: return 9;
- }
- return 0;
+ protected static Block getCasingBlock3() {
+ return ModBlocks.blockSpecialMultiCasings2;
}
- @Override
- public IStructureDefinition<GregtechMTE_ElementalDuplicator> getStructureDefinition() {
- if (STRUCTURE_DEFINITION == null) {
- STRUCTURE_DEFINITION = StructureDefinition.<GregtechMTE_ElementalDuplicator>builder()
- .addShape(mName, transpose(new String[][]{
- {"XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX", "XXXXXXX"},
- {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
- {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
- {"X X", " ", " HHH ", " HHH ", " HHH ", " ", "X X"},
- {"X X", " ", " PPP ", " PPP ", " PPP ", " ", "X X"},
- {"X X", " MMMMM ", " MHHHM ", " MHHHM ", " MHHHM ", " MMMMM ", "X X"},
- {"CCC~CCC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CMMMMMC", "CCCCCCC"},
- }))
- .addElement(
- 'C',
- ofChain(
- ofHatchAdder(
- GregtechMTE_ElementalDuplicator::addChemicalPlantList, getCasingTextureID(), 1
- ),
- onElementPass(
- x -> {++x.checkCasing[0]; ++x.mCasing;},
- ofSolidCasing(0)
- ),
- onElementPass(
- x -> {++x.checkCasing[1]; ++x.mCasing;},
- ofSolidCasing(1)
- ),
- onElementPass(
- x -> {++x.checkCasing[2]; ++x.mCasing;},
- ofSolidCasing(2)
- ),
- onElementPass(
- x -> {++x.checkCasing[3]; ++x.mCasing;},
- ofSolidCasing(3)
- ),
- onElementPass(
- x -> {++x.checkCasing[4]; ++x.mCasing;},
- ofSolidCasing(4)
- ),
- onElementPass(
- x -> {++x.checkCasing[5]; ++x.mCasing;},
- ofSolidCasing(5)
- ),
- onElementPass(
- x -> {++x.checkCasing[6]; ++x.mCasing;},
- ofSolidCasing(6)
- ),
- onElementPass(
- x -> {++x.checkCasing[7]; ++x.mCasing;},
- ofSolidCasing(7)
- )
- )
- )
- .addElement(
- 'X',
- ofChain(
- onElementPass(
- x -> {++x.checkCasing[0]; ++x.mCasing;},
- ofSolidCasing(0)
- ),
- onElementPass(
- x -> {++x.checkCasing[1]; ++x.mCasing;},
- ofSolidCasing(1)
- ),
- onElementPass(
- x -> {++x.checkCasing[2]; ++x.mCasing;},
- ofSolidCasing(2)
- ),
- onElementPass(
- x -> {++x.checkCasing[3]; ++x.mCasing;},
- ofSolidCasing(3)
- ),
- onElementPass(
- x -> {++x.checkCasing[4]; ++x.mCasing;},
- ofSolidCasing(4)
- ),
- onElementPass(
- x -> {++x.checkCasing[5]; ++x.mCasing;},
- ofSolidCasing(5)
- ),
- onElementPass(
- x -> {++x.checkCasing[6]; ++x.mCasing;},
- ofSolidCasing(6)
- ),
- onElementPass(
- x -> {++x.checkCasing[7]; ++x.mCasing;},
- ofSolidCasing(7)
- )
- )
- )
- .addElement(
- 'M',
- addTieredBlock(
- GregTech_API.sBlockCasings1, GregtechMTE_ElementalDuplicator::setMachineMeta, GregtechMTE_ElementalDuplicator::getMachineMeta, 10
- )
- )
- .addElement(
- 'H',
- addTieredBlock(
- GregTech_API.sBlockCasings5, GregtechMTE_ElementalDuplicator::setCoilMeta, GregtechMTE_ElementalDuplicator::getCoilMeta, 11
- )
- )
- .addElement(
- 'P',
- addTieredBlock(
- GregTech_API.sBlockCasings2, GregtechMTE_ElementalDuplicator::setPipeMeta, GregtechMTE_ElementalDuplicator::getPipeMeta, 12, 16
- )
- )
- .build();
- }
- return STRUCTURE_DEFINITION;
+ protected static Block getCasingBlock4() {
+ return ModBlocks.blockCasingsMisc;
}
- public static <T> IStructureElement<T> ofSolidCasing(int aIndex) {
- return new IStructureElement<T>() {
- @Override
- public boolean check(T t, World world, int x, int y, int z) {
- Block block = world.getBlock(x, y, z);
- int meta = world.getBlockMetadata(x, y, z);
- Block target = mTieredBlockRegistry.get(aIndex).getValue_1();
- int targetMeta = mTieredBlockRegistry.get(aIndex).getValue_2();
- return target.equals(block) && meta == targetMeta;
- }
+ protected static int getCasingMeta() {
+ return 3;
+ }
- int getIndex(int size) {
- if (size > 8) size = 8;
- return size - 1;
- }
+ protected static int getCasingMeta2() {
+ return 12;
+ }
- @Override
- public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
- StructureLibAPI.hintParticle(world, x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2());
- return true;
- }
+ protected static int getCasingMeta3() {
+ return 13;
+ }
- @Override
- public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
- return world.setBlock(x, y, z, mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_1(), mTieredBlockRegistry.get(getIndex(trigger.stackSize)).getValue_2(), 3);
- }
- };
+ protected static int getCasingMeta4() {
+ return 2;
}
- @Override
- public void construct(ItemStack stackSize, boolean hintsOnly) {
- buildPiece(mName , stackSize, hintsOnly, 3, 6, 0);
+ protected static int getCasingMeta5() {
+ return 6;
}
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mCasing = 0;
- for (int i = 0; i < 8; i++) {
- checkCasing[i] = 0;
- }
- checkCoil = 0;
- checkPipe = 0;
- checkMachine = 0;
- mSolidCasingTier = 0;
- mMachineCasingTier = 0;
- mPipeCasingTier = 0;
- mCoilTier = 0;
- mReplicatorDataOrbHatches.clear();
- if (checkPiece(mName, 3, 6, 0) && mCasing >= 80) {
- for (int i = 0; i < 8; i++) {
- if (checkCasing[i] == mCasing) {
- mSolidCasingTier = i;
- }
- else if (checkCasing[i] > 0)
- return false;
- }
- mMachineCasingTier = checkMachine - 1;
- mPipeCasingTier = checkPipe - 12;
- mCoilTier = coilTier(checkCoil - 1);
- updateHatchTexture();
- return mMachineCasingTier >= maxTierOfHatch;
- }
- return false;
+ protected static int getCasingMeta6() {
+ return 9;
}
- public void updateHatchTexture() {
- for (GT_MetaTileEntity_Hatch h : mReplicatorDataOrbHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mInputBusses) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mMaintenanceHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mEnergyHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mOutputBusses) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mInputHatches) h.updateTexture(getCasingTextureID());
- for (GT_MetaTileEntity_Hatch h : mOutputHatches) h.updateTexture(getCasingTextureID());
+ protected static int getCasingMeta7() {
+ return 8;
}
- public final boolean addChemicalPlantList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder){
- return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier);
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_OutputBus) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
- maxTierOfHatch = Math.max(maxTierOfHatch, ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
+ try {
+ ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aMetaTileEntity).mRecipeMap = getRecipeMap();
+ return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
return false;
}
- @Override
- public String getSound() {
- return GregTech_API.sSoundList.get(Integer.valueOf(207));
- }
-
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
-
- ITexture aOriginalTexture;
-
- // Check things exist client side (The worst code ever)
- if (aBaseMetaTileEntity.getWorld() != null) {
-
- }
- int aCasingID = getCasingTextureID();
- aOriginalTexture = Textures.BlockIcons.getCasingTextureForId(aCasingID);
-
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == aFacing) {
- return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID),
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
}
- return new ITexture[]{aOriginalTexture};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)};
}
@Override
public boolean hasSlotInGUI() {
- return true;
+ return false;
}
@Override
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) {
- generateRecipes();
- }
- return GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT;
- }
-
- public static void generateRecipes() {
- for (GT_Recipe i : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlantRecipes.mRecipeList) {
- GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.add(i);
- }
+ public boolean requiresVanillaGtGUI() {
+ return false;
}
@Override
- public int getMaxParallelRecipes() {
- return 2 * getPipeCasingTier();
+ public String getCustomGUIResourceName() {
+ return null;
}
- @Override
- public int getEuDiscountForParallelism() {
- return 100;
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe_Map.sElementalDuplicatorRecipes;
}
- private int getSolidCasingTier() {
- return this.mSolidCasingTier;
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ return true;
}
- private int getMachineCasingTier() {
- return mMachineCasingTier;
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(getMaxParallelRecipes(), 100, 100);
}
- private int getPipeCasingTier() {
- return mPipeCasingTier;
- }
- private int getCasingTextureID() {
- // Check the Tier Client Side
- int aTier = mSolidCasingTier;
- int aCasingID = getCasingTextureIdForTier(aTier);
- return aCasingID;
- }
+ @Override
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
+ // Based on the Processing Array. A bit overkill, but very flexible.
- public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
- int aMaxTier = getMachineCasingTier();
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
- GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
- int aTileTier = aMachineBlock.mTier;
- if (aTileTier > aMaxTier) {
- log("Hatch tier too high.");
- return false;
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = null;
+
+ try {
+ log("Checking "+aItemInputs.length+" Data Orbs");
+
+ for (int i=0;i<aItemInputs.length;i++) {
+ ItemStack aItem = aItemInputs[i];
+ log("Found: "+aItem.getDisplayName());
+ }
+ ItemStack aDataOrbStack = null;
+ recipe : for (GT_Recipe nRecipe : this.getRecipeMap().mRecipeList) {
+ log("Checking Recipe for: "+(nRecipe.mOutputs.length > 0 && nRecipe.mOutputs[0] != null ? nRecipe.mOutputs[0].getDisplayName() : nRecipe.mFluidOutputs[0].getLocalizedName()));
+ ItemStack aTempStack = getSpecialSlotStack(nRecipe);
+ if (aTempStack != null) {
+ for (ItemStack aItem : aItemInputs) {
+ if (nRecipe.mSpecialItems != null) {
+ if (GT_Utility.areStacksEqual(aTempStack, aItem, false)) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aTempStack)).mLinkedMaterials.get(0);
+ log("Found: "+aTempStack.getDisplayName()+" for "+tMaterial.name());
+ aDataOrbStack = aTempStack;
+ break recipe;
+ }
+ }
+ }
+ }
+ }
+ if (aDataOrbStack != null) {
+ tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aDataOrbStack, aItemInputs);
+ if (tRecipe != null) {
+ Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(aDataOrbStack)).mLinkedMaterials.get(0);
+ log("Found recipe for "+tMaterial.name());
+ }
+ else {
+ log("No Recipe Found");
+ }
}
else {
- return addToMachineList(aTileEntity, getCasingTextureID());
+ log("Null DO");
}
+
}
- else {
- log("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
return false;
- }
- }
+ }
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier);
- aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier);
- aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier);
- aNBT.setInteger("mCoilTier", this.mCoilTier);
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
}
+
@Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mSolidCasingTier = aNBT.getInteger("mSolidCasingTier");
- mMachineCasingTier = aNBT.getInteger("mMachineCasingTier");
- mPipeCasingTier = aNBT.getInteger("mPipeCasingTier");
- mCoilTier = aNBT.getInteger("mCoilTier");
+ public int getMaxParallelRecipes() {
+ return (8 * GT_Utility.getTier(this.getMaxInputVoltage()));
}
@Override
- public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) {
- log("Found GT_MetaTileEntity_Hatch_ElementalDataOrbHolder");
- ((GT_MetaTileEntity_Hatch_ElementalDataOrbHolder) aTileEntity).mRecipeMap = getRecipeMap();
- return addToMachineListInternal(mReplicatorDataOrbHatches, aMetaTileEntity, aBaseCasingIndex);
- }
- return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ public int getEuDiscountForParallelism() {
+ return 100;
}
- @Override
public int getMaxEfficiency(final ItemStack aStack) {
return 10000;
}
- @Override
- public int getPollutionPerTick(final ItemStack aStack) {
- return 100;
+ public int getPollutionPerSecond(final ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiMolecularTransformer;
}
- @Override
- public int getAmountOfOutputs() {
- return 1;
+ public int getDamageToComponent(final ItemStack aStack) {
+ return 0;
}
- @Override
public boolean explodesOnComponentBreak(final ItemStack aStack) {
return false;
}
@Override
- public String getCustomGUIResourceName() {
- return null;
- }
-
- // Same speed bonus as pyro oven
- public int getSpeedBonus() {
- return 50 * (this.mCoilTier - 2);
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
}
@Override
@@ -554,191 +550,136 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase
}
@Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- }
-
- @Override
- public boolean checkRecipe(final ItemStack aStack) {
- return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), getSpeedBonus());
+ public ArrayList<ItemStack> getStoredInputs() {
+ ArrayList<ItemStack> tItems = super.getStoredInputs();
+ for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
+ tHatch.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tHatch)) {
+ tItems.addAll(tHatch.getInventory());
+ }
+ }
+ tItems.removeAll(Collections.singleton(null));
+ return tItems;
}
+ /**
+ * finds a Recipe matching the aFluid and ItemStack Inputs.
+ *
+ * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup.
+ * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up.
+ * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs
+ * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with the provided input
+ * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage
+ * @param aFluids the Fluid Inputs
+ * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do.
+ * @param aInputs the Item Inputs
+ * @return the Recipe it has found or null for no matching Recipe
+ */
+ public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) {
- @Override
- public boolean checkRecipeGeneric(
- ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
- int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
- return false;
- }
-
- private static final HashMap<Long, AutoMap<GT_Recipe>> mTieredRecipeMap = new HashMap<Long, AutoMap<GT_Recipe>>();
- private static final AutoMap<GT_Recipe> aTier0Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier1Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier2Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier3Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier4Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier5Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier6Recipes = new AutoMap<GT_Recipe>();
- private static final AutoMap<GT_Recipe> aTier7Recipes = new AutoMap<GT_Recipe>();
- private static boolean mInitRecipeCache = false;
-
- private static void initRecipeCaches() {
- if (!mInitRecipeCache) {
- mTieredRecipeMap.put((long) 0, aTier0Recipes);
- mTieredRecipeMap.put((long) 1, aTier1Recipes);
- mTieredRecipeMap.put((long) 2, aTier2Recipes);
- mTieredRecipeMap.put((long) 3, aTier3Recipes);
- mTieredRecipeMap.put((long) 4, aTier4Recipes);
- mTieredRecipeMap.put((long) 5, aTier5Recipes);
- mTieredRecipeMap.put((long) 6, aTier6Recipes);
- mTieredRecipeMap.put((long) 7, aTier7Recipes);
- for (GT_Recipe aRecipe : GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList) {
- if (aRecipe != null) {
- switch (aRecipe.mSpecialValue) {
- case 0:
- aTier0Recipes.add(aRecipe);
- continue;
- case 1:
- aTier1Recipes.add(aRecipe);
- continue;
- case 2:
- aTier2Recipes.add(aRecipe);
- continue;
- case 3:
- aTier3Recipes.add(aRecipe);
- continue;
- case 4:
- aTier4Recipes.add(aRecipe);
- continue;
- case 5:
- aTier5Recipes.add(aRecipe);
- continue;
- case 6:
- aTier6Recipes.add(aRecipe);
- continue;
- case 7:
- aTier7Recipes.add(aRecipe);
- continue;
- }
- }
- }
- mInitRecipeCache = true;
+ GT_Recipe_Map mRecipeMap = this.getRecipeMap();
+ // No Recipes? Well, nothing to be found then.
+ if (mRecipeMap.mRecipeList.isEmpty()) {
+ return null;
}
- }
- private static boolean areInputsEqual(GT_Recipe aComparator, ItemStack[] aInputs, FluidStack[] aFluids) {
- int aInputCount = aComparator.mInputs.length;
- if (aInputCount > 0) {
- //Logger.INFO("Looking for recipe with "+aInputCount+" Items");
- int aMatchingInputs = 0;
- recipe : for (ItemStack a : aComparator.mInputs) {
- for (ItemStack b : aInputs) {
- if (a.getItem() == b.getItem()) {
- if (a.getItemDamage() == b.getItemDamage()) {
- //Logger.INFO("Found matching Item Input - "+b.getUnlocalizedName());
- aMatchingInputs++;
- continue recipe;
- }
- }
- }
- }
- if (aMatchingInputs != aInputCount) {
- return false;
- }
- }
- int aFluidInputCount = aComparator.mFluidInputs.length;
- if (aFluidInputCount > 0) {
- //Logger.INFO("Looking for recipe with "+aFluidInputCount+" Fluids");
- int aMatchingFluidInputs = 0;
- recipe : for (FluidStack b : aComparator.mFluidInputs) {
- //Logger.INFO("Checking for fluid "+b.getLocalizedName());
- for (FluidStack a : aFluids) {
- if (GT_Utility.areFluidsEqual(a, b)) {
- //Logger.INFO("Found matching Fluid Input - "+b.getLocalizedName());
- aMatchingFluidInputs++;
- continue recipe;
- }
- else {
- //Logger.INFO("Found fluid which did not match - "+a.getLocalizedName());
- }
- }
+ // Some Recipe Classes require a certain amount of Inputs of certain kinds. Like "at least 1 Fluid + 1 Stack" or "at least 2 Stacks" before they start searching for Recipes.
+ // This improves Performance massively, especially if people leave things like Circuits, Molds or Shapes in their Machines to select Sub Recipes.
+ if (GregTech_API.sPostloadFinished) {
+ if (mRecipeMap.mMinimalInputFluids > 0) {
+ if (aFluids == null) return null;
+ int tAmount = 0;
+ for (FluidStack aFluid : aFluids) if (aFluid != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputFluids) return null;
}
- if (aMatchingFluidInputs != aFluidInputCount) {
- return false;
+ if (mRecipeMap.mMinimalInputItems > 0) {
+ if (aInputs == null) return null;
+ int tAmount = 0;
+ for (ItemStack aInput : aInputs) if (aInput != null) tAmount++;
+ if (tAmount < mRecipeMap.mMinimalInputItems) return null;
}
}
- Logger.INFO("Recipes Match!");
- return true;
- }
- public GT_Recipe findRecipe(final GT_Recipe aRecipe, final long aVoltage, final long aSpecialValue, ItemStack[] aInputs, final FluidStack[] aFluids) {
- if (!mInitRecipeCache) {
- initRecipeCaches();
+ // Unification happens here in case the Input isn't already unificated.
+ if (aNotUnificated) {
+ aInputs = GT_OreDictUnificator.getStackArray(true, (Object[]) aInputs);
}
- if (this.getRecipeMap().mRecipeList.isEmpty()) {
- log("No Recipes in Map to search through.");
- return null;
+
+ // Check the Recipe which has been used last time in order to not have to search for it again, if possible.
+ if (aRecipe != null) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(aRecipe);
+ if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return aRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= aRecipe.mEUt ? aRecipe : null;
+ }
}
- else {
- log("Checking tier "+aSpecialValue+" recipes and below. Using Input Voltage of "+aVoltage+"V.");
- log("We have "+aInputs.length+" Items and "+aFluids.length+" Fluids.");
- // Try check the cached recipe first
- if (aRecipe != null) {
- if (areInputsEqual(aRecipe, aInputs, aFluids)) {
- if (aRecipe.mEUt <= aVoltage) {
- Logger.INFO("Using cached recipe.");
- return aRecipe;
+
+ // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items.
+ if (mRecipeMap.mUsualInputCount > 0 && aInputs != null) for (ItemStack tStack : aInputs)
+ if (tStack != null) {
+ Collection<GT_Recipe> tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack));
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ tRecipes = mRecipeMap.mRecipeItemMap.get(new GT_ItemStack(tStack, true));
}
}
- }
-
- // Get all recipes for the tier
- AutoMap<AutoMap<GT_Recipe>> aMasterMap = new AutoMap<AutoMap<GT_Recipe>>();
- for (long i=0;i<=aSpecialValue;i++) {
- aMasterMap.add(mTieredRecipeMap.get(i));
- }
- GT_Recipe aFoundRecipe = null;
-
- // Iterate the tiers recipes until we find the one with all inputs matching
- master : for (AutoMap<GT_Recipe> aTieredMap : aMasterMap) {
- for (GT_Recipe aRecipeToCheck : aTieredMap) {
- if (areInputsEqual(aRecipeToCheck, aInputs, aFluids)) {
- log("Found recipe with matching inputs!");
- if (aRecipeToCheck.mSpecialValue <= aSpecialValue) {
- if (aRecipeToCheck.mEUt <= aVoltage) {
- aFoundRecipe = aRecipeToCheck;
- break master;
+ if (tRecipes != null) {
+ for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
}
- }
+ }
}
}
}
- // If we found a recipe, return it
- if (aFoundRecipe != null) {
- log("Found valid recipe.");
- return aFoundRecipe;
+ // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too.
+ if (mRecipeMap.mMinimalInputItems == 0 && aFluids != null) for (FluidStack aFluid : aFluids)
+ if (aFluid != null) {
+ Collection<GT_Recipe>
+ tRecipes = mRecipeMap.mRecipeFluidMap.get(aFluid.getFluid());
+ if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) {
+ if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) {
+ ItemStack aRecipeSpecial = getSpecialSlotStack(tRecipe);
+ if (GT_Utility.areStacksEqual(aRecipeSpecial, aSpecialSlot, false) && areDataOrbsEqual(aRecipeSpecial, aSpecialSlot)) {
+ return tRecipe.mEnabled && aVoltage * mRecipeMap.mAmperage >= tRecipe.mEUt ? tRecipe : null;
+ }
+ }
+ }
}
- }
- log("Did not find valid recipe.");
+
+ // And nothing has been found.
return null;
}
- /*
- * Catalyst Handling
- */
+ public static ItemStack getSpecialSlotStack(GT_Recipe aRecipe) {
+ ItemStack aStack = null;
+ if (aRecipe.mSpecialItems != null) {
+ if (aRecipe.mSpecialItems instanceof ItemStack[]) {
+ ItemStack[] aTempStackArray = (ItemStack[]) aRecipe.mSpecialItems;
+ aStack = aTempStackArray[0];
+ }
+ }
+ return aStack;
+ }
- @Override
- public ArrayList<ItemStack> getStoredInputs() {
- ArrayList<ItemStack> tItems = super.getStoredInputs();
- for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) {
- tHatch.mRecipeMap = getRecipeMap();
- if (isValidMetaTileEntity(tHatch)) {
- tItems.addAll(tHatch.getInventory());
+ private static boolean areDataOrbsEqual(ItemStack aOrb1, ItemStack aOrb2) {
+ if (aOrb1 != null && aOrb2 != null) {
+ Materials tMaterial1 = Element.get(Behaviour_DataOrb.getDataName(aOrb1)).mLinkedMaterials.get(0);
+ Materials tMaterial2 = Element.get(Behaviour_DataOrb.getDataName(aOrb2)).mLinkedMaterials.get(0);
+ if (tMaterial1.equals(tMaterial2)) {
+ return true;
}
- }
- return tItems;
+ }
+
+ return false;
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
index 25b8865f55..715ef30697 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java
@@ -1,19 +1,18 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.metatileentity.implementations.*;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gtPlusPlus.core.lib.CORE;
-import org.apache.commons.lang3.ArrayUtils;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
@@ -21,10 +20,16 @@ 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_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GTPP_Recipe;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -34,7 +39,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase<GregtechMTE_FrothFlotationCell> {
private int mCasing;
private IStructureDefinition<GregtechMTE_FrothFlotationCell> STRUCTURE_DEFINITION = null;
@@ -67,7 +72,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
.beginStructureBlock(3, 3, 3, true)
.addController("Front Center")
.addCasingInfo("Inconel Reinforced Casing", 68)
- .addCasingInfo("Flotation Casings", 52)
+ .addCasingInfo("Flotation Casing", 52)
.addInputBus("Bottom Casing", 1)
.addInputHatch("Bottom Casing", 1)
.addOutputHatch("Bottom Casing", 1)
@@ -222,7 +227,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
// Fix GT bug
- if (this.getBaseMetaTileEntity().getFrontFacing() == 0 && this.getBaseMetaTileEntity().getBackFacing() == 1) {
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
log("Fixing Bad Facing. (GT Bug)");
this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
}
@@ -233,6 +238,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase
return super.checkRecipeGeneric();
}
+ @Override
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
index cccee84c99..fabbd42924 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java
@@ -33,7 +33,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntityGeneratorArray> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntityGeneratorArray> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
index 83b8eae458..2b5320de20 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
@@ -29,10 +29,10 @@ import net.minecraft.item.ItemStack;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntityTreeFarm> {
public static int CASING_TEXTURE_ID;
- public static String mCasingName = "Advanced Cryogenic Casing";
+ public static String mCasingName = "Sterile Farm Casing";
public static TreeGenerator mTreeData;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntityTreeFarm> STRUCTURE_DEFINITION = null;
@@ -51,13 +51,11 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
}
public GregtechMetaTileEntityTreeFarm(final String aName) {
super(aName);
CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
}
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
@@ -71,9 +69,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
- }
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Converts EU to Oak Logs")
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
index 323efa2193..06983572af 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java
@@ -33,8 +33,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_AlloyBlastSmelter
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_AlloyBlastSmelter extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_AlloyBlastSmelter> {
private int mMode = 0;
private boolean isUsingControllerCircuit = false;
@@ -68,6 +67,7 @@ extends GregtechMeta_MultiBlockBase {
.addInfo("Controller Block for the Alloy Blast Smelter")
.addInfo("20% Faster than the Electric Blast Furnace")
.addInfo("Allows Complex GT++ alloys to be created")
+ .addInfo("This multiblock cannot be overclocked")
.addInfo("Circuit for recipe goes in the Input Bus or GUI slot")
.addPollutionAmount(getPollutionPerSecond(null))
.addSeparator()
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index 7514a3dea6..1b24b8f264 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -34,7 +34,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Cyclotron> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Cyclotron> STRUCTURE_DEFINITION = null;
@@ -203,6 +203,8 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus && ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier >= 5){
return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output && ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier >= 5) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy && ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity).mTier >= 5){
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
index 80eb09640d..26a744612a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -39,7 +39,7 @@ import net.minecraft.util.WeightedRandomFishable;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialFishingPond> {
private boolean isUsingControllerCircuit = false;
private static final Item circuit = CI.getNumberedCircuit(0).getItem();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
index d9162cea89..28d82bc492 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
@@ -1,28 +1,28 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.ArrayList;
import java.util.Collection;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.*;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.chemistry.RocketFuels;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.util.minecraft.FluidUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
@@ -31,12 +31,9 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-
public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeRocketEngine>
{
protected int fuelConsumption;
@@ -52,6 +49,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public static String mCasingName = "Turbodyne Casing";
public static String mIntakeHatchName = "Tungstensteel Turbine Casing";
public static String mGearboxName = "Inconel Reinforced Casing";
+
+ private static Fluid sAirFluid = null;
+ private static FluidStack sAirFluidStack = null;
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_LargeRocketEngine> STRUCTURE_DEFINITION = null;
@@ -64,6 +64,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.fuelValue = 0;
this.fuelRemaining = 0;
this.boostEu = false;
+ setAir();
}
public GregtechMetaTileEntity_LargeRocketEngine(final String aName) {
@@ -72,26 +73,11 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.fuelValue = 0;
this.fuelRemaining = 0;
this.boostEu = false;
+ setAir();
}
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
- }
- if (mIntakeHatchName.toLowerCase().contains(".name")) {
- mIntakeHatchName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11);
- }
- if (mGearboxName.toLowerCase().contains(".name")) {
- mGearboxName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 1);
- }
- if (mLubricantName.toLowerCase().contains(".")) {
- mLubricantName = FluidUtils.getFluidStack("carbondioxide", 1).getLocalizedName();
- }
- if (mCoolantName.toLowerCase().contains(".")) {
- mCoolantName = FluidUtils.getFluidStack("liquidhydrogen", 1).getLocalizedName();
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Large Rocket Engine")
@@ -111,7 +97,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
.addStructureHint("Air Intake Hatch", 1)
.addInputBus("Side center line", 1)
.addInputHatch("Side center line", 1)
- .addMaintenanceHatch("Side center line", 1)
+ .addMaintenanceHatch("Any Block Touching Inconel Reinforced Casing", 1)
.addDynamoHatch("Top center line", 2)
.addMufflerHatch("Back Center", 3)
.toolTipFinisher(CORE.GT_Tooltip_Builder);
@@ -123,7 +109,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
if (STRUCTURE_DEFINITION == null) {
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_LargeRocketEngine>builder()
.addShape(mName, transpose(new String[][]{
- {"CCC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CCC"},
+ {"CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC", "CTC"},
{"C~C", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "SIS", "CMC"},
{"CCC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CSC", "CCC"},
}))
@@ -195,13 +181,19 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public final boolean addLargeRocketEngineTopList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } if (LoadedMods.TecTech) {
+ }
+ if (LoadedMods.TecTech) {
if (isThisHatchMultiDynamo(aMetaTileEntity)) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
@@ -213,15 +205,19 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public final boolean addLargeRocketEngineSideList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
- } else {
+ }
+ else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
@@ -257,19 +253,28 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity);
}
+
+ public static void setAir() {
+ if (sAirFluidStack == null) {
+ sAirFluidStack = FluidUtils.getFluidStack("air", 1);
+ }
+ if (sAirFluid == null && sAirFluidStack != null) {
+ sAirFluid = sAirFluidStack.getFluid();
+ }
+ }
public int getAir() {
+ setAir();
if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) {
return 0;
}
else {
int totalAir = 0;
- FluidStack airstack = FluidUtils.getFluidStack("air", 1);
for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) {
if (u != null && u.mFluid != null) {
// had this trow errors cousing the machine to stop probebly fixed
FluidStack f = u.mFluid;
- if (f.isFluidEqual(airstack)) {
+ if (f.isFluidEqual(sAirFluidStack)) {
totalAir += f.amount;
}
}
@@ -279,9 +284,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
}
@Override
+ public GT_Recipe_Map getRecipeMap() {
+ return GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels;
+ }
+
+ @Override
public boolean checkRecipe(final ItemStack aStack) {
final ArrayList<FluidStack> tFluids = this.getStoredFluids();
- FluidStack air = FluidUtils.getFluidStack("air", 1);
int aircount = getAir() ;
if (aircount < euProduction/100) {
@@ -289,7 +298,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
return false;
}
else {
- boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100));
+ boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(sAirFluid, euProduction/100));
if (!hasIntakeAir) {
//log("Could not consume Air to run "+aircount);
freeFuelTicks = 0;
@@ -302,10 +311,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
//log("Running "+aircount);
log("looking at hatch");
- final Collection<GT_Recipe> tRecipeList = GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.mRecipeList;
- if (tFluids.size() > 0 && tRecipeList != null) {
+ if (tFluids.size() > 0 && getRecipeMap() != null) {
if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluidStack(this.boostEu ? 3 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
@@ -324,12 +332,12 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
this.boostEu = consumeLOH();
for (final FluidStack hatchFluid1 : tFluids) {
- if (hatchFluid1.isFluidEqual(air)) {
+ if (hatchFluid1.isFluidEqual(sAirFluidStack)) {
continue;
}
if (freeFuelTicks == 0) {
- for (final GT_Recipe aFuel : tRecipeList) {
+ for (final GT_Recipe aFuel : getRecipeMap().mRecipeList) {
final FluidStack tLiquid;
tLiquid = aFuel.mFluidInputs[0];
if (hatchFluid1.isFluidEqual(tLiquid)) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
index 9be787e922..5135a7eeed 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
@@ -28,7 +28,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargeSemifluidGenerator> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_LargeSemifluidGenerator> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
index 31fcc41cf4..177d1690cf 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -1,5 +1,8 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import java.util.ArrayList;
+import java.util.Collection;
+
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.enums.ConfigCategories;
@@ -82,16 +85,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
}
public GregtechMetaTileEntity_MassFabricator(final String aName) {
super(aName);
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
}
@Override
@@ -101,21 +98,13 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
-
- if (mCasingName1.toLowerCase().contains(".name")) {
- mCasingName1 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 9);
- }
- if (mCasingName2.toLowerCase().contains(".name")) {
- mCasingName2 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 15);
- }
- if (mCasingName3.toLowerCase().contains(".name")) {
- mCasingName3 = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasingsMisc, 8);
- }
-
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
.addInfo("Controller Block for the Matter Fabricator")
+ .addInfo("Speed: 100% | Eu Usage: 80%")
+ .addInfo("Parallel: Scrap = 64 | UU = 8 * Tier")
.addInfo("Produces UU-A, UU-M & Scrap")
+ .addInfo("Change mode with screwdriver")
.addPollutionAmount(getPollutionPerSecond(null))
.addSeparator()
.beginStructureBlock(5, 4, 5, true)
@@ -445,7 +434,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public boolean checkRecipeUU(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll) {
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
// Based on the Processing Array. A bit overkill, but very flexible.
@@ -645,7 +634,7 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
@Override
public int getMaxParallelRecipes() {
- return this.mMode == MODE_SCRAP ? 32 : 2 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
+ return this.mMode == MODE_SCRAP ? 64 : 8 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
}
@Override
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
index f86ecf3196..ca33c31f8c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java
@@ -21,7 +21,7 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Refinery> {
private int mCasing;
private IStructureDefinition<GregtechMetaTileEntity_Refinery> STRUCTURE_DEFINITION = null;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
index d42b33a403..4ad4c76be4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java
@@ -1,10 +1,12 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
+import java.util.ArrayList;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
@@ -12,13 +14,15 @@ 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.*;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater;
@@ -27,24 +31,29 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_SolarTower
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SolarTower> {
//862
- private static final int mCasingTextureID = TAE.getIndexFromPage(3, 4);
- public static String mCasingName = "";
- private int mHeight = 0;
+ private static final int mCasingTextureID = TAE.getIndexFromPage(3, 9);
private int mHeatLevel = 0;
+ private int mCasing1;
+ private int mCasing2;
+ private int mCasing3;
+ private int mCasing4;
+
+
+ public ArrayList<TileEntitySolarHeater> mSolarHeaters = new ArrayList<TileEntitySolarHeater>();
+
public GregtechMetaTileEntity_SolarTower(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
}
public GregtechMetaTileEntity_SolarTower(final String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
}
@Override
@@ -58,14 +67,326 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4);
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Contributing Green Energy towards the future")
+ .addInfo("Input: "+MISC_MATERIALS.SOLAR_SALT_COLD.getLocalizedName())
+ .addInfo("Output: "+MISC_MATERIALS.SOLAR_SALT_HOT.getLocalizedName())
+ .addInfo("Surround with rings of Solar Heaters")
+ .addInfo("Each ring increases tier")
+ .addInfo("1 = 1, 2 = 2, 3 = 4, 4 = 8, 5 = 16")
+ .addInfo("Tier decreases heating time and allows more salt to be processed")
+ .addSeparator()
+ .beginStructureBlock(6, 27, 6, false)
+ .addController("Top Middle")
+ .addCasingInfo("Structural Solar Casing", 229)
+ .addCasingInfo("Thermally Insulated Casing", 60)
+ .addCasingInfo("Salt Containment Casing", 66)
+ .addCasingInfo("Thermal Containment Casing", 60)
+ .addInputHatch("Any 2 dot hint(min 1)", 2)
+ .addOutputHatch("Any 2 dot hint(min 1)", 2)
+ .addMaintenanceHatch("Any 2 dot hint", 2)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ private static final String STRUCTURE_PIECE_BASE = "base";
+ private static final String STRUCTURE_PIECE_TOWER = "tower";
+ private static final String STRUCTURE_PIECE_TOP = "top";
+
+ private static final String SOLAR_HEATER_RING_1 = "ring1";
+ private static final String SOLAR_HEATER_RING_2 = "ring2";
+ private static final String SOLAR_HEATER_RING_3 = "ring3";
+ private static final String SOLAR_HEATER_RING_4 = "ring4";
+ private static final String SOLAR_HEATER_RING_5 = "ring5";
+
+ private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>>() {
+ @Override
+ protected IStructureDefinition<GregtechMetaTileEntity_SolarTower> computeValue(Class<?> type) {
+ return StructureDefinition.<GregtechMetaTileEntity_SolarTower>builder()
+
+ // s = salt
+ // c = thermal containment
+ // i = thermal insulated
+ // t = solar structural
+ // h = hatch
+ // g = solar heater
+
+ .addShape(STRUCTURE_PIECE_TOP, (new String[][]{
+ {" ", " ", " ~ ", " ", " "},
+ {" ", " s ", " sss ", " s ", " "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ {" c ", " ccc ", "ccscc", " ccc ", " c "},
+ }))
+ .addShape(STRUCTURE_PIECE_TOWER, (new String[][]{
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ {" i ", "isi", " i "},
+ }))
+ .addShape(STRUCTURE_PIECE_BASE, (new String[][]{
+ {" ", " ", " t ", " ttt ", " ttstt ", " ttssstt ", " ttstt ", " ttt ", " t ", " ", " "},
+ {" ", " ", " t ", " ttt ", " tssst ", " ttssstt ", " tssst ", " ttt ", " t ", " ", " "},
+ {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "},
+ {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "},
+ {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "htttsssttth", "htttsssttth", "htttsssttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "},
+ {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "httttttttth", "httttttttth", "httttttttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "},
+ }))
+
+
+ .addShape(SOLAR_HEATER_RING_1, (new String[][]{
+ {
+ " ggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_2, (new String[][]{
+ {
+ " ggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_3, (new String[][]{
+ {
+ " ggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_4, (new String[][]{
+ {
+ " ggggggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggggggg ",
+ }}))
+ .addShape(SOLAR_HEATER_RING_5, (new String[][]{
+ {
+ " ggggggggggggggggggggg ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ "g g",
+ " g g ",
+ " g g ",
+ " g g ",
+ " g g ",
+ " ggggggggggggggggggggg ",
+ }}))
+
+ .addElement('g', lazy(t -> ofHatchAdder(GregtechMetaTileEntity_SolarTower::addSolarHeater, 0, 1)))
+ .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))
+ .addElement('i', lazy(t -> onElementPass(x -> ++x.mCasing2, ofBlock(t.getCasingBlock(), t.getCasingMeta2()))))
+ .addElement('s', lazy(t -> onElementPass(x -> ++x.mCasing3, ofBlock(t.getCasingBlock(), t.getCasingMeta3()))))
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing4, ofBlock(t.getCasingBlock2(), t.getCasingMeta4()))))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_SolarTower::addGenericHatch, t.getCasingTextureIndex(), 2),
+ onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta())))))
+
+
+ .build();
+ }
+ };
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ resetSolarHeaters();
+ this.mMaintenanceHatches.clear();
+ this.mInputHatches.clear();
+ this.mOutputHatches.clear();
+ mCasing1 = 0;
+ mCasing2 = 0;
+ mCasing3 = 0;
+ mCasing4 = 0;
+
+ boolean aStructureTop = checkPiece(STRUCTURE_PIECE_TOP, 2, 2, 0);
+ log("Top Check: "+aStructureTop);
+ boolean aStructureTower = checkPiece(STRUCTURE_PIECE_TOWER, 1, 1, -7);
+ log("Tower Check: "+aStructureTower);
+ boolean aStructureBase = checkPiece(STRUCTURE_PIECE_BASE, 5, 5, -22);
+ log("Base Check: "+aStructureBase);
+ boolean aCasingCount1 = mCasing1 >= 229;
+ boolean aCasingCount2 = mCasing2 == 60;
+ boolean aCasingCount3 = mCasing3 == 66;
+ boolean aCasingCount4 = mCasing4 == 60;
+ boolean aAllStructure = aStructureTop && aStructureTower && aStructureBase;
+ boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4;
+ if (!aAllCasings || !aAllStructure ||
+ mMaintenanceHatches.size() != 1 ||
+ mInputHatches.size() < 1 ||
+ mOutputHatches.size() < 1
+ ) {
+ log("Bad Hatches - Solar Heaters: "+mSolarHeaters.size()+
+ ", Maint: "+mMaintenanceHatches.size()+
+ ", Input Hatches: "+mInputHatches.size()+
+ ", Output Hatches: "+mOutputHatches.size()+
+ ", Top: "+aStructureTop+
+ ", Tower: "+aStructureTower+
+ ", Base: "+aStructureBase+
+ ", Casing Count: "+aCasingCount1+" | Found: "+mCasing1+
+ ", Casing Count: "+aCasingCount2+" | Found: "+mCasing2+
+ ", Casing Count: "+aCasingCount3+" | Found: "+mCasing3+
+ ", Casing Count: "+aCasingCount4+" | Found: "+mCasing4);
+ return false;
+ }
+ log("Built "+this.getLocalName()+" with "+mCasing1+" Structural Solar casings, "+mCasing2+" Thermally Insulated casings, "+mCasing3+" Salt Containment casings, "+mCasing4+" Thermal Containment casings.");
+ return aAllCasings && aAllStructure;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ // Tower
+ buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, 2, 0);
+ buildPiece(STRUCTURE_PIECE_TOWER, stackSize, hintsOnly, 1, 1, -7);
+ buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 5, 5, -22);
+
+ //Solar Heaters
+ if (stackSize.stackSize >= 1) {
+ buildPiece(SOLAR_HEATER_RING_1, stackSize, hintsOnly, 7, 7, -27);
+ if (stackSize.stackSize >= 2) {
+ buildPiece(SOLAR_HEATER_RING_2, stackSize, hintsOnly, 9, 9, -27);
+ if (stackSize.stackSize >= 3) {
+ buildPiece(SOLAR_HEATER_RING_3, stackSize, hintsOnly, 11, 11, -27);
+ if (stackSize.stackSize >= 4) {
+ buildPiece(SOLAR_HEATER_RING_4, stackSize, hintsOnly, 13, 13, -27);
+ if (stackSize.stackSize >= 5) {
+ buildPiece(SOLAR_HEATER_RING_5, stackSize, hintsOnly, 15, 15, -27);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_SolarTower> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
- return new String[]{
- "Contributing Green Energy towards the future",
- mCasingName+"s for the base of the tower",
- };
+ log("Bad Hatch");
+ return false;
}
@Override
@@ -76,10 +397,10 @@ extends GregtechMeta_MultiBlockBase {
@Override
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
if (aSide == 0 || aSide == 1) {
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6)),
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)),
new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)};
}
- return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6))};
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))};
}
@Override
@@ -97,68 +418,174 @@ extends GregtechMeta_MultiBlockBase {
return null;
}
- @Override
- public boolean isFacingValid(final byte aFacing) {
- return aFacing <= 1;
- }
-
- private Set<String> mCachedReflectors = new HashSet<String>();
-
- public Set<String> getConnectedSolarReflectors(){
- Set<String> mValidTilePositions = new HashSet<String>();
- IGregTechTileEntity tTileEntity;
- Map<String, BlockPos> mFastMap = new HashMap<String, BlockPos>();
- for (int x = -64; x <= 64; x++) {
- for (int z = -64; z <= 64; z++) {
- int aX, aY, aZ;
- aX = this.getBaseMetaTileEntity().getXCoord();
- aY = this.mHeight;
- aZ = this.getBaseMetaTileEntity().getZCoord();
- BlockPos b = new BlockPos(aX+x, aY, aZ+z, this.getBaseMetaTileEntity().getWorld());
-
- tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX + x, this.mHeight, aZ + z);
- if (tTileEntity == null) {
- continue;
- }
- else {
- Logger.INFO("Found Tile Entity at "+b.getLocationString());
- if (tTileEntity.getMetaTileEntity() instanceof TileEntitySolarHeater) {
- TileEntitySolarHeater mTile = (TileEntitySolarHeater) tTileEntity.getMetaTileEntity();
- if (mTile != null) {
- b = new BlockPos(tTileEntity.getXCoord(), tTileEntity.getYCoord(), tTileEntity.getZCoord(), tTileEntity.getWorld());
- if (!mTile.mHasTower || mTile.mSolarTower == null) {
- Logger.INFO("Found Solar Reflector, Injecting Data.");
- mTile.setSolarTower(b);
- }
- mFastMap.put(b.getUniqueIdentifier(), b);
- }
- }
- else {
- continue;
- }
- }
+ private int getHeaterTier() {
+ int aSolarHeaterCounter = this.mSolarHeaters.size();
+ if (aSolarHeaterCounter > 0) {
+ if (aSolarHeaterCounter == 36) {
+ return 1;
+ }
+ else if (aSolarHeaterCounter == 88) {
+ return 2;
+ }
+ else if (aSolarHeaterCounter == 156) {
+ return 4;
+ }
+ else if (aSolarHeaterCounter == 240) {
+ return 8;
+ }
+ else if (aSolarHeaterCounter == 340) {
+ return 16;
+ }
+ }
+ return 0;
+ }
+
+ private int getHeaterCountForTier(int aTier) {
+ switch (aTier) {
+ case 1:
+ return 36;
+ case 2:
+ return 88;
+ case 4:
+ return 156;
+ case 8:
+ return 240;
+ case 16:
+ return 340;
+ default:
+ return 0;
+ }
+ }
- if (addToMachineList(tTileEntity, mCasingTextureID)) {
- continue;
- }
- }
+ public boolean getConnectedSolarReflectors(){
+
+ this.mSolarHeaters.clear();
+ int aRing = 1;
+
+ if (this.mSolarHeaters.size() < 36) {
+ // 15x15
+ boolean aRing1 = checkPiece(SOLAR_HEATER_RING_1, 7, 7, -27);
+ if (aRing1) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 88) {
+ // 17x17
+ boolean aRing2 = checkPiece(SOLAR_HEATER_RING_2, 9, 9, -27);
+ if (aRing2) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
}
+ if (this.mSolarHeaters.size() < 156) {
+ // 19x19
+ boolean aRing3 = checkPiece(SOLAR_HEATER_RING_3, 11, 11, -27);
+ if (aRing3) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 240) {
+ // 21x21
+ boolean aRing4 = checkPiece(SOLAR_HEATER_RING_4, 13, 13, -27);
+ if (aRing4) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ if (this.mSolarHeaters.size() < 340) {
+ // 23x23
+ boolean aRing5 = checkPiece(SOLAR_HEATER_RING_5, 15, 15, -27);
+ if (aRing5) {
+ //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size());
+ }
+ }
+ return mSolarHeaters.size() > 0;
+ }
- for (BlockPos p : mFastMap.values()) {
- if (mValidTilePositions.add(p.getUniqueIdentifier()));
+ private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof TileEntitySolarHeater) {
+ TileEntitySolarHeater mTile = (TileEntitySolarHeater) aMetaTileEntity;
+ if (mTile != null) {
+ if (!mTile.hasSolarTower() && mTile.canSeeSky()) {
+ //Logger.INFO("Found Solar Reflector, Injecting Data.");
+ mTile.setSolarTower(this);
+ return this.mSolarHeaters.add(mTile);
+ }
+ }
+ }
}
- mCachedReflectors = mValidTilePositions;
- return mCachedReflectors;
+ return false;
}
+
+ private Fluid mColdSalt = null;
+ private Fluid mHotSalt = null;
@Override
- public boolean checkRecipe(final ItemStack aStack) {
- //this.mEfficiencyIncrease = 100;
- //this.mMaxProgresstime = 100;
- //this.mEUt = -4;
+ public boolean checkRecipe(final ItemStack aStack) {
+ this.mEfficiencyIncrease = 10;
+ this.mMaxProgresstime = 100;
+
+ if (this.mSolarHeaters.isEmpty() || this.mSolarHeaters.size() < 340 || this.getTotalRuntimeInTicks() % 200 == 0) {
+ getConnectedSolarReflectors();
+ }
+
+ int aTier = getHeaterTier();
+ int aHeaters = getHeaterCountForTier(aTier);
+
+ //Manage Heat every 5s
+ //Add Heat First, if sources available
+ if (aHeaters > 0) {
+ for (int i = 0; i < aHeaters; i++) {
+ Math.min((this.mHeatLevel += aTier), 20000);
+ }
+ }
+
+ //Remove Heat, based on time of day
+ if (mHeatLevel > 0) {
+ if (mHeatLevel > 20000) {
+ this.mHeatLevel = 20000;
+ }
+ }
+ World w = this.getBaseMetaTileEntity().getWorld();
+ if (w != null) {
+ int aRemovalFactor = 0;
+ if (w.isDaytime()) {
+ aRemovalFactor = 1;
+ }
+ else {
+ aRemovalFactor = 8;
+ }
+ for (int i = 0; i<MathUtils.randInt((aHeaters/10), aHeaters); i++){
+ this.mHeatLevel -= aRemovalFactor;
+ }
+ }
+
+ if (this.mEfficiency == this.getMaxEfficiency(null) && this.mHeatLevel >= 10000) {
+ if (mColdSalt == null) {
+ mColdSalt = MISC_MATERIALS.SOLAR_SALT_COLD.getFluid();
+ }
+ if (mHotSalt == null) {
+ mHotSalt = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid();
+ }
+ ArrayList<FluidStack> aFluids = this.getStoredFluids();
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.getFluid().equals(mColdSalt)) {
+ if (aFluid.amount >= (aTier * 1000)) {
+ this.depleteInput(FluidUtils.getFluidStack(mColdSalt, (aTier * 1000)));
+ this.addOutput(FluidUtils.getFluidStack(mHotSalt, (aTier * 1000)));
+ break;
+ }
+ }
+ }
+ }
+
+
return true;
}
-
+
@Override
public int getMaxParallelRecipes() {
return 1;
@@ -175,27 +602,6 @@ extends GregtechMeta_MultiBlockBase {
}
@Override
- public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- this.mHeight = 0;
- for (int i = 0; i <= 19; i++) {
- if (!checkLayer(i)) {
- Logger.INFO("Invalid Structure on Y level "+i);
- return false;
- }
- }
- if (mMaintenanceHatches.size() != 1) {
- Logger.INFO("Bad Hatches");
- return false;
- }
-
- this.mHeight = this.getBaseMetaTileEntity().getYCoord() - 19;
- Logger.INFO("Built Structure");
- if (!aBaseMetaTileEntity.getWorld().isRemote)
- getConnectedSolarReflectors();
- return true;
- }
-
- @Override
public int getMaxEfficiency(final ItemStack aStack) {
return 10000;
}
@@ -216,36 +622,29 @@ extends GregtechMeta_MultiBlockBase {
}
public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
+ return ModBlocks.blockSpecialMultiCasings;
}
+ public Block getCasingBlock2() {
+ return ModBlocks.blockCasings2Misc;
+ }
public byte getCasingMeta() {
- return 4;
+ return 6;
}
public byte getCasingMeta2() {
- return 5;
+ return 8;
}
public byte getCasingMeta3() {
- return 6;
+ return 7;
}
- public boolean isValidCasingBlock(Block aBlock, int aMeta) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- return true;
- }
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- return true;
- }
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- return true;
- }
- Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta);
- return false;
+ public byte getCasingMeta4() {
+ return 11;
}
public byte getCasingTextureIndex() {
@@ -254,7 +653,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (this.mHeight > 3) {}
+
}
@@ -262,441 +661,48 @@ extends GregtechMeta_MultiBlockBase {
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- aNBT.setInteger("mHeight", mHeight);
aNBT.setInteger("mHeatLevel", mHeatLevel);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- mHeight = aNBT.getInteger("mHeight");
mHeatLevel = aNBT.getInteger("mHeatLevel");
}
- public boolean checkLayer(int aY) {
- if (aY >= 0 && aY <= 6) {
- return checkTopLayers(-aY);
- }
- if (aY >= 7 && aY <= 16) {
- return checkTowerLayer(-aY);
- }
- else if (aY >= 17 && aY <= 19) {
- return checkBaseLayer(-aY);
- }
- Logger.INFO("Bad Y level to check");
- return false;
- }
-
- public boolean checkTopLayers(int aY) {
- Block aBlock;
- int aMeta;
-
- if (aY == 0) {
- return true;
- } else if (aY == -1) {
- for (int x = -1; x <= 1; x++) {
- for (int z = -1; z <= 1; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- } else if (aY == -2 || aY == -6) {
- for (int x = -2; x <= 2; x++) {
- for (int z = -2; z <= 2; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- //Edge Casing
- if (x == -2 || x == 2 || z == -2 || z == 2) {
- //Edge Corners
- if ((x == 2 || x == -2) && (z == 2 | z == -2)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else {
- //Edge Sides
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
-
- //Internal
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- //Top Layers 7x7
- else if (aY == -3 || aY == -5) {
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- //Edge Casing
- if (x == -3 || x == 3 || z == -3 || z == 3) {
-
- //3, 3
- //2, 3
- //3, 2
-
- //Air Spacing
- if (x == 3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (x == -3 && (z == -3 || z == -2 || z == 2 || z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (z == 3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else if (z == -3 && (x == -3 || x == -2 || x == 2 || x == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- else {
- continue;
- }
- }
- else {
- //Edge Sides
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- else if ((x == -2 || x == 2) & (z == -2 || z == 2)) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- //Internal
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- //Midle Top Layer 9x9
- else if (aY == -4) {
- //Check Inner 5x5
- for (int x = -2; x <= 2; x++) {
- for (int z = -2; z <= 2; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, z) != getCasingBlock() && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z) != getCasingMeta2()) {
- Logger.INFO("Error at offset: X:" + x + ", Y:" + aY + ", Z:" + z);
- return false;
- }
- else {
- continue;
- }
- }
- }
- //Check Pos Sides
- for (int z = -1; z <= -1; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta2()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
-
- }
- for (int x = -1; x <= -1; x++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta2()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
-
- //Corner Casings
- for (int z = -2; z <= -2; z++) {
- if (z == -2 || z == 2) {
- if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("2 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
- }
- }
- for (int x = -2; x <= -2; x++) {
- if (x == -2 || x == 2) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("2 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
- }
- //Check Sides Casings
- for (int z = -1; z <= -1; z++) {
- if (getBaseMetaTileEntity().getBlockOffset(4, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(4, aY, z) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(-4, aY, z) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(-4, aY, z) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z);
- return false;
- }
-
- }
- for (int x = -1; x <= -1; x++) {
- if (getBaseMetaTileEntity().getBlockOffset(x, aY, 4) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 4) == getCasingMeta3()) {
- continue;
- } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -4) == getCasingBlock()
- && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -4) == getCasingMeta3()) {
- continue;
- } else {
- Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3");
- return false;
- }
- }
- }
- return true;
- }
-
- public boolean checkTowerLayer(int aY) {
- Block aBlock;
- int aMeta;
- for (int x = -1; x <= 1; x++) {
- for (int z = -1; z <= 1; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- if (x == -1 || x == 1 || z == -1 || z == 1) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Externally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- } else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- return true;
- }
-
- public boolean checkBaseLayer(int aY) {
- Block aBlock;
- int aMeta;
-
- int requiredMeta = getCasingMeta2();
- if (aY == -19) {
- requiredMeta = getCasingMeta();
- }
-
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
-
- if ((x == 3 && z == 3) || (x == 2 && z == 2) || (x == 3 && z == 2) || (x == 2 && z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == -3 && z == -3) || (x == -2 && z == -2) || (x == -3 && z == -2) || (x == -2 && z == -3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == -3 && z == 3) || (x == -2 && z == 2) || (x == -3 && z == 2) || (x == -2 && z == 3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else if ((x == 3 && z == -3) || (x == 2 && z == -2) || (x == 3 && z == -2) || (x == 2 && z == -3)) {
- if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- return false;
- }
- }
- else {
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (addToMachineList(tTileEntity, mCasingTextureID)) {
- continue;
- }
- if (x == 0 && z == 0) {
- if (aBlock == getCasingBlock() && aMeta == requiredMeta) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- else {
- if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) {
- continue;
- } else {
- Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z);
- Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta);
- return false;
- }
- }
- }
- }
- }
- return true;
- }
-
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
-
- //Add Heat every second
- if (aTick % 20 == 0) {
-
- //Add Heat First, if sources available
- int aCacheSize = this.mCachedReflectors.size();
- if (aCacheSize > 0) {
- int aCount = aCacheSize;
- for (int i = 0; i < aCount; i++) {
- this.mHeatLevel++;
- }
- }
-
- //Remove Heat, based on time of day
- World w = this.getBaseMetaTileEntity().getWorld();
- if (w != null) {
- int aRemovalFactor = 0;
- if (w.isDaytime()) {
- aRemovalFactor = 1;
- }
- else {
- aRemovalFactor = 3;
- }
- for (int i = 0; i<MathUtils.randInt((aCacheSize/10), (aCacheSize*10)); i++){
- this.mHeatLevel -= aRemovalFactor;
- }
- }
- }
}
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- if (this.mCachedReflectors.isEmpty()) {
- if (aTick % (30*20) == 0) {
- this.getConnectedSolarReflectors();
- }
- }
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
}
@Override
public void onRemoval() {
- this.mCachedReflectors.clear();
+ resetSolarHeaters();
super.onRemoval();
}
+ private void resetSolarHeaters() {
+ for (TileEntitySolarHeater aTile : this.mSolarHeaters) {
+ aTile.clearSolarTower();
+ }
+ this.mSolarHeaters.clear();
+ }
+
@Override
public String[] getExtraInfoData() {
return new String[] {
"Internal Heat Level: "+this.mHeatLevel,
- "Connected Solar Reflectors: "+this.mCachedReflectors.size()
+ "Connected Solar Reflectors: "+this.mSolarHeaters.size()
};
}
-
-
-
-
-
-
-
-
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
index 4759457d8d..d3db328bd4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java
@@ -42,7 +42,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase {
+public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase<GregtechMTE_AlgaePondBase> {
private int mLevel = -1;
private int mCasing;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index 4a01809ac7..daad2f50da 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -585,7 +585,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
public boolean checkRecipeGeneric(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
- int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isOC) {
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
// Based on the Processing Array. A bit overkill, but very flexible.
@@ -609,7 +609,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
}
// checks if it has a catalyst
- ItemStack tCatalystRecipe = findCatalyst(aItemInputs);
+ ItemStack tCatalystRecipe = null;
boolean aDoesRecipeNeedCatalyst = false;
for (ItemStack aInputItem : tRecipe.mInputs) {
if (ItemUtils.isCatalyst(aInputItem)) {
@@ -618,6 +618,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
}
}
if (aDoesRecipeNeedCatalyst) {
+ tCatalystRecipe = findCatalyst(aItemInputs, tRecipe.mInputs);
if (tCatalystRecipe == null) {
log("does not have catalyst");
return false;
@@ -959,12 +960,16 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt
return allowedParallel;
}
- private ItemStack findCatalyst(ItemStack[] aItemInputs) {
+ private ItemStack findCatalyst(ItemStack[] aItemInputs, ItemStack[] aRecipeInputs) {
if (aItemInputs != null) {
for (final ItemStack aInput : aItemInputs) {
if (aInput != null) {
if (ItemUtils.isCatalyst(aInput)) {
- return aInput;
+ for (ItemStack aRecipeInput : aRecipeInputs) {
+ if (GT_Utility.areStacksEqual(aRecipeInput, aInput, true)) {
+ return aInput;
+ }
+ }
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java
new file mode 100644
index 0000000000..6221dba89d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java
@@ -0,0 +1,170 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import static gtPlusPlus.core.lib.CORE.RANDOM;
+
+import java.util.ArrayList;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+@SuppressWarnings("deprecation")
+public class GT_MTE_LargeTurbine_Gas extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ public GT_MTE_LargeTurbine_Gas(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+
+ public GT_MTE_LargeTurbine_Gas(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_Gas(mName);
+ }
+
+ @Override
+ public int getCasingMeta() {
+ return 3;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 58;
+ }
+
+
+ @Override
+ protected boolean requiresOutputHatch() {
+ return false;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return 5000;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return 0;
+ }
+ GT_Recipe tFuel = GT_Recipe_Map.sTurbineFuels.findFuel(aLiquid);
+ if (tFuel != null) {
+ return tFuel.mSpecialValue;
+ }
+ return 0;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if (aFluids.size() >= 1) {
+ int tEU = 0;
+ int actualOptimalFlow = 0;
+
+ FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
+ int fuelValue = getFuelValue(firstFuelType);
+ //log("Fuel Value of "+aFluids.get(0).getLocalizedName()+" is "+fuelValue+"eu");
+ if (aOptFlow < fuelValue) {
+ // turbine too weak and/or fuel too powerful
+ // at least consume 1L
+ this.realOptFlow = 1;
+ // wastes the extra fuel and generate aOptFlow directly
+ depleteInput(new FluidStack(firstFuelType, 1));
+ this.storedFluid += 1;
+ return GT_Utility.safeInt((long) aOptFlow * (long) aBaseEff / 10000L);
+ }
+
+ actualOptimalFlow = GT_Utility.safeInt((long) aOptFlow / fuelValue);
+ this.realOptFlow = actualOptimalFlow;
+
+ int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ int flow = 0;
+ int totalFlow = 0;
+
+ storedFluid = 0;
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.isFluidEqual(firstFuelType)) {
+ flow = Math.min(aFluid.amount, remainingFlow); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluid, flow)); // deplete that amount
+ this.storedFluid += aFluid.amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ }
+ }
+ if (totalFlow <= 0) return 0;
+ tEU = GT_Utility.safeInt((long) totalFlow * fuelValue);
+
+ //log("Total Flow: "+totalFlow);
+ //log("Real Optimal Flow: "+actualOptimalFlow);
+ //log("Flow: "+flow);
+ //log("Remaining Flow: "+remainingFlow);
+
+ if (totalFlow == actualOptimalFlow) {
+ tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L);
+ } else {
+ float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow);
+ tEU *= efficiency;
+ tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L);
+ }
+
+ return tEU;
+
+ }
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return (RANDOM.nextInt(4) == 0) ? 0 : 1;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Gas Turbine";
+ }
+
+ @Override
+ protected String getTurbineType() {
+ return "Gas";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Gas Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java
new file mode 100644
index 0000000000..20a8d7e964
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java
@@ -0,0 +1,262 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+
+import java.util.ArrayList;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+@SuppressWarnings("deprecation")
+public class GT_MTE_LargeTurbine_Plasma extends GregtechMetaTileEntity_LargerTurbineBase {
+
+ public GT_MTE_LargeTurbine_Plasma(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+
+ public GT_MTE_LargeTurbine_Plasma(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MTE_LargeTurbine_Plasma(mName);
+ }
+
+ @Override
+ public int getCasingMeta() {
+ return 4;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 60;
+ }
+
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
+ @Override
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid == null) {
+ return 0;
+ }
+ GT_Recipe tFuel = GT_Recipe_Map.sPlasmaFuels.findFuel(aLiquid);
+ if (tFuel != null) {
+ return tFuel.mSpecialValue;
+ }
+ return 0;
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+
+ try {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies();
+ if (aEmptyTurbineRotorHatches.size() > 0) {
+ log("Found "+aEmptyTurbineRotorHatches.size()+" Assemblies without Turbine.");
+ ArrayList<ItemStack> aTurbines = getAllBufferedTurbines();
+ hatch : for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) {
+ for (ItemStack aTurbineItem : aTurbines) {
+ if (aTurbineItem == null) {
+ continue;
+ }
+ if (aTurbineItem != null && aHatch.insertTurbine(aTurbineItem.copy())) {
+ boolean aDidDeplete = depleteTurbineFromStock(aTurbineItem);
+ log("Put Turbine into Assembly - "+aDidDeplete);
+ continue hatch;
+ }
+ }
+ }
+ }
+ //log("Found "+getFullTurbineAssemblies().size()+" Assemblies with a Turbine.");
+
+ if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) {
+ log("BAD RETURN - 1");
+ stopMachine();
+ return false;
+ }
+
+ //log("Running checkRecipeGeneric(0)");
+
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+
+ if (tFluids.size() > 0) {
+ if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
+ || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
+ counter = 0;
+ float aTotalBaseEff = 0;
+ float aTotalOptimalFlow = 0;
+ ItemStack aStack = getFullTurbineAssemblies().get(0).getTurbine();
+ for (int i=0;i<18;i++) {
+ if (i == 0) {
+ aTotalBaseEff += GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ }
+ aTotalOptimalFlow += GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL,
+ ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
+ * 50));
+ }
+
+ baseEff = MathUtils.roundToClosestInt(aTotalBaseEff);
+ optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow);
+ if(optFlow<=0 || baseEff<=0){
+ log("Running checkRecipeGeneric(bad-1)");
+ stopMachine();//in case the turbine got removed
+ return false;
+ }
+ } else {
+ counter++;
+ }
+ }
+
+ // How much the turbine should be producing with this flow
+ int newPower = fluidIntoPower(tFluids, optFlow, baseEff);
+ int difference = newPower - this.mEUt; // difference between current output and new output
+
+ // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
+ // This is how much the turbine can actually change during this tick
+ int maxChangeAllowed = Math.max(200, GT_Utility.safeInt((long) Math.abs(difference) / 5));
+
+ if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
+ int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
+ this.mEUt += change; // Apply the change
+ }
+ else {
+ this.mEUt = newPower;
+ }
+ if (this.mEUt <= 0) {
+ this.mEUt=0;
+ this.mEfficiency=0;
+ log("Running checkRecipeGeneric(bad-2)");
+ return false;
+ } else {
+ this.mMaxProgresstime = 20;
+ this.mEfficiencyIncrease = 200;
+ // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here.
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ //log("GOOD RETURN - Making: "+this.mEUt+" EU/t");
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ return false;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+ if (aFluids.size() >= 1) {
+ aOptFlow *= 800;//CHANGED THINGS HERE, check recipe runs once per 20 ticks
+ int tEU = 0;
+
+ int actualOptimalFlow = 0;
+
+ FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
+ int fuelValue = getFuelValue(firstFuelType);
+ actualOptimalFlow = GT_Utility.safeInt((long) Math.ceil((double) aOptFlow / (double) fuelValue));
+ this.realOptFlow = actualOptimalFlow; // For scanner info
+
+ int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
+ int flow = 0;
+ int totalFlow = 0;
+
+ storedFluid = 0;
+ for (FluidStack aFluid : aFluids) {
+ if (aFluid.isFluidEqual(firstFuelType)) {
+ flow = Math.min(aFluid.amount, remainingFlow); // try to use up w/o exceeding remainingFlow
+ depleteInput(new FluidStack(aFluid, flow)); // deplete that amount
+ this.storedFluid += aFluid.amount;
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ }
+ }
+ String fn = FluidRegistry.getFluidName(firstFuelType);
+ String[] nameSegments = fn.split("\\.", 2);
+ if (nameSegments.length == 2) {
+ String outputName = nameSegments[1];
+ FluidStack output = FluidRegistry.getFluidStack(outputName, totalFlow);
+ if (output == null) {
+ output = FluidRegistry.getFluidStack("molten." + outputName, totalFlow);
+ }
+ if (output != null) {
+ addOutput(output);
+ }
+ }
+ if (totalFlow <= 0) return 0;
+ tEU = GT_Utility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow));
+
+ //GT_FML_LOGGER.info(totalFlow+" : "+fuelValue+" : "+aOptFlow+" : "+actualOptimalFlow+" : "+tEU);
+
+ if (totalFlow == actualOptimalFlow) {
+ tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU));
+ } else {
+ double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow);
+
+ tEU = (int) (tEU * efficiency);
+ tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU));
+ }
+
+ return tEU;
+
+ }
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Large Plasma Turbine";
+ }
+
+
+ @Override
+ protected String getTurbineType() {
+ return "Plasma";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Plasma Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
index f52f02b5de..d1e3e35938 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java
@@ -1,23 +1,22 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
import java.util.ArrayList;
import gregtech.GT_Mod;
+import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
+@SuppressWarnings("deprecation")
public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTurbineBase {
public boolean achievement = false;
@@ -31,36 +30,14 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
super(aName);
}
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 9);
- }
- return new String[]{
- "Controller Block for the XL High Pressure Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Superheated Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Steam (Side centered)",
- mCasingName+"s for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
- }
-
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MTE_LargeTurbine_SHSteam(mName);
}
@Override
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
- }
-
- @Override
- public byte getCasingMeta() {
- return 9;
+ public int getCasingMeta() {
+ return 2;
}
@Override
@@ -68,11 +45,21 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return 59;
}
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
@Override
- public int getPollutionPerTick(ItemStack aStack) {
+ public int getPollutionPerSecond(ItemStack aStack) {
return 0;
}
+ @Override
+ public int getFuelValue(FluidStack aLiquid) {
+ return 0;
+ }
+
@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
if(looseFit) {
@@ -142,11 +129,9 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return (looseFit && CORE.RANDOM.nextInt(4)==0)?0:1;
}
- @Override
- public String[] getExtraInfoData() {
- super.looseFit = looseFit;
- return super.getInfoData();
- }
+ public boolean isLooseMode() {
+ return looseFit;
+ }
@Override
public void saveNBTData(NBTTagCompound aNBT) {
@@ -161,11 +146,6 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
}
@Override
- public boolean hasSlotInGUI() {
- return true;
- }
-
- @Override
public String getCustomGUIResourceName() {
return null;
}
@@ -175,5 +155,24 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu
return "Large Super-heated Steam Turbine";
}
+ @Override
+ protected String getTurbineType() {
+ return "Super-heated Steam";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced HP Steam Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5);
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
index 2e6f6149e7..f285d3e8de 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java
@@ -1,4 +1,3 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
import static gtPlusPlus.core.lib.CORE.RANDOM;
@@ -6,19 +5,19 @@ import static gtPlusPlus.core.lib.CORE.RANDOM;
import java.util.ArrayList;
import gregtech.GT_Mod;
+import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
+@SuppressWarnings("deprecation")
public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurbineBase {
private float water;
@@ -34,36 +33,14 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
super(aName);
}
- public String[] getTooltip() {
- if (mCasingName.toLowerCase().contains(".name")) {
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 8);
- }
- return new String[]{
- "Controller Block for the XL Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Distilled Water (Side centered)",
- mCasingName+"s for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
- }
-
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MTE_LargeTurbine_Steam(mName);
}
@Override
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
- }
-
- @Override
- public byte getCasingMeta() {
- return 8;
+ public int getCasingMeta() {
+ return 1;
}
@Override
@@ -71,8 +48,13 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
return 16;
}
+ @Override
+ protected boolean requiresOutputHatch() {
+ return true;
+ }
+
@Override
- public int getPollutionPerTick(ItemStack aStack) {
+ public int getPollutionPerSecond(ItemStack aStack) {
return 0;
}
@@ -82,6 +64,10 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
water = water - usage;
return usage;
}
+
+ public int getFuelValue(FluidStack aLiquid) {
+ return 0;
+ }
@Override
int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
@@ -149,13 +135,10 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
public int getDamageToComponent(ItemStack aStack) {
return (looseFit && RANDOM.nextInt(4)==0)?0:1;
}
-
-
- @Override
- public String[] getExtraInfoData() {
- super.looseFit = looseFit;
- return super.getInfoData();
- }
+
+ public boolean isLooseMode() {
+ return looseFit;
+ }
@Override
public void saveNBTData(NBTTagCompound aNBT) {
@@ -170,12 +153,6 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
}
@Override
- public boolean hasSlotInGUI() {
- return true;
- }
-
-
- @Override
public String getCustomGUIResourceName() {
return null;
}
@@ -185,5 +162,24 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb
return "Large Steam Turbine";
}
+ @Override
+ protected String getTurbineType() {
+ return "Steam";
+ }
+
+ @Override
+ protected String getCasingName() {
+ return "Reinforced Steam Turbine Casing";
+ }
+
+ @Override
+ protected ITexture getTextureFrontFace() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5);
+ }
+
+ @Override
+ protected ITexture getTextureFrontFaceActive() {
+ return new GT_RenderedTexture(gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5);
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
index 9da724c6eb..4b2f60abd1 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java
@@ -1,10 +1,17 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+
import java.util.ArrayList;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.TAE;
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
@@ -13,374 +20,577 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gregtech.common.items.GT_MetaGenerated_Tool_01;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.core.util.sys.KeyboardUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
-import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler;
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.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
-public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase {
+public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_LargerTurbineBase> {
protected int baseEff = 0;
protected int optFlow = 0;
protected double realOptFlow = 0;
protected int storedFluid = 0;
protected int counter = 0;
- protected boolean looseFit=false;
+ protected int mCasing;
+
+ public ITexture frontFace;
+ public ITexture frontFaceActive;
+
+
+ public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
- private final int mCasingTextureID;
- public static String mCasingName;
-
- public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- mCasingTextureID = getTAE();
- GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
- GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
- frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
- frontFace = new GT_RenderedTexture(GT9_5);
-
+ frontFace = getTextureFrontFace();
+ frontFaceActive = getTextureFrontFaceActive();
+
}
public GregtechMetaTileEntity_LargerTurbineBase(String aName) {
super(aName);
- mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- mCasingTextureID = getTAE();
- GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4;
- GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4;
- frontFaceActive = new GT_RenderedTexture(GT9_5_Active);
- frontFace = new GT_RenderedTexture(GT9_5);
+ frontFace = getTextureFrontFace();
+ frontFaceActive = getTextureFrontFaceActive();
}
- public final int getTAE() {
- return TAE.getIndexFromPage(3, getCasingMeta());
- }
- public final String getCasingNaming() {
- return ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta());
- }
+ protected abstract ITexture getTextureFrontFace();
+
+ protected abstract ITexture getTextureFrontFaceActive();
+
+ protected abstract String getTurbineType();
+
+ protected abstract String getCasingName();
+
+ protected abstract boolean requiresOutputHatch();
@Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return getMaxEfficiency(aStack) > 0;
- }
+ protected final GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Controller Block for the XL "+getTurbineType()+" Turbine")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 9, 3, false)
+ .addController("Top Middle")
+ .addCasingInfo(getCasingName(), 360)
+ .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1)
+ .addInputBus("Any 4 dot hint (min 1)", 4)
+ .addInputHatch("Any 4 dot hint(min 1)", 4);
+ if (requiresOutputHatch()) {
+ tt.addOutputHatch("Any 4 dot hint(min 1)", 4);
+ }
+ tt.addDynamoHatch("Any 4 dot hint(min 1)", 4)
+ .addMaintenanceHatch("Any 4 dot hint(min 1)", 4);
+ if (requiresMufflers()) {
+ tt.addMufflerHatch("Any 7 dot hint (x4)", 7);
+ }
+ tt.toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ private static final String STRUCTURE_PIECE_MAIN = "main";
+ private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase>>() {
+ @Override
+ protected IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> computeValue(Class<?> type) {
+ return StructureDefinition.<GregtechMetaTileEntity_LargerTurbineBase>builder()
+ // c = turbine casing
+ // s = turbine shaft
+ // t = turbine housing
+ // h = dynamo/maint
+ // m = muffler
+ .addShape(STRUCTURE_PIECE_MAIN, (new String[][]{
+ {"ccchccc", "ccccccc", "ccmmmcc", "ccm~mcc", "ccmmmcc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ {"ctchctc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "cscccsc", "ctchctc"},
+ {"ccchccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccccccc", "ccchccc"},
+ }))
+
+ .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))
+ .addElement('s', lazy(t -> ofBlock(t.getCasingBlock(), t.getTurbineShaftMeta())))
+ .addElement('t', lazy(t -> ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addTurbineHatch, t.getCasingTextureIndex(), 1)))
+ .addElement('h', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addGenericHatch, t.getCasingTextureIndex(), 4),
+ onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta()))
+ )))
+ .addElement('m', lazy(t -> ofChain(
+ ofHatchAdder(GregtechMetaTileEntity_LargerTurbineBase::addMuffler, t.getCasingTextureIndex(), 7),
+ onElementPass(x -> ++x.mCasing, ofBlock(t.getCasingBlock(), t.getCasingMeta())))))
+ .build();
+ }
+ };
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_LargerTurbineBase> getStructureDefinition() {
+ return STRUCTURE_DEFINITION.get(getClass());
}
- @Override
- public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- return checkMachine2(aBaseMetaTileEntity, aStack);
+ private boolean requiresMufflers() {
+ return getPollutionPerSecond(null) > 0;
}
- public boolean checkMachine2(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- //9 high
- //7x7
-
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
this.mDynamoHatches.clear();
this.mTurbineRotorHatches.clear();
this.mMaintenanceHatches.clear();
- this.mMufflerHatches.clear();
+ if (requiresMufflers()) {
+ this.mMufflerHatches.clear();
+ }
+ this.mInputBusses.clear();
this.mInputHatches.clear();
- this.mOutputHatches.clear();
-
- for (int i=0;i>-9;i--) {
- if (!getLayer(i)) {
- Logger.INFO("Bad Layer: "+(+i));
- return false;
- }
- }
-
- Logger.INFO("Hatches | Found "+mTurbineRotorHatches.size()+" Rotor Assemblies, "+12+" are required.");
- Logger.INFO("Hatches | Found "+mMaintenanceHatches.size()+" Maint. hatches, "+1+" are required.");
- Logger.INFO("Hatches | Found "+mDynamoHatches.size()+" Dynamos, "+1+" or more are required.");
- Logger.INFO("Hatches | Found "+mMufflerHatches.size()+" Mufflers, "+4+" are required.");
- Logger.INFO("Hatches | Found "+mInputHatches.size()+" Input Hatches, "+1+" or more are required.");
- Logger.INFO("Hatches | Found "+mOutputHatches.size()+" Output Hatches, "+1+" ore more are required.");
-
- if (mTurbineRotorHatches.size() != 12 ||
+ if (requiresOutputHatch()) {
+ this.mOutputHatches.clear();
+ }
+ mCasing = 0;
+
+ boolean aStructure = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0);
+ boolean aCasingCount = mCasing >= 360;
+ log("Structure Check: "+aStructure);
+ if (!aCasingCount ||
+ mTurbineRotorHatches.size() != 12 ||
mMaintenanceHatches.size() != 1 ||
mDynamoHatches.size() < 1 ||
- mMufflerHatches.size() != 4 ||
+ (requiresMufflers() && mMufflerHatches.size() != 4) ||
+ mInputBusses.size() < 1 ||
mInputHatches.size() < 1 ||
- mOutputHatches.size() < 1
+ (requiresOutputHatch() && mOutputHatches.size() < 1)
) {
+ log("Bad Hatches - Turbine Housings: "+mTurbineRotorHatches.size()+
+ ", Maint: "+mMaintenanceHatches.size()+
+ ", Dynamo: "+mDynamoHatches.size()+
+ ", Muffler: "+mMufflerHatches.size()+
+ ", Input Buses: "+mInputBusses.size()+
+ ", Input Hatches: "+mInputHatches.size()+
+ ", Output Hatches: "+mOutputHatches.size()+
+ ", Casing Count: "+aCasingCount+" | Found: "+mCasing);
return false;
- }
- Logger.INFO("Built Structure");
- return true;
+ }
+ log("Built "+this.getLocalName()+" with "+mCasing+"/360 casings.");
+ return aCasingCount && aStructure;
}
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 3, 3, 0);
+ }
- public boolean getLayer(int aY) {
- if (aY == 0 || aY == -2 || aY == -3 || aY == -5 || aY == -6 || aY == -8) {
- return checkNormalLayer(aY);
+ public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
}
- else {
- return checkTurbineLayer(aY);
- }
- }
-
- public boolean checkNormalLayer(int aY) {
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
- IGregTechTileEntity tTileEntity;
-
- if (aY == 0 && x == 0 && z == 0) {
- continue;
- }
- else if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
- else if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- } else {
- if (tBlock != null) {
- log("Offset: "+x+", "+aY+", "+z);
- log("Found "+tBlock.getLocalizedName()+" with Meta "+tMeta);
- log("Expected "+getCasingBlock().getLocalizedName()+" with Meta "+getCasingMeta());
- }
- return false;
- }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
+ log("Found GT_MetaTileEntity_Hatch_Turbine");
+ updateTexture(aTileEntity, aBaseCasingIndex);
+ GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
+ IGregTechTileEntity g = this.getBaseMetaTileEntity();
+ if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) {
+ boolean aDidAdd = this.mTurbineRotorHatches.add(aTurbineHatch);
+ Logger.INFO("Injected Controller into Turbine Assembly. Found: "+this.mTurbineRotorHatches.size());
+ return aDidAdd;
+ }
+ else {
+ Logger.INFO("Failed to inject controller into Turbine Assembly Hatch.");
}
}
- return true;
+ log("Bad Turbine Housing");
+ return false;
}
-
- public boolean checkTurbineLayer(int aY) {
- if (!checkTurbineLayerX(aY)) {
- return checkTurbineLayerZ(aY);
+ public final boolean addMuffler(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
+ return false;
+ }
+
+ public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
else {
- return true;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
}
+ log("Bad Hatch");
+ return false;
}
- public boolean checkTurbineLayerX(int aY) {
- Logger.INFO("checking X");
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
- if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png");
+ }
+ public boolean isValidCasingBlock(Block aBlock, int aMeta) {
+ if (Block.isEqualTo(aBlock, getCasingBlock()) && aMeta == getCasingMeta()) {
+ return true;
+ }return false;
+ }
- if (x == -2 || x == 2) {
-
- //Find Hatches on the ends
- if (z == -3 || z == 3) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
- log("Found x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- continue;
- }
- else {
- log("Missing x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- }
- }
-
- if (isValidTurbineBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- else {
- if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- }
- }
+ public boolean isValidTurbineShaft(Block aBlock, int aMeta) {
+ if (aBlock == getCasingBlock() && aMeta == getTurbineShaftMeta()) {
+ return true;
+ }
+ return false;
+ }
+
+ public final Block getCasingBlock() {
+ return ModBlocks.blockSpecialMultiCasings;
+ }
+
+ @Override
+ public final boolean hasSlotInGUI() {
return true;
}
- public boolean checkTurbineLayerZ(int aY) {
- Logger.INFO("checking Z");
- Block tBlock;
- int tMeta;
- for (int x = -3; x <= 3; x++) {
- for (int z = -3; z <= 3; z++) {
- tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z);
- tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z);
-
- if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) ||
- ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) {
- Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName());
- continue;
- }
- }
+ public abstract int getCasingMeta();
- if (z == -2 || z == 2) {
-
- //Find Hatches on the ends
- if (x == -3 || x == 3) {
- IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z);
- if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) {
- log("Found z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- continue;
- }
- else {
- log("Missing z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z);
- }
- }
-
- if (isValidTurbineBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
+ public byte getTurbineShaftMeta() {
+ return 0;
+ }
+
+ public abstract byte getCasingTextureIndex();
+
+ public abstract int getFuelValue(FluidStack aLiquid);
+
+ public static boolean isValidTurbine(ItemStack aTurbine) {
+ return (aTurbine !=null && aTurbine.getItem() instanceof GT_MetaGenerated_Tool && aTurbine.getItemDamage() >= 170 && aTurbine.getItemDamage() <= 176);
+ }
+
+ protected ArrayList<ItemStack> getAllBufferedTurbines(){
+ ArrayList<ItemStack> aTurbinesInStorage = new ArrayList<ItemStack>();
+ for (GT_MetaTileEntity_Hatch_InputBus aBus: this.mInputBusses) {
+ if (isValidMetaTileEntity(aBus)) {
+ for (ItemStack aContent : aBus.mInventory) {
+ if (isValidTurbine(aContent)) {
+ aTurbinesInStorage.add(aContent);
}
}
- else {
- if (isValidCasingBlock(tBlock, tMeta)) {
- continue;
- }
- else {
- return false;
- }
- }
- }
- }
- return true;
- }
+ }
+ }
+ return aTurbinesInStorage;
+ }
- public boolean isValidCasingBlock(Block aBlock, int aMeta) {
- if (GregTech_API.sBlockMachines == aBlock) {
- return true;
+ public boolean areAllTurbinesTheSame() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineAssemblies = getFullTurbineAssemblies();
+ if (aTurbineAssemblies.size() < 12) {
+ log("Found "+aTurbineAssemblies.size()+", expected 12.");
+ return false;
}
- if (Block.isEqualTo(aBlock, getCasingBlock()) && (int) aMeta == (int) getCasingMeta()) {
- return true;
+ AutoMap<Materials> aTurbineMats = new AutoMap<Materials>();
+ AutoMap<Integer> aTurbineSizes = new AutoMap<Integer>();
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : aTurbineAssemblies) {
+ aTurbineMats.add(GT_MetaGenerated_Tool.getPrimaryMaterial(aHatch.getTurbine()));
+ aTurbineSizes.add(getTurbineSize(aHatch.getTurbine()));
}
- log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMeta());
- return false;
+ Materials aBaseMat = aTurbineMats.get(0);
+ int aBaseSize = aTurbineSizes.get(0);
+ for (int aSize : aTurbineSizes) {
+ if (aBaseSize != aSize) {
+ return false;
+ }
+ }
+ for (Materials aMat : aTurbineMats) {
+ if (aBaseMat != aMat) {
+ return false;
+ }
+ }
+ return true;
}
- public boolean isValidTurbineBlock(Block aBlock, int aMeta) {
- if (aBlock == getCasingBlock() && aMeta == getCasingMetaTurbine()) {
- return true;
+ public static int getTurbineSize(ItemStack aTurbine) {
+ if (isValidTurbine(aTurbine)) {
+ if (aTurbine.getItemDamage() >= 170 && aTurbine.getItemDamage() < 172) {
+ return 1;
+ }
+ else if (aTurbine.getItemDamage() >= 172 && aTurbine.getItemDamage() < 174) {
+ return 2;
+ }
+ else if (aTurbine.getItemDamage() >= 174 && aTurbine.getItemDamage() < 176) {
+ return 3;
+ }
+ else if (aTurbine.getItemDamage() >= 176 && aTurbine.getItemDamage() < 178) {
+ return 4;
+ }
}
- log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMetaTurbine());
- return false;
+ return 0;
}
- public Block getCasingBlock() {
- return ModBlocks.blockCasings4Misc;
+ public static String getTurbineSizeString(int aSize) {
+ switch (aSize) {
+ case 1:
+ return "Small Turbine";
+ case 2:
+ return "Turbine";
+ case 3:
+ return "Large Turbine";
+ case 4:
+ return "Huge Turbine";
+ default:
+ return "";
+ }
}
- public abstract byte getCasingMeta();
+ protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getEmptyTurbineAssemblies() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
+ //log("Checking "+mTurbineRotorHatches.size()+" Assemblies for empties.");
+ for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) {
+ if (!aTurbineHatch.hasTurbine()) {
+ //log("Found Assembly without Turbine.");
+ aEmptyTurbineRotorHatches.add(aTurbineHatch);
+ }
+ }
+ return aEmptyTurbineRotorHatches;
+ }
- public byte getCasingMetaTurbine() {
- return 7;
+ protected ArrayList<GT_MetaTileEntity_Hatch_Turbine> getFullTurbineAssemblies() {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>();
+ //log("Checking "+mTurbineRotorHatches.size()+" Assemblies for Turbines.");
+ for (GT_MetaTileEntity_Hatch_Turbine aTurbineHatch : this.mTurbineRotorHatches) {
+ if (aTurbineHatch.hasTurbine()) {
+ //log("Found Assembly with Turbine.");
+ aTurbineRotorHatches.add(aTurbineHatch);
+ }
+ }
+ return aTurbineRotorHatches;
}
- public abstract byte getCasingTextureIndex();
+ protected boolean depleteTurbineFromStock(ItemStack aTurbine) {
+ for (GT_MetaTileEntity_Hatch_InputBus aInputBus : this.mInputBusses) {
+ for (int slot = 0; slot < aInputBus.mInventory.length; slot++) {
+ ItemStack aStack = aInputBus.getStackInSlot(slot);
+ if (aStack != null && GT_Utility.areStacksEqual(aStack, aTurbine)) {
+ aInputBus.setInventorySlotContents(slot, null);
+ updateSlots();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
@Override
- public boolean checkRecipe(ItemStack aStack) {
- if((counter&7)==0 && (aStack==null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() >179)) {
- stopMachine();
- return false;
- }
- ArrayList<FluidStack> tFluids = getStoredFluids();
- if (tFluids.size() > 0) {
- if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
- || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
- counter = 0;
- baseEff = MathUtils.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
- optFlow = MathUtils.safeInt((long)Math.max(Float.MIN_NORMAL,
- ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
- * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
- * 50));
- if(optFlow<=0 || baseEff<=0){
- stopMachine();//in case the turbine got removed
- return false;
+ public boolean checkRecipe(final ItemStack aStack) {
+ return checkRecipeGeneric(new ItemStack[] {}, getStoredFluids().toArray(new FluidStack[] {}), 1, 100, 100, 10000);
+ }
+
+ public boolean checkRecipeGeneric(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) {
+
+ try {
+ ArrayList<GT_MetaTileEntity_Hatch_Turbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies();
+ if (aEmptyTurbineRotorHatches.size() > 0) {
+ log("Found "+aEmptyTurbineRotorHatches.size()+" Assemblies without Turbine.");
+ ArrayList<ItemStack> aTurbines = getAllBufferedTurbines();
+ hatch : for (GT_MetaTileEntity_Hatch_Turbine aHatch : aEmptyTurbineRotorHatches) {
+ for (ItemStack aTurbineItem : aTurbines) {
+ if (aTurbineItem == null) {
+ continue;
+ }
+ if (aTurbineItem != null && aHatch.insertTurbine(aTurbineItem.copy())) {
+ boolean aDidDeplete = depleteTurbineFromStock(aTurbineItem);
+ log("Put Turbine into Assembly - "+aDidDeplete);
+ continue hatch;
+ }
+ }
}
- } else {
- counter++;
}
- }
- else {
- Logger.INFO("Did not find any valid input fluids.");
- }
+ //log("Found "+getFullTurbineAssemblies().size()+" Assemblies with a Turbine.");
- int newPower = fluidIntoPower(tFluids, optFlow, baseEff); // How much the turbine should be producing with this flow
- int difference = newPower - this.mEUt; // difference between current output and new output
+ if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) {
+ log("BAD RETURN - 1");
+ stopMachine();
+ return false;
+ }
- // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
- // This is how much the turbine can actually change during this tick
- int maxChangeAllowed = Math.max(10, MathUtils.safeInt((long)Math.abs(difference)/100));
+ //log("Running checkRecipeGeneric(0)");
+
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+
+ if (tFluids.size() > 0) {
+ if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
+ || this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
+ counter = 0;
+
+ //log("Running checkRecipeGeneric(1)");
+ float aTotalBaseEff = 0;
+ float aTotalOptimalFlow = 0;
+
+ ItemStack aStack = getFullTurbineAssemblies().get(0).getTurbine();
+ for (int i=0;i<18;i++) {
+ if (i == 0) {
+ aTotalBaseEff += GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F));
+ //log("Bumped base eff to "+aTotalBaseEff);
+ }
+ aTotalOptimalFlow += GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL,
+ ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
+ * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed
+ * 50));
+ //log("Bumped base optimal flow to "+aTotalOptimalFlow);
+ }
- if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
- int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
- this.mEUt += change; // Apply the change
- } else {
- this.mEUt = newPower;
+ //log("Running checkRecipeGeneric(2)");
+ //log("Total base eff: "+aTotalBaseEff);
+ //log("Total base optimal flow: "+aTotalOptimalFlow);
+ baseEff = MathUtils.roundToClosestInt(aTotalBaseEff);
+ optFlow = MathUtils.roundToClosestInt(aTotalOptimalFlow);
+ //log("Total eff: "+baseEff);
+ //log("Total optimal flow: "+optFlow);
+ if(optFlow<=0 || baseEff<=0){
+ log("Running checkRecipeGeneric(bad-1)");
+ stopMachine();//in case the turbine got removed
+ return false;
+ }
+ } else {
+ counter++;
+ }
+ }
+
+ //log("Total eff: "+baseEff);
+ //log("Total optimal flow: "+optFlow);
+
+ // How much the turbine should be producing with this flow
+ int newPower = fluidIntoPower(tFluids, optFlow, baseEff);
+ //log("Bumped newPower to "+newPower);
+ //log("New Power: "+newPower);
+ int difference = newPower - this.mEUt; // difference between current output and new output
+ //log("diff: "+difference);
+
+ // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
+ // This is how much the turbine can actually change during this tick
+ int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.abs(difference)/100));
+ //log("Max Change Allowed: "+maxChangeAllowed);
+
+ if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
+ int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
+ this.mEUt += change; // Apply the change
+ //log("Applied power change.");
+ }
+ else {
+ this.mEUt = newPower;
+ //log("Using same value.");
+ }
+ if (this.mEUt <= 0) {
+ this.mEUt=0;
+ this.mEfficiency=0;
+ log("Running checkRecipeGeneric(bad-2)");
+ //stopMachine();
+ return false;
+ } else {
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 10;
+ // Overvoltage is handled inside the MultiBlockBase when pushing out to dynamos. no need to do it here.
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ //log("GOOD RETURN - Making: "+this.mEUt+" EU/t");
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
}
+ return false;
+ }
- if (this.mEUt <= 0) {
- //stopMachine();
- this.mEUt=0;
- this.mEfficiency=0;
+ public boolean doRandomMaintenanceDamage() {
+ if (getMaxParallelRecipes() == 0 || getRepairStatus() == 0) {
+ stopMachine();
return false;
- } else {
- this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = 10;
- if(this.mDynamoHatches.size()>0){
- for(GT_MetaTileEntity_Hatch dynamo:mDynamoHatches)
- if(isValidMetaTileEntity(dynamo) && dynamo.maxEUOutput() < mEUt)
- explodeMultiblock();
- }
- return true;
}
+ if (mRuntime++ > 1000) {
+ mRuntime = 0;
+ if (getBaseMetaTileEntity().getRandomNumber(6000) == 0) {
+ switch (getBaseMetaTileEntity().getRandomNumber(6)) {
+ case 0:
+ mWrench = false;
+ break;
+ case 1:
+ mScrewdriver = false;
+ break;
+ case 2:
+ mSoftHammer = false;
+ break;
+ case 3:
+ mHardHammer = false;
+ break;
+ case 4:
+ mSolderingTool = false;
+ break;
+ case 5:
+ mCrowbar = false;
+ break;
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : getFullTurbineAssemblies()) {
+ aHatch.damageTurbine(mEUt, damageFactorLow, damageFactorHigh);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (getFullTurbineAssemblies().size());
+ }
+
+ public boolean runRecipe(GT_MetaTileEntity_Hatch_Turbine aHatch) {
+ return false;
}
abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff);
@@ -391,19 +601,17 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
}
public int getMaxEfficiency(ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) {
- return 0;
- }
- if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) {
- return 10000;
- }
- return 0;
+ return this.getMaxParallelRecipes() == 12 ? 10000 : 0;
}
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return true;
}
+ public boolean isLooseMode() {
+ return false;
+ }
+
@Override
public String[] getExtraInfoData() {
int mPollutionReduction=0;
@@ -413,17 +621,20 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
}
}
- String tRunning = mMaxProgresstime>0 ?
-
+ String tRunning = mMaxProgresstime > 0 ?
EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET :
EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET;
+
String tMaintainance = getIdealStatus() == getRepairStatus() ?
EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ;
int tDura = 0;
- if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) {
- tDura = MathUtils.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1));
+ String aTurbineDamage = "";
+ for (GT_MetaTileEntity_Hatch_Turbine aHatch : this.getFullTurbineAssemblies()) {
+ ItemStack aTurbine = aHatch.getTurbine();
+ tDura = MathUtils.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(aTurbine) * (GT_MetaGenerated_Tool.getToolDamage(aTurbine))+1));
+ aTurbineDamage += EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"% | ";
}
long storedEnergy=0;
@@ -434,38 +645,23 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
}
}
- String[] ret = new String[]{
- // 8 Lines available for information panels
- tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", */
-/* 1 *//*
-
- tMaintainance, */
-/* 2 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%", */
-/* 2 *//*
- StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ */
-/* 3 *//*
-
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
- StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" + */
-/* 4 *//*
-
- EnumChatFormatting.YELLOW+" ("+(looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")", */
-/* 5 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L", */
-/* 6 *//*
-
- StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"%", */
-/* 7 *//*
-
- StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" */
-/* 8 *//*
+ boolean aIsSteam = this.getClass().getName().toLowerCase().contains("steam");
+ String[] ret = new String[]{
+ // 8 Lines available for information panels
+ tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t",
+ tMaintainance,
+ StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%",
+ StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" +
+ EnumChatFormatting.YELLOW+" ("+(isLooseMode()?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")",
+ StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L",
+ StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+aTurbineDamage,
+ StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
};
- if (!this.getClass().getName().contains("Steam"))
+ if (!aIsSteam)
ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+MathUtils.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t";
return ret;
@@ -479,19 +675,22 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
public boolean polluteEnvironment(int aPollutionLevel) {
- mPollution += aPollutionLevel;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- if (mPollution >= 1000) {
- if (tHatch.polluteEnvironment()) {
- mPollution -= 1000;
+ if (this.requiresMufflers()) {
+ mPollution += aPollutionLevel;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ if (mPollution >= 10000) {
+ if (PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10000)) {
+ mPollution -= 10000;
+ }
+ } else {
+ break;
}
- } else {
- break;
}
}
+ return mPollution < 10000;
}
- return mPollution < 1000;
+ return true;
}
@Override
public long maxAmperesOut() {
@@ -505,114 +704,65 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
//super.onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ);
}
else {
+ /*
this.mIsAnimated = Utils.invertBoolean(mIsAnimated);
if (this.mIsAnimated) {
- PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
}
else {
- PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
}
if (mTurbineRotorHatches.size() > 0) {
- for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) {
- if (h != null) {
- h.mUsingAnimation = mIsAnimated;
- }
+ for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) {
+ if (h != null) {
+ h.mUsingAnimation = mIsAnimated;
}
+ }
}
- }
+ */}
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mIsAnimated", mIsAnimated);
+ public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())};
}
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mIsAnimated = aNBT.getBoolean("mIsAnimated");
- }
-
- private boolean mIsAnimated = true;
- public ITexture frontFace;
- public ITexture frontFaceActive;
- private CustomIcon GT9_5_Active;
- private CustomIcon GT9_5;
-
- public boolean usingAnimations() {
- return mIsAnimated;
- }
-
- @Override
- public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.getCasingTextureForId(getTAE())};
- }
-
protected ITexture getFrontFacingTurbineTexture(boolean isActive) {
- if (usingAnimations()) {
- if (isActive) {
- return frontFaceActive;
- }
+ if (isActive) {
+ return frontFaceActive;
}
return frontFace;
}
-
- public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity,
- final int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) {
- log("Found GT_MetaTileEntity_Hatch_Turbine");
- updateTexture(aTileEntity, aBaseCasingIndex);
- GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity;
- IGregTechTileEntity g = this.getBaseMetaTileEntity();
- if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) {
- Logger.INFO("Injected Controller into Turbine Assembly.");
- return this.mTurbineRotorHatches.add(aTurbineHatch);
- }
- else {
- Logger.INFO("Failed to inject controller into Turbine Assembly Hatch.");
- }
- }
- return false;
- }
-
+
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide()) {
- if (mUpdate == 0 || this.mStartUpCheck == 0) {
+ if (mUpdate == 1 || mStartUpCheck == 1) {
+ log("Cleared Rotor Assemblies.");
this.mTurbineRotorHatches.clear();
}
- }
- if (aTick % 20 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.maxProgresstime() > 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) {
enableAllTurbineHatches();
}
-
+ if (this.maxProgresstime() <= 0) {
+ stopMachine();
+ }
+
}
@Override
public void startProcess() {
super.startProcess();
enableAllTurbineHatches();
}
- @Override
- public void onMachineBlockUpdate() {
- super.onMachineBlockUpdate();
- }
- @Override
- public boolean onRunningTick(ItemStack aStack) {
- return super.onRunningTick(aStack);
- }
+
@Override
public void stopMachine() {
- super.stopMachine();
+ baseEff = 0;
+ optFlow = 0;
disableAllTurbineHatches();
+ super.stopMachine();
}
@Override
public void onRemoval() {
@@ -630,7 +780,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
public boolean disableAllTurbineHatches() {
return updateTurbineHatches(false) > 0;
}
-
+
private Long mLastHatchUpdate;
public int updateTurbineHatches(boolean aState) {
int aUpdated = 0;
@@ -648,16 +798,97 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM
mLastHatchUpdate = System.currentTimeMillis()/1000;
return aUpdated;
}
-
- @Override
- public int getMaxParallelRecipes() {
- return 1;
- }
@Override
public int getEuDiscountForParallelism() {
return 0;
}
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ // Fix GT bug
+ if (this.getBaseMetaTileEntity().getFrontFacing() != 1) {
+ log("Fixing Bad Facing. (GT Bug)");
+ this.getBaseMetaTileEntity().setFrontFacing((byte) 1);
+ }
+ }
+
+ /**
+ * Called every tick the Machine runs
+ */
+ public boolean onRunningTick(ItemStack aStack) {
+ if (mEUt > 0) {
+ addEnergyOutput(((long) mEUt * mEfficiency) / 10000);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean addEnergyOutput(long aEU) {
+ if (aEU <= 0) {
+ return true;
+ }
+ if (this.mAllDynamoHatches.size() > 0) {
+ return addEnergyOutputMultipleDynamos(aEU, true);
+ }
+ return false;
+ }
+ public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) {
+ int injected = 0;
+ long totalOutput = 0;
+ long aFirstVoltageFound = -1;
+ boolean aFoundMixedDynamos = false;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if(aDynamo == null) {
+ return false;
+ }
+ if (isValidMetaTileEntity(aDynamo)) {
+ long aVoltage = aDynamo.maxEUOutput();
+ long aTotal = aDynamo.maxAmperesOut() * aVoltage;
+ // Check against voltage to check when hatch mixing
+ if (aFirstVoltageFound == -1) {
+ aFirstVoltageFound = aVoltage;
+ }
+ else {
+ if (aFirstVoltageFound != aVoltage) {
+ aFoundMixedDynamos = true;
+ }
+ }
+ totalOutput += aTotal;
+ }
+ }
+
+ if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) {
+ explodeMultiblock();
+ return false;
+ }
+
+ long leftToInject;
+ long aVoltage;
+ int aAmpsToInject;
+ int aRemainder;
+ int ampsOnCurrentHatch;
+ for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) {
+ if (isValidMetaTileEntity(aDynamo)) {
+ leftToInject = aEU - injected;
+ aVoltage = aDynamo.maxEUOutput();
+ aAmpsToInject = (int) (leftToInject / aVoltage);
+ aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage));
+ ampsOnCurrentHatch= (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject);
+ for (int i = 0; i < ampsOnCurrentHatch; i++) {
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false);
+ }
+ injected+=aVoltage*ampsOnCurrentHatch;
+ if(aRemainder>0 && ampsOnCurrentHatch<aDynamo.maxAmperesOut()){
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false);
+ injected+=aRemainder;
+ }
+ }
+ }
+ return injected > 0;
+ }
+
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
index 78adb094ed..344b7f710a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
@@ -14,8 +14,7 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -57,6 +56,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
}
protected long mAverageEuUsage = 0;
+ protected long mAverageEuAdded = 0;
+ protected long mAverageEuConsumed = 0;
protected long mTotalEnergyAdded = 0;
protected long mTotalEnergyConsumed = 0;
protected long mTotalEnergyLost = 0;
@@ -87,7 +88,6 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
protected GT_Multiblock_Tooltip_Builder createTooltip() {
GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType(getMachineType())
- .addInfo("[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)")
.addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches")
.addInfo("Does not require maintenance")
.addInfo("Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "")
@@ -128,7 +128,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (mBatteryCapacity <= 0) return false;
+ //if (mBatteryCapacity <= 0) return false;
if (!aBaseMetaTileEntity.isClientSide()) {
aBaseMetaTileEntity.openGUI(aPlayer);
}
@@ -194,7 +194,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
public static int getMaxHatchTier(int aCellTier) {
switch(aCellTier) {
case 9:
- return CORE.GTNH ? 15 : 9;
+ return GT_Values.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9;
default:
if (aCellTier < 4) {
return 0;
@@ -476,6 +476,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setLong("mAverageEuUsage", this.mAverageEuUsage);
+ aNBT.setLong("mAverageEuAdded", this.mAverageEuAdded);
+ aNBT.setLong("mAverageEuConsumed", this.mAverageEuConsumed);
//Usage Stats
aNBT.setLong("mTotalEnergyAdded", this.mTotalEnergyAdded);
@@ -493,7 +495,13 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
// Best not to get a long if the Tag Map is holding an int
if (aNBT.hasKey("mAverageEuUsage")) {
this.mAverageEuUsage = aNBT.getLong("mAverageEuUsage");
- }
+ }
+ if (aNBT.hasKey("mAverageEuAdded")) {
+ this.mAverageEuAdded = aNBT.getLong("mAverageEuAdded");
+ }
+ if (aNBT.hasKey("mAverageEuConsumed")) {
+ this.mAverageEuConsumed = aNBT.getLong("mAverageEuConsumed");
+ }
//Usage Stats
this.mTotalEnergyAdded = aNBT.getLong("mTotalEnergyAdded");
@@ -510,8 +518,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
@Override
public boolean checkRecipe(final ItemStack aStack) {
- this.mProgresstime = 1;
- this.mMaxProgresstime = 1;
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 200;
this.mEUt = 0;
this.mEfficiencyIncrease = 10000;
this.fixAllMaintenanceIssue();
@@ -528,34 +536,43 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
return 0;
}
- private void drawEnergyFromHatch(MetaTileEntity aHatch) {
- if (!isValidMetaTileEntity(aHatch)) return;
+ private long drawEnergyFromHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) {
+ return 0;
+ }
long stored = aHatch.getEUVar();
long voltage = aHatch.maxEUInput() * aHatch.maxAmperesIn();
if (voltage > stored) {
- return;
+ return 0;
}
if (this.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false)) {
aHatch.setEUVar((stored - voltage));
this.mTotalEnergyAdded += voltage;
+ return voltage;
}
+ return 0;
}
- private void addEnergyToHatch(MetaTileEntity aHatch) {
- if (!isValidMetaTileEntity(aHatch)) return;
+ private long addEnergyToHatch(MetaTileEntity aHatch) {
+ if (!isValidMetaTileEntity(aHatch)) {
+ return 0;
+ }
long voltage = aHatch.maxEUOutput() * aHatch.maxAmperesOut();
- if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) return;
+ if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) {
+ return 0;
+ }
if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(voltage, false)) {
aHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(voltage, false);
this.mTotalEnergyConsumed+=voltage;
+ return voltage;
}
-
+ return 0;
}
private long computeEnergyTax() {
@@ -586,23 +603,32 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
this.mTotalEnergyLost += Math.min(mDecrease, this.getEUVar());
this.setEUVar(Math.max(0, this.getEUVar() - mDecrease));
+ long aInputAverage = 0;
+ long aOutputAverage = 0;
// Input Power
for (Object THatch : this.mDischargeHatches) {
GT_MetaTileEntity_Hatch_OutputBattery tHatch = (GT_MetaTileEntity_Hatch_OutputBattery) THatch;
drawEnergyFromHatch(tHatch);
+ aInputAverage += tHatch.maxEUInput() * tHatch.maxAmperesIn();
}
for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) {
drawEnergyFromHatch(tHatch);
+ aInputAverage += tHatch.maxEUInput() * tHatch.maxAmperesIn();
}
// Output Power
for (Object THatch : this.mChargeHatches) {
GT_MetaTileEntity_Hatch_InputBattery tHatch = (GT_MetaTileEntity_Hatch_InputBattery) THatch;
- addEnergyToHatch(tHatch);
+ aOutputAverage += addEnergyToHatch(tHatch);
}
for (GT_MetaTileEntity_Hatch tHatch : this.mAllDynamoHatches) {
- addEnergyToHatch(tHatch);
+ aOutputAverage += addEnergyToHatch(tHatch);
}
+ // reset progress time
+ mProgresstime = 0;
+
+ this.mAverageEuAdded = aInputAverage;
+ this.mAverageEuConsumed = aOutputAverage;
return true;
@@ -658,6 +684,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
"Requires Maintenance: " + (!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED)+ mMaint + EnumChatFormatting.RESET +" | Code: ["+(!mMaint ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + errorCode + EnumChatFormatting.RESET +"]",
"----------------------",
"Stats for Nerds",
+ "Average Input: " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(this.mAverageEuAdded) + EnumChatFormatting.RESET + " EU",
+ "Average Output: " + EnumChatFormatting.GOLD + GT_Utility.formatNumbers(this.mAverageEuConsumed) + EnumChatFormatting.RESET + " EU",
"Total Input: " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(this.mTotalEnergyAdded) + EnumChatFormatting.RESET + " EU",
"Total Output: " + EnumChatFormatting.GOLD + GT_Utility.formatNumbers(this.mTotalEnergyConsumed) + EnumChatFormatting.RESET + " EU",
"Total Costs: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(this.mTotalEnergyLost) + EnumChatFormatting.RESET + " EU",
@@ -726,6 +754,14 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
return 32768;
}
+ public final long getAverageEuAdded() {
+ return this.mAverageEuAdded;
+ }
+
+ public final long getAverageEuConsumed() {
+ return this.mAverageEuConsumed;
+ }
+
@Override
public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
mIsOutputtingPower = Utils.invertBoolean(mIsOutputtingPower);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java
new file mode 100644
index 0000000000..67999087f3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java
@@ -0,0 +1,1052 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.misc;
+
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+import Ic2ExpReactorPlanner.SimulationData;
+import cpw.mods.fml.common.FMLCommonHandler;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.*;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.*;
+import gregtech.api.util.*;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.common.items.behaviors.Behaviour_DataOrb;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_ComputerCube;
+import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_ComputerCube;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description;
+import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Simulator;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank {
+
+ public static int MODE_MAIN = 0;
+ public static int MODE_REACTOR_PLANNER = 1;
+ public static int MODE_SCANNER = 2;
+ public static int MODE_CENTRIFUGE = 3;
+ public static int MODE_FUSION = 4;
+ public static int MODE_INFO = 5;
+ public static int MODE_ELECTROLYZER = 6;
+
+ public static boolean mSeedscanner = true;
+
+ public static boolean mReactorplanner = true;
+
+ public static ArrayList<GT_ItemStack> sReactorList;
+
+ public boolean mStarted = false;
+
+ public int mMode = 0;
+
+ public int mHeat = 0;
+
+ public long mEUOut = 0;
+
+ public int mMaxHeat = 1;
+
+ public long mEU = 0;
+
+ public int mProgress = 0;
+ public int mMaxProgress = 0;
+
+ public int mEUTimer = 0;
+
+ public int mEULast1 = 0;
+
+ public int mEULast2 = 0;
+
+ public int mEULast3 = 0;
+
+ public int mEULast4 = 0;
+
+ public float mHEM = 1.0F, mExplosionStrength = 0.0F;
+
+ public String mFusionOutput = "";
+
+ private boolean mNeedsUpdate;
+
+ private GT_Computercube_Simulator mSimulator;
+
+ public GT_TileEntity_ComputerCube(final int aID, final String aDescription) {
+ super(aID, "computer.cube", "Computer Cube MKII", 5, 114, aDescription);
+ }
+
+ public GT_TileEntity_ComputerCube(final String aName, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 5, 114, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ Logger.INFO("CC-Sever ID: "+aID);
+ return new GT_Container_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ Logger.INFO("CC-Client ID: "+aID);
+ return new GT_GUIContainer_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Built in Reactor Planner",
+ "Built in Scanner",
+ "Built in Info-Bank",
+ "Displays Fusion Recipes",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer, mMode);
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_TileEntity_ComputerCube(this.mName, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ ItemStack tStack = aPlayer.getCurrentEquippedItem();
+ if (tStack != null && ItemList.Tool_DataOrb.isStackEqual(tStack)) {
+ return false;
+ }
+ return true;
+ }
+
+ public final GT_Computercube_Simulator getSimulator() {
+ return this.mSimulator;
+ }
+
+ public final void setSimulator(GT_Computercube_Simulator mSimulator) {
+ this.mSimulator = mSimulator;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aDirection) {
+ return true;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 4;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[4];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[5] * 1024;
+ }
+
+ @Override
+ public boolean ownerControl() {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 114;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return (aIndex > 53 && aIndex < 58);
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ public void saveNuclearReactor() {
+ for (int i = 0; i < 54; i++) {
+ if (this.mInventory[i] == null) {
+ this.mInventory[i + 59] = null;
+ }
+ else {
+ this.mInventory[i + 59] = this.mInventory[i].copy();
+ }
+ }
+ }
+
+ public void loadNuclearReactor() {
+ for (int i = 0; i < 54; i++) {
+ if (this.mInventory[i + 59] == null) {
+ this.mInventory[i] = null;
+ }
+ else {
+ this.mInventory[i] = this.mInventory[i + 59].copy();
+ }
+ }
+ }
+
+ public int getXCoord() {
+ return this.getBaseMetaTileEntity().getXCoord();
+ }
+
+ public int getYCoord() {
+ return this.getBaseMetaTileEntity().getYCoord();
+ }
+
+ public int getZCoord() {
+ return this.getBaseMetaTileEntity().getZCoord();
+ }
+
+ public void reset() {
+ this.mEU = 0;
+ this.mHeat = 0;
+ this.mEUOut = 0;
+ this.mMaxHeat = 10000;
+ this.mHEM = 1.0F;
+ this.mExplosionStrength = 0.0F;
+ this.mProgress = 0;
+ this.mMaxProgress = 0;
+ this.mFusionOutput = "";
+ this.mInventory[113] = null;
+ int i;
+ for (i = 0; i < 54; i++) {
+ this.mInventory[i] = null;
+ this.mInventory[i + 59] = null;
+ }
+ for (i = 54; i < 58; i++) {
+ if (this.mInventory[i] != null) {
+ if (!this.getWorld().isRemote)
+ this.getWorld().spawnEntityInWorld((Entity) new EntityItem(this.getWorld(), this.getXCoord() + 0.5D, this.getYCoord() + 0.5D, this.getZCoord() + 0.5D, this.mInventory[i]));
+ this.mInventory[i] = null;
+ }
+ }
+ }
+
+ public void switchModeForward() {
+ int aTempMode = mMode;
+ aTempMode++;
+ if (aTempMode == MODE_ELECTROLYZER ||aTempMode == MODE_CENTRIFUGE) {
+ aTempMode++;
+ }
+ if (aTempMode >= 7) {
+ aTempMode = 0;
+ }
+ mMode = aTempMode;
+ switchMode();
+ }
+
+ public void switchModeBackward() {
+ int aTempMode = mMode;
+ aTempMode--;
+ if (aTempMode == MODE_ELECTROLYZER ||aTempMode == MODE_CENTRIFUGE) {
+ aTempMode--;
+ }
+ if (aTempMode < 0) {
+ aTempMode = 6;
+ }
+ mMode = aTempMode;
+ switchMode();
+ }
+
+ private void switchMode() {
+ reset();
+ if (this.mMode == MODE_REACTOR_PLANNER && !mReactorplanner) {
+ switchMode();
+ return;
+ }
+ if (this.mMode == MODE_SCANNER && !mSeedscanner) {
+ switchMode();
+ return;
+ }
+ if (this.mMode == MODE_CENTRIFUGE) {
+ showCentrifugeRecipe(0);
+ }
+ if (this.mMode == MODE_FUSION) {
+ showFusionRecipe(0);
+ }
+ if (this.mMode == MODE_INFO) {
+ showDescription(0);
+ }
+ if (this.mMode == MODE_ELECTROLYZER) {
+ showElectrolyzerRecipe(0);
+ }
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 10, this.mMode);
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 11, this.mMaxHeat);
+ }
+
+ public void showDescription(int aIndex) {
+ this.mExplosionStrength = 0.0F;
+ if (GT_Computercube_Description.sDescriptions.isEmpty()) {
+ return;
+ }
+ if (aIndex >= GT_Computercube_Description.sDescriptions.size() || aIndex < 0)
+ aIndex = 0;
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[0] == null) {
+ this.mInventory[59] = null;
+ }
+ else {
+ this.mInventory[59] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[0].copy();
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[1] == null) {
+ this.mInventory[60] = null;
+ }
+ else {
+ this.mInventory[60] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[1].copy();
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[2] == null) {
+ this.mInventory[61] = null;
+ }
+ else {
+ this.mInventory[61] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[2].copy();
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[3] == null) {
+ this.mInventory[62] = null;
+ }
+ else {
+ this.mInventory[62] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[3].copy();
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[4] == null) {
+ this.mInventory[63] = null;
+ }
+ else {
+ this.mInventory[63] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[4].copy();
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[5] == null) {
+ this.mInventory[64] = null;
+ }
+ else {
+ this.mInventory[64] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[5].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[6] == null) {
+ this.mInventory[65] = null;
+ }
+ else {
+ this.mInventory[65] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[6].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[7] == null) {
+ this.mInventory[66] = null;
+ }
+ else {
+ this.mInventory[66] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[7].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[8] == null) {
+ this.mInventory[67] = null;
+ }
+ else {
+ this.mInventory[67] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[8].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[9] == null) {
+ this.mInventory[68] = null;
+ }
+ else {
+ this.mInventory[68] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[9].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[10] == null) {
+ this.mInventory[69] = null;
+ }
+ else {
+ this.mInventory[69] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[10].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[11] == null) {
+ this.mInventory[70] = null;
+ }
+ else {
+ this.mInventory[70] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[11].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[12] == null) {
+ this.mInventory[71] = null;
+ }
+ else {
+ this.mInventory[71] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[12].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ if (((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[13] == null) {
+ this.mInventory[72] = null;
+ }
+ else {
+ this.mInventory[72] = ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(aIndex)).mStacks[13].copy();
+ this.mExplosionStrength = 100.0F;
+ }
+ this.mMaxHeat = aIndex;
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 11, this.mMaxHeat);
+ }
+
+ public void switchDescriptionPageForward() {
+ if (++this.mMaxHeat >= GT_Computercube_Description.sDescriptions.size())
+ this.mMaxHeat = 0;
+ showDescription(this.mMaxHeat);
+ }
+
+ public void switchDescriptionPageBackward() {
+ if (--this.mMaxHeat < 0)
+ this.mMaxHeat = GT_Computercube_Description.sDescriptions.size() - 1;
+ showDescription(this.mMaxHeat);
+ }
+
+ public void showCentrifugeRecipe(int aIndex) {
+ /*
+ if (aIndex >= GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size() || aIndex < 0)
+ aIndex = 0;
+ GT_Recipe tRecipe = GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.get(aIndex);
+ if (tRecipe != null) {
+ if (tRecipe.mInput1 == null) {
+ this.mInventory[59] = null;
+ }
+ else {
+ this.mInventory[59] = tRecipe.mInput1.copy();
+ }
+ if (tRecipe.mInput2 == null) {
+ this.mInventory[60] = null;
+ }
+ else {
+ this.mInventory[60] = tRecipe.mInput2.copy();
+ }
+ if (tRecipe.mOutput1 == null) {
+ this.mInventory[61] = null;
+ }
+ else {
+ this.mInventory[61] = tRecipe.mOutput1.copy();
+ }
+ if (tRecipe.mOutput2 == null) {
+ this.mInventory[62] = null;
+ }
+ else {
+ this.mInventory[62] = tRecipe.mOutput2.copy();
+ }
+ if (tRecipe.mOutput3 == null) {
+ this.mInventory[63] = null;
+ }
+ else {
+ this.mInventory[63] = tRecipe.mOutput3.copy();
+ }
+ if (tRecipe.mOutput4 == null) {
+ this.mInventory[64] = null;
+ }
+ else {
+ this.mInventory[64] = tRecipe.mOutput4.copy();
+ }
+ this.mEU = tRecipe.mDuration * 5;
+ this.mMaxHeat = aIndex;
+ }
+ this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat);
+ */}
+
+ public void switchCentrifugePageForward() {
+ if (++this.mMaxHeat >= GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size())
+ this.mMaxHeat = 0;
+ // showCentrifugeRecipe(this.mMaxHeat);
+ }
+
+ public void switchCentrifugePageBackward() {
+ if (--this.mMaxHeat < 0)
+ this.mMaxHeat = GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size() - 1;
+ // showCentrifugeRecipe(this.mMaxHeat);
+ }
+
+ public void showElectrolyzerRecipe(int aIndex) {
+ /*
+ if (aIndex >= GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size() || aIndex < 0)
+ aIndex = 0;
+ GT_Recipe tRecipe = GT_Recipe_Map.sElectrolyzerRecipes.get(aIndex);
+ if (tRecipe != null) {
+ if (tRecipe.mInput1 == null) {
+ this.mInventory[59] = null;
+ }
+ else {
+ this.mInventory[59] = tRecipe.mInput1.copy();
+ }
+ if (tRecipe.mInput2 == null) {
+ this.mInventory[60] = null;
+ }
+ else {
+ this.mInventory[60] = tRecipe.mInput2.copy();
+ }
+ if (tRecipe.mOutput1 == null) {
+ this.mInventory[61] = null;
+ }
+ else {
+ this.mInventory[61] = tRecipe.mOutput1.copy();
+ }
+ if (tRecipe.mOutput2 == null) {
+ this.mInventory[62] = null;
+ }
+ else {
+ this.mInventory[62] = tRecipe.mOutput2.copy();
+ }
+ if (tRecipe.mOutput3 == null) {
+ this.mInventory[63] = null;
+ }
+ else {
+ this.mInventory[63] = tRecipe.mOutput3.copy();
+ }
+ if (tRecipe.mOutput4 == null) {
+ this.mInventory[64] = null;
+ }
+ else {
+ this.mInventory[64] = tRecipe.mOutput4.copy();
+ }
+ this.mEU = tRecipe.mDuration * tRecipe.mEUt;
+ this.mMaxHeat = aIndex;
+ }
+ this.getWorld().addBlockEvent(this.xCoord, this.yCoord, this.zCoord, (GregTech_API.sBlockList[1]).field_71990_ca, 11, this.mMaxHeat);
+ */}
+
+ public void switchElectrolyzerPageForward() {
+ if (++this.mMaxHeat >= GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size())
+ this.mMaxHeat = 0;
+ showElectrolyzerRecipe(this.mMaxHeat);
+ }
+
+ public void switchElectrolyzerPageBackward() {
+ if (--this.mMaxHeat < 0)
+ this.mMaxHeat = GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size() - 1;
+ showElectrolyzerRecipe(this.mMaxHeat);
+ }
+
+ public static ArrayList<GT_Recipe> sFusionReactorRecipes = new ArrayList<GT_Recipe>();
+
+ public void showFusionRecipe(int aIndex) {
+
+ if (sFusionReactorRecipes.isEmpty()) {
+ for (GT_Recipe aRecipe : GT_Recipe_Map.sFusionRecipes.mRecipeList) {
+ sFusionReactorRecipes.add(aRecipe);
+ }
+ Collections.sort(sFusionReactorRecipes);
+ }
+
+ if (aIndex >= sFusionReactorRecipes.size() || aIndex < 0) {
+ aIndex = 0;
+ }
+ GT_Recipe tRecipe = sFusionReactorRecipes.get(aIndex);
+ if (tRecipe != null) {
+ if (tRecipe.mFluidInputs[0] == null) {
+ this.mInventory[59] = null;
+ }
+ else {
+ this.mInventory[59] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[0], true);
+ }
+ if (tRecipe.mFluidInputs[1] == null) {
+ this.mInventory[60] = null;
+ }
+ else {
+ this.mInventory[60] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[1], true);
+ }
+ if (tRecipe.mFluidOutputs[0] == null) {
+ this.mInventory[61] = null;
+ }
+ else {
+ this.mInventory[61] = GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[0], true);
+ }
+ this.mEU = tRecipe.mSpecialValue;
+ this.mEUOut = tRecipe.mEUt;
+ this.mHeat = tRecipe.mDuration;
+ this.mMaxHeat = aIndex;
+ this.mFusionOutput = tRecipe.mFluidOutputs[0].getLocalizedName();
+ }
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 11, this.mMaxHeat);
+ }
+
+ public void switchFusionPageForward() {
+ if (++this.mMaxHeat >= sFusionReactorRecipes.size())
+ this.mMaxHeat = 0;
+ showFusionRecipe(this.mMaxHeat);
+ }
+
+ public void switchFusionPageBackward() {
+ if (--this.mMaxHeat < 0)
+ this.mMaxHeat = sFusionReactorRecipes.size() - 1;
+ showFusionRecipe(this.mMaxHeat);
+ }
+
+ public void switchNuclearReactor() {
+ if (this.mStarted) {
+ stopNuclearReactor();
+ }
+ else {
+ startNuclearReactor();
+ }
+ }
+
+ public void startNuclearReactor() {
+ this.mStarted = true;
+ this.mHeat = 0;
+ this.mEU = 0;
+ mSimulator.simulate();
+ }
+
+ public void stopNuclearReactor() {
+ this.mStarted = false;
+ mSimulator.simulate();
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mMode", this.mMode);
+ aNBT.setInteger("mProgress", this.mProgress);
+ aNBT.setInteger("mMaxProgress", this.mMaxProgress);
+ aNBT.setBoolean("mStarted", this.mStarted);
+ int[] aSplitLong1 = MathUtils.splitLongIntoTwoIntegers(mEU);
+ aNBT.setInteger("mEU1", aSplitLong1[0]);
+ aNBT.setInteger("mEU2", aSplitLong1[1]);
+ aNBT.setInteger("mHeat", this.mHeat);
+ int[] aSplitLong2 = MathUtils.splitLongIntoTwoIntegers(mEUOut);
+ aNBT.setInteger("mEUOut1", aSplitLong2[0]);
+ aNBT.setInteger("mEUOut2", aSplitLong2[1]);
+ aNBT.setInteger("mMaxHeat", this.mMaxHeat);
+ aNBT.setFloat("mHEM", this.mHEM);
+ aNBT.setFloat("mExplosionStrength", this.mExplosionStrength);
+ aNBT.setString("mFusionOutput", this.mFusionOutput);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mMode = aNBT.getInteger("mMode");
+ this.mProgress = aNBT.getInteger("mProgress");
+ this.mMaxProgress = aNBT.getInteger("mMaxProgress");
+ this.mStarted = aNBT.getBoolean("mStarted");
+ int partA = aNBT.getInteger("mEU1");
+ int partB = aNBT.getInteger("mEU2");
+ this.mEU = MathUtils.combineTwoIntegersToLong(partA, partB);
+ this.mHeat = aNBT.getInteger("mHeat");
+ partA = aNBT.getInteger("mEUOut1");
+ partB = aNBT.getInteger("mEUOut2");
+ this.mEUOut = MathUtils.combineTwoIntegersToLong(partA, partB);
+ this.mMaxHeat = aNBT.getInteger("mMaxHeat");
+ this.mHEM = aNBT.getFloat("mHEM");
+ this.mExplosionStrength = aNBT.getFloat("mExplosionStrength");
+ this.mFusionOutput = aNBT.getString("mFusionOutput");
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ if (mSimulator == null) {
+ mSimulator = new GT_Computercube_Simulator(this);
+ }
+ if(this.getBaseMetaTileEntity().isClientSide()) {
+ this.getWorld().markBlockForUpdate(this.getXCoord(), this.getYCoord(), this.getZCoord());
+ this.mNeedsUpdate = false;
+ }
+ else {
+ this.mNeedsUpdate = false;
+ }
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (this.mMode == MODE_SCANNER) {
+ /*if (this.mInventory[55] == null) {
+ this.mInventory[55] = this.mInventory[54];
+ this.mInventory[54] = null;
+ }*/
+ if (this.mInventory[57] == null) {
+ this.mInventory[57] = this.mInventory[56];
+ this.mInventory[56] = null;
+ }
+
+ // 54 - 55 || 56 - 57
+ // Do scanny bits
+ if (mSeedscanner && this.mMode == MODE_SCANNER) {
+ /*if (doScan(this.mInventory[55]) == 4) {
+ if ((this.mInventory[57] != null) && (this.mInventory[57].getUnlocalizedName().equals("gt.metaitem.01.32707"))) {
+ GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning");
+ }
+ }*/
+ /*if (this.mEU > 0) {
+ if (!this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mEU, false)) {
+ this.mProgress = 0;
+ }
+ }*/
+ }
+
+ /*if (mSeedscanner && this.mInventory[55] != null && GT_Utility.areStacksEqual(this.mInventory[55], Ic2Items.cropSeed, true) && this.mInventory[55].getTagCompound() != null) {
+ if (this.mInventory[55].getTagCompound().getByte("scan") < 4) {
+ if (this.mProgress >= 100) {
+ this.mInventory[55].getTagCompound().setByte("scan", (byte) 4);
+ this.mProgress = 0;
+ }
+ else if (this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(100, false)) {
+ this.mProgress++;
+ }
+ }
+ else {
+ this.mProgress = 0;
+ if (this.mInventory[56] == null) {
+ this.mInventory[56] = this.mInventory[55];
+ this.mInventory[55] = null;
+ }
+ }
+ }
+ else {
+ this.mProgress = 0;
+ if (this.mInventory[56] == null) {
+ this.mInventory[56] = this.mInventory[55];
+ this.mInventory[55] = null;
+ }
+ }*/
+ }
+
+ if (this.mMode == MODE_REACTOR_PLANNER && mReactorplanner && this.mSimulator != null && this.mSimulator.simulator != null && this.mSimulator.simulatedReactor != null) {
+ SimulationData aData = this.mSimulator.simulator.getData();
+ if (aData != null && aData.totalReactorTicks > 0 && this.mProgress != aData.totalReactorTicks) {
+ Logger.INFO("Updating Variables");
+ this.mEU = aData.avgEUoutput;
+ this.mEUOut = (aData.totalEUoutput / aData.totalReactorTicks);
+ this.mHeat = aData.avgHUoutput;
+ this.mMaxHeat = aData.maxHUoutput;
+ this.mExplosionStrength = aData.explosionPower;
+ this.mHEM = (float) aData.hullHeating;
+ this.mProgress = aData.totalReactorTicks;
+ }
+ }
+
+ if (aTick % 20L == 0L) {
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 10, this.mMode);
+ this.getWorld().addBlockEvent(this.getXCoord(), this.getYCoord(), this.getZCoord(), GregTech_API.sBlockMachines, 11, this.mMaxHeat);
+ }
+ }
+ }
+
+ @Override
+ public void receiveClientEvent(byte aEventID, byte aValue) {
+ super.receiveClientEvent(aEventID, aValue);
+ if (this.getWorld().isRemote)
+ switch (aEventID) {
+ case 10 :
+ this.mNeedsUpdate = true;
+ this.mMode = aValue;
+ break;
+ case 11 :
+ this.mMaxHeat = aValue;
+ break;
+ }
+ return;
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ super.onValueUpdate(aValue);
+ this.mNeedsUpdate = true;
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ super.onMachineBlockUpdate();
+ this.mNeedsUpdate = true;
+ }
+
+ @Override
+ public boolean canInsertItem(int i, ItemStack itemstack, int j) {
+ return (this.mMode == MODE_SCANNER) ? ((i == 54 || i == 55)) : false;
+ }
+
+ @Override
+ public boolean canExtractItem(int i, ItemStack itemstack, int j) {
+ return (this.mMode == MODE_SCANNER) ? ((i == 56 || i == 57)) : false;
+ }
+
+ public World getWorld() {
+ return this.getBaseMetaTileEntity().getWorld();
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getSides(i);
+ rTextures[2][i + 1] = this.getSides(i);
+ rTextures[3][i + 1] = this.getSides(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getSides(i);
+ rTextures[7][i + 1] = this.getSides(i);
+ rTextures[8][i + 1] = this.getSides(i);
+ rTextures[9][i + 1] = this.getSides(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Screen_3)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Computer_Cube)};
+ }
+
+ protected static final int
+ DID_NOT_FIND_RECIPE = 0,
+ FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
+ FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
+
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ */
+ protected void calculateOverclockedNess(int aEUt, int aDuration) {
+ if(mTier==0){
+ //Long time calculation
+ long xMaxProgresstime = ((long)aDuration)<<1;
+ if(xMaxProgresstime>Integer.MAX_VALUE-1){
+ //make impossible if too long
+ mEU=Integer.MAX_VALUE-1;
+ mMaxProgress=Integer.MAX_VALUE-1;
+ }else{
+ mEU=aEUt>>2;
+ mMaxProgress=(int)xMaxProgresstime;
+ }
+ }else{
+ //Long EUt calculation
+ long xEUt=aEUt;
+ //Isnt too low EUt check?
+ long tempEUt = Math.max(xEUt, V[1]);
+
+ mMaxProgress = aDuration;
+
+ while (tempEUt <= V[mTier -1] * (long)this.maxAmperesIn()) {
+ tempEUt<<=2;//this actually controls overclocking
+ //xEUt *= 4;//this is effect of everclocking
+ mMaxProgress>>=1;//this is effect of overclocking
+ xEUt = mMaxProgress==0 ? xEUt>>1 : xEUt<<2;//U know, if the time is less than 1 tick make the machine use 2x less power
+ }
+ if(xEUt>Integer.MAX_VALUE-1){
+ mEU = Integer.MAX_VALUE-1;
+ mMaxProgress = Integer.MAX_VALUE-1;
+ }else{
+ mEU = (int)xEUt;
+ if(mEU==0)
+ mEU = 1;
+ if(mMaxProgress==0)
+ mMaxProgress = 1;//set time to 1 tick
+ }
+ }
+ }
+
+ public int doScan(ItemStack aInput) {
+ if (this.mMode != MODE_SCANNER) {
+ return DID_NOT_FIND_RECIPE;
+ }
+ ItemStack aStack = aInput;
+ if (this.mInventory[56] != null) {
+ return DID_NOT_FIND_RECIPE;
+ } else if ((GT_Utility.isStackValid(aStack)) && (aStack.stackSize > 0)) {
+
+
+ if (ItemList.IC2_Crop_Seeds.isStackEqual(aStack, true, true)) {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ if (tNBT.getByte("scan") < 4) {
+ tNBT.setByte("scan", (byte) 4);
+ calculateOverclockedNess(8, 160);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ } else {
+ this.mMaxProgress = 1;
+ this.mEU = 1;
+ }
+ aStack.stackSize -= 1;
+ this.mInventory[57] = GT_Utility.copyAmount(1L, aStack);
+ this.mInventory[57].setTagCompound(tNBT);
+ return 2;
+ }
+
+
+ if (ItemList.Tool_DataOrb.isStackEqual(getSpecialSlot(), false, true)) {
+ if (ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) {
+ aStack.stackSize -= 1;
+ this.mInventory[57] = GT_Utility.copyAmount(1L, getSpecialSlot());
+ calculateOverclockedNess(30, 512);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return 2;
+ }
+ ItemData tData = GT_OreDictUnificator.getAssociation(aStack);
+ if ((tData != null) && ((tData.mPrefix == OrePrefixes.dust) || (tData.mPrefix == OrePrefixes.cell)) && (tData.mMaterial.mMaterial.mElement != null) && (!tData.mMaterial.mMaterial.mElement.mIsIsotope) && (tData.mMaterial.mMaterial != Materials.Magic) && (tData.mMaterial.mMaterial.getMass() > 0L)) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mInventory[57] = ItemList.Tool_DataOrb.get(1L);
+ Behaviour_DataOrb.setDataTitle(this.mInventory[57], "Elemental-Scan");
+ Behaviour_DataOrb.setDataName(this.mInventory[57], tData.mMaterial.mMaterial.mElement.name());
+ calculateOverclockedNess(30, GT_Utility.safeInt(tData.mMaterial.mMaterial.getMass() * 8192L));
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return 2;
+ }
+ }
+
+
+ if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true)) {
+ if (ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) {
+ aStack.stackSize -= 1;
+ this.mInventory[57] = GT_Utility.copyAmount(1L, getSpecialSlot());
+ calculateOverclockedNess(30, 128);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return 2;
+ }
+ if (aStack.getItem() == Items.written_book) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mInventory[57] = GT_Utility.copyAmount(1L, getSpecialSlot());
+ this.mInventory[57].setTagCompound(aStack.getTagCompound());
+ calculateOverclockedNess(30, 128);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return 2;
+ }
+ if (aStack.getItem() == Items.filled_map) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mInventory[57] = GT_Utility.copyAmount(1L, getSpecialSlot());
+ this.mInventory[57].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "map_id", (short) aStack.getItemDamage()));
+ calculateOverclockedNess(30, 128);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return 2;
+ }
+
+ }
+
+ if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true) && aStack != null) {
+ for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) {
+ if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, aStack, true)) {
+ boolean failScanner = true;
+ for (GT_Recipe scannerRecipe : sScannerFakeRecipes.mRecipeList) {
+ if (GT_Utility.areStacksEqual(scannerRecipe.mInputs[0], aStack, true)) {
+ failScanner = false;
+ break;
+ }
+ }
+ if (failScanner) {
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+
+
+ String s = tRecipe.mOutput.getDisplayName();
+ if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
+ s = GT_Assemblyline_Server.lServerNames.get(tRecipe.mOutput.getDisplayName());
+ if (s == null)
+ s = tRecipe.mOutput.getDisplayName();
+ }
+ this.mInventory[57] = GT_Utility.copyAmount(1L, getSpecialSlot());
+
+
+ // Use Assline Utils
+ if (GT_AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(this.mInventory[57], tRecipe)) {
+ aStack.stackSize -= 1;
+ calculateOverclockedNess(30, tRecipe.mResearchTime);
+ //In case recipe is too OP for that machine
+ if (mMaxProgress == Integer.MAX_VALUE - 1 && mEU == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ getSpecialSlot().stackSize -= 1;
+ return 2;
+ }
+
+ }
+ }
+ }
+
+ }
+ return 0;
+ }
+
+ private ItemStack getSpecialSlot() {
+ return this.mInventory[54];
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java
index 5d8e9d468d..4b73bba6df 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java
@@ -1,4 +1,3 @@
-/*
package gtPlusPlus.xmod.gregtech.common.tileentities.misc;
import gregtech.api.enums.Textures;
@@ -13,16 +12,18 @@ import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock {
- public String mSolarTower;
public boolean mHasTower = false;
-
- private Integer mTX, mTY, mTZ;
+ private GregtechMetaTileEntity_SolarTower mTower = null;
+
+ private int mTX, mTY, mTZ;
private Byte mRequiredFacing;
public TileEntitySolarHeater(final int aID, final String aName, final String aNameRegional, final int aTier,
@@ -88,7 +89,8 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock
}
public ITexture[] getSides(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) };
}
public ITexture[] getFrontActive(final byte aColor) {
@@ -110,7 +112,8 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock
}
public ITexture[] getSidesActive(final byte aColor) {
- return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) };
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top),
+ new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) };
}
@Override
@@ -223,7 +226,7 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setBoolean("mHasTower", mHasTower);
- if (mHasTower && mTX != null && mTY != null && mTZ != null) {
+ if (mHasTower) {
aNBT.setInteger("mTX", mTX);
aNBT.setInteger("mTY", mTY);
aNBT.setInteger("mTZ", mTZ);
@@ -262,57 +265,55 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock
public void onExplosion() {
}
-
+
+ public boolean hasSolarTower() {
+ return mHasTower;
+ }
+
public GregtechMetaTileEntity_SolarTower getSolarTower() {
- if (this.mHasTower && this.mSolarTower != null && this.mSolarTower.length() > 0) {
- BlockPos p = BlockPos.generateBlockPos(mSolarTower);
- if (p != null) {
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos, p.zPos);
- if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) {
- return (GregtechMetaTileEntity_SolarTower) tTileEntity;
- }
- }
+ if (this.mHasTower) {
+ return mTower;
}
return null;
}
+ public boolean canSeeSky() {
+ if (this.getBaseMetaTileEntity().getWorld().canBlockSeeTheSky(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord())) {
+ return true;
+ }
+ return false;
+ }
- public boolean setSolarTower(BlockPos aTowerPos) {
- if (!this.mHasTower && setSolarTowerInternal(aTowerPos.getUniqueIdentifier())) {
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aTowerPos.xPos, aTowerPos.yPos, aTowerPos.zPos);
- if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) {
- this.mTX = tTileEntity.getXCoord();
- this.mTY = (int) tTileEntity.getYCoord();
- this.mTZ = tTileEntity.getZCoord();
- this.mHasTower = true;
- return true;
- }
- }
+
+ public boolean setSolarTower(GregtechMetaTileEntity_SolarTower aTowerTile) {
+ if (!hasSolarTower()) {
+ this.mTX = aTowerTile.getBaseMetaTileEntity().getXCoord();
+ this.mTY = (int) aTowerTile.getBaseMetaTileEntity().getYCoord();
+ this.mTZ = aTowerTile.getBaseMetaTileEntity().getZCoord();
+ this.mHasTower = true;
+ this.mTower = aTowerTile;
+ return true;
+ }
return false;
}
-
- private boolean clearSolarTower() {
- if (mHasTower || mTX != null || mTY != null || mTZ != null || mRequiredFacing != null || this.mSolarTower != null) {
- this.mTX = null;
- this.mTY = null;
- this.mTZ = null;
- this.mRequiredFacing = null;
- this.mSolarTower = null;
- this.mHasTower = false;
- return true;
- }
- return false;
- }
-
- private final boolean setSolarTowerInternal(String aTowerPos) {
- this.mSolarTower = aTowerPos;
- return this.mSolarTower != null && this.mSolarTower.length() > 0;
+
+ public boolean clearSolarTower() {
+ if (mHasTower || mRequiredFacing != null || this.mTower != null) {
+ this.mTX = 0;
+ this.mTY = 0;
+ this.mTZ = 0;
+ this.mRequiredFacing = null;
+ this.mTower = null;
+ this.mHasTower = false;
+ return true;
+ }
+ return false;
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
-
+
}
@Override
@@ -345,4 +346,3 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock
}
}
-*/
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
new file mode 100644
index 0000000000..9bb2443683
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
@@ -0,0 +1,121 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_TieredMachineBlock {
+
+ protected int mOpenerCount;
+
+ public GT_MetaTileEntity_RedstoneBase(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_RedstoneBase(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_RedstoneBase(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_RedstoneBase(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public final boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return aSide != getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public final boolean isValidSlot(int aIndex) {
+ return false;
+ }
+
+ @Override
+ public final boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public final boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public abstract void saveNBTData(NBTTagCompound aNBT);
+
+ @Override
+ public abstract void loadNBTData(NBTTagCompound aNBT);
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ return false;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, gregtech.api.interfaces.tileentity.IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, gregtech.api.interfaces.tileentity.IGregTechTileEntity aBaseMetaTileEntity) {
+ return null;
+ }
+
+ @Override
+ public final void onOpenGUI() {
+ super.onOpenGUI();
+ mOpenerCount++;
+ }
+
+ @Override
+ public final void onCloseGUI() {
+ super.onCloseGUI();
+ mOpenerCount--;
+ }
+
+ public boolean hasRedstoneSignal() {
+ if (getBaseMetaTileEntity().getStrongestRedstone() > 0) {
+ return true;
+ }
+ for (byte i=0;i<6;i++) {
+ if (getBaseMetaTileEntity().getOutputRedstoneSignal(i) > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ CORE.GT_Tooltip
+ };
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java
new file mode 100644
index 0000000000..0c0cc44d93
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneButtonPanel.java
@@ -0,0 +1,207 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class GT_MetaTileEntity_RedstoneButtonPanel extends GT_MetaTileEntity_RedstoneBase {
+
+ public byte mRedstoneStrength = 0, mType = 0, mUpdate = 0;
+
+ public static TexturesGtBlock.CustomIcon[] sIconList = new TexturesGtBlock.CustomIcon[64];
+
+ static {
+ for (int i=0;i<64;i++) {
+ sIconList[i] = new CustomIcon("TileEntities/gt4/redstone/ButtonPanel/"+i);
+ }
+ }
+
+ public GT_MetaTileEntity_RedstoneButtonPanel(int aID) {
+ super(aID, "redstone.button.panel", "Button Panel", 5, 0, "Right-click with Screwdriver to change Button Design");
+ }
+
+ public GT_MetaTileEntity_RedstoneButtonPanel(final String aName, String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 5, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RedstoneButtonPanel(this.mName, mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mRedstoneStrength", mRedstoneStrength);
+ aNBT.setByte("mType", mType);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mRedstoneStrength = aNBT.getByte("mRedstoneStrength");
+ mType = aNBT.getByte("mType");
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ mRedstoneStrength = (byte)(aValue & 15);
+ mType = (byte)(aValue >>> 4);
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return (byte)((mRedstoneStrength & 15) | (mType << 4));
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ if (getBaseMetaTileEntity().isServerSide()) {
+ mUpdate = 2;
+ switch (mType) {
+ case 0: default:
+ switch (aSide) {
+ case 0: case 1:
+ mRedstoneStrength = (byte)((byte)( aX*4) + 4 * (byte)( aZ*4));
+ break;
+ case 2:
+ mRedstoneStrength = (byte)((byte)(4-aX*4) + 4 * (byte)(4-aY*4));
+ break;
+ case 3:
+ mRedstoneStrength = (byte)((byte)( aX*4) + 4 * (byte)(4-aY*4));
+ break;
+ case 4:
+ mRedstoneStrength = (byte)((byte)( aZ*4) + 4 * (byte)(4-aY*4));
+ break;
+ case 5:
+ mRedstoneStrength = (byte)((byte)(4-aZ*4) + 4 * (byte)(4-aY*4));
+ break;
+ }
+ break;
+ case 1:
+ switch (aSide) {
+ case 0: case 1:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << (((byte)( aX*2) + 2 * (byte)( aZ*2)))));
+ break;
+ case 2:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << (((byte)(2-aX*2) + 2 * (byte)(2-aY*2)))));
+ break;
+ case 3:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << (((byte)( aX*2) + 2 * (byte)(2-aY*2)))));
+ break;
+ case 4:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << (((byte)( aZ*2) + 2 * (byte)(2-aY*2)))));
+ break;
+ case 5:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << (((byte)(2-aZ*2) + 2 * (byte)(2-aY*2)))));
+ break;
+ }
+ break;
+ case 2:
+ switch (aSide) {
+ case 0: case 1:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << ((byte)( aZ*4))));
+ break;
+ case 2:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << ((byte)(4-aY*4))));
+ break;
+ case 3:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << ((byte)(4-aY*4))));
+ break;
+ case 4:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << ((byte)(4-aY*4))));
+ break;
+ case 5:
+ mRedstoneStrength = (byte)(mRedstoneStrength ^ (1 << ((byte)(4-aY*4))));
+ break;
+ }
+ break;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (getBaseMetaTileEntity().isServerSide()) {
+ getBaseMetaTileEntity().setGenericRedstoneOutput(true);
+ if (mUpdate > 0) {
+ mUpdate--;
+ }
+ else if (getBaseMetaTileEntity().isAllowedToWork()) {
+ mRedstoneStrength = 0;
+ }
+ for (byte i = 0; i < 6; i++) {
+ getBaseMetaTileEntity().setStrongOutputRedstoneSignal(i, i == getBaseMetaTileEntity().getFrontFacing()?(byte)0:mRedstoneStrength);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(i, i == getBaseMetaTileEntity().getFrontFacing()?(byte)0:mRedstoneStrength);
+ }
+ }
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing()) mType=(byte)((mType+1)%3);
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getSides(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getSidesActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(sIconList[mType*16+mRedstoneStrength])};
+ }
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_Main_Off)};
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_Main_On)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Main_Off)};
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Main_On)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Main_Off)};
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Main_On)};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
new file mode 100644
index 0000000000..379345ec6a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
@@ -0,0 +1,498 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import java.util.*;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.IRedstoneCircuitBlock;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.*;
+import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_RedstoneCircuitBlock;
+import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_RedstoneCircuitBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+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.tileentity.TileEntity;
+
+public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_RedstoneBase implements IRedstoneCircuitBlock {
+
+ public int mGate = 0, mGateData[] = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
+ public boolean bOutput = true;
+
+ public GT_MetaTileEntity_RedstoneCircuitBlock(int aID) {
+ super(aID, "redstone.circuit", "Redstone Circuit Block", 1, 5, "Computes Redstone");
+ }
+
+ public GT_MetaTileEntity_RedstoneCircuitBlock(final String aName, String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 1, 5, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RedstoneCircuitBlock(this.mName, mDescription, this.mTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_RedstoneCircuitBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_RedstoneCircuitBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public boolean hasSidedRedstoneOutputBehavior() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return !this.isOutputFacing(aSide);
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isPneumatic() {
+ return false;
+ }
+
+ @Override
+ public boolean isSteampowered() {
+ return false;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return aSide == this.getOutputFacing();
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 512;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GT_Values.V[1];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return bOutput ? GT_Values.V[1] : 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 1;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 5;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return GT_Values.V[3] * 1024;
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer, 147);
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mGate", mGate);
+ aNBT.setIntArray("mGateData", mGateData);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mGate = aNBT.getInteger("mGate");
+ mGateData = aNBT.getIntArray("mGateData");
+ if (mGateData.length != 8)
+ mGateData = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
+ }
+
+ public void switchOutput() {
+ bOutput = !bOutput;
+ }
+
+ public void switchGateForward(boolean aShift) {
+ try {
+ Set<Integer> tKeys = GregTech_API.sCircuitryBehaviors.keySet();
+ ArrayList<Integer> tList = new ArrayList<Integer>();
+ tList.addAll(tKeys);
+ if (tList.size() <= 0)
+ return;
+ Collections.sort(tList);
+ if (!GregTech_API.sCircuitryBehaviors.containsKey(mGate))
+ mGate = tList.get(0);
+ int tIndex = Collections.binarySearch(tList, mGate);
+ tIndex += aShift ? 16 : 1;
+ while (tIndex >= tList.size())
+ tIndex -= tList.size();
+ mGate = tList.get(tIndex);
+ switchGate();
+ }
+ catch (Throwable e) {
+ GT_Log.err.print(e);
+ }
+ }
+
+ public void switchGateBackward(boolean aShift) {
+ try {
+ Set<Integer> tKeys = GregTech_API.sCircuitryBehaviors.keySet();
+ ArrayList<Integer> tList = new ArrayList<Integer>();
+ tList.addAll(tKeys);
+ if (tList.size() <= 0)
+ return;
+ Collections.sort(tList);
+ if (!GregTech_API.sCircuitryBehaviors.containsKey(mGate))
+ mGate = tList.get(0);
+ int tIndex = Collections.binarySearch(tList, mGate);
+ tIndex -= aShift ? 16 : 1;
+ while (tIndex < 0)
+ tIndex += tList.size();
+ mGate = tList.get(tIndex);
+ switchGate();
+ }
+ catch (Throwable e) {
+ GT_Log.err.print(e);
+ }
+ }
+
+ @Override
+ public void onFacingChange() {
+ resetRedstone();
+ }
+
+ private void resetRedstone() {
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 0, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 1, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 2, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 3, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 4, (byte) 0);
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal((byte) 5, (byte) 0);
+ }
+
+ public void changeGateData(int aIndex, int aValue) {
+ mGateData[aIndex] += aValue;
+ validateGateData();
+ }
+
+ public void stackGateData(int aIndex, ItemStack aStack) {
+ mGateData[aIndex] = GT_Utility.stackToInt(aStack);
+ validateGateData();
+ }
+
+ private void switchGate() {
+ resetRedstone();
+ for (int i = 0; i < mGateData.length; i++)
+ mGateData[i] = 0;
+ GT_CircuitryBehavior tBehaviour = GregTech_API.sCircuitryBehaviors.get(mGate);
+ if (tBehaviour != null)
+ try {
+ tBehaviour.initParameters(mGateData, this);
+ }
+ catch (Throwable e) {
+ GT_Log.err.print(e);
+ }
+ validateGateData();
+ }
+
+ private void validateGateData() {
+ GT_CircuitryBehavior tBehaviour = GregTech_API.sCircuitryBehaviors.get(mGate);
+ if (tBehaviour != null)
+ try {
+ tBehaviour.validateParameters(mGateData, this);
+ }
+ catch (Throwable e) {
+ GT_Log.err.print(e);
+ }
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ getBaseMetaTileEntity().setGenericRedstoneOutput(true);
+ validateGateData();
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ getBaseMetaTileEntity().setGenericRedstoneOutput(true);
+ if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide()) {
+ mInventory[0] = mInventory[1] = mInventory[2] = mInventory[3] = mInventory[4] = null;
+ if (getBaseMetaTileEntity().getUniversalEnergyStored() >= getMinimumStoredEU()) {
+ if (getBaseMetaTileEntity().isActive()) {
+ GT_CircuitryBehavior tBehaviour = GregTech_API.sCircuitryBehaviors.get(mGate);
+ if (tBehaviour != null) {
+ try {
+ tBehaviour.onTick(mGateData, this);
+ if (tBehaviour.displayItemStack(mGateData, this, 0))
+ mInventory[1] = getCoverByID(mGateData[0]);
+ if (tBehaviour.displayItemStack(mGateData, this, 1))
+ mInventory[2] = getCoverByID(mGateData[1]);
+ if (tBehaviour.displayItemStack(mGateData, this, 2))
+ mInventory[3] = getCoverByID(mGateData[2]);
+ if (tBehaviour.displayItemStack(mGateData, this, 3))
+ mInventory[4] = getCoverByID(mGateData[3]);
+ }
+ catch (Throwable e) {
+ GT_Log.err.print(e);
+ }
+ }
+ }
+ getBaseMetaTileEntity().setErrorDisplayID(0);
+ }
+ else {
+ getBaseMetaTileEntity().setErrorDisplayID(1);
+ }
+ }
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ //Only Calc server-side
+ if (!this.getBaseMetaTileEntity().isServerSide()) {
+ return;
+ }
+ //Emit Redstone
+ for (byte i=0;i<6;i++) {
+ byte aRedstone = getBaseMetaTileEntity().getOutputRedstoneSignal(i);
+ this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(i, aRedstone);
+ }
+
+ }
+
+ @Override
+ public final boolean hasRedstoneSignal() {
+ for (byte i=0;i<6;i++) {
+ if (getBaseMetaTileEntity().getOutputRedstoneSignal(i) > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowGeneralRedstoneOutput() {
+ return true;
+ }
+
+ /** The Item List for Covers */
+ public static final Map<Integer, ItemStack> sCoversItems = new HashMap<Integer, ItemStack>();
+
+ private static void initCovers() {
+ for (GT_ItemStack aKey : GregTech_API.sCovers.keySet()) {
+ ItemStack aStack = aKey.toStack().copy();
+ if (aStack != null) {
+ sCoversItems.put(GT_Utility.stackToInt(aStack), aStack);
+ }
+ }
+ }
+
+ public static ItemStack getCoverByID(int aStack) {
+ if (sCoversItems.isEmpty()) {
+ initCovers();
+ }
+ return sCoversItems.get(Integer.valueOf(aStack));
+ }
+
+ @Override
+ public byte getOutputFacing() {
+ return getBaseMetaTileEntity().getBackFacing();
+ }
+
+ @Override
+ public boolean setRedstone(byte aStrength, byte aSide) {
+ if (getOutputRedstone(aSide) != aStrength) {
+ if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(1, false)) {
+ getBaseMetaTileEntity().setInternalOutputRedstoneSignal(aSide, aStrength);
+ getBaseMetaTileEntity().setErrorDisplayID(0);
+ return true;
+ }
+ else {
+ getBaseMetaTileEntity().setErrorDisplayID(1);
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /* @Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ if (aSide == getOutputFacing()) {
+ if (aSide == 0)
+ return aRedstone ? 56 : 54;
+ if (aSide == 1)
+ return aRedstone ? 53 : 52;
+ return aRedstone ? 94 : 93;
+ }
+ if (aSide == 0)
+ return aRedstone ? 60 : 59;
+ if (aSide == 1)
+ return aRedstone ? 58 : 57;
+ return aRedstone ? 62 : 61;
+ }*/
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public byte getOutputRedstone(byte aSide) {
+ return getBaseMetaTileEntity().getOutputRedstoneSignal(aSide);
+ }
+
+ @Override
+ public byte getInputRedstone(byte aSide) {
+ return getBaseMetaTileEntity().getInternalInputRedstoneSignal(aSide);
+ }
+
+ @Override
+ public Block getBlockAtSide(byte aSide) {
+ return getBaseMetaTileEntity().getBlockAtSide(aSide);
+ }
+
+ @Override
+ public byte getMetaIDAtSide(byte aSide) {
+ return getBaseMetaTileEntity().getMetaIDAtSide(aSide);
+ }
+
+ @Override
+ public TileEntity getTileEntityAtSide(byte aSide) {
+ return getBaseMetaTileEntity().getTileEntityAtSide(aSide);
+ }
+
+ @Override
+ public int getRandom(int aRange) {
+ return getBaseMetaTileEntity().getRandomNumber(aRange);
+ }
+
+ @Override
+ public GT_CoverBehavior getCover(byte aSide) {
+ return getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide);
+ }
+
+ @Override
+ public int getCoverID(byte aSide) {
+ return getBaseMetaTileEntity().getCoverIDAtSide(aSide);
+ }
+
+ @Override
+ public int getCoverVariable(byte aSide) {
+ return getBaseMetaTileEntity().getCoverDataAtSide(aSide);
+ }
+
+ @Override
+ public ICoverable getOwnTileEntity() {
+ return getBaseMetaTileEntity();
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getSides(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getSidesActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ private GT_RenderedTexture getBase() {
+ return new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top);
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_Off)};
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_On)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] {getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Off), new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red)};
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[] {getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On), new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red_Redstone)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Off)};
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_On)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Off)};
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On)};
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java
new file mode 100644
index 0000000000..81517c83b9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneLamp.java
@@ -0,0 +1,75 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class GT_MetaTileEntity_RedstoneLamp extends GT_MetaTileEntity_RedstoneBase {
+
+ public byte mRedstoneStrength = 0, mType = 0;
+ public static TexturesGtBlock.CustomIcon[] sIconList = new TexturesGtBlock.CustomIcon[2];
+
+ static {
+ sIconList[0] = new CustomIcon("TileEntities/gt4/redstone/Lamp/off");
+ sIconList[1] = new CustomIcon("TileEntities/gt4/redstone/Lamp/on");
+ }
+
+ public GT_MetaTileEntity_RedstoneLamp(int aID) {
+ super(aID, "redstone.lamp", "Redstone Controlled Lamp", 0, 0, "Redstone Controlled Lamp");
+ }
+
+ public GT_MetaTileEntity_RedstoneLamp(final String aName, String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 0, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RedstoneLamp(this.mName, mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide()) {
+ getBaseMetaTileEntity().setLightValue(getBaseMetaTileEntity().getStrongestRedstone());
+ getBaseMetaTileEntity().setActive(getBaseMetaTileEntity().getStrongestRedstone()>0);
+ }
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getSides(i);
+ rTextures[1][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 1 : 0)][aColorIndex + 1];
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {new GT_RenderedTexture(sIconList[0])};
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] {new GT_RenderedTexture(sIconList[1])};
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java
new file mode 100644
index 0000000000..1f65385793
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthDisplay.java
@@ -0,0 +1,144 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import gregtech.api.enums.Textures;
+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.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class GT_MetaTileEntity_RedstoneStrengthDisplay extends GT_MetaTileEntity_RedstoneBase {
+
+ public byte mRedstoneStrength = 0, mType = 0;
+ public static TexturesGtBlock.CustomIcon[] sIconList = new TexturesGtBlock.CustomIcon[144];
+
+ static {
+ for (int i=0;i<144;i++) {
+ sIconList[i] = new CustomIcon("TileEntities/gt4/redstone/Display/"+i);
+ }
+ }
+
+ public GT_MetaTileEntity_RedstoneStrengthDisplay(int aID, String aUnlocal, String aLocal, String aDescription) {
+ super(aID, aUnlocal, aLocal, 5, 0, aDescription);
+ }
+
+ public GT_MetaTileEntity_RedstoneStrengthDisplay(final String aName, String aDescription, final ITexture[][][] aTextures) {
+ super(aName, 5, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RedstoneStrengthDisplay(this.mName, mDescription, this.mTextures);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mRedstoneStrength", mRedstoneStrength);
+ aNBT.setByte("mType", mType);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mRedstoneStrength = aNBT.getByte("mRedstoneStrength");
+ mType = aNBT.getByte("mType");
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ mRedstoneStrength = (byte) (aValue & 15);
+ mType = (byte) (aValue >>> 4);
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return (byte) ((mRedstoneStrength & 15) | (mType << 4));
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().isServerSide()) {
+ mRedstoneStrength = getBaseMetaTileEntity().getStrongestRedstone();
+ }
+ }
+
+ /*@Override
+ public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ if (aSide == 0)
+ return aRedstone ? 60 : 59;
+ if (aSide == 1)
+ return aRedstone ? 58 : 57;
+ return aRedstone ? 62 : 61;
+ }*/
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing())
+ mType = (byte) ((mType + 1) % 6);
+ }
+
+ /*@Override
+ public IIcon getTextureIcon(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) {
+ return aSide == aFacing ? sIconList[mType * 16 + mRedstoneStrength] : null;
+ }*/
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getSides(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getSidesActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(sIconList[mType * 16 + mRedstoneStrength])};
+ }
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_Off)};
+ }
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_On)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Off)};
+ }
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_On)};
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Off)};
+ }
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On)};
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java
new file mode 100644
index 0000000000..efa3763370
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneStrengthScale.java
@@ -0,0 +1,50 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.redstone;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class GT_MetaTileEntity_RedstoneStrengthScale extends GT_MetaTileEntity_RedstoneStrengthDisplay {
+
+ public static TexturesGtBlock.CustomIcon[] sIconList = new TexturesGtBlock.CustomIcon[32];
+
+ static {
+ for (int i=0;i<32;i++) {
+ sIconList[i] = new CustomIcon("TileEntities/gt4/redstone/Scale/"+i);
+ }
+ }
+
+ public GT_MetaTileEntity_RedstoneStrengthScale(int aID) {
+ super(aID, "redstone.display.scale", "Redstone Scale", "Redstone Strength on a Scale");
+ }
+
+ public GT_MetaTileEntity_RedstoneStrengthScale(final String aName, String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RedstoneStrengthScale(this.mName, mDescription, this.mTextures);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aSide == getBaseMetaTileEntity().getFrontFacing())
+ mType = (byte) ((mType + 1) % 2);
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(sIconList[mType * 16 + mRedstoneStrength])};
+ }
+ return this.mTextures[(aActive || hasRedstoneSignal() ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java
new file mode 100644
index 0000000000..0b815bfae7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java
@@ -0,0 +1,551 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import java.util.ArrayList;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.item.general.ItemBlueprint;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_AdvancedWorkbench;
+import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_AdvancedWorkbench;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+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.nbt.NBTTagList;
+
+public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_BasicTank {
+
+ public boolean mFlushMode = false;
+
+ protected String mLocalName;
+
+ public GT_MetaTileEntity_AdvancedCraftingTable(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription) {
+ super(aID, aName, aNameRegional, aTier, 35, aDescription);
+ mLocalName = aNameRegional;
+ }
+
+ public GT_MetaTileEntity_AdvancedCraftingTable(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, 35, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return true;
+ }
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 31 || aIndex > 32;
+ }
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+ @Override
+ public boolean isEnetInput() {
+ return isElectric();
+ }
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+ @Override
+ public long maxEUInput() {
+ return isElectric() ? GT_Values.V[3] : 0;
+ }
+ @Override
+ public long maxEUStore() {
+ return isElectric() ? GT_Values.V[3] * 1024 : 0;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return isAdvanced();
+ }
+
+ @Override
+ public boolean isPneumatic() {
+ return false;
+ }
+
+ @Override
+ public boolean isSteampowered() {
+ return false;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return isElectric() ? 2 : 0;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return isElectric() ? GT_Values.V[3] * 2 : 0;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 35;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_AdvancedCraftingTable(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ public void sortIntoTheInputSlots() {
+ for (byte i = 21; i < 30; i++)
+ if (mInventory[i] != null) {
+ if (mInventory[i].stackSize == 0) {
+ mInventory[i] = null;
+ }
+ if (mInventory[i] != null)
+ for (byte j = 0; j < 16; j++) {
+ if (GT_Utility.areStacksEqual(
+ mInventory[i], mInventory[j]
+ )) {
+ GT_Utility.moveStackFromSlotAToSlotB(
+ getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte) 64, (byte) 1, (byte) 64, (byte) 1
+ );
+ }
+ }
+ if (mInventory[i] != null)
+ for (byte j = 0; j < 16; j++) {
+ if (mInventory[j] == null) {
+ GT_Utility.moveStackFromSlotAToSlotB(
+ getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte) 64, (byte) 1, (byte) 64, (byte) 1
+ );
+ }
+ }
+ }
+ }
+
+ private void fillLiquidContainers() {
+ for (byte i = 16; i < 21 && mFluid != null; i++) {
+ ItemStack tOutput = GT_Utility.fillFluidContainer(mFluid, mInventory[i], false, true);
+ if (tOutput != null) {
+ if (mInventory[i].stackSize == 1) {
+ mFluid.amount -= GT_Utility.getFluidForFilledItem(
+ tOutput, true
+ ).amount * tOutput.stackSize;
+ mInventory[i] = tOutput;
+ }
+ else
+ for (byte j = 16; j < 21; j++) {
+ if (mInventory[j] == null || (GT_Utility.areStacksEqual(
+ tOutput, mInventory[j]
+ ) && mInventory[j].stackSize
+ + tOutput.stackSize <= tOutput.getMaxStackSize())) {
+ mFluid.amount -= GT_Utility.getFluidForFilledItem(
+ tOutput, true
+ ).amount * tOutput.stackSize;
+ getBaseMetaTileEntity().decrStackSize(i, 1);
+ if (mInventory[j] == null) {
+ mInventory[j] = tOutput;
+ }
+ else {
+ mInventory[j].stackSize++;
+ }
+ break;
+ }
+ }
+ if (mFluid != null && mFluid.amount <= 0)
+ mFluid = null;
+ }
+ }
+ if (mFluid != null && mFluid.amount <= 0)
+ mFluid = null;
+ }
+
+ public void setBluePrint(ItemStack aStack) {
+ if (aStack == null) {
+ aStack = mInventory[30];
+ Logger.INFO("Using Slot 30 supply.");
+ }
+ if (mInventory[31] == null || aStack == null || aStack.getItem() == null
+ || aStack.getItemDamage() != 0 || aStack.stackSize != 1
+ || !(aStack.getItem() instanceof ItemBlueprint)) {
+ try {
+ Logger.INFO(
+ "Could not set Blueprint. Slot 31: "
+ + (mInventory[31] != null ? mInventory[31].getDisplayName() : "Null")
+ + ", aStack: "+(aStack != null ? aStack.getDisplayName() : "Null")
+ + ", Damage: "+(aStack != null ? aStack.getItemDamage() : "Null"));
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ return;
+ }
+ if (!aStack.getTagCompound().hasKey("Inventory")) {
+ NBTTagCompound tNBT = new NBTTagCompound();
+ NBTTagList tNBT_ItemList = new NBTTagList();
+ for (int i = 0; i < 9; i++) {
+ ItemStack tStack = mInventory[i + 21];
+ if (tStack != null) {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setByte("Slot", (byte) i);
+ tStack.writeToNBT(tag);
+ tNBT_ItemList.appendTag(tag);
+ }
+ }
+ tNBT.setTag("Inventory", tNBT_ItemList);
+ tNBT.setBoolean("mBlueprint", true);
+ tNBT.setInteger("mID", MathUtils.randInt(1, Short.MAX_VALUE));
+ tNBT.setString("mName", mInventory[31].getDisplayName());
+ aStack.setTagCompound(tNBT);
+ Logger.INFO("Set NBT of crafting table to Stack in slot 30.");
+ }
+ else {
+ Logger.INFO("Blueprint already has recipe tags.");
+ }
+
+ }
+
+ public ItemStack getCraftingOutput() {
+ if (mInventory[30] != null && mInventory[30].getItem() != null
+ && mInventory[30].getItemDamage() == 0
+ && mInventory[30].hasTagCompound() && mInventory[30].getItem() instanceof ItemBlueprint) {
+ //Logger.INFO("Getting Blueprint Data in slot 30. "+mInventory[30].getDisplayName());
+ NBTTagCompound tNBT = mInventory[30].getTagCompound();
+ NBTTagList tNBT_ItemList = tNBT.getTagList("Blueprint", 10);
+ for (int i = 0; i < tNBT_ItemList.tagCount() && i < 9; i++) {
+ NBTTagCompound tag = (NBTTagCompound) tNBT_ItemList.getCompoundTagAt(
+ i
+ );
+ byte slot = tag.getByte("Slot");
+ if (slot >= 0 && slot < 9 && mInventory[slot + 21] == null) {
+ mInventory[slot + 21] = GT_Utility.loadItem(tag);
+ if (mInventory[slot + 21] != null)
+ mInventory[slot + 21].stackSize = 0;
+ }
+ }
+ }
+ mInventory[31] = GT_ModHandler.getAllRecipeOutput(
+ getBaseMetaTileEntity().getWorld(), new ItemStack[]{
+ mInventory[21], mInventory[22], mInventory[23],
+ mInventory[24], mInventory[25], mInventory[26],
+ mInventory[27], mInventory[28], mInventory[29]
+ }
+ );
+ return mInventory[31];
+ }
+
+ public boolean canDoCraftingOutput() {
+ if (mInventory[31] == null)
+ return false;
+ for (ItemStack tStack : recipeContent()) {
+ if (tStack.stackSize > getAmountOf(tStack)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private int getAmountOf(ItemStack aStack) {
+ int tAmount = 0;
+ for (byte i = 0; i < 30 && tAmount < 9; i++) {
+ if (GT_Utility.areStacksOrToolsEqual(aStack, mInventory[i])) {
+ tAmount += mInventory[i].stackSize;
+ }
+ }
+ return tAmount;
+ }
+
+ private ArrayList<ItemStack> recipeContent() {
+ ArrayList<ItemStack> tList = new ArrayList<ItemStack>();
+ for (byte i = 21; i < 30; i++) {
+ if (mInventory[i] != null) {
+ boolean temp = false;
+ for (byte j = 0; j < tList.size(); j++) {
+ if (GT_Utility.areStacksOrToolsEqual(
+ mInventory[i], tList.get(j)
+ )) {
+ tList.get(j).stackSize++;
+ temp = true;
+ break;
+ }
+ }
+ if (!temp)
+ tList.add(GT_Utility.copy(1, mInventory[i]));
+ }
+ }
+ return tList;
+ }
+
+ public ItemStack consumeMaterials(EntityPlayer aPlayer, ItemStack aHoldStack) {
+ if (mInventory[31] == null)
+ return aHoldStack;
+ if (aHoldStack != null) {
+ if (!GT_Utility.areStacksEqual(aHoldStack, mInventory[31]))
+ return aHoldStack;
+ if (aHoldStack.stackSize
+ + mInventory[31].stackSize > aHoldStack.getMaxStackSize())
+ return aHoldStack;
+ }
+ for (byte i = 21; i < 30; i++)
+ if (mInventory[i] != null) {
+ for (byte j = 0; j <= i; j++) {
+ if (j < 21 || j == i) {
+ if (GT_Utility.areStacksOrToolsEqual(
+ mInventory[i], mInventory[j]
+ ) && mInventory[j].stackSize > 0) {
+ ItemStack tStack = GT_Utility.getContainerItem(
+ mInventory[j], true
+ );
+ if (tStack == null
+ || (tStack.isItemStackDamageable()
+ && tStack.getItemDamage() >= tStack.getMaxDamage())) {
+ getBaseMetaTileEntity().decrStackSize(j, 1);
+ }
+ else if (mInventory[j].stackSize == 1) {
+ mInventory[j] = tStack;
+ }
+ else {
+ getBaseMetaTileEntity().decrStackSize(j, 1);
+ for (byte k = 0; k < 21; k++) {
+ if (mInventory[k] == null) {
+ mInventory[k] = tStack;
+ break;
+ }
+ else {
+ if (GT_Utility.areStacksEqual(
+ tStack, mInventory[k]
+ )) {
+ if (tStack.stackSize
+ + mInventory[k].stackSize <= mInventory[k].getMaxStackSize()) {
+ mInventory[k].stackSize += tStack.stackSize;
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (aHoldStack == null) {
+ aHoldStack = GT_Utility.copy(mInventory[31]);
+ aHoldStack.onCrafting(
+ getBaseMetaTileEntity().getWorld(), aPlayer, mInventory[31].stackSize
+ );
+ }
+ else {
+ aHoldStack.stackSize += mInventory[31].stackSize;
+ aHoldStack.onCrafting(
+ getBaseMetaTileEntity().getWorld(), aPlayer, mInventory[31].stackSize
+ );
+ }
+
+ fillLiquidContainers();
+
+ return aHoldStack;
+ }
+
+ @Override
+ public int rechargerSlotStartIndex() {
+ return 16;
+ }
+
+ @Override
+ public int rechargerSlotCount() {
+ return 5;
+ }
+
+ @Override
+ public long getOutputTier() {
+ return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage());
+ }
+
+ @Override
+ public int getCapacity() {
+ return 64000;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return -100;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == 33 || (mFlushMode && aIndex >= 21 && aIndex < 30);
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (aIndex < 16) {
+ for (byte i = 0; i < 16; i++)
+ if (GT_Utility.areStacksOrToolsEqual(aStack, mInventory[i]))
+ return aIndex == i;
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ getCraftingOutput();
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide()) {
+ if (getBaseMetaTileEntity().hasInventoryBeenModified())
+ getCraftingOutput();
+ fillLiquidContainers();
+ if (mFlushMode) {
+ mFlushMode = false;
+ for (byte i = 21; i < 30; i++) {
+ if (mInventory[i] != null) {
+ if (mInventory[i].stackSize == 0) {
+ mInventory[i] = null;
+ }
+ else {
+ mFlushMode = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ /*if (aTick % 100 == 0) {
+ for (int i = 0; i < this.mInventory.length; i++) {
+ ItemStack aSlot = mInventory[i];
+ Logger.INFO("Slot "+i+" "+(aSlot != null ? "contains "+aSlot.getDisplayName() : "is empty"));
+ }
+ }*/
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {
+ isAdvanced() ? "For the very large Projects" : "For the smaller Projects",
+ "Hold Shift in GUI to see slot usage",
+ this.mDescription,
+ CORE.GT_Tooltip };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFront(i);
+ rTextures[6][i + 1] = this.getBack(i);
+ rTextures[7][i + 1] = this.getBottom(i);
+ rTextures[8][i + 1] = this.getTop(i);
+ rTextures[9][i + 1] = this.getSides(i);
+ }
+ return rTextures;
+ }
+
+ protected boolean isAdvanced() {
+ return true;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0
+ : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex
+ + 1];
+ }
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)};
+ }
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)};
+ }
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Bottom) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Bottom)};
+ }
+
+ public ITexture[] getTop(final byte aColor) {
+ if (isAdvanced()) {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Top),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) };
+ }
+ else {
+ return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Top),
+ new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Crafting_Overlay) };
+ }
+ }
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)};
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java
new file mode 100644
index 0000000000..f421d391c0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java
@@ -0,0 +1,83 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_ItemStack;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_BronzeWorkbench;
+import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_BronzeWorkbench;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_AdvancedCraftingTable {
+
+ public GT_MetaTileEntity_BronzeCraftingTable(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aDescription);
+ }
+
+ public GT_MetaTileEntity_BronzeCraftingTable(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName);
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_BronzeCraftingTable(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return GregTech_API.getCoverBehavior(aStack.toStack()).isSimpleCover();
+ }
+
+ @Override
+ public int rechargerSlotStartIndex() {
+ return 0;
+ }
+
+ @Override
+ public int rechargerSlotCount() {
+ return 0;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 16000;
+ }
+
+ @Override
+ protected boolean isAdvanced() {
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
index 320e2175b0..e18f5d4bfc 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
@@ -2,12 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
import static gregtech.api.enums.GT_Values.V;
-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.world.World;
-
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_1by1;
import gregtech.api.gui.GT_GUIContainer_1by1;
@@ -17,12 +11,16 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+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.world.World;
public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
@@ -252,7 +250,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
return true;
}
- private void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ protected void showEnergy(final World worldIn, final EntityPlayer playerIn){
final long tempStorage = this.getBaseMetaTileEntity().getStoredEU();
final double c = ((double) tempStorage / this.maxEUStore()) * 100;
final double roundOff = Math.round(c * 100.00) / 100.00;