From 3b681b69d50cddd8a9efbb677c51bf8d2df389db Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Wed, 10 May 2017 19:56:36 +0200 Subject: Changed multiblocks so they all consider all inputs for finding recipes --- .../machines/multi/GT_MetaTileEntity_DistillationTower.java | 2 +- .../machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java | 2 +- .../machines/multi/GT_MetaTileEntity_ImplosionCompressor.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 22dd01c755..78f247bb3b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -90,7 +90,7 @@ public class GT_MetaTileEntity_DistillationTower long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); if (tFluids.length > 0) { for(int i = 0;i tFluidList = getStoredFluids(); int tFluidList_sS = tFluidList.size(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 81e9485ecf..090b84320b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -83,7 +83,7 @@ public class GT_MetaTileEntity_ImplosionCompressor } } } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); if (tInputList.size() > 0) { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { -- cgit From 38bfbabd58f1fd64a472c108fa6591437f1f4eb9 Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Tue, 30 May 2017 10:21:46 +0200 Subject: Fixed a bug where the LCM could have a mMaxProgressTime of zero. --- .../GT_MetaTileEntity_LargeChemicalReactor.java | 391 +++++++++++---------- 1 file changed, 196 insertions(+), 195 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index 3262d4eee7..aeff099248 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -1,195 +1,196 @@ -package gregtech.common.tileentities.machines.multi; - -import java.util.ArrayList; -import java.util.Arrays; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { - - private static final int CASING_INDEX = 62; - - public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_LargeChemicalReactor(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LargeChemicalReactor(this.mName); - } - - @Override - public String[] getDescription() { - return new String[] { - "Controller block for the Large Chemical Reactor", - "Has the same recipes as the Chemical Reactor", - "Does not lose efficiency when overclocked", - "Accepts fluids instead of fluid cells", - "Size(WxHxD): 3x3x3", - "3x3x3 of Chemically Inert Machine Casings (hollow, min 24!)", - "Controller (Front centered)", - "1x Cupronickel Coil Block (Bottom centered)", - "1x PTFE Pipe Machine Casing (inside the hollow casings)", - "1x Input Bus/Hatch (Any inert casing)", - "1x Output Bus/Hatch (Any inert casing)", - "1x Maintenance Hatch (Any inert casing)", - "1x Energy Hatch (Any inert casing)"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, - boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[] { - Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) }; - } - return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX] }; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - int tInputList_sS = tInputList.size(); - for (int i = 0; i < tInputList_sS - 1; i++) { - for (int j = i + 1; j < tInputList_sS; j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } else { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - } - } - } - ItemStack[] inputs = tInputList.toArray(new ItemStack[tInputList.size()]); - - ArrayList tFluidList = getStoredFluids(); - int tFluidList_sS = tFluidList.size(); - for (int i = 0; i < tFluidList_sS - 1; i++) { - for (int j = i + 1; j < tFluidList_sS; j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - tFluidList_sS = tFluidList.size(); - } else { - tFluidList.remove(i--); - tFluidList_sS = tFluidList.size(); - break; - } - } - } - } - FluidStack[] fluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); - - if (inputs.length > 0 || fluids.length > 0) { - long voltage = getMaxInputVoltage(); - byte tier = (byte) Math.max(1, GT_Utility.getTier(voltage)); - GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, - gregtech.api.enums.GT_Values.V[tier], fluids, inputs); - if (recipe != null && recipe.isRecipeInputEqual(true, fluids, inputs)) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - int EUt = recipe.mEUt; - int maxProgresstime = recipe.mDuration; - - while (EUt <= gregtech.api.enums.GT_Values.V[tier - 1] && maxProgresstime > 1) { - EUt *= 4; - maxProgresstime /= 4; - } - - this.mEUt = -EUt; - this.mMaxProgresstime = maxProgresstime; - this.mOutputItems = recipe.mOutputs; - this.mOutputFluids = recipe.mFluidOutputs; - return true; - } - } - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int casingAmount = 0; - // x=width, z=depth, y=height - for (int x = -1 + xDir; x <= xDir + 1; x++) { - for (int z = -1 + zDir; z <= zDir + 1; z++) { - for (int y = -1; y <= 1; y++) { - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - if (x == xDir && z == zDir && y <= 0) { - if ((y == -1) - && (block != GregTech_API.sBlockCasings5 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 0)) { - return false; - } else if (y == 0 && (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 15)) { - return false; - } - } else if (x != 0 || y != 0 || z != 0) { - if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 14) { - casingAmount++; - } else { - return false; - } - } - } - - } - } - - } - return casingAmount >= 8; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - -} +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; +import java.util.Arrays; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { + + private static final int CASING_INDEX = 62; + + public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_LargeChemicalReactor(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_LargeChemicalReactor(this.mName); + } + + @Override + public String[] getDescription() { + return new String[] { + "Controller block for the Large Chemical Reactor", + "Has the same recipes as the Chemical Reactor", + "Does not lose efficiency when overclocked", + "Accepts fluids instead of fluid cells", + "Size(WxHxD): 3x3x3", + "3x3x3 of Chemically Inert Machine Casings (hollow, min 24!)", + "Controller (Front centered)", + "1x Cupronickel Coil Block (Bottom centered)", + "1x PTFE Pipe Machine Casing (inside the hollow casings)", + "1x Input Bus/Hatch (Any inert casing)", + "1x Output Bus/Hatch (Any inert casing)", + "1x Maintenance Hatch (Any inert casing)", + "1x Energy Hatch (Any inert casing)"}; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, + boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[] { + Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE + : Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) }; + } + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX] }; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + int tInputList_sS = tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + tInputList_sS = tInputList.size(); + } else { + tInputList.remove(i--); + tInputList_sS = tInputList.size(); + break; + } + } + } + } + ItemStack[] inputs = tInputList.toArray(new ItemStack[tInputList.size()]); + + ArrayList tFluidList = getStoredFluids(); + int tFluidList_sS = tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + tFluidList_sS = tFluidList.size(); + } else { + tFluidList.remove(i--); + tFluidList_sS = tFluidList.size(); + break; + } + } + } + } + FluidStack[] fluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + + if (inputs.length > 0 || fluids.length > 0) { + long voltage = getMaxInputVoltage(); + byte tier = (byte) Math.max(1, GT_Utility.getTier(voltage)); + GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, + gregtech.api.enums.GT_Values.V[tier], fluids, inputs); + if (recipe != null && recipe.isRecipeInputEqual(true, fluids, inputs)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + int EUt = recipe.mEUt; + int maxProgresstime = recipe.mDuration; + + while (EUt <= gregtech.api.enums.GT_Values.V[tier - 1] && maxProgresstime > 1) { + EUt *= 4; + maxProgresstime /= 4; + } + maxProgresstime = Math.max(maxProgresstime, 1); + + this.mEUt = -EUt; + this.mMaxProgresstime = maxProgresstime; + this.mOutputItems = recipe.mOutputs; + this.mOutputFluids = recipe.mFluidOutputs; + return true; + } + } + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int casingAmount = 0; + // x=width, z=depth, y=height + for (int x = -1 + xDir; x <= xDir + 1; x++) { + for (int z = -1 + zDir; z <= zDir + 1; z++) { + for (int y = -1; y <= 1; y++) { + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (x == xDir && z == zDir && y <= 0) { + if ((y == -1) + && (block != GregTech_API.sBlockCasings5 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 0)) { + return false; + } else if (y == 0 && (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 15)) { + return false; + } + } else if (x != 0 || y != 0 || z != 0) { + if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 14) { + casingAmount++; + } else { + return false; + } + } + } + + } + } + + } + return casingAmount >= 8; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + +} -- cgit From b187410005771f1762f3bb5c94c0c5cd26dd06db Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 1 Jun 2017 00:01:32 +0500 Subject: AdvMiner rewriting; now it's Ore Drilling Plant Four tiers of Ore Drilling Plant I - radius is 3 chunks MV+ (default) II - radius is 4 chunks HV+ III - radius is 6 chunks EV+ IV - radius is 9 chunks IV+ New behavior: - pick pipes after mining finish - extract ore block before moving down --- src/main/java/gregtech/api/enums/ItemList.java | 4 +- src/main/java/gregtech/api/enums/Textures.java | 2 +- .../GT_MetaTileEntity_MultiBlockBase.java | 7 +- src/main/java/gregtech/api/util/GT_Utility.java | 5 + .../gregtech/common/blocks/GT_Block_Casings4.java | 4 +- .../multi/GT_MetaTileEntity_AdvMiner2.java | 342 ------------------ .../multi/GT_MetaTileEntity_OreDrillingPlant1.java | 51 +++ .../multi/GT_MetaTileEntity_OreDrillingPlant2.java | 51 +++ .../multi/GT_MetaTileEntity_OreDrillingPlant3.java | 51 +++ .../multi/GT_MetaTileEntity_OreDrillingPlant4.java | 51 +++ .../GT_MetaTileEntity_OreDrillingPlantBase.java | 386 +++++++++++++++++++++ .../loaders/postload/GT_MachineRecipeLoader.java | 1 + .../preload/GT_Loader_MetaTileEntities.java | 14 +- .../iconsets/MACHINE_CASING_MINING_OSMIRIDIUM.png | Bin 0 -> 455 bytes .../textures/gui/multimachines/AdvMiner2.png | Bin 4364 -> 0 bytes .../gui/multimachines/OreDrillingPlant.png | Bin 0 -> 4364 bytes 16 files changed, 620 insertions(+), 349 deletions(-) delete mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_MINING_OSMIRIDIUM.png delete mode 100644 src/main/resources/assets/gregtech/textures/gui/multimachines/AdvMiner2.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/multimachines/OreDrillingPlant.png (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 12cad31cc5..155ebf459d 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -536,7 +536,7 @@ public enum ItemList implements IItemContainer { Casing_ULV, Casing_LV, Casing_MV, Casing_HV, Casing_EV, Casing_IV, Casing_LuV, Casing_ZPM, Casing_UV, Casing_MAX, Casing_BronzePlatedBricks, Casing_HeatProof, Casing_Coil_Cupronickel_Deprecated, Casing_Coil_Kanthal_Deprecated, Casing_Coil_Nichrome_Deprecated, Casing_Coil_Superconductor, Casing_SolidSteel, Casing_FrostProof, Casing_Gearbox_Bronze, Casing_Gearbox_Steel, Casing_Gearbox_Titanium, Casing_Gearbox_TungstenSteel, Casing_Processor, Casing_DataDrive, Casing_ContainmentField, Casing_Assembler, Casing_Pump, Casing_Motor, Casing_Pipe_Bronze, Casing_Pipe_Steel, Casing_Pipe_Titanium, Casing_Pipe_TungstenSteel, Casing_Stripes_A, Casing_Stripes_B, Casing_RadioactiveHazard, Casing_BioHazard, Casing_ExplosionHazard, Casing_FireHazard, Casing_AcidHazard, Casing_MagicHazard, Casing_FrostHazard, Casing_NoiseHazard, Casing_Grate, Casing_Vent, Casing_RadiationProof, Casing_Firebox_Bronze, Casing_Firebox_Steel, Casing_Firebox_TungstenSteel, - Casing_RobustTungstenSteel, Casing_CleanStainlessSteel, Casing_StableTitanium, Casing_Firebox_Titanium, + Casing_MiningOsmiridium, Casing_RobustTungstenSteel, Casing_CleanStainlessSteel, Casing_StableTitanium, Casing_Firebox_Titanium, Hull_ULV, Hull_LV, Hull_MV, Hull_HV, Hull_EV, Hull_IV, Hull_LuV, Hull_ZPM, Hull_UV, Hull_MAX, Automation_Filter_ULV, Automation_Filter_LV, Automation_Filter_MV, Automation_Filter_HV, Automation_Filter_EV, Automation_Filter_IV, Automation_Filter_LuV, Automation_Filter_ZPM, Automation_Filter_UV, Automation_Filter_MAX, @@ -632,7 +632,7 @@ public enum ItemList implements IItemContainer { Casing_Coil_Cupronickel, Casing_Coil_Kanthal, Casing_Coil_Nichrome, Casing_Coil_TungstenSteel, Casing_Coil_HSSG, Casing_Coil_Naquadah, Casing_Coil_NaquadahAlloy, MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, MobRep_LuV, MobRep_ZPM, MobRep_UV, Cover_PlayerDetector, Machine_Multi_HeatExchanger, Block_BronzePlate, Block_IridiumTungstensteel, Block_Plascrete, Block_TungstenSteelReinforced, - Honeycomb, Charcoal_Pile, Block_BrittleCharcoal, Seismic_Prospector, Seismic_Prospector_Adv, OilDrill, AdvancedMiner2, PyrolyseOven, OilCracker, Crop_Drop_UUMBerry, Crop_Drop_UUABerry, Empty_Board_Basic, Empty_Board_Elite, + Honeycomb, Charcoal_Pile, Block_BrittleCharcoal, Seismic_Prospector, Seismic_Prospector_Adv, OilDrill, OreDrill1, OreDrill2, OreDrill3, OreDrill4, PyrolyseOven, OilCracker, Crop_Drop_UUMBerry, Crop_Drop_UUABerry, Empty_Board_Basic, Empty_Board_Elite, Battery_Charger_4by4_ULV, Battery_Charger_4by4_LV, Battery_Charger_4by4_MV, Battery_Charger_4by4_HV, Battery_Charger_4by4_EV, Battery_Charger_4by4_IV, Battery_Charger_4by4_LuV, Battery_Charger_4by4_ZPM, Battery_Charger_4by4_UV, Battery_Charger_4by4_MAX, MicroTransmitter_HV, MicroTransmitter_EV, MicroTransmitter_IV, MicroTransmitter_LUV, MicroTransmitter_ZPM, Crop_Drop_Bauxite, Crop_Drop_Ilmenite, Crop_Drop_Pitchblende, Crop_Drop_Uraninite, Crop_Drop_Thorium, Crop_Drop_Nickel, Crop_Drop_Zinc, Crop_Drop_Manganese, Crop_Drop_Scheelite, Crop_Drop_Platinum, Crop_Drop_Iridium, Crop_Drop_Osmium, Crop_Drop_Naquadah, Uraniumcell_1, Uraniumcell_2, Uraniumcell_4, Moxcell_1, Moxcell_2, Moxcell_4, diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index d2894ad7bd..565398010f 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -29,7 +29,7 @@ public class Textures { MACHINE_MV_SIDE, MACHINE_MV_BOTTOM, MACHINE_HV_TOP, MACHINE_HV_SIDE, MACHINE_HV_BOTTOM, MACHINE_EV_TOP, MACHINE_EV_SIDE, MACHINE_EV_BOTTOM, MACHINE_IV_TOP, MACHINE_IV_SIDE, MACHINE_IV_BOTTOM, MACHINE_LuV_TOP, MACHINE_LuV_SIDE, MACHINE_LuV_BOTTOM, MACHINE_ZPM_TOP, MACHINE_ZPM_SIDE, MACHINE_ZPM_BOTTOM, MACHINE_UV_TOP, MACHINE_UV_SIDE, MACHINE_UV_BOTTOM, MACHINE_MAX_TOP, MACHINE_MAX_SIDE, MACHINE_MAX_BOTTOM, MACHINE_BRONZEPLATEDBRICKS, MACHINE_HEATPROOFCASING, MACHINE_COIL_SUPERCONDUCTOR, - MACHINE_BRONZEBLASTFURNACE, MACHINE_BRONZEBLASTFURNACE_ACTIVE, MACHINE_CASING_ROBUST_TUNGSTENSTEEL, MACHINE_CASING_CLEAN_STAINLESSSTEEL, MACHINE_CASING_STABLE_TITANIUM, + MACHINE_BRONZEBLASTFURNACE, MACHINE_BRONZEBLASTFURNACE_ACTIVE, MACHINE_CASING_ROBUST_TUNGSTENSTEEL, MACHINE_CASING_CLEAN_STAINLESSSTEEL, MACHINE_CASING_STABLE_TITANIUM, MACHINE_CASING_MINING_OSMIRIDIUM, MACHINE_CASING_FIREBOX_TITANIUM, MACHINE_CASING_FUSION_COIL, MACHINE_CASING_FUSION, MACHINE_CASING_FUSION_GLASS, MACHINE_CASING_FUSION_GLASS_YELLOW, MACHINE_CASING_FUSION_2, MACHINE_CASING_MAGIC, MACHINE_CASING_MAGIC_ACTIVE, MACHINE_CASING_MAGIC_FRONT, MACHINE_CASING_MAGIC_FRONT_ACTIVE, MACHINE_CASING_DRAGONEGG, MACHINE_CASING_SOLID_STEEL, MACHINE_CASING_FROST_PROOF, MACHINE_CASING_PUMP, MACHINE_CASING_MOTOR, MACHINE_CASING_PIPE_BRONZE, MACHINE_CASING_PIPE_STEEL, MACHINE_CASING_PIPE_TITANIUM, MACHINE_CASING_PIPE_TUNGSTENSTEEL, diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 3dd59126b8..bd10ca635c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -35,7 +35,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public ItemStack[] mOutputItems = null; public FluidStack[] mOutputFluids = null; public String mNEI; - public int damageFactorLow = 5; + public int damageFactorLow = 5; public float damageFactorHigh = 0.6f; public ArrayList mInputHatches = new ArrayList(); @@ -393,6 +393,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { return 6; } + public int getCurrentEfficiency(ItemStack itemStack) { + int maxEff = getMaxEfficiency(itemStack); + return maxEff - (getIdealStatus() - getRepairStatus()) * maxEff / 10; + } + public boolean doRandomMaintenanceDamage() { if (!isCorrectMachinePart(mInventory[1]) || getRepairStatus() == 0) { stopMachine(); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 6c3289af30..59bc2a59ed 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1950,6 +1950,11 @@ public class GT_Utility { return result; } + @SuppressWarnings("unchecked") + public static T[] listToArray(List list) { + return (T[]) list.toArray(); + } + public static class ItemNBT { public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { if (aNBT == null) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 3c3535e4da..4d835869b6 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -37,6 +37,7 @@ public class GT_Block_Casings4 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Titanium Turbine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Tungstensteel Turbine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Engine Intake Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Mining Osmiridium Casing"); ItemList.Casing_RobustTungstenSteel.set(new ItemStack(this, 1, 0)); ItemList.Casing_CleanStainlessSteel.set(new ItemStack(this, 1, 1)); @@ -50,6 +51,7 @@ public class GT_Block_Casings4 ItemList.Casing_Turbine2.set(new ItemStack(this, 1, 11)); ItemList.Casing_Turbine3.set(new ItemStack(this, 1, 12)); ItemList.Casing_EngineIntake.set(new ItemStack(this, 1, 13)); + ItemList.Casing_MiningOsmiridium.set(new ItemStack(this, 1, 14)); } public IIcon getIcon(int aSide, int aMeta) { @@ -83,7 +85,7 @@ public class GT_Block_Casings4 case 13: return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getIcon(); case 14: - return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_MINING_OSMIRIDIUM.getIcon(); case 15: return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java deleted file mode 100644 index 08d889b7e4..0000000000 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AdvMiner2.java +++ /dev/null @@ -1,342 +0,0 @@ -package gregtech.common.tileentities.machines.multi; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Block_Ores_Abstract; -import gregtech.common.blocks.GT_TileEntity_Ores; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkPosition; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import java.util.ArrayList; - -public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBase { - - private final ArrayList mMineList = new ArrayList(); - - public GT_MetaTileEntity_AdvMiner2(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_AdvMiner2(String aName) { - super(aName); - } - - public String[] getDescription() { - return new String[]{ - "Controller Block for the Advanced Miner II", - "Size(WxHxD): 3x7x3, Controller (Front middle bottom)", - "3x1x3 Base of Solid Steel Casings", - "1x3x1 Solid Steel Casing pillar (Center of base)", - "1x3x1 Steel Frame Boxes (Each Steel pillar side and on top)", - "1x Input Hatch (Any bottom layer casing)", - "1x Output Bus (Any bottom layer casing)", - "1x Maintenance Hatch (Any bottom layer casing)", - "1x MV+ Energy Hatch (Any bottom layer casing)"}; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AdvMiner2.png"); - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - if (mInventory[1] == null || (mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && mInventory[1].stackSize < mInventory[1].getMaxStackSize())) { - ArrayList tItems = getStoredInputs(); - for (ItemStack tStack : tItems) { - if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) { - tStack.stackSize--; - if (tStack.stackSize < 1) { - tStack = null; - } - if (mInventory[1] == null) { - mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L); - } else { - mInventory[1].stackSize++; - } - } - - } - } - if (mInputHatches == null || mInputHatches.get(0).mFluid == null || mInputHatches.get(0).mFluid.getFluid().getID() != ItemList.sDrillingFluid.getID()) { - return false; - } - FluidStack tFluid = mInputHatches.get(0).mFluid.copy(); - if (tFluid == null) { - return false; - } - if (tFluid.amount < 100) { - return false; - } - tFluid.amount = 100; - depleteInput(tFluid); - long tVoltage = getMaxInputVoltage(); - if (getBaseMetaTileEntity().getRandomNumber(20) == 0) { - if (mMineList.isEmpty()) { - int yLevel = getYOfPumpHead(); - for (int i = -48; i < 49; i++) { - for (int f = -48; f < 49; f++) { - Block tBlock = getBaseMetaTileEntity().getBlockOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); - int tMetaID = getBaseMetaTileEntity().getMetaIDOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); - if (tBlock instanceof GT_Block_Ores_Abstract) { - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); - if ((tTileEntity!=null) && (tTileEntity instanceof GT_TileEntity_Ores) && ((GT_TileEntity_Ores) tTileEntity).mNatural == true && !mMineList.contains(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f))) { - mMineList.add(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f)); - } - } - else { - ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID)); - if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) { - ChunkPosition cp = new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f); - if (!mMineList.contains(cp)) { - mMineList.add(cp); - } - } - } - } - } - } - if (mMineList.isEmpty()) { - if(getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock){ - if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4)) { - if (!moveOneDown()) - return false; - } - }else{ - stopMachine(); - return false; - } - } - ArrayList tDrops = new ArrayList(); - Block tMineBlock = null; - ChunkPosition mle = null; - int posX, posY, posZ, offX, offY, offZ; - while ((tMineBlock==null || tMineBlock == Blocks.air) && !mMineList.isEmpty()) { - mle = mMineList.get(0); - mMineList.remove(0); - tMineBlock = getBaseMetaTileEntity().getBlockOffset(mle.chunkPosX, mle.chunkPosY, mle.chunkPosZ); - } - - if (tMineBlock!=null && tMineBlock!=Blocks.air) { - posX = mle.chunkPosX + getBaseMetaTileEntity().getXCoord(); - posY = mle.chunkPosY + getBaseMetaTileEntity().getYCoord(); - posZ = mle.chunkPosZ + getBaseMetaTileEntity().getZCoord(); - offX = mle.chunkPosX; - offY = mle.chunkPosY; - offZ = mle.chunkPosZ; - - int metadata = getBaseMetaTileEntity().getMetaIDOffset(offX, offY, offZ); - boolean silkTouch = tMineBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, metadata); - if (silkTouch){ - ItemStack IS = new ItemStack(tMineBlock); - IS.setItemDamage(metadata); - IS.stackSize=1; - tDrops.add(IS); - } - else{ - tDrops = tMineBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, metadata, 1); - } - - getBaseMetaTileEntity().getWorld().setBlockToAir(posX, posY, posZ); - if (!tDrops.isEmpty()) { - ItemData tData = GT_OreDictUnificator.getItemData(tDrops.get(0).copy()); - if (tData.mPrefix != OrePrefixes.crushed && tData.mMaterial.mMaterial != Materials.Oilsands) { - - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, tVoltage, null, tDrops.get(0).copy()); - if (tRecipe != null) { - this.mOutputItems = new ItemStack[tRecipe.mOutputs.length]; - for (int g = 0; g < mOutputItems.length; g++) { - mOutputItems[g] = tRecipe.mOutputs[g].copy(); - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(g)) { - mOutputItems[g].stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; - } - } - } else { - this.mOutputItems = new ItemStack[tDrops.size()]; - for (int g = 0; g < mOutputItems.length; g++) { - mOutputItems[g] = tDrops.get(g).copy(); - } - } - } else { - this.mOutputItems = null; - ItemStack[] tStack = new ItemStack[tDrops.size()]; - for (int j = 0; j < tDrops.size(); j++) { - tStack[j] = tDrops.get(j).copy(); - tStack[j].stackSize = tStack[j].stackSize * (getBaseMetaTileEntity().getRandomNumber(4) + 1); - } - mOutputItems = tStack; - } - } - - } - } - - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - int tEU = 48; - int tDuration = 24; - if (tEU <= 16) { - this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tDuration / (1 << tTier - 1)); - } else { - this.mEUt = tEU; - this.mMaxProgresstime = tDuration; - 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); - return true; - } - - private boolean moveOneDown() { - if ((this.mInventory[1] == null) || (this.mInventory[1].stackSize < 1) - || (!GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L)))) { - stopMachine(); - return false; - } - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int yHead = getYOfPumpHead(); - if (yHead <= 0) { - stopMachine(); - return false; - } - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) { - stopMachine(); - return false; - } - if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { - stopMachine(); - return false; - } - if (yHead != getBaseMetaTileEntity().getYCoord()) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); - } - getBaseMetaTileEntity().decrStackSize(1, 1); - return true; - } - - private int getYOfPumpHead() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - int y = getBaseMetaTileEntity().getYCoord() - 1; - while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { - y--; - } - if (y == getBaseMetaTileEntity().getYCoord() - 1) { - if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { - return y + 1; - } - } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility - .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[1] != null && this.mInventory[1].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) { - getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir, - GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))); - getBaseMetaTileEntity().decrStackSize(0, 1); - } - return y; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((xDir + i != 0) || (zDir + j != 0)) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16)) && (!addOutputToMachineList(tTileEntity, 16)) && (!addEnergyInputToMachineList(tTileEntity, 16))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings2) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 0) { - return false; - } - } - } - } - } - for (int y = 1; y < 4; y++) { - if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir) != GregTech_API.sBlockCasings2) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + 1, y, zDir) != GregTech_API.sBlockMachines) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir - 1, y, zDir) != GregTech_API.sBlockMachines) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir + 1) != GregTech_API.sBlockMachines) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir - 1) != GregTech_API.sBlockMachines) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir, y + 3, zDir) != GregTech_API.sBlockMachines) { - return false; - } - } - return true; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_AdvMiner2(this.mName); - } - -} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java new file mode 100644 index 0000000000..25e4e3eb5d --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java @@ -0,0 +1,51 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDrillingPlantBase { + public GT_MetaTileEntity_OreDrillingPlant1(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_OreDrillingPlant1(String aName) { + super(aName); + } + + @Override + public String[] getDescription() { + return getDescriptionInternal("I"); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_OreDrillingPlant1(mName); + } + + @Override + protected ItemList getCasingBlockItem() { + return ItemList.Casing_SolidSteel; + } + + @Override + protected Materials getFrameMaterial() { + return Materials.Steel; + } + + @Override + protected int getCasingTextureIndex() { + return 16; + } + + @Override + protected int getRadiusInChunks() { + return 3; + } + + @Override + protected int getMinTier() { + return 2; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java new file mode 100644 index 0000000000..2b161fe471 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java @@ -0,0 +1,51 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDrillingPlantBase { + public GT_MetaTileEntity_OreDrillingPlant2(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_OreDrillingPlant2(String aName) { + super(aName); + } + + @Override + public String[] getDescription() { + return getDescriptionInternal("II"); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_OreDrillingPlant2(mName); + } + + @Override + protected ItemList getCasingBlockItem() { + return ItemList.Casing_StableTitanium; + } + + @Override + protected Materials getFrameMaterial() { + return Materials.Titanium; + } + + @Override + protected int getCasingTextureIndex() { + return 50; + } + + @Override + protected int getRadiusInChunks() { + return 4; + } + + @Override + protected int getMinTier() { + return 3; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java new file mode 100644 index 0000000000..1be6391f7a --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java @@ -0,0 +1,51 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDrillingPlantBase { + public GT_MetaTileEntity_OreDrillingPlant3(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_OreDrillingPlant3(String aName) { + super(aName); + } + + @Override + public String[] getDescription() { + return getDescriptionInternal("III"); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_OreDrillingPlant3(mName); + } + + @Override + protected ItemList getCasingBlockItem() { + return ItemList.Casing_RobustTungstenSteel; + } + + @Override + protected Materials getFrameMaterial() { + return Materials.TungstenSteel; + } + + @Override + protected int getCasingTextureIndex() { + return 48; + } + + @Override + protected int getRadiusInChunks() { + return 6; + } + + @Override + protected int getMinTier() { + return 4; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java new file mode 100644 index 0000000000..d69ed7c79d --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java @@ -0,0 +1,51 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDrillingPlantBase { + public GT_MetaTileEntity_OreDrillingPlant4(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_OreDrillingPlant4(String aName) { + super(aName); + } + + @Override + public String[] getDescription() { + return getDescriptionInternal("IV"); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_OreDrillingPlant4(mName); + } + + @Override + protected ItemList getCasingBlockItem() { + return ItemList.Casing_MiningOsmiridium; + } + + @Override + protected Materials getFrameMaterial() { + return Materials.Osmiridium; + } + + @Override + protected int getCasingTextureIndex() { + return 50; + } + + @Override + protected int getRadiusInChunks() { + return 9; + } + + @Override + protected int getMinTier() { + return 5; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java new file mode 100644 index 0000000000..cf2456a0ae --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -0,0 +1,386 @@ +package gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.*; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import gregtech.common.blocks.GT_Block_Ores_Abstract; +import gregtech.common.blocks.GT_TileEntity_Ores; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkPosition; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.GT_Values.W; + +public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_MultiBlockBase { + private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); + private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0); + private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe); + private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(miningPipeTip); + + private final ArrayList oreBlockPositions = new ArrayList<>(); + private Block casingBlock; + + private int casingMeta; + private int frameMeta; + private int casingTextureIndex; + + private ForgeDirection back; + private int xDrill, yDrill, zDrill, xCenter, zCenter, yHead; + private boolean isPickingPipes; + + public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + //initFields(); + } + + public GT_MetaTileEntity_OreDrillingPlantBase(String aName) { + super(aName); + initFields(); + } + + private void initFields() { + xDrill = getBaseMetaTileEntity().getXCoord(); + yDrill = getBaseMetaTileEntity().getYCoord(); + zDrill = getBaseMetaTileEntity().getZCoord(); + back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()); + xCenter = xDrill + back.offsetX; + zCenter = zDrill + back.offsetZ; + isPickingPipes = false; + casingBlock = getCasingBlockItem().getBlock(); + casingMeta = getCasingBlockItem().get(0).getItemDamage(); + frameMeta = 4096 + getFrameMaterial().mMetaItemSubID; + casingTextureIndex = getCasingTextureIndex(); + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + if (isPickingPipes) { + if (tryPickPipe()) { + mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)}; + setElectricityStats(); + return true; + } else { + stopMachine(); + return false; + } + } + putMiningPipesFromInputsInController(); + if (!tryConsumeDrillingFluid()) return false; + + fillMineListIfEmpty(); + if (oreBlockPositions.isEmpty()) { + boolean isMoved = moveOneDown(); + if (!isMoved) { + isPickingPipes = true; + setElectricityStats(); + return true; + } + } + + ChunkPosition oreBlockPos = null; + Block oreBlock = null; + + while ((oreBlock == null || oreBlock == Blocks.air) && !oreBlockPositions.isEmpty()) { + oreBlockPos = oreBlockPositions.remove(0); + oreBlock = getBaseMetaTileEntity().getBlock(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + } + + if (oreBlock != null && oreBlock != Blocks.air) { + ArrayList oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ); + mOutputItems = getOutputByDrops(oreBlockDrops); + } + + setElectricityStats(); + return true; + } + + private boolean tryPickPipe() { + if (yHead == yDrill) return false; + if (checkBlockAndMeta(xCenter, yHead + 1, zCenter, miningPipeBlock, W)) + getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead + 1, zCenter, miningPipeTipBlock); + getBaseMetaTileEntity().getWorld().setBlockToAir(xCenter, yHead, zCenter); + return true; + } + + private void setElectricityStats() { + this.mEfficiency = getCurrentEfficiency(null); + this.mEfficiencyIncrease = 10000; + //T1 = 12; T2 = 48; T3 = 192; T4 = 768 + this.mEUt = 3 * (1 << (getMinTier() << 1)); + //T1 = 960; T2 = 480; T3 = 240; T4 = 120 + this.mMaxProgresstime = 1920 / (1 << getMinTier()); + + long voltage = getMaxInputVoltage(); + long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1]; + while (this.mEUt <= overclockEu) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + + this.mEUt = -this.mEUt; + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + } + + private ItemStack[] getOutputByDrops(ArrayList oreBlockDrops) { + long voltage = getMaxInputVoltage(); + ArrayList outputItems = new ArrayList<>(); + while (!oreBlockDrops.isEmpty()) { + ItemStack currentItem = oreBlockDrops.remove(0).copy(); + if (!doUseMaceratorRecipe(currentItem)) { + multiplyStackSize(currentItem); + outputItems.add(currentItem); + continue; + } + + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, voltage, null, currentItem); + if (tRecipe == null) { + outputItems.add(currentItem); + continue; + } + + for (int i = 0; i < tRecipe.mOutputs.length; i++) { + ItemStack recipeOutput = tRecipe.mOutputs[i].copy(); + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i)) + multiplyStackSize(recipeOutput); + outputItems.add(recipeOutput); + } + } + return GT_Utility.listToArray(outputItems); + } + + private boolean doUseMaceratorRecipe(ItemStack currentItem) { + ItemData itemData = GT_OreDictUnificator.getItemData(currentItem); + return itemData == null + || itemData.mPrefix != OrePrefixes.crushed + && itemData.mPrefix != OrePrefixes.dustImpure + && itemData.mPrefix != OrePrefixes.dust + && itemData.mMaterial.mMaterial != Materials.Oilsands; + } + + private void multiplyStackSize(ItemStack itemStack) { + itemStack.stackSize *= getBaseMetaTileEntity().getRandomNumber(4) + 1; + } + + private ArrayList getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { + final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); + if (oreBlock.canSilkHarvest(getBaseMetaTileEntity().getWorld(), null, posX, posY, posZ, blockMeta)) { + return new ArrayList() {{ + add(new ItemStack(oreBlock, 1, blockMeta)); + }}; + } else { + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); + } + } + + private boolean tryConsumeDrillingFluid() { + return depleteInput(new FluidStack(ItemList.sDrillingFluid, 2000)); + } + + private void putMiningPipesFromInputsInController() { + int maxPipes = miningPipe.getMaxStackSize(); + if (isHasMiningPipes(maxPipes)) return; + + ItemStack pipes = getStackInSlot(1); + for (ItemStack storedItem : getStoredInputs()) { + if (!storedItem.isItemEqual(miningPipe)) continue; + + if (pipes == null) { + setInventorySlotContents(1, GT_Utility.copy(miningPipe)); + pipes = getStackInSlot(1); + } + + if (pipes.stackSize == maxPipes) break; + + int needPipes = maxPipes - pipes.stackSize; + int transferPipes = storedItem.stackSize < needPipes ? storedItem.stackSize : needPipes; + + pipes.stackSize += transferPipes; + storedItem.stackSize -= transferPipes; + } + updateSlots(); + } + + private void fillMineListIfEmpty() { + if (!oreBlockPositions.isEmpty()) return; + + tryAddOreBlockToMineList(xCenter, yHead - 1, zCenter); + if (yHead == yDrill) return; //skip controller block layer + + int radius = getRadiusInChunks() << 4; + for (int xOff = -radius; xOff <= radius; xOff++) { + for (int zOff = -radius; zOff <= radius; zOff++) { + tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); + } + } + } + + private void tryAddOreBlockToMineList(int x, int y, int z) { + Block block = getBaseMetaTileEntity().getBlock(x, y, z); + int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z); + ChunkPosition blockPos = new ChunkPosition(x, y, z); + if (block instanceof GT_Block_Ores_Abstract) { + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); + if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos)) { + oreBlockPositions.add(blockPos); + } + } else { + ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); + if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos)) { + oreBlockPositions.add(blockPos); + } + } + } + + private boolean moveOneDown() { + if (!isHasMiningPipes()) return false; + + if (yHead <= 0) return false; + if (checkBlockAndMeta(xCenter, yHead - 1, zCenter, Blocks.bedrock, 0)) return false; + + if (!getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead - 1, zCenter, miningPipeTipBlock)) return false; + if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeBlock); + + getBaseMetaTileEntity().decrStackSize(1, 1); + return true; + } + + private boolean isHasMiningPipes() { + return isHasMiningPipes(1); + } + + private boolean isHasMiningPipes(int minCount) { + ItemStack pipe = getStackInSlot(1); + return pipe != null && pipe.stackSize > minCount - 1 && pipe.isItemEqual(miningPipe); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + //check base layer + for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) { + for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) { + if (xOff == 0 && zOff == 0) continue; + + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff); + if (addMaintenanceToMachineList(tTileEntity, casingTextureIndex) + || addInputToMachineList(tTileEntity, casingTextureIndex) + || addOutputToMachineList(tTileEntity, casingTextureIndex) + || addEnergyInputToMachineList(tTileEntity, casingTextureIndex)) + continue; + + if (!checkCasingBlock(xOff, 0, zOff)) return false; + } + } + //check tower + for (int yOff = 1; yOff < 4; yOff++) { + if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ) + || !checkFrameBlock(back.offsetX + 1, yOff, back.offsetZ) + || !checkFrameBlock(back.offsetX - 1, yOff, back.offsetZ) + || !checkFrameBlock(back.offsetX, yOff, back.offsetZ + 1) + || !checkFrameBlock(back.offsetX, yOff, back.offsetZ - 1) + || !checkFrameBlock(back.offsetX, yOff + 3, back.offsetZ)) + return false; + } + return checkPipesAndSetYHead(); + } + + private boolean checkPipesAndSetYHead() { + yHead = yDrill - 1; + while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--; + if (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeTipBlock, W)) return true; + yHead++; + return yHead == yDrill || getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeTipBlock); + } + + private boolean checkCasingBlock(int xOff, int yOff, int zOff) { + return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta); + } + + private boolean checkFrameBlock(int xOff, int yOff, int zOff) { + return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta); + } + + private boolean checkBlockAndMetaOffset(int xOff, int yOff, int zOff, Block block, int meta) { + return checkBlockAndMeta(xDrill + xOff, yDrill + yOff, zDrill + zOff, block, meta); + } + + private boolean checkBlockAndMeta(int x, int y, int z, Block block, int meta) { + return (meta == W || getBaseMetaTileEntity().getMetaID(x, y, z) == meta) + && getBaseMetaTileEntity().getBlock(x, y, z) == block; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + protected abstract ItemList getCasingBlockItem(); + + protected abstract Materials getFrameMaterial(); + + protected abstract int getCasingTextureIndex(); + + protected abstract int getRadiusInChunks(); + + protected abstract int getMinTier(); + + protected String[] getDescriptionInternal(String tierSuffix) { + String casings = getCasingBlockItem().get(0).getDisplayName(); + return new String[]{ + "Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : ""), + "Size(WxHxD): 3x7x3, Controller (Front middle bottom)", + "3x1x3 Base of " + casings, + "1x3x1 " + casings + " pillar (Center of base)", + "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)", + "1x Input Hatch (Any bottom layer casing)", + "1x Output Bus (Any bottom layer casing)", + "1x Maintenance Hatch (Any bottom layer casing)", + "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"}; + } +} diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 1daeb77eba..37ee710107 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1345,6 +1345,7 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.TungstenSteel, 1L), ItemList.Casing_RobustTungstenSteel.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1L), ItemList.Casing_CleanStainlessSteel.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Titanium, 1L), ItemList.Casing_StableTitanium.get(2L, new Object[0]), 50, 16); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmiridium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 1L), ItemList.Casing_StableTitanium.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), ItemList.Casing_LuV.get(1L, new Object[0]), ItemList.Casing_Fusion.get(1L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Magnalium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.BlueSteel, 1L), ItemList.Casing_Turbine.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine1.get(2L, new Object[0]), 50, 16); diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index c381a29c43..9f2d79223e 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -58,6 +58,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { GT_ModHandler.addCraftingRecipe(ItemList.Casing_FrostProof.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.Aluminium), 'F', OrePrefixes.frameGt.get(Materials.Aluminium)}); GT_ModHandler.addCraftingRecipe(ItemList.Casing_CleanStainlessSteel.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.StainlessSteel), 'F', OrePrefixes.frameGt.get(Materials.StainlessSteel)}); GT_ModHandler.addCraftingRecipe(ItemList.Casing_RobustTungstenSteel.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.TungstenSteel), 'F', OrePrefixes.frameGt.get(Materials.TungstenSteel)}); + GT_ModHandler.addCraftingRecipe(ItemList.Casing_MiningOsmiridium.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.Osmiridium), 'F', OrePrefixes.frameGt.get(Materials.Osmiridium)}); GT_ModHandler.addCraftingRecipe(ItemList.Casing_Turbine.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.Magnalium), 'F', OrePrefixes.frameGt.get(Materials.BlueSteel)}); GT_ModHandler.addCraftingRecipe(ItemList.Casing_Turbine1.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.StainlessSteel), 'F', ItemList.Casing_Turbine}); GT_ModHandler.addCraftingRecipe(ItemList.Casing_Turbine2.get(2L, new Object[0]), bits, new Object[]{"PhP", "PFP", aTextPlateWrench, 'P', OrePrefixes.plate.get(Materials.Titanium), 'F', ItemList.Casing_Turbine}); @@ -1209,8 +1210,17 @@ public class GT_Loader_MetaTileEntities implements Runnable { ItemList.OilDrill.set(new GT_MetaTileEntity_OilDrill(1157, "multimachine.oildrill", "Oil Drilling Rig").getStackForm(1)); GT_ModHandler.addCraftingRecipe(ItemList.OilDrill.get(1L, new Object[0]), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.Hull_MV, 'W', OrePrefixes.frameGt.get(Materials.Steel), 'E', OrePrefixes.circuit.get(Materials.Good), 'C', ItemList.Electric_Motor_MV}); - ItemList.AdvancedMiner2.set(new GT_MetaTileEntity_AdvMiner2(1158, "multimachine.advminer2", "Advanced Miner II").getStackForm(1)); - GT_ModHandler.addCraftingRecipe(ItemList.AdvancedMiner2.get(1L, new Object[0]), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.Hull_EV, 'W', OrePrefixes.frameGt.get(Materials.Titanium), 'E', OrePrefixes.circuit.get(Materials.Data), 'C', ItemList.Electric_Motor_EV}); + ItemList.OreDrill1.set(new GT_MetaTileEntity_OreDrillingPlant1(1158, "multimachine.oredrill1", "Ore Drilling Plant").getStackForm(1)); + GT_ModHandler.addCraftingRecipe(ItemList.OreDrill1.get(1L), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.Hull_EV, 'W', OrePrefixes.frameGt.get(Materials.Titanium), 'E', OrePrefixes.circuit.get(Materials.Data), 'C', ItemList.Electric_Motor_EV}); + + ItemList.OreDrill2.set(new GT_MetaTileEntity_OreDrillingPlant2(1177, "multimachine.oredrill2", "Ore Drilling Plant II").getStackForm(1)); + GT_ModHandler.addCraftingRecipe(ItemList.OreDrill2.get(1L), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.OreDrill1, 'W', OrePrefixes.frameGt.get(Materials.TungstenSteel), 'E', OrePrefixes.circuit.get(Materials.Elite), 'C', ItemList.Electric_Motor_IV}); + + ItemList.OreDrill3.set(new GT_MetaTileEntity_OreDrillingPlant3(1178, "multimachine.oredrill3", "Ore Drilling Plant III").getStackForm(1)); + GT_ModHandler.addCraftingRecipe(ItemList.OreDrill3.get(1L), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.OreDrill2, 'W', OrePrefixes.frameGt.get(Materials.Osmiridium), 'E', OrePrefixes.circuit.get(Materials.Master), 'C', ItemList.Electric_Motor_LuV}); + + ItemList.OreDrill4.set(new GT_MetaTileEntity_OreDrillingPlant4(1179, "multimachine.oredrill4", "Ore Drilling Plant IV").getStackForm(1)); + GT_ModHandler.addCraftingRecipe(ItemList.OreDrill4.get(1L), bitsd, new Object[]{"WWW", "EME", "CCC", 'M', ItemList.OreDrill3, 'W', OrePrefixes.frameGt.get(Materials.Tritanium), 'E', OrePrefixes.circuit.get(Materials.Ultimate), 'C', ItemList.Electric_Motor_ZPM}); ItemList.PyrolyseOven.set(new GT_MetaTileEntity_PyrolyseOven(1159, "multimachine.pyro", "Pyrolyse Oven").getStackForm(1)); GT_ModHandler.addCraftingRecipe(ItemList.PyrolyseOven.get(1L, new Object[0]), bitsd, new Object[]{"WEP", "EME", "WCP", 'M', ItemList.Hull_MV, 'W', ItemList.Electric_Piston_MV, 'P', OrePrefixes.wireGt04.get(Materials.Cupronickel), 'E', OrePrefixes.circuit.get(Materials.Good), 'C', ItemList.Electric_Pump_MV}); diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_MINING_OSMIRIDIUM.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_MINING_OSMIRIDIUM.png new file mode 100644 index 0000000000..d0fcc4da96 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MACHINE_CASING_MINING_OSMIRIDIUM.png differ diff --git a/src/main/resources/assets/gregtech/textures/gui/multimachines/AdvMiner2.png b/src/main/resources/assets/gregtech/textures/gui/multimachines/AdvMiner2.png deleted file mode 100644 index 7b60ec4de7..0000000000 Binary files a/src/main/resources/assets/gregtech/textures/gui/multimachines/AdvMiner2.png and /dev/null differ diff --git a/src/main/resources/assets/gregtech/textures/gui/multimachines/OreDrillingPlant.png b/src/main/resources/assets/gregtech/textures/gui/multimachines/OreDrillingPlant.png new file mode 100644 index 0000000000..7b60ec4de7 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/gui/multimachines/OreDrillingPlant.png differ -- cgit From 82458fed2e4c065091f38340ceb05e98f28fc459 Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 1 May 2017 08:18:30 +0200 Subject: Cherry-Pick c12e474 https://github.com/GTNewHorizons/GT5-Unofficial/commit/c12e474c23ca02fb3479312850f6ae07e623d8b9 --- .../interfaces/tileentity/IEnergyConnected.java | 4 + .../api/metatileentity/BaseMetaTileEntity.java | 3 +- .../api/metatileentity/MetaPipeEntity.java | 4 + .../GT_MetaTileEntity_BasicGenerator.java | 6 +- .../GT_MetaTileEntity_Hatch_Muffler.java | 59 ++++- .../GT_MetaTileEntity_MultiBlockBase.java | 2 + .../java/gregtech/api/objects/GT_UO_Dimension.java | 8 +- .../gregtech/api/objects/GT_UO_DimensionList.java | 11 +- .../java/gregtech/api/objects/GT_UO_Fluid.java | 2 +- src/main/java/gregtech/api/util/GT_Utility.java | 175 ++++++++------- src/main/java/gregtech/common/GT_Pollution.java | 250 ++++++++++++--------- src/main/java/gregtech/common/GT_Proxy.java | 123 +++++++--- .../java/gregtech/common/GT_UndergroundOil.java | 96 ++++++++ .../boilers/GT_MetaTileEntity_Boiler_Bronze.java | 2 +- .../boilers/GT_MetaTileEntity_Boiler_Lava.java | 2 +- .../boilers/GT_MetaTileEntity_Boiler_Steel.java | 2 +- .../GT_MetaTileEntity_AdvSeismicProspector.java | 3 +- .../GT_MetaTileEntity_BronzeBlastFurnace.java | 21 +- .../multi/GT_MetaTileEntity_Charcoal_Pit.java | 2 +- .../machines/multi/GT_MetaTileEntity_OilDrill.java | 5 +- 20 files changed, 535 insertions(+), 245 deletions(-) create mode 100644 src/main/java/gregtech/common/GT_UndergroundOil.java (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index b62ed4500b..63020684c0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -1,8 +1,10 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; @@ -85,6 +87,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) + if(GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX,tZ), 100000); tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 4aa49a954c..b537ce71ef 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1146,7 +1146,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } } } - GT_Pollution.addPollution(getWorld(), new ChunkPosition(getXCoord(), getYCoord(), getZCoord()), 100000); + + GT_Pollution.addPollution(this, 100000); mMetaTileEntity.doExplosion(aAmount); } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index b34483c31b..5edc5751fb 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -2,6 +2,7 @@ package gregtech.api.metatileentity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,6 +10,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.texture.IIconRegister; @@ -645,6 +647,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity { World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) + if(GT_Mod.gregtechproxy.mPollution) + GT_Pollution.addPollution(getBaseMetaTileEntity(), 100000); tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 76b2e9aaf5..73d3c19a6b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -203,8 +203,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) { long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), - 10 * getPollution()); + GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution()); mFluid.amount -= tFluidAmountToUse * tConsumed; } } @@ -216,8 +215,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), - 10 * getPollution()); + GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution()); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index dde8d7cf4f..1209b9c582 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -1,14 +1,18 @@ package gregtech.api.metatileentity.implementations; +import gregtech.GT_Mod; 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.objects.XSTR; import gregtech.common.GT_Pollution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { @@ -69,7 +73,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public boolean polluteEnvironment() { if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), calculatePollutionReduction(10000)); + GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); return true; } return false; @@ -88,4 +92,57 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) + pollutionParticles(this.getBaseMetaTileEntity().getWorld(),"largesmoke"); + } + + private static XSTR floatGen=new XSTR(); + + public void pollutionParticles(World aWorld,String name){ + boolean chk1,chk2,chk3; + float ran1=floatGen.nextFloat(),ran2=0,ran3=0; + chk1=ran1*100= GT_Mod.gregtechproxy.mPollutionSmogLimit){ + ran2=floatGen.nextFloat(); + ran3=floatGen.nextFloat(); + chk2=ran2*100 fl : fFluids.entrySet()) { int chance = fl.getValue().Chance*1000/maxChance; if (random<=chance) return fl.getValue(); //System.out.println("GT UO "+fl.getValue().Registry+" Chance:"+chance+" Random:"+random); random-=chance; } - return null; - } } diff --git a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java index 89340132be..c566affe41 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -48,15 +48,16 @@ public class GT_UO_DimensionList { fConfig.get(Category, "MaxAmount", aMaxAmount).getInt(aMaxAmount); fConfig.get(Category, "Chance", aChance).getInt(aChance); fConfig.get(Category, "DecreasePerOperationAmount", aDecreasePerOperationAmount).getInt(aDecreasePerOperationAmount); + //IT IS IN BUCKETS!!! } public void SetDafultValues() { - SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 625, 20, 5); + SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 625, 20, 7); SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 625, 20, 5); - SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 625, 20, 5); - SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20, 5); - SetConfigValues("Overworld", "0", "oil", "oil", 0, 625, 20, 5); - SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 0, 375, 100, 5); + SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 625, 20, 3); + SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20, 1); + SetConfigValues("Overworld", "0", "oil", "oil", 0, 625, 20, 3); + SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 1, 375, 100, 1); } public void getConfig(Configuration aConfig, String aCategory) { diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index c2d9b70bd2..d65e94c4f1 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -53,7 +53,7 @@ public class GT_UO_Fluid { } } - public int getRandomAmount(Random aRandom){ + public int getRandomAmount(Random aRandom){//generates milliBuckets int r1 = (int)Math.round(Math.pow((MaxAmount-MinAmount)*500000.d, 0.2)); int r2 = (int)Math.floor(Math.pow(MinAmount*500000.d, 0.2)); double amount = aRandom.nextInt(r1)+r2+aRandom.nextDouble(); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 6c3289af30..9ccdc73a24 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -53,10 +53,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; @@ -73,6 +76,9 @@ import java.util.*; import java.util.Map.Entry; import static gregtech.api.enums.GT_Values.*; +import static gregtech.common.GT_Proxy.GTPOLLUTION; +import static gregtech.common.GT_Proxy.dimensionWiseChunkData; +import static gregtech.common.GT_UndergroundOil.undergroundOil; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -95,6 +101,14 @@ public class GT_Utility { GregTech_API.sItemStackMappings.add(sFilledContainerToData); GregTech_API.sItemStackMappings.add(sEmptyContainerToFluidToData); } + + public static int safeInt(long number, int margin){ + return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; + } + + public static int safeInt(long number){ + return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number0){ - if(tInts[0]>0){tAmount = tInts[0];} - } - if(tInts.length>2){ - if(tInts[2]>0&&tInts[2]!=tFluidId) - { - tFluidId = tInts[2]; - tFluid = FluidRegistry.getFluid(tFluidId); - } - } - GT_Proxy.chunkData.remove(tPos); - } - - if (needConsumeOil && tAmount >= 5000) - tAmount = tAmount - tDecreasePerOperationAmount; - - tInts[0] = tAmount; - tInts[2] = tFluidId; - GT_Proxy.chunkData.put(tPos, tInts); - } catch (Exception e) { - System.out.println("getUndergroundOil() - Error put data"); - } - if (tFluid!=null) - return new FluidStack(tFluid, tAmount); - return null; - } - +// public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) { +// return getUndergroundOil(aWorld, aX, aZ, false); +// } +// +// public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) { +// +// if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(aWorld.provider.dimensionId)) +// return null; +// +// Random tRandom = new Random((aWorld.getSeed() + aWorld.provider.dimensionId * 2 + (getScaleCoordinates(aX,96)) + (7 * (getScaleCoordinates(aZ,96))))); +// int tAmount = 0; +// int tFluidId = 0; +// int tDecreasePerOperationAmount = 5; +// Fluid tFluid = null; +//// System.out.println("Dimension: "+GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).Dimension); +// try { +// GT_UO_Fluid uoFluid = GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).getRandomFluid(tRandom); +// if (uoFluid != null) +// { +// tFluid = uoFluid.getFluid(); +// tAmount = uoFluid.getRandomAmount(tRandom); +// tDecreasePerOperationAmount = uoFluid.DecreasePerOperationAmount; +// if (tFluid != null) +// tFluidId = tFluid.getID(); +// //System.out.println("Fluid: ("+tFluidId+")"+tFluid.getName()+" Amount:"+tAmount); +// } +// +// } catch (Exception e) { +// tAmount = 0; +// tFluidId = 0; +// } +// +// try { +// ChunkPosition tPos = new ChunkPosition(getScaleCoordinates(aX,16), aWorld.provider.dimensionId, getScaleCoordinates(aZ,16)); +// int[] tInts = new int[3]; +// if(GT_Proxy.chunkData.containsKey(tPos)){ +// tInts = GT_Proxy.chunkData.get(tPos); +// if(tInts.length>0){ +// if(tInts[0]>0){tAmount = tInts[0];} +// } +// if(tInts.length>2){ +// if(tInts[2]>0&&tInts[2]!=tFluidId) +// { +// tFluidId = tInts[2]; +// tFluid = FluidRegistry.getFluid(tFluidId); +// } +// } +// GT_Proxy.chunkData.remove(tPos); +// } +// +// if (needConsumeOil && tAmount >= 5000) +// tAmount = tAmount - tDecreasePerOperationAmount; +// +// tInts[0] = tAmount; +// tInts[2] = tFluidId; +// GT_Proxy.chunkData.put(tPos, tInts); +// } catch (Exception e) { +// System.out.println("getUndergroundOil() - Error put data"); +// } +// if (tFluid!=null) +// return new FluidStack(tFluid, tAmount); +// return null; +// } + public static int getCoordinateScan(ArrayList aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) { if (aList == null) return 0; @@ -1779,22 +1793,25 @@ public class GT_Utility { if (D1) e.printStackTrace(GT_Log.err); } } - if (aPlayer.capabilities.isCreativeMode&>_Values.D1) { - FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ); + + if (aPlayer.capabilities.isCreativeMode && GT_Values.D1) { + FluidStack tFluid = undergroundOil(aWorld.getChunkFromBlockCoords(aX,aZ),-1);//-# to only read if (tFluid!=null) - tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName()); - } -// if(aPlayer.capabilities.isCreativeMode){ - ChunkPosition tPos = new ChunkPosition(getScaleCoordinates(aX,16), aWorld.provider.dimensionId, getScaleCoordinates(aZ,16)); - if(GT_Proxy.chunkData.containsKey(tPos)){ - int[] tPollution = GT_Proxy.chunkData.get(tPos); - if(tPollution.length>1){ - tList.add("Pollution in Chunk: "+tPollution[1]); - }else{ - tList.add("No Pollution in Chunk"); - } - } -// } + tList.add(EnumChatFormatting.GOLD+tFluid.getLocalizedName()+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ tFluid.amount +EnumChatFormatting.RESET+" L"); + else + tList.add(EnumChatFormatting.GOLD+"Nothing"+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ '0' +EnumChatFormatting.RESET+" L"); + } +// if(aPlayer.capabilities.isCreativeMode){ + int[] chunkData = GT_Proxy.dimensionWiseChunkData.get(aWorld.provider.dimensionId).get(aWorld.getChunkFromBlockCoords(aX,aZ).getChunkCoordIntPair()); + if(chunkData !=null){ + if(chunkData[GTPOLLUTION]>0){ + tList.add("Pollution in Chunk: "+EnumChatFormatting.RED+chunkData[GTPOLLUTION]+EnumChatFormatting.RESET+" gibbl"); + }else{ + tList.add(EnumChatFormatting.GREEN+"No Pollution in Chunk! HAYO!"+EnumChatFormatting.RESET); + } + }else{ + tList.add(EnumChatFormatting.GREEN+"No Pollution in Chunk! HAYO!"+EnumChatFormatting.RESET); +} try { if (tBlock instanceof IDebugableBlock) { diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java index a950e8a2f2..4ab0c97d79 100644 --- a/src/main/java/gregtech/common/GT_Pollution.java +++ b/src/main/java/gregtech/common/GT_Pollution.java @@ -1,6 +1,8 @@ package gregtech.common; +import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.GT_Mod; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -10,12 +12,17 @@ import net.minecraft.init.Blocks; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.event.world.WorldEvent; -import java.util.ArrayList; -import java.util.List; +import java.util.*; + +import static gregtech.common.GT_Proxy.*; + +//import net.minecraft.entity.EntityLiving; public class GT_Pollution { /** @@ -49,95 +56,131 @@ public class GT_Pollution { * Muffler Hatch Pollution reduction: * LV (0%), MV (30%), HV (52%), EV (66%), IV (76%), LuV (84%), ZPM (89%), UV (92%), MAX (95%) */ + private static XSTR tRan = new XSTR(); + private List pollutionList = new ArrayList<>();//chunks left to process + private HashMap chunkData;//link to chunk data that is saved/loaded + private int operationsPerTick=0;//how much chunks should be processed in each cycle + private static final short cycleLen=1200; + private final World aWorld; - static List tList = null; - static int loops = 1; - static XSTR tRan = new XSTR(); + public GT_Pollution(World world){ + aWorld=world; + chunkData=dimensionWiseChunkData.get(aWorld.provider.dimensionId); + if(chunkData==null){ + chunkData=new HashMap<>(1024); + dimensionWiseChunkData.put(world.provider.dimensionId,chunkData); + } + dimensionWisePollution.put(aWorld.provider.dimensionId,this); + } - public static void onWorldTick(World aWorld, int aTick){ - if(!GT_Mod.gregtechproxy.mPollution)return; - if(aTick == 0 || (tList==null && GT_Proxy.chunkData!=null)){ - tList = new ArrayList(GT_Proxy.chunkData.keySet()); - loops = (tList.size()/1200) + 1; -// System.out.println("new Pollution loop"+aTick); + public static void onWorldTick(TickEvent.WorldTickEvent aEvent){//called from proxy + //return if pollution disabled + if(!GT_Mod.gregtechproxy.mPollution) return; + final GT_Pollution pollutionInstance = dimensionWisePollution.get(aEvent.world.provider.dimensionId); + if(pollutionInstance==null)return; + pollutionInstance.tickPollutionInWorld((int)(aEvent.world.getTotalWorldTime()%cycleLen)); + } + + private void tickPollutionInWorld(int aTickID){//called from method above + //gen data set + if(aTickID==0){ + pollutionList = new ArrayList<>(chunkData.keySet()); + //set operations per tick + if(pollutionList.size()>0) operationsPerTick =(pollutionList.size()/cycleLen); + else operationsPerTick=0;//SANity } - if(tList!=null && tList.size() > 0){ - int i = 0; - for(; i < loops ; i++){ - if(tList.size()>0){ - ChunkPosition tPos = tList.get(0); - tList.remove(0); - if(tPos!=null && GT_Proxy.chunkData.containsKey(tPos)){ - int tPollution = GT_Proxy.chunkData.get(tPos)[1]; -// System.out.println("process: "+tPos.chunkPosY+" "+tPos.chunkPosX+" "+tPos.chunkPosZ+" "+tPollution); - //Reduce pollution in chunk - tPollution = (int)(0.99f*tPollution); - tPollution -= 2000; - if(tPollution<=0){tPollution = 0;} - //Spread Pollution - if(tPollution>50000){ - List tNeighbor = new ArrayList(); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, tPos.chunkPosY, tPos.chunkPosZ)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, tPos.chunkPosY, tPos.chunkPosZ)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ+1)); - tNeighbor.add(new ChunkPosition(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ-1)); - for(ChunkPosition tNPos : tNeighbor){ - if(GT_Proxy.chunkData.containsKey(tNPos)){ - int tNPol = GT_Proxy.chunkData.get(tNPos)[1]; - if(tNPol400000){//Spread Pollution + + ChunkCoordIntPair[] tNeighbors = new ChunkCoordIntPair[4];//array is faster + tNeighbors[0]=(new ChunkCoordIntPair(actualPos.chunkXPos+1,actualPos.chunkZPos)); + tNeighbors[1]=(new ChunkCoordIntPair(actualPos.chunkXPos-1,actualPos.chunkZPos)); + tNeighbors[2]=(new ChunkCoordIntPair(actualPos.chunkXPos,actualPos.chunkZPos+1)); + tNeighbors[3]=(new ChunkCoordIntPair(actualPos.chunkXPos,actualPos.chunkZPos-1)); + for(ChunkCoordIntPair neighborPosition : tNeighbors){ + if(!chunkData.containsKey(neighborPosition)) chunkData.put(actualPos,getDefaultChunkDataOnCreation()); + + int neighborPollution = chunkData.get(neighborPosition)[GTPOLLUTION]; + if(neighborPollution*6 < tPollution*5){//METHEMATICS... + int tDiff = tPollution - neighborPollution; + tDiff = tDiff/20; + neighborPollution = GT_Utility.safeInt((long)neighborPollution+tDiff);//tNPol += tDiff; + tPollution -= tDiff; + chunkData.get(neighborPosition)[GTPOLLUTION] = neighborPollution; } - }} - int[] tArray = GT_Proxy.chunkData.get(tPos); - tArray[1] = tPollution; - GT_Proxy.chunkData.remove(tPos); - GT_Proxy.chunkData.put(tPos, tArray); + } + + //Create Pollution effects -// Smog filter TODO - if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){ - AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX<<4, 0, tPos.chunkPosZ<<4, (tPos.chunkPosX<<4)+16, 256, (tPos.chunkPosZ<<4)+16); - List tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk); - for(EntityLivingBase tEnt : tEntitys){ - if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 40){ - int ran = tRan.nextInt(3); - if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id, Math.min(tPollution/2500,1000), tPollution/400000)); - if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution/2500,1000), tPollution/400000)); - if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Math.min(tPollution/2500,1000), tPollution/400000)); + //Smog filter TODO + if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit) { + AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(actualPos.chunkXPos << 4, 0, actualPos.chunkZPos << 4, (actualPos.chunkXPos << 4) + 16, 256, (actualPos.chunkZPos << 4) + 16); + List tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk); + for (EntityLivingBase tEnt : tEntitys) { + if (!GT_Utility.isWearingFullGasHazmat(tEnt)) { + switch (tRan.nextInt(3)) { + default: + tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); + case 1: + tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); + case 2: + tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); + } } -} -// Poison effects - if(tPollution > GT_Mod.gregtechproxy.mPollutionPoisonLimit){ - for(EntityLivingBase tEnt : tEntitys){ - if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 20){ - int ran = tRan.nextInt(3); - if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution/2500,1000), tPollution/500000)); - if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.confusion.id, Math.min(tPollution/2500,1000), 1)); - if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/2500,1000), 1)); -} - } -// killing plants - if(tPollution > GT_Mod.gregtechproxy.mPollutionVegetationLimit){ - int f = 20; - for(;f<(tPollution/25000);f++){ - int x =tPos.chunkPosX<<4+(tRan.nextInt(16));; - int y =60 +(-f+tRan.nextInt(f*2+1)); - int z =tPos.chunkPosZ<<4+(tRan.nextInt(16)); - damageBlock(x, y, z, tPollution > GT_Mod.gregtechproxy.mPollutionSourRainLimit); - }}}} + } + + + // Poison effects + if (tPollution > GT_Mod.gregtechproxy.mPollutionPoisonLimit) { + //AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX*16, 0, tPos.chunkPosZ*16, tPos.chunkPosX*16+16, 256, tPos.chunkPosZ*16+16); + //List tEntitys = aWorld.getEntitiesWithinAABB(EntityLiving.class, chunk); + for (EntityLivingBase tEnt : tEntitys) { + if (!GT_Utility.isWearingFullGasHazmat(tEnt)) { + switch (tRan.nextInt(4)) { + default: + tEnt.addPotionEffect(new PotionEffect(Potion.hunger.id, tPollution / 500000)); + case 1: + tEnt.addPotionEffect(new PotionEffect(Potion.confusion.id, Math.min(tPollution / 2000, 1000), 1)); + case 2: + tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution / 4000, 1000), tPollution / 500000)); + case 3: + tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution / 2000, 1000), 1)); + } + } + } + + + // killing plants + if (tPollution > GT_Mod.gregtechproxy.mPollutionVegetationLimit) { + int f = 20; + for (; f < (tPollution / 25000); f++) { + int x = (actualPos.chunkXPos << 4) + tRan.nextInt(16); + int y = 60 + (-f + tRan.nextInt(f * 2 + 1)); + int z = (actualPos.chunkZPos << 4) + tRan.nextInt(16); + damageBlock(aWorld, x, y, z, tPollution > GT_Mod.gregtechproxy.mPollutionSourRainLimit); + } + } + } } } - }} + //Write new pollution to Hashmap !!! + chunkData.get(actualPos)[GTPOLLUTION] = tPollution; + } } - public static void damageBlock(int x, int y, int z, boolean sourRain){ - World world = DimensionManager.getWorld(0); + private static void damageBlock(World world, int x, int y, int z, boolean sourRain){ if (world.isRemote) return; Block tBlock = world.getBlock(x, y, z); int tMeta = world.getBlockMetadata(x, y, z); @@ -187,24 +230,31 @@ public class GT_Pollution { } } - //Add aWorld to Save Pollution - public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution){ + public static void addPollution(IGregTechTileEntity te, int aPollution){ + System.out.println(te.getWorld().provider.dimensionId+" "+te.getXCoord()+" "+te.getZCoord()); + addPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()), aPollution); + } + + public static void addPollution(Chunk ch, int aPollution){ if(!GT_Mod.gregtechproxy.mPollution)return; - try{ - ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(aPos.chunkPosX,16), aWorld.provider.dimensionId, GT_Utility.getScaleCoordinates(aPos.chunkPosZ,16)); // OLD in coordinate -1 -1 chunk 0 0 -// System.out.println("add pollution dim: "+aWorld.provider.dimensionId+" x: "+ tPos.chunkPosX +" z: " + tPos.chunkPosZ +" poll: "+aPollution); - int[] tData = new int[3]; - if(GT_Proxy.chunkData.containsKey(tPos)){ - tData = GT_Proxy.chunkData.get(tPos); - if(tData.length>1){ - tData[1] += aPollution; - } - }else{ - tData[1] += aPollution; - GT_Proxy.chunkData.put(tPos, tData); - } - }catch(Exception e){ - + HashMap dataMap=dimensionWiseChunkData.get(ch.worldObj.provider.dimensionId); + if(dataMap==null){ + dataMap=new HashMap<>(1024); + dimensionWiseChunkData.put(ch.worldObj.provider.dimensionId,dataMap); } + if(dataMap.get(ch.getChunkCoordIntPair())==null) + dataMap.put(ch.getChunkCoordIntPair(),getDefaultChunkDataOnCreation()); + dataMap.get(ch.getChunkCoordIntPair())[GTPOLLUTION]+=aPollution; + } + + public static int getPollution(IGregTechTileEntity te){ + return getPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord())); + } + + public static int getPollution(Chunk ch){ + if(!GT_Mod.gregtechproxy.mPollution)return 0; + HashMap dataMap=dimensionWiseChunkData.get(ch.worldObj.provider.dimensionId); + if(dataMap==null || dataMap.get(ch.getChunkCoordIntPair())==null) return 0; + return dataMap.get(ch.getChunkCoordIntPair())[GTPOLLUTION]; } -} +} \ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index e7fcd1e01d..b79e6691d3 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -6,6 +6,8 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ProgressManager; import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.EventBus; +import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.FMLNetworkEvent; @@ -55,10 +57,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -69,6 +73,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.terraingen.OreGenEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.ChunkDataEvent; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; @@ -581,6 +586,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + + dimensionWiseChunkData.clear();//!!! IMPORTANT for map switching... + dimensionWisePollution.clear();//!!! IMPORTANT for map switching... } public void onServerStarted() { @@ -1246,8 +1254,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } } - if(aEvent.world.provider.dimensionId==0) - GT_Pollution.onWorldTick(aEvent.world, (int) (aEvent.world.getTotalWorldTime() % 1200)); + + GT_Pollution.onWorldTick(aEvent); } } @@ -1700,48 +1708,91 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { ProgressManager.pop(progressBar); } - public static final HashMap chunkData = new HashMap(5000); + public static final HashMap> dimensionWiseChunkData = new HashMap<>(16);//stores chunk data that is loaded/saved + public static final HashMap dimensionWisePollution = new HashMap<>(16);//stores GT_Polluttors objects + public static final byte GTOIL=3,GTOILFLUID=2,GTPOLLUTION=1,GTMETADATA=0,NOT_LOADED=0,LOADED=1;//consts + //@Deprecated + //public static final HashMap chunkData = new HashMap<>(0); + + private static final byte oilVer=(byte)20;//non zero plz + + //TO get default's fast + public static int[] getDefaultChunkDataOnCreation(){ + return new int[]{NOT_LOADED,0,-1,-1}; + } + public static int[] getDefaultChunkDataOnLoad(){ + return new int[]{LOADED,0,-1,-1}; + } @SubscribeEvent - public void handleChunkSaveEvent(ChunkDataEvent.Save event) - { - ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,event.getChunk().worldObj.provider.dimensionId,event.getChunk().zPosition); - if(chunkData.containsKey(tPos)){ - int[] tInts = chunkData.get(tPos); - if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);} - if(tInts.length>1){event.getData().setInteger("GTPOLLUTION", tInts[1]);} - if(tInts.length>2){event.getData().setInteger("GTOILFLUID", tInts[2]);} - } + public void handleChunkSaveEvent(ChunkDataEvent.Save event) {//ALWAYS SAVE FROM THE HASH MAP DATA + HashMap chunkData=dimensionWiseChunkData.get(event.world.provider.dimensionId); + if(chunkData==null) return;//no dim info stored + + int[] tInts = chunkData.get(event.getChunk().getChunkCoordIntPair()); + if(tInts==null) return;//no chunk data stored + //assuming len of this array 4 + if(tInts[3]>=0)event.getData().setInteger("GTOIL", tInts[GTOIL]); + else event.getData().removeTag("GTOIL"); + if(tInts[2]>=0)event.getData().setInteger("GTOILFLUID", tInts[GTOILFLUID]); + else event.getData().removeTag("GTOILFLUID"); + if(tInts[1]>0)event.getData().setInteger("GTPOLLUTION", tInts[GTPOLLUTION]); + else event.getData().removeTag("GTPOLLUTION"); + event.getData().setByte("GTOILVER", oilVer);//version mark } @SubscribeEvent - public void handleChunkLoadEvent(ChunkDataEvent.Load event) - { - int tOil = 0; - int tOilFluid = 0; - int tPollution = 0; - - ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,event.getChunk().worldObj.provider.dimensionId,event.getChunk().zPosition); - int[] tData = new int[0]; - if(chunkData.containsKey(tPos)){ - tData = chunkData.get(tPos); - chunkData.remove(tPos); - if(tData.length>0) - tOil = tData[0]; - if(tData.length>1) - tPollution = tData[1]; - if(tData.length>2) - tOilFluid = tData[2]; + public void handleChunkLoadEvent(ChunkDataEvent.Load event) { + final int worldID=event.world.provider.dimensionId; + HashMap chunkData = dimensionWiseChunkData.get(worldID); + if (chunkData == null){ + chunkData=new HashMap<>(1024); + dimensionWiseChunkData.put(worldID, chunkData); } + if (dimensionWisePollution.get(worldID) == null) + dimensionWisePollution.put(worldID, new GT_Pollution(event.world)); + + int[] tInts = chunkData.get(event.getChunk().getChunkCoordIntPair()); + if (tInts == null) { + //NOT LOADED and NOT PROCESSED by pollution algorithms + //regular load + tInts = getDefaultChunkDataOnLoad(); + + if (event.getData().getByte("GTOILVER") == oilVer) { + if (event.getData().hasKey("GTOIL")) + tInts[GTOIL] = event.getData().getInteger("GTOIL"); + if (event.getData().hasKey("GTOILFLUID")) + tInts[GTOILFLUID] = event.getData().getInteger("GTOILFLUID"); + } + + tInts[GTPOLLUTION] = event.getData().getInteger("GTPOLLUTION");//Defaults to 0 + + //store in HASH MAP if has useful data + if (tInts[GTPOLLUTION] > 0 || tInts[GTOIL] >= 0 || tInts[GTOILFLUID] >= 0) + chunkData.put(event.getChunk().getChunkCoordIntPair(), tInts); + } else if (tInts[GTMETADATA] == NOT_LOADED) {//was NOT loaded from chunk save game data + //NOT LOADED but generated + //append load + if (event.getData().getByte("GTOILVER") == oilVer) { + if (tInts[GTOIL] < 0 && event.getData().hasKey("GTOIL"))//if was not yet initialized + tInts[GTOIL] = event.getData().getInteger("GTOIL"); + + if (tInts[GTOILFLUID] < 0 && event.getData().hasKey("GTOILFLUID"))//if was not yet initialized + tInts[GTOILFLUID] = event.getData().getInteger("GTOILFLUID"); + } else { + tInts[GTOIL] = -1; + tInts[GTOILFLUID] = -1; + } - if(tOil==0&&event.getData().hasKey("GTOIL")) - tOil = event.getData().getInteger("GTOIL"); - if(tPollution==0&&event.getData().hasKey("GTPOLLUTION")) - tPollution = event.getData().getInteger("GTPOLLUTION"); - if(tOilFluid==0&&event.getData().hasKey("GTOILFLUID")) - tOilFluid = event.getData().getInteger("GTOILFLUID"); + tInts[GTPOLLUTION] += event.getData().getInteger("GTPOLLUTION");//Defaults to 0, add stored pollution to data + tInts[GTMETADATA] = LOADED;//mark as = loaded + //store in HASHMAP - chunkData.put(tPos, new int[]{tOil,tPollution,tOilFluid}); + chunkData.put(event.getChunk().getChunkCoordIntPair(), tInts); + }//else if(tInts[0]==1){ + ////Already loaded chunk data + ////DO NOTHING - this chunk data was already loaded and stored in hash map + //} } public static class OreDictEventContainer { diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java new file mode 100644 index 0000000000..bc9a1331b1 --- /dev/null +++ b/src/main/java/gregtech/common/GT_UndergroundOil.java @@ -0,0 +1,96 @@ +package gregtech.common; + +import gregtech.GT_Mod; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_UO_Fluid; +import gregtech.api.objects.XSTR; +import gregtech.common.GT_Proxy; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import java.util.HashMap; + +import static gregtech.api.util.GT_Utility.getScaleCoordinates; +import static gregtech.common.GT_Proxy.*; + +/** + * Created by Tec on 29.04.2017. + */ +public class GT_UndergroundOil { + + public static FluidStack undergroundOil(IGregTechTileEntity te,float drainSpeedCoefficient){ + return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),drainSpeedCoefficient); + } + + //Returns whole content for information purposes -> when drainSpeedCoeff < 0 + //Else returns extracted fluidStack if amount > 0, or null otherwise + public static FluidStack undergroundOil(Chunk chunk, float drainSpeedCoefficient) { + if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(chunk.worldObj.provider.dimensionId)) return null; + World aWorld = chunk.worldObj; + + //Read hash map + HashMap chunkData = dimensionWiseChunkData.get(aWorld.provider.dimensionId); + if(chunkData==null){ + chunkData=new HashMap<>(1024); + dimensionWiseChunkData.put(aWorld.provider.dimensionId,chunkData); + } + + int[] tInts = chunkData.get(chunk.getChunkCoordIntPair()); + + if(tInts==null) tInts=getDefaultChunkDataOnCreation();//init if null + else if(tInts[GTOIL]==0){ + //can return 0 amount stack for info :D + return drainSpeedCoefficient>=0 ? null : new FluidStack(FluidRegistry.getFluid(tInts[GTOILFLUID]),0); + } + + //GEN IT TO GET OBJECT... + XSTR tRandom = new XSTR(aWorld.getSeed() + aWorld.provider.dimensionId * 2 + + (chunk.getChunkCoordIntPair().chunkXPos>>3) + + 8267 * (chunk.getChunkCoordIntPair().chunkZPos>>3)); + GT_UO_Fluid uoFluid = GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).getRandomFluid(tRandom); + + //Fluid stack holder + FluidStack fluidInChunk; + + //Set fluidstack from uoFluid + if (uoFluid == null || uoFluid.getFluid()==null){ + tInts[GTOILFLUID]=Integer.MAX_VALUE;//null fluid pointer... kindof + tInts[GTOIL]=0; + chunkData.put(chunk.getChunkCoordIntPair(),tInts);//update hash map + return null; + } else { + if(tInts[GTOILFLUID]== uoFluid.getFluid().getID()){//if stored fluid matches uoFluid + fluidInChunk = new FluidStack(uoFluid.getFluid(),tInts[GTOIL]); + }else{ + fluidInChunk = new FluidStack(uoFluid.getFluid(), uoFluid.getRandomAmount(tRandom)); + tRandom=new XSTR(); + fluidInChunk.amount=(int)((float)fluidInChunk.amount*(0.75f+(tRandom.nextFloat()/2f)));//Randomly change amounts by +/- 25% + } + tInts[GTOIL]=fluidInChunk.amount; + tInts[GTOILFLUID]=fluidInChunk.getFluidID(); + } + + //do stuff on it if needed + if(drainSpeedCoefficient>=0) { + int actualExtractionSpeed=(int)(uoFluid.DecreasePerOperationAmountInBuckets*1000*drainSpeedCoefficient); + if(fluidInChunk.amount>actualExtractionSpeed) { + fluidInChunk.amount=actualExtractionSpeed;//give appropriate amount + tInts[GTOIL]-=actualExtractionSpeed;//diminish amount + }else if(fluidInChunk.amount>0) { + //fluidInChunk.amount= the same amount... going to return this + tInts[GTOIL]=0; + }else{ + fluidInChunk=null; + tInts[GTOIL]=0;//just to be on safe side... + } + } + + chunkData.put(chunk.getChunkCoordIntPair(),tInts);//update hash map + return fluidInChunk; + } +} diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index b16986fffd..c725634030 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -148,7 +148,7 @@ public class GT_MetaTileEntity_Boiler_Bronze this.mTemperature += 1; } if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + GT_Pollution.addPollution(getBaseMetaTileEntity(), 20); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index 3e5afedba2..8aef783b6b 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -127,7 +127,7 @@ public class GT_MetaTileEntity_Boiler_Lava } if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + GT_Pollution.addPollution(getBaseMetaTileEntity(), 20); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java index 5d7ec97401..92a9b6d7dc 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java @@ -153,7 +153,7 @@ public class GT_MetaTileEntity_Boiler_Steel this.mTemperature += 1; } if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); + GT_Pollution.addPollution(getBaseMetaTileEntity(), 30); } aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 270fef65e3..54bf3ee177 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -22,6 +22,7 @@ import gregtech.api.objects.ItemData; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_UndergroundOil; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import ic2.core.Ic2Items; @@ -148,7 +149,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba for (int z = tLeftZBound; z <= tRightZBound; ++z) { ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(x*16,96), 0, GT_Utility.getScaleCoordinates(z*16,96)); - FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), x*16, z*16); + FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity(),-1); if (tFluid != null) if (tFluids.containsKey(tPos)) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index ea8eb2f7ba..3b287d9ca4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -23,6 +23,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class GT_MetaTileEntity_BronzeBlastFurnace @@ -187,10 +188,6 @@ public class GT_MetaTileEntity_BronzeBlastFurnace } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if ((aBaseMetaTileEntity.isClientSide()) && - (aBaseMetaTileEntity.isActive())) { - aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D); - } if (aBaseMetaTileEntity.isServerSide()) { if (this.mUpdate-- == 0) { this.mMachine = checkMachine(); @@ -210,7 +207,7 @@ public class GT_MetaTileEntity_BronzeBlastFurnace } } if(this.mMaxProgresstime>0 && (aTimer % 20L == 0L)){ - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 50); + GT_Pollution.addPollution(getBaseMetaTileEntity(), 50); } aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); @@ -233,8 +230,20 @@ public class GT_MetaTileEntity_BronzeBlastFurnace this.mUpdate = 1; } } + }else if(aBaseMetaTileEntity.isActive()){ + World aWorld=aBaseMetaTileEntity.getWorld(); + double xPos=aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1); + double yPos=aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1)+0.05F; + double zPos=aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1); + XSTR floatGen=new XSTR(); + aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.3D, 0.0D); + //Pollution particles intensify + if(GT_Pollution.getPollution(getBaseMetaTileEntity())>GT_Mod.gregtechproxy.mPollutionSmogLimit){ + aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.45D, 0.0D); + aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.6D, 0.0D); + } } - } +} private void addOutputProducts() { if (this.mOutputItem1 != null) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 11c0fd109a..ff3af18e53 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -87,7 +87,7 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock this.mEfficiency = 10000; this.mEfficiencyIncrease = 10000; this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), mMaxProgresstime*5); + GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime*5); return true; } else { this.mEfficiency = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java index 60863e4c52..c86bdce89d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java @@ -18,6 +18,8 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import static gregtech.common.GT_UndergroundOil.undergroundOil; + public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase { private boolean completedCycle = false; @@ -73,12 +75,13 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase } } } - FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), true); + FluidStack tFluid = undergroundOil(getBaseMetaTileEntity(),.5F+(getInputTier()*.25F)); if (tFluid == null) { stopMachine(); return false; } if (getYOfPumpHead() > 0 && getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) { + if (completedCycle) { moveOneDown(); } -- cgit From 75a33be210cda273ef9e6cc9cbbf739dd913907e Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 1 Jun 2017 20:23:13 +0500 Subject: Fix OreDrill; fix getting block in ItemList; some changes in addInformation - need check this --- src/main/java/gregtech/api/enums/ItemList.java | 2 +- src/main/java/gregtech/api/enums/Textures.java | 2 +- .../api/metatileentity/MetaTileEntity.java | 8 +-- src/main/java/gregtech/api/util/GT_Utility.java | 10 +++- .../gregtech/common/blocks/GT_Item_Machines.java | 11 +--- .../multi/GT_MetaTileEntity_OreDrillingPlant4.java | 2 +- .../GT_MetaTileEntity_OreDrillingPlantBase.java | 66 ++++++++++----------- .../blocks/iconsets/OVERLAY_FRONT_ADVMINER2.png | Bin 439 -> 0 bytes .../iconsets/OVERLAY_FRONT_ADVMINER2_ACTIVE.png | Bin 457 -> 0 bytes .../blocks/iconsets/OVERLAY_FRONT_ORE_DRILL.png | Bin 0 -> 439 bytes .../iconsets/OVERLAY_FRONT_ORE_DRILL_ACTIVE.png | Bin 0 -> 457 bytes 11 files changed, 50 insertions(+), 51 deletions(-) delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2.png delete mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL_ACTIVE.png (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 155ebf459d..22364d991d 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -684,7 +684,7 @@ public enum ItemList implements IItemContainer { public Block getBlock() { if (mHasNotBeenSet) throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!"); - return GT_Utility.getBlockFromStack(getItem()); + return GT_Utility.getBlockFromItem(getItem()); } @Override diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 565398010f..3d4560cfac 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -101,7 +101,7 @@ public class Textures { BASALT_BRICKS_CRACKED, BASALT_BRICKS_MOSSY, BASALT_BRICKS_CHISELED, BASALT_SMOOTH, OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE, OVERLAY_FRONT_HEAT_EXCHANGER, OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE, OVERLAY_FRONT_PROCESSING_ARRAY, OVERLAY_FRONT_OIL_DRILL_ACTIVE, OVERLAY_FRONT_OIL_DRILL, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, OVERLAY_FRONT_DIESEL_ENGINE, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE, OVERLAY_FRONT_PYROLYSE_OVEN, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, OVERLAY_FRONT_OIL_CRACKER, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, OVERLAY_FRONT_DISTILLATION_TOWER, - OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ADVMINER2_ACTIVE, OVERLAY_FRONT_ADVMINER2, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM; + OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ORE_DRILL_ACTIVE, OVERLAY_FRONT_ORE_DRILL, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM; /** * Icon for Fresh CFoam diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 662dc59d80..0fd4061275 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -86,10 +86,10 @@ public abstract class MetaTileEntity implements IMetaTileEntity { GT_LanguageManager.addStringLocalization("gt.blockmachines." + mName + ".name", aRegionalName); mInventory = new ItemStack[aInvSlotCount]; - if (GT.isClientSide()) { - ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); - tStack.getItem().addInformation(tStack, null, new ArrayList(), true); - } +// if (GT.isClientSide()) { +// ItemStack tStack = new ItemStack(GregTech_API.sBlockMachines, 1, aID); +// tStack.getItem().addInformation(tStack, null, new ArrayList(), true); +// } } /** diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 59bc2a59ed..f3013a767e 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1018,9 +1018,13 @@ public class GT_Utility { return (Block) aBlock; } - public static Block getBlockFromStack(Object aStack) { - if (isStackInvalid(aStack)) return Blocks.air; - return Block.getBlockFromItem(((ItemStack) aStack).getItem()); + public static Block getBlockFromStack(ItemStack itemStack) { + if (isStackInvalid(itemStack)) return Blocks.air; + return getBlockFromItem(itemStack.getItem()); + } + + public static Block getBlockFromItem(Item item) { + return Block.getBlockFromItem(item); } public static boolean isBlockValid(Object aBlock) { diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 4014b01f39..8189a8a52b 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -33,14 +33,9 @@ public class GT_Item_Machines if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { return; } - TileEntity temp = GregTech_API.sBlockMachines.createTileEntity(aPlayer == null ? GT_Values.DW : aPlayer.worldObj, GregTech_API.METATILEENTITIES[tDamage] == null ? 0 : GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType()); - temp.setWorldObj(aPlayer == null ? GT_Values.DW : aPlayer.worldObj); - temp.xCoord = 0; - temp.yCoord = 0; - temp.zCoord = 0; - if ((temp instanceof IGregTechTileEntity)) { - IGregTechTileEntity tTileEntity = (IGregTechTileEntity) temp; - tTileEntity.setInitialValuesAsNBT(new NBTTagCompound(), (short) tDamage); + + if (GregTech_API.METATILEENTITIES[tDamage] != null) { + IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); if (tTileEntity.getDescription() != null) { int i = 0; for (String tDescription : tTileEntity.getDescription()) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java index d69ed7c79d..55fc1ef7e0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java @@ -36,7 +36,7 @@ public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDr @Override protected int getCasingTextureIndex() { - return 50; + return 62; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index cf2456a0ae..9eb31eaf72 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -45,7 +45,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - //initFields(); + initFields(); } public GT_MetaTileEntity_OreDrillingPlantBase(String aName) { @@ -54,24 +54,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile } private void initFields() { - xDrill = getBaseMetaTileEntity().getXCoord(); - yDrill = getBaseMetaTileEntity().getYCoord(); - zDrill = getBaseMetaTileEntity().getZCoord(); - back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()); - xCenter = xDrill + back.offsetX; - zCenter = zDrill + back.offsetZ; - isPickingPipes = false; casingBlock = getCasingBlockItem().getBlock(); casingMeta = getCasingBlockItem().get(0).getItemDamage(); - frameMeta = 4096 + getFrameMaterial().mMetaItemSubID; + int frameId = 4096 + getFrameMaterial().mMetaItemSubID; + frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W; casingTextureIndex = getCasingTextureIndex(); + isPickingPipes = false; } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ADVMINER2)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]}; + if (aSide == aFacing) + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex],new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL)}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex]}; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { @@ -194,9 +188,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return new ArrayList() {{ add(new ItemStack(oreBlock, 1, blockMeta)); }}; - } else { - return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); - } + } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); } private boolean tryConsumeDrillingFluid() { @@ -234,11 +226,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile if (yHead == yDrill) return; //skip controller block layer int radius = getRadiusInChunks() << 4; - for (int xOff = -radius; xOff <= radius; xOff++) { - for (int zOff = -radius; zOff <= radius; zOff++) { + for (int xOff = -radius; xOff <= radius; xOff++) + for (int zOff = -radius; zOff <= radius; zOff++) tryAddOreBlockToMineList(xDrill + xOff, yHead, zDrill + zOff); - } - } } private void tryAddOreBlockToMineList(int x, int y, int z) { @@ -247,14 +237,12 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile ChunkPosition blockPos = new ChunkPosition(x, y, z); if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos)) { + if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos)) oreBlockPositions.add(blockPos); - } } else { ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); - if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos)) { + if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos)) oreBlockPositions.add(blockPos); - } } } @@ -282,21 +270,23 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + updateCoordinates(); //check base layer for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) { for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) { if (xOff == 0 && zOff == 0) continue; IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff); - if (addMaintenanceToMachineList(tTileEntity, casingTextureIndex) - || addInputToMachineList(tTileEntity, casingTextureIndex) - || addOutputToMachineList(tTileEntity, casingTextureIndex) - || addEnergyInputToMachineList(tTileEntity, casingTextureIndex)) - continue; - - if (!checkCasingBlock(xOff, 0, zOff)) return false; + if (!checkCasingBlock(xOff, 0, zOff) + && !addMaintenanceToMachineList(tTileEntity, casingTextureIndex) + && !addInputToMachineList(tTileEntity, casingTextureIndex) + && !addOutputToMachineList(tTileEntity, casingTextureIndex) + && !addEnergyInputToMachineList(tTileEntity, casingTextureIndex)) + return false; } } + if (mMaintenanceHatches.isEmpty() || mInputHatches.isEmpty() || mOutputBusses.isEmpty() || mEnergyHatches.isEmpty()) return false; + if (GT_Utility.getTier(getMaxInputVoltage()) < getMinTier()) return false; //check tower for (int yOff = 1; yOff < 4; yOff++) { if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ) @@ -310,6 +300,15 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return checkPipesAndSetYHead(); } + private void updateCoordinates() { + xDrill = getBaseMetaTileEntity().getXCoord(); + yDrill = getBaseMetaTileEntity().getYCoord(); + zDrill = getBaseMetaTileEntity().getZCoord(); + back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()); + xCenter = xDrill + back.offsetX; + zCenter = zDrill + back.offsetZ; + } + private boolean checkPipesAndSetYHead() { yHead = yDrill - 1; while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--; @@ -321,7 +320,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private boolean checkCasingBlock(int xOff, int yOff, int zOff) { return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta); } - + //meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation) private boolean checkFrameBlock(int xOff, int yOff, int zOff) { return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta); } @@ -378,7 +377,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "3x1x3 Base of " + casings, "1x3x1 " + casings + " pillar (Center of base)", "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)", - "1x Input Hatch (Any bottom layer casing)", + "1x Input Hatch for drilling fluid (Any bottom layer casing)", + "1x Input Bus for mining pipes (Any bottom layer casing; not necessary)", "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"}; diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2.png deleted file mode 100644 index bc1dd3f5f0..0000000000 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2.png and /dev/null differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2_ACTIVE.png deleted file mode 100644 index b57178136f..0000000000 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ADVMINER2_ACTIVE.png and /dev/null differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL.png new file mode 100644 index 0000000000..bc1dd3f5f0 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL_ACTIVE.png new file mode 100644 index 0000000000..b57178136f Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_ORE_DRILL_ACTIVE.png differ -- cgit From 7c48590a49242bb26eddafa26d2cd7b4ce3546d8 Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 1 Jun 2017 20:58:24 +0500 Subject: OreDrill state saving --- .../multi/GT_MetaTileEntity_OreDrillingPlantBase.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 9eb31eaf72..6e4b80b75d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -15,6 +15,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.ForgeDirection; @@ -33,14 +34,15 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(miningPipeTip); private final ArrayList oreBlockPositions = new ArrayList<>(); - private Block casingBlock; + private Block casingBlock; private int casingMeta; private int frameMeta; private int casingTextureIndex; private ForgeDirection back; private int xDrill, yDrill, zDrill, xCenter, zCenter, yHead; + private boolean isPickingPipes; public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { @@ -72,6 +74,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); } + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("isPickingPipe", isPickingPipes); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + isPickingPipes = aNBT.getBoolean("isPickingPipes"); + } + @Override public boolean checkRecipe(ItemStack aStack) { if (isPickingPipes) { -- cgit From c5402ee38998cc086ceb36fbce6c54aba6d9d79c Mon Sep 17 00:00:00 2001 From: Techlone Date: Fri, 2 Jun 2017 22:18:29 +0500 Subject: Some ODP fixes, energy checking, add radius in tooltip, add "missing pipes" message for II-IV tiers change build.gradle for debugging in IDEA --- .gitignore | 1 + build.gradle | 2 + .../api/gui/GT_GUIContainer_MultiMachine.java | 24 ++++---- src/main/java/gregtech/api/util/GT_Utility.java | 5 -- .../GT_MetaTileEntity_OreDrillingPlantBase.java | 68 +++++++++++++++------- 5 files changed, 61 insertions(+), 39 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/.gitignore b/.gitignore index 27501edac3..f427f51f8c 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,7 @@ local.properties .idea/ .idea_modules/ +classes/ /out/ gradle/wrapper/gradle-wrapper.properties diff --git a/build.gradle b/build.gradle index 397ecab8cd..bb90467c03 100644 --- a/build.gradle +++ b/build.gradle @@ -37,6 +37,8 @@ minecraft { runDir = "eclipse" } +idea { module { inheritOutputDirs = true } } + configurations { provided embedded diff --git a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java index 189e5d25f1..55c1ace559 100644 --- a/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java +++ b/src/main/java/gregtech/api/gui/GT_GUIContainer_MultiMachine.java @@ -53,18 +53,18 @@ public class GT_GUIContainer_MultiMachine extends GT_GUIContainerMetaTile_Machin } else { fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); } - int id = mContainer.mTileEntity.getMetaTileID(); - if(id == 1157 || id == 1158){ - ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); - if(tItem==null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))){ - fontRendererObj.drawString("Missing Mining Pipe", 10,((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); - } - }else if(id == 1131 || id == 1151 || id == 1152 || id == 1153){ - ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); - if(tItem==null || !(tItem.getItem()==GT_MetaGenerated_Tool_01.INSTANCE&&tItem.getItemDamage()>=170&&tItem.getItemDamage()<=177)){ - fontRendererObj.drawString("Missing Turbine Rotor", 10, ((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); - } - } + int id = mContainer.mTileEntity.getMetaTileID(); + if (id == 1157 || id == 1158 || id == 1177 || id == 1178 || id == 1179) { + ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + if (tItem == null || !GT_Utility.areStacksEqual(tItem, GT_ModHandler.getIC2Item("miningPipe", 1L))) { + fontRendererObj.drawString("Missing Mining Pipe", 10, ((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); + } + } else if (id == 1131 || id == 1151 || id == 1152 || id == 1153) { + ItemStack tItem = mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); + if (tItem == null || !(tItem.getItem() == GT_MetaGenerated_Tool_01.INSTANCE && tItem.getItemDamage() >= 170 && tItem.getItemDamage() <= 177)) { + fontRendererObj.drawString("Missing Turbine Rotor", 10, ((GT_Container_MultiMachine) mContainer).mActive == 0 ? 40 : 24, 16448255); + } + } } } } diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 642fc5d9a4..076442e4f0 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -1971,11 +1971,6 @@ public class GT_Utility { return result; } - @SuppressWarnings("unchecked") - public static T[] listToArray(List list) { - return (T[]) list.toArray(); - } - public static class ItemNBT { public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { if (aNBT == null) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 6e4b80b75d..729a133766 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -1,14 +1,21 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; @@ -23,9 +30,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.GT_Values.*; public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_MultiBlockBase { private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); @@ -88,27 +93,33 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile @Override public boolean checkRecipe(ItemStack aStack) { + setElectricityStats(); + if (!checkPipesAndSetYHead() || !isEnergyEnough()) { + stopMachine(); + return false; + } if (isPickingPipes) { if (tryPickPipe()) { mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)}; - setElectricityStats(); return true; } else { + isPickingPipes = false; stopMachine(); return false; } } + putMiningPipesFromInputsInController(); if (!tryConsumeDrillingFluid()) return false; fillMineListIfEmpty(); if (oreBlockPositions.isEmpty()) { - boolean isMoved = moveOneDown(); - if (!isMoved) { + if (!tryLowerPipe()) { isPickingPipes = true; - setElectricityStats(); return true; } + //new layer - fill again + fillMineListIfEmpty(); } ChunkPosition oreBlockPos = null; @@ -125,10 +136,18 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile mOutputItems = getOutputByDrops(oreBlockDrops); } - setElectricityStats(); return true; } + private boolean isEnergyEnough() { + long requiredEnergy = 512 + getMaxInputVoltage() * 4; + for (GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) { + requiredEnergy -= energyHatch.getEUVar(); + if (requiredEnergy <= 0) return true; + } + return false; + } + private boolean tryPickPipe() { if (yHead == yDrill) return false; if (checkBlockAndMeta(xCenter, yHead + 1, zCenter, miningPipeBlock, W)) @@ -143,7 +162,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile //T1 = 12; T2 = 48; T3 = 192; T4 = 768 this.mEUt = 3 * (1 << (getMinTier() << 1)); //T1 = 960; T2 = 480; T3 = 240; T4 = 120 - this.mMaxProgresstime = 1920 / (1 << getMinTier()); + this.mMaxProgresstime = (isPickingPipes ? 80 : 1920) / (1 << getMinTier()); long voltage = getMaxInputVoltage(); long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1]; @@ -180,7 +199,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile outputItems.add(recipeOutput); } } - return GT_Utility.listToArray(outputItems); + return outputItems.toArray(new ItemStack[0]); } private boolean doUseMaceratorRecipe(ItemStack currentItem) { @@ -249,22 +268,23 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile Block block = getBaseMetaTileEntity().getBlock(x, y, z); int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z); ChunkPosition blockPos = new ChunkPosition(x, y, z); + if (oreBlockPositions.contains(blockPos)) return; if (block instanceof GT_Block_Ores_Abstract) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z); - if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural && !oreBlockPositions.contains(blockPos)) + if (tTileEntity != null && tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) oreBlockPositions.add(blockPos); } else { ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta)); - if (association != null && association.mPrefix.toString().startsWith("ore") && !oreBlockPositions.contains(blockPos)) + if (association != null && association.mPrefix.toString().startsWith("ore")) oreBlockPositions.add(blockPos); } } - private boolean moveOneDown() { + private boolean tryLowerPipe() { if (!isHasMiningPipes()) return false; if (yHead <= 0) return false; - if (checkBlockAndMeta(xCenter, yHead - 1, zCenter, Blocks.bedrock, 0)) return false; + if (checkBlockAndMeta(xCenter, yHead - 1, zCenter, Blocks.bedrock, W)) return false; if (!getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead - 1, zCenter, miningPipeTipBlock)) return false; if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeBlock); @@ -311,7 +331,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile || !checkFrameBlock(back.offsetX, yOff + 3, back.offsetZ)) return false; } - return checkPipesAndSetYHead(); + return true; } private void updateCoordinates() { @@ -325,10 +345,13 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile private boolean checkPipesAndSetYHead() { yHead = yDrill - 1; - while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--; - if (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeTipBlock, W)) return true; - yHead++; - return yHead == yDrill || getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeTipBlock); + while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--; //skip pipes + //is pipe tip OR is controller layer + if (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeTipBlock, W) || ++yHead == yDrill) return true; + //pipe column is broken - try fix + getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeTipBlock); + oreBlockPositions.clear(); + return true; } private boolean checkCasingBlock(int xOff, int yOff, int zOff) { @@ -395,6 +418,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x Input Bus for mining pipes (Any bottom layer casing; not necessary)", "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", - "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"}; + "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", + "Radius is " + (getRadiusInChunks() << 4) + " blocks"}; } } -- cgit From 467e6ba02286fa97b2cbd407158227958756032b Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 15 May 2017 08:13:34 +0200 Subject: 1ddc91a --- .../GT_MetaTileEntity_BasicMachine.java | 24 +++++++++++++++- .../multi/GT_MetaTileEntity_ProcessingArray.java | 32 ++++++++++++++++++---- 2 files changed, 50 insertions(+), 6 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index fc4ecfeea9..81948bb563 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -741,11 +741,33 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B * @return see constants above */ public int checkRecipe() { + return checkRecipe(false); + } + + public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId){ + return //TODO check or get a better solution + DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") || + DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") || + DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation"); + } + + + /** + * + * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... + * @return + */ + public int checkRecipe(boolean skipOC){ GT_Recipe_Map tMap = getRecipeList(); if (tMap == null) return DID_NOT_FIND_RECIPE; GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; - if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && !(DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Orbit")||DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Space"))) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; if (!canOutput(tRecipe)) { mOutputBlocked++; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index db8462f76b..b45c0da6ca 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -22,6 +23,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; + public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase { GT_Recipe mLastRecipe; @@ -64,7 +67,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl public GT_Recipe.GT_Recipe_Map getRecipeMap() { if (mInventory[1] == null) return null; - String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt.blockmachines.basicmachine.", ""); + String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicmachine\\.", ""); if (tmp.startsWith("centrifuge")) { return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; } else if (tmp.startsWith("electrolyzer")) { @@ -131,8 +134,25 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl return GT_Recipe.GT_Recipe_Map.sPolarizerRecipes; } else if(tmp.startsWith("press")){ return GT_Recipe.GT_Recipe_Map.sPressRecipes; + } else if (tmp.startsWith("plasmaarcfurnace")) { + return GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes; + } else if (tmp.startsWith("printer")) { + return GT_Recipe.GT_Recipe_Map.sPrinterRecipes; + } else if (tmp.startsWith("press")) { + return GT_Recipe.GT_Recipe_Map.sPressRecipes; + } else if (tmp.startsWith("fluidcanner")) { + return GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes; + } else if (tmp.startsWith("fluidheater")) { + return GT_Recipe.GT_Recipe_Map.sFluidHeaterRecipes; + } else if (tmp.startsWith("distillery")) { + return GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; + } else if (tmp.startsWith("slicer")) { + return GT_Recipe.GT_Recipe_Map.sSlicerRecipes; + } else if (tmp.startsWith("amplifier")) { + return GT_Recipe.GT_Recipe_Map.sAmplifiers; + } else if (tmp.startsWith("circuitassembler")) { + return GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes; } - return null; } @@ -153,9 +173,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl return false; } GT_Recipe.GT_Recipe_Map map = getRecipeMap(); - if (map == null) { - return false; - } + if (map == null) return false; ArrayList tInputList = getStoredInputs(); int tTier = 0; if (mInventory[1].getUnlocalizedName().endsWith("1")) { @@ -186,6 +204,10 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl if (tInputList.size() > 0 || tFluids.length > 0) { GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return false; + mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null; -- cgit From 23de1f09edb99c58aee37182fd07cef642025060 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sun, 4 Jun 2017 00:26:31 +0200 Subject: Cleanroom controller outputs efficency as redstone signal #948 --- .../api/interfaces/metatileentity/IMetaTileEntity.java | 2 ++ .../java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 4 ++-- src/main/java/gregtech/api/metatileentity/MetaTileEntity.java | 5 +++++ .../implementations/GT_MetaTileEntity_Buffer.java | 6 ++++++ .../machines/multi/GT_MetaTileEntity_Cleanroom.java | 11 ++++++++++- 5 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 64c5072c39..2454392cf7 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -379,6 +379,8 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand public void onColorChangeClient(byte aColor); public int getLightOpacity(); + + public boolean allowGeneralRedstoneOutput(); public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index b537ce71ef..2d3e00ae6c 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -65,7 +65,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE; private String mOwnerName = ""; private NBTTagCompound mRecipeStuff = new NBTTagCompound(); - + private static final Field ENTITY_ITEM_HEALTH_FIELD; static { @@ -1414,7 +1414,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE @Override public byte getOutputRedstoneSignal(byte aSide) { - return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0; + return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : mMetaTileEntity.allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 662dc59d80..0561e87198 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -863,4 +863,9 @@ public abstract class MetaTileEntity implements IMetaTileEntity { public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { // } + + @Override + public boolean allowGeneralRedstoneOutput(){ + return false; + } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index abbf5b7ee5..fba40a13a0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -224,6 +224,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) { mSuccess--; moveItems(aBaseMetaTileEntity, aTimer); + System.out.println("inv "+bInvert+" full "+bRedstoneIfFull); aBaseMetaTileEntity.setGenericRedstoneOutput(bInvert); if (bRedstoneIfFull) { aBaseMetaTileEntity.setGenericRedstoneOutput(!bInvert); @@ -256,4 +257,9 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide != aBaseMetaTileEntity.getBackFacing(); } + + @Override + public boolean allowGeneralRedstoneOutput(){ + return true; + } } \ No newline at end of file diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 015670cb02..6d3bf94534 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -148,9 +148,18 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas if (doorState) { mEfficiency = Math.max(0, mEfficiency - 200); } - + for(byte i = 0 ; i<6 ; i++){ + byte t = (byte) Math.max(1, (byte)(15/(10000f / mEfficiency))); + aBaseMetaTileEntity.setInternalOutputRedstoneSignal(i, t); + } + return true; } + + @Override + public boolean allowGeneralRedstoneOutput(){ + return true; + } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == 0 || aSide == 1) { -- cgit From d0247a5d73dc5074dba989b8ff6560a9023eebfb Mon Sep 17 00:00:00 2001 From: Johannes Gäßler Date: Sun, 4 Jun 2017 20:19:07 +0200 Subject: Moved the casing IDs for the Large Chemical Reactor: 14, 15 -> 4, 5 Limited the minimal recipe time for the LCM to 2 ticks to avoid bugs. --- .../java/gregtech/common/blocks/GT_Block_Casings4.java | 18 ++++++++---------- .../multi/GT_MetaTileEntity_LargeChemicalReactor.java | 15 +++++++++------ 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 639cbf5d6f..bbf489c6aa 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -27,8 +27,8 @@ public class GT_Block_Casings4 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Clean Stainless Steel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Stable Titanium Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Titanium Firebox Casing"); -// GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Fusion Casing"); -// GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Chemically Inert Machine Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "PTFE Pipe Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Fusion Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Fusion Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Fusion Machine Casing MK II"); @@ -37,13 +37,13 @@ public class GT_Block_Casings4 GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Titanium Turbine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Tungstensteel Turbine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Engine Intake Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Chemically Inert Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "PTFE Pipe Machine Casing"); ItemList.Casing_RobustTungstenSteel.set(new ItemStack(this, 1, 0)); ItemList.Casing_CleanStainlessSteel.set(new ItemStack(this, 1, 1)); ItemList.Casing_StableTitanium.set(new ItemStack(this, 1, 2)); ItemList.Casing_Firebox_Titanium.set(new ItemStack(this, 1, 3)); + ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 4)); + ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 5)); ItemList.Casing_Fusion.set(new ItemStack(this, 1, 6)); ItemList.Casing_Fusion_Coil.set(new ItemStack(this, 1, 7)); ItemList.Casing_Fusion2.set(new ItemStack(this, 1, 8)); @@ -52,8 +52,6 @@ public class GT_Block_Casings4 ItemList.Casing_Turbine2.set(new ItemStack(this, 1, 11)); ItemList.Casing_Turbine3.set(new ItemStack(this, 1, 12)); ItemList.Casing_EngineIntake.set(new ItemStack(this, 1, 13)); - ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 14)); - ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 15)); } public IIcon getIcon(int aSide, int aMeta) { @@ -67,9 +65,9 @@ public class GT_Block_Casings4 case 3: return aSide > 1 ? Textures.BlockIcons.MACHINE_CASING_FIREBOX_TITANIUM.getIcon() : Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); case 4: - return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon(); case 5: - return Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon(); case 6: return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon(); case 7: @@ -87,9 +85,9 @@ public class GT_Block_Casings4 case 13: return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getIcon(); case 14: - return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); case 15: - return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon(); } return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index aeff099248..1a7b444b54 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -20,7 +20,7 @@ import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { - private static final int CASING_INDEX = 62; + private static final int CASING_INDEX = 52; public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -43,7 +43,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu "Does not lose efficiency when overclocked", "Accepts fluids instead of fluid cells", "Size(WxHxD): 3x3x3", - "3x3x3 of Chemically Inert Machine Casings (hollow, min 24!)", + "3x3x3 of Chemically Inert Machine Casings (hollow, min 8!)", "Controller (Front centered)", "1x Cupronickel Coil Block (Bottom centered)", "1x PTFE Pipe Machine Casing (inside the hollow casings)", @@ -120,11 +120,14 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu int EUt = recipe.mEUt; int maxProgresstime = recipe.mDuration; - while (EUt <= gregtech.api.enums.GT_Values.V[tier - 1] && maxProgresstime > 1) { + while (EUt <= gregtech.api.enums.GT_Values.V[tier - 1] && maxProgresstime > 2) { EUt *= 4; maxProgresstime /= 4; } - maxProgresstime = Math.max(maxProgresstime, 1); + if (maxProgresstime < 2) { + maxProgresstime = 2; + EUt = recipe.mEUt * recipe.mDuration / 2; + } this.mEUt = -EUt; this.mMaxProgresstime = maxProgresstime; @@ -151,14 +154,14 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu if ((y == -1) && (block != GregTech_API.sBlockCasings5 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 0)) { return false; - } else if (y == 0 && (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 15)) { + } else if (y == 0 && (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 5)) { return false; } } else if (x != 0 || y != 0 || z != 0) { if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 14) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 4) { casingAmount++; } else { return false; -- cgit From 7cb51ae461815bfd767aa0bf64f8ff075de5624d Mon Sep 17 00:00:00 2001 From: Techlone Date: Mon, 5 Jun 2017 17:14:24 +0500 Subject: fix OsmiridiumCasing recipe in Assembler fix ODP changing state when the tip meets itself fix cleaning of oreBlockPositions when a mining column was broken --- .../machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java | 5 +++-- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 729a133766..f25d2d304c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -94,10 +94,12 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile @Override public boolean checkRecipe(ItemStack aStack) { setElectricityStats(); + int oldYHead = yHead; if (!checkPipesAndSetYHead() || !isEnergyEnough()) { stopMachine(); return false; } + if (yHead != oldYHead) oreBlockPositions.clear(); if (isPickingPipes) { if (tryPickPipe()) { mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)}; @@ -286,7 +288,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile if (yHead <= 0) return false; if (checkBlockAndMeta(xCenter, yHead - 1, zCenter, Blocks.bedrock, W)) return false; - if (!getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead - 1, zCenter, miningPipeTipBlock)) return false; + getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead - 1, zCenter, miningPipeTipBlock); if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeBlock); getBaseMetaTileEntity().decrStackSize(1, 1); @@ -350,7 +352,6 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile if (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeTipBlock, W) || ++yHead == yDrill) return true; //pipe column is broken - try fix getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeTipBlock); - oreBlockPositions.clear(); return true; } diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 861d2e5171..31c16d3e90 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1346,7 +1346,7 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.TungstenSteel, 1L), ItemList.Casing_RobustTungstenSteel.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.StainlessSteel, 1L), ItemList.Casing_CleanStainlessSteel.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Titanium, 1L), ItemList.Casing_StableTitanium.get(2L, new Object[0]), 50, 16); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmiridium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 1L), ItemList.Casing_StableTitanium.get(2L, new Object[0]), 50, 16); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Osmiridium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Osmiridium, 1L), ItemList.Casing_MiningOsmiridium.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), ItemList.Casing_LuV.get(1L, new Object[0]), ItemList.Casing_Fusion.get(1L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Magnalium, 6L), GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.BlueSteel, 1L), ItemList.Casing_Turbine.get(2L, new Object[0]), 50, 16); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine1.get(2L, new Object[0]), 50, 16); -- cgit From 4c25e83b0db8a9ed1ec55517b3b5f99834fb0355 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 5 Jun 2017 21:07:23 +0200 Subject: Improved large boiler tooltip #877 --- .../machines/multi/GT_MetaTileEntity_LargeBoiler.java | 8 +++++--- .../machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java | 4 ++++ .../machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java | 4 ++++ .../machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java | 4 ++++ .../multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java | 4 ++++ 5 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index 04922c0a03..467030cf21 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -41,9 +41,9 @@ public abstract class GT_MetaTileEntity_LargeBoiler "Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s", "A programmed circuit in the main block throttles the boiler (-1000L/s per config)", "Size(WxHxD): 3x5x3, Controller (Front middle in Fireboxes)", - "3x1x3 of Fire Boxes (Bottom layer, Min 3)", - "3x4x3 of Casings (Above Fireboxes, hollow, Min 24!)", - "3 Pipe Casing Blocks (Inside the Hollow Casing)", + "3x1x3 of "+getCasingMaterial()+" Fire Boxes (Bottom layer, Min 3)", + "3x4x3 of "+getCasingMaterial()+" Casings (Above Fireboxes, hollow, Min 24!)", + "3 "+getCasingMaterial()+" Pipe Casing Blocks (Inside the Hollow Casing)", "1x Input Fuel Hatch/Bus (Any Firebox)", "1x Input Water Hatch (Any Firebox)", "1x Output Hatch (Any Casing)", @@ -53,6 +53,8 @@ public abstract class GT_MetaTileEntity_LargeBoiler String.format("Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()), "Causes up to " + 20 * getPollutionPerTick(null) + " Pollution per second"}; } + + public abstract String getCasingMaterial(); public abstract Block getCasingBlock(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java index 7c5dad3c96..cc494498da 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java @@ -18,6 +18,10 @@ public class GT_MetaTileEntity_LargeBoiler_Bronze public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Bronze(this.mName); } + + public String getCasingMaterial(){ + return "Bronze"; + } public Block getCasingBlock() { return GregTech_API.sBlockCasings1; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java index a68c0e6212..984290a3c6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java @@ -18,6 +18,10 @@ public class GT_MetaTileEntity_LargeBoiler_Steel public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Steel(this.mName); } + + public String getCasingMaterial(){ + return "Steel"; + } public Block getCasingBlock() { return GregTech_API.sBlockCasings2; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java index 6fc32f8c34..144c44aeed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java @@ -18,6 +18,10 @@ public class GT_MetaTileEntity_LargeBoiler_Titanium public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Titanium(this.mName); } + + public String getCasingMaterial(){ + return "Titanium"; + } public Block getCasingBlock() { return GregTech_API.sBlockCasings4; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java index 997a176e34..b69bac2f94 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java @@ -18,6 +18,10 @@ public class GT_MetaTileEntity_LargeBoiler_TungstenSteel public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_TungstenSteel(this.mName); } + + public String getCasingMaterial(){ + return "TungstenSteel"; + } public Block getCasingBlock() { return GregTech_API.sBlockCasings4; -- cgit From 96b1cb31ced61270a1289da6da4cdd99f75eeb3a Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Wed, 14 Jun 2017 02:16:18 +0200 Subject: improve cleanroom tooltip --- .../machines/multi/GT_MetaTileEntity_Cleanroom.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 6d3bf94534..170604ff6e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -33,12 +33,13 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas public String[] getDescription() { return new String[]{ "Controller Block for the Cleanroom", - "Min(WxHxD): 3x3x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", - "Controller (Top center), Walls Plascrete", - "Top besides contoller and corners filter casings", - "1 Reinforced Door", + "Min(WxHxD): 3x4x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)", + "Controller (Top center)", + "Top besides contoller and edges filter casings", + "1 Reinforced Door(keep closed for 100% efficency", "1x Energy Hatch, 1x Maintainance Hatch", - "up to 10 Machine Hull to transfer Items & Energy inside"}; + "up to 10 Machine Hull Item & Energy transfer through walls", + "Remaining Blocks Plascrete"}; } public boolean checkRecipe(ItemStack aStack) { -- cgit From 617f057dad27b8d9fc1dde0c669569b09453a0ed Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sat, 17 Jun 2017 14:37:57 +0200 Subject: Extended logging for Assemblyline --- .../machines/multi/GT_MetaTileEntity_AssemblyLine.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities/machines/multi') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index c3ab282906..09fabef2a2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -67,8 +68,10 @@ public class GT_MetaTileEntity_AssemblyLine } public boolean checkRecipe(ItemStack aStack) { + if(GT_Values.D1)System.out.println("Start ALine recipe check"); if (!GT_Utility.isStackValid(mInventory[1]) || !ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) return false; + if(GT_Values.D1)System.out.println("Stick accepted"); NBTTagCompound tTag = mInventory[1].getTagCompound(); if (tTag == null) return false; @@ -78,24 +81,30 @@ public class GT_MetaTileEntity_AssemblyLine if (mInputBusses.get(i) == null) return false; tStack[i] = GT_Utility.loadItem(tTag, "" + i); if (tStack[i] == null) continue; + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); if (!GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) || tStack[i].stackSize > stackInSlot.stackSize) { + if(GT_Values.D1)System.out.println(i +" not accepted"); return false; } + if(GT_Values.D1)System.out.println(i+" accepted"); } - + if(GT_Values.D1)System.out.println("All Items done, start fluid check"); FluidStack[] tFluids = new FluidStack[4]; 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) return false; 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"); return false; } + 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")) return false; mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) @@ -107,6 +116,7 @@ public class GT_MetaTileEntity_AssemblyLine if (!tTag.hasKey("eu")) return false; mEUt = tTag.getInteger("eu"); + 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); @@ -120,6 +130,7 @@ public class GT_MetaTileEntity_AssemblyLine 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); @@ -138,6 +149,7 @@ public class GT_MetaTileEntity_AssemblyLine } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); updateSlots(); + if(GT_Values.D1)System.out.println("Recipe sucessfull"); return true; } -- cgit