From 2214833189caf3eb262f049746be4987b97aa6a7 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Fri, 15 Dec 2017 18:15:08 +1000 Subject: More fixes pre-gtnh update (#168) $ Tree Farmer Fix (a) $ Multitank Fix. ^ Version Bump. * + Added Chainsaw support to treefarm. + Added check for creative tools to tree farm for creative testing. --- .../multi/GregtechMetaTileEntityTreeFarm.java | 77 +++++++++++----------- .../multi/GregtechMetaTileEntity_MultiTank.java | 4 +- 2 files changed, 40 insertions(+), 41 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index eccc96c253..6d951b7221 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -15,10 +15,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.metatileentity.implementations.*; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; @@ -35,6 +32,7 @@ import gtPlusPlus.core.util.particles.BlockBreakParticles; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_TreeFarmer; import gtPlusPlus.xmod.gregtech.api.gui.GUI_TreeFarmer; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; import net.minecraft.block.Block; @@ -48,7 +46,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; -public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlockBase { +public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase { /* private */ private int treeCheckTicks = 0; /* private */ private int plantSaplingTicks = 0; @@ -102,10 +100,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public void saveNBTData(final NBTTagCompound aNBT) { - + Utils.LOG_INFO("Called NBT data save"); aNBT.setLong("mInternalPower", this.mInternalPower); - + //Save [Buzz]Saw final NBTTagList list = new NBTTagList(); for(int i = 0;i<2;i++){ @@ -119,14 +117,14 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } } aNBT.setTag("Items", list); - + super.saveNBTData(aNBT); } @Override public void loadNBTData(final NBTTagCompound aNBT) { this.mInternalPower = aNBT.getLong("mInternalPower"); - + //Load [Buzz]Saw final NBTTagList list = aNBT.getTagList("Items", 10); for(int i = 0;i(); this.mEnergyHatches = new ArrayList<>(); - this.canChop = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + if (aBaseMetaTileEntity != null && this.mInventory[1] != null){ + this.canChop = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } } } } @@ -989,7 +986,9 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Call Cleanup Task last, before ticking. if (this.cleanupTicks == 600){ - this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + if (aBaseMetaTileEntity != null && this.mInventory[1] != null){ + this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); + } /*Utils.LOG_MACHINE_INFO("Looking For rubbish to cleanup - Serverside | "+this.cleanupTicks); TreeFarmHelper.cleanUp(aBaseMetaTileEntity);*/ } @@ -1002,7 +1001,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } - //@Deprecated + //@Deprecated //public static boolean damageOrDechargeItem(ItemStack aStack, int aDamage, int aDecharge, EntityLivingBase aPlayer) { // if ((GT_Utility.isStackInvalid(aStack)) || ((aStack.getMaxStackSize() <= 1) && (aStack.stackSize > 1))) // return false; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java index b908e5439c..b8f2535b1f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MultiTank.java @@ -172,7 +172,7 @@ extends GregtechMeta_MultiBlockBase { public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.internalStorageTank.amount >= this.maximumFluidStorage){ + if ((this.internalStorageTank != null) && this.internalStorageTank.amount >= this.maximumFluidStorage){ if (this.internalStorageTank.amount > this.maximumFluidStorage){ this.internalStorageTank.amount = this.maximumFluidStorage; } @@ -589,4 +589,4 @@ extends GregtechMeta_MultiBlockBase { this.getBaseMetaTileEntity().markDirty();*/ return true; } -} +} \ No newline at end of file -- cgit From 5715a32d2901922503fd850f3a68503fb77467c3 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Wed, 20 Dec 2017 23:39:49 +1000 Subject: - Disabled some logging. % Minor Project Clean-up, added missing Override annotations to 100+ methods & removed pointless casts. % Moved Logging to it's own class. $ Fixed Multi-block handling of Pollution. $ Fixed the GT 5.09 material enabler system. (From My Side, it's still borked on GTs). + Added a Dynamic Proxy invocation for IMaterialHandler. + Added an AutoMap data type, which is a Auto-incremental ID'd Hashmap wrapper. --- .../machines/multi/GT4Entity_AutoCrafter.java | 18 +-- .../machines/multi/GT4Entity_ThermalBoiler.java | 4 +- .../machines/multi/GregtechMTE_NuclearReactor.java | 96 +++++++------- .../multi/GregtechMetaTileEntityAnimalFarm.java | 60 ++++----- .../GregtechMetaTileEntityGeneratorArray.java | 41 +++--- .../multi/GregtechMetaTileEntityTreeFarm.java | 139 ++++++++++----------- .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 6 +- .../GregtechMetaTileEntity_CatalyticReactor.java | 54 ++++---- .../multi/GregtechMetaTileEntity_Cyclotron.java | 26 ++-- ...regtechMetaTileEntity_IndustrialCentrifuge.java | 38 +++--- .../GregtechMetaTileEntity_IndustrialCokeOven.java | 14 +-- ...echMetaTileEntity_IndustrialCuttingMachine.java | 20 +-- ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 4 +- ...GregtechMetaTileEntity_IndustrialMacerator.java | 22 ++-- ...regtechMetaTileEntity_IndustrialPlatePress.java | 4 +- .../GregtechMetaTileEntity_IndustrialSifter.java | 82 ++++++------ .../GregtechMetaTileEntity_IndustrialSinter.java | 22 ++-- ...MetaTileEntity_IndustrialThermalCentrifuge.java | 34 ++--- ...GregtechMetaTileEntity_IndustrialWashPlant.java | 32 ++--- .../GregtechMetaTileEntity_IndustrialWireMill.java | 22 ++-- .../GregtechMetaTileEntity_MassFabricator.java | 56 ++++----- .../multi/GregtechMetaTileEntity_MultiTank.java | 73 ++++++----- ...chMetaTileEntity_PowerSubStationController.java | 79 ++++++------ .../multi/GregtechMetaTileEntity_Refinery.java | 52 ++++---- 24 files changed, 503 insertions(+), 495 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java index 3dee1df0f0..777310ef0f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java @@ -13,10 +13,10 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.ArrayUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.nbt.NBTUtils; @@ -178,12 +178,12 @@ extends GT_MetaTileEntity_MultiBlockBase final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(28))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { - Utils.LOG_WARNING("Bad Block. Found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) .getLocalizedName()); - Utils.LOG_WARNING("Block Found at x:"+(aBaseMetaTileEntity.getXCoord()+xDir+i)+" | y:"+(aBaseMetaTileEntity.getYCoord()+h)+" | z:"+(aBaseMetaTileEntity.getZCoord()+zDir+j)); + Logger.WARNING("Bad Block. Found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) .getLocalizedName()); + Logger.WARNING("Block Found at x:"+(aBaseMetaTileEntity.getXCoord()+xDir+i)+" | y:"+(aBaseMetaTileEntity.getYCoord()+h)+" | z:"+(aBaseMetaTileEntity.getZCoord()+zDir+j)); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_WARNING("Bad Meta."); + Logger.WARNING("Bad Meta."); return false; } ++tAmount; @@ -197,8 +197,8 @@ extends GT_MetaTileEntity_MultiBlockBase (this.mInputBusses.size() == 0) || (this.mOutputBusses.size() == 0) || (this.mMufflerHatches.size() != 1) || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() == 0)){ - Utils.LOG_WARNING("Wrong Hatch count."); - Utils.LOG_WARNING("|"+this.mInputHatches.size()+ + Logger.WARNING("Wrong Hatch count."); + Logger.WARNING("|"+this.mInputHatches.size()+ "|"+this.mOutputHatches.size()+ "|"+this.mInputBusses.size()+ "|"+this.mOutputBusses.size()+ @@ -394,7 +394,7 @@ extends GT_MetaTileEntity_MultiBlockBase } //Return if no input hatch set. if (craftingInput == null){ - Utils.LOG_WARNING("Cannot do Auto-Crafting without a 9-slot Input Bus [MV]."); + Logger.WARNING("Cannot do Auto-Crafting without a 9-slot Input Bus [MV]."); return false; } @@ -458,7 +458,7 @@ extends GT_MetaTileEntity_MultiBlockBase this.mEUt = 8 * (1 << this.mTier - 1) * (1 << this.mTier - 1); this.mMaxProgresstime = MathUtils.roundToClosestInt((50-(5*MathUtils.randDouble(((this.mTier-2) <= 0 ? 1 : (this.mTier-2)), this.mTier)))); - Utils.LOG_WARNING("MPT: "+mMaxProgresstime+" | "+mEUt); + Logger.WARNING("MPT: "+mMaxProgresstime+" | "+mEUt); this.getBaseMetaTileEntity().setActive(true); //Setup some vars @@ -494,7 +494,7 @@ extends GT_MetaTileEntity_MultiBlockBase mCorrectInputs++; } else { - Utils.LOG_WARNING("Input in Slot "+mCorrectInputs+" was not valid."); + Logger.WARNING("Input in Slot "+mCorrectInputs+" was not valid."); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java index f7940e3d68..98f3d92980 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_ThermalBoiler.java @@ -7,10 +7,10 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.*; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.general.ItemLavaFilter; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -55,7 +55,7 @@ extends GT_MetaTileEntity_MultiBlockBase @Override public int getDamageToComponent(ItemStack aStack){ - Utils.LOG_INFO("Trying to damage component."); + Logger.INFO("Trying to damage component."); return ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack) ? 1 : 0; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index cc8f25869c..c95a91a724 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -13,12 +13,12 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; @@ -166,12 +166,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //If not a hatch, continue, else add hatch and continue. if ((!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(12))) && (!this.addDynamoToMachineList(tTileEntity, TAE.GTPP_INDEX(12)))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing."); return false; } } @@ -183,7 +183,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase // Reactor Inner 5x5 //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { - Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); + Logger.INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } @@ -211,13 +211,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase //Deal with all 4 sides (Reactor walls) if ((h == 1) || (h == 2)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Reactor Shielding Missing from somewhere in the second layer."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 13) { - Utils.LOG_INFO("Reactor Shielding Missing from somewhere in the second layer."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Reactor Shielding Missing from somewhere in the second layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } } @@ -228,13 +228,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Hastelloy-N Reactor Casing(s) Missing from one of the edges on the top layer. "+h); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); if (h ==0){ if (tTileEntity instanceof GregtechMTE_NuclearReactor){ @@ -256,8 +256,8 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mDynamoHatches != null) { for (int i = 0; i < this.mDynamoHatches.size(); i++) { if (this.mDynamoHatches.get(i).mTier < 5){ - Utils.LOG_INFO("You require at LEAST IV tier Dynamo Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO("You require at LEAST IV tier Dynamo Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); return false; } } @@ -266,9 +266,9 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase for (int i = 0; i < this.mOutputHatches.size(); i++) { if ((this.mOutputHatches.get(i).mTier < 5) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Utils.LOG_INFO("You require at LEAST IV tier Output Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.INFO("You require at LEAST IV tier Output Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } @@ -276,31 +276,31 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.mInputHatches != null) { for (int i = 0; i < this.mInputHatches.size(); i++) { if (this.mInputHatches.get(i).mTier < 5){ - Utils.LOG_INFO("You require at LEAST IV tier Input Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.INFO("You require at LEAST IV tier Input Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } } if (this.mMufflerHatches.size() != 4){ - Utils.LOG_INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); + Logger.INFO("You require EXACTLY 4 muffler hatches on top. FOUR. You have "+this.mMufflerHatches.size()); return false; } if (this.mInputHatches.size() < 4){ - Utils.LOG_INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); + Logger.INFO("You require 4 or more input hatches. You have "+this.mInputHatches.size()); return false; } if (this.mOutputHatches.size() < 10){ - Utils.LOG_INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); + Logger.INFO("You require 10 or more output hatches. You have "+this.mOutputHatches.size()); return false; } if (this.mDynamoHatches.size() != 4){ - Utils.LOG_INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); + Logger.INFO("You require EXACTLY 4 dynamo hatches. FOUR. You have "+this.mDynamoHatches.size()); return false; } if (this.mMaintenanceHatches.size() != 2){ - Utils.LOG_INFO("You require EXACTLY 2 muffler hatches. TWO. You have "+this.mMaintenanceHatches.size()); + Logger.INFO("You require EXACTLY 2 muffler hatches. TWO. You have "+this.mMaintenanceHatches.size()); return false; } this.mWrench = true; @@ -310,7 +310,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase this.mSolderingTool = true; this.mCrowbar = true; this.turnCasingActive(false); - Utils.LOG_INFO("Multiblock Formed."); + Logger.INFO("Multiblock Formed."); return true; } @@ -385,15 +385,15 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase final ArrayList tFluids = this.getStoredFluids(); final Collection tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mRecipeList; if((tFluids.size() > 0) && (tRecipeList != null)) { //Does input hatch have a LFTR fuel? - Utils.LOG_WARNING("Found more than one input fluid and a list of valid recipes."); + Logger.WARNING("Found more than one input fluid and a list of valid recipes."); for (final FluidStack hatchFluid1 : tFluids) { //Loops through hatches - Utils.LOG_WARNING("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); + Logger.WARNING("Looping through Input hatches - Found "+hatchFluid1.getLocalizedName()); for(final GT_Recipe aFuel : tRecipeList) { //Loops through LFTR fuel recipes - Utils.LOG_WARNING("Looping through Recipes. "+aFuel.mSpecialValue); + Logger.WARNING("Looping through Recipes. "+aFuel.mSpecialValue); FluidStack tLiquid; final FluidStack testStack = aFuel.mFluidInputs[1]; if ((tLiquid = testStack) != null) { //Create fluidstack from current recipe - Utils.LOG_WARNING("Creating a fluidstack from the current recipe. "+testStack.getLocalizedName()); + Logger.WARNING("Creating a fluidstack from the current recipe. "+testStack.getLocalizedName()); if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a LFTR fluid this.fuelConsumption = this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048); //Calc fuel consumption @@ -409,37 +409,37 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if(tFluids.contains(NUCLIDE.LiFBeF2ThF4UF4.getFluid(2))){ FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); if(this.depleteInput(depletionStack)) { //Deplete that amount - Utils.LOG_WARNING("Depleted some FLiBe fluid"); + Logger.WARNING("Depleted some FLiBe fluid"); } this.depleteInput(NUCLIDE.LiFBeF2ThF4UF4.getFluid(this.boostEu ? 2 : 1)); - Utils.LOG_WARNING("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); + Logger.WARNING("Depleted "+(this.boostEu ? 2 : 1)+"L of LiFBeF2ThF4UF4 fluid"); } //1/2 as Efficient if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(4))){ FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); if(this.depleteInput(depletionStack)) { //Deplete that amount - Utils.LOG_WARNING("Depleted some FLiBe fluid"); + Logger.WARNING("Depleted some FLiBe fluid"); } this.depleteInput(NUCLIDE.LiFBeF2ZrF4UF4.getFluid(this.boostEu ? 4 : 2)); - Utils.LOG_WARNING("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); + Logger.WARNING("Depleted "+(this.boostEu ? 4 : 2)+"L of LiFBeF2ZrF4UF4 fluid"); } //10x less Efficient. if (tFluids.contains(NUCLIDE.LiFBeF2ZrF4U235.getFluid(20))) { FluidStack depletionStack = FluidUtils.getFluidStack(tLiquid, (this.boostEu ? (aFuel.mSpecialValue/4096) : (aFuel.mSpecialValue/2048))); - Utils.LOG_WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); + Logger.WARNING("Input hatch contains some FLiBe Fuel, using "+this.fuelConsumption+" | "+aFuel.mSpecialValue+" | "+depletionStack.amount); if(this.depleteInput(depletionStack)) { //Deplete that amount - Utils.LOG_WARNING("Depleted some FLiBe fluid"); + Logger.WARNING("Depleted some FLiBe fluid"); } this.depleteInput(NUCLIDE.LiFBeF2ZrF4U235.getFluid(this.boostEu ? 20 : 10)); - Utils.LOG_WARNING("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); + Logger.WARNING("Depleted "+(this.boostEu ? 20 : 10)+"L of LiFBeF2ZrF4U235 fluid"); } } } else { @@ -452,7 +452,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.depleteInput(Materials.Helium.getGas(1000L))){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; - Utils.LOG_WARNING("Doing a Sparge with Helium - "+this.heliumSparging); + Logger.WARNING("Doing a Sparge with Helium - "+this.heliumSparging); this.heliumSparging = false; spargeOutput = this.getByproductsOfSparge(Materials.Helium.getGas(1000L)); @@ -460,7 +460,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase try { if (spargeOutput.length >= 1){ for (final FluidStack F : spargeOutput){ - Utils.LOG_WARNING("Adding Sparge Output - "+F.getLocalizedName()); + Logger.WARNING("Adding Sparge Output - "+F.getLocalizedName()); this.addOutput(F); } } @@ -472,13 +472,13 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase if (this.depleteInput(Materials.Fluorine.getGas(100L))){ //Make an empty fluid stack for possible sparging output FluidStack[] spargeOutput = new FluidStack[]{}; - Utils.LOG_WARNING("Doing a Sparge with Fluorine"); + Logger.WARNING("Doing a Sparge with Fluorine"); spargeOutput = this.getByproductsOfSparge(Materials.Fluorine.getGas(100L)); this.heliumSparging = true; //If Sparging occurred, try add the outputs to the output hatches. if (spargeOutput.length > 0){ for (final FluidStack F : spargeOutput){ - Utils.LOG_WARNING("Adding Sparge Output - "+F.getLocalizedName()); + Logger.WARNING("Adding Sparge Output - "+F.getLocalizedName()); this.addOutput(F); } } @@ -504,10 +504,10 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase else if (this.mEfficiency > 500){ this.mEfficiency = 500; } - Utils.LOG_WARNING("Efficiency == "+this.mEfficiency); + Logger.WARNING("Efficiency == "+this.mEfficiency); this.mEUt = (this.mEfficiency < 500 ? 2048 : (8196)); //Output 0 if startup is less than 20% - Utils.LOG_WARNING("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); + Logger.WARNING("Generating "+this.mEUt+"EU/t @ an efficiency level of "+this.mEfficiency); this.mProgresstime = 1; this.mMaxProgresstime = 1; @@ -586,7 +586,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase MathUtils.roundToClosestInt(MathUtils.randInt(10, 100)/10) }; final int heliumContent = (1000-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]-outputChances[4]); - Utils.LOG_WARNING("Helium remaining: "+heliumContent); + Logger.WARNING("Helium remaining: "+heliumContent); outputArrayOfGases = new FluidStack[]{ ELEMENT.getInstance().XENON.getFluid(outputChances[0]), ELEMENT.getInstance().NEON.getFluid(outputChances[1]), @@ -604,7 +604,7 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase MathUtils.roundToClosestInt(MathUtils.randDouble(1, 50)/10) }; final int fluorineContent = (100-outputChances[0]-outputChances[1]-outputChances[2]-outputChances[3]); - Utils.LOG_WARNING("Fluorine remaining: "+fluorineContent); + Logger.WARNING("Fluorine remaining: "+fluorineContent); outputArrayOfGases = new FluidStack[]{ FLUORIDES.LITHIUM_FLUORIDE.getFluid(outputChances[0]), FLUORIDES.NEPTUNIUM_HEXAFLUORIDE.getFluid(outputChances[1]), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java index d55912badc..da83b3c3d1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityAnimalFarm.java @@ -13,8 +13,8 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachi import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.trees.TreefarmManager; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -111,7 +111,7 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo @Override public boolean checkRecipe(final ItemStack aStack) { - Utils.LOG_INFO("Working"); + Logger.INFO("Working"); /*if (!checkRecursiveBlocks()) { this.mEfficiency = 0; this.mEfficiencyIncrease = 0; @@ -145,28 +145,28 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { //this.mCasings.clear(); - Utils.LOG_INFO("Step 1"); + Logger.INFO("Step 1"); final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { - Utils.LOG_INFO("Step 2"); + Logger.INFO("Step 2"); for (int j = -7; j <= 7; j++) { - Utils.LOG_INFO("Step 3"); + Logger.INFO("Step 3"); for (int h = 0; h <= 1; h++) { - Utils.LOG_INFO("Step 4"); + Logger.INFO("Step 4"); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { - Utils.LOG_INFO("Step 5 - H:"+h); + Logger.INFO("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { //Dirt Floor if (!TreefarmManager.isDirtBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_INFO("Dirt like block missing from inner 14x14."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Dirt like block missing from inner 14x14."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); aBaseMetaTileEntity.getWorld().setBlock( (aBaseMetaTileEntity.getXCoord()+(xDir+i)), (aBaseMetaTileEntity.getYCoord()+(h)), @@ -189,12 +189,12 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo } //Dealt with inner 5x5, now deal with the exterior. else { - Utils.LOG_INFO("Step 6 - H:"+h); + Logger.INFO("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_INFO("Fence/Gate missing from outside the second layer."); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Fence/Gate missing from outside the second layer."); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } } @@ -209,31 +209,31 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (!(aBaseMetaTileEntity.getMetaTileID() != 752)) { - Utils.LOG_INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); - Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.INFO("Fark Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); + Logger.INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } - Utils.LOG_INFO("Found a farm keeper."); + Logger.INFO("Found a farm keeper."); } } } - Utils.LOG_INFO("Step a"); + Logger.INFO("Step a"); } - Utils.LOG_INFO("Step b"); + Logger.INFO("Step b"); } - Utils.LOG_INFO("Step c"); + Logger.INFO("Step c"); } - Utils.LOG_INFO("Step d"); + Logger.INFO("Step d"); } - Utils.LOG_INFO("Step 7"); + Logger.INFO("Step 7"); //Must have at least one energy hatch. if (this.mEnergyHatches != null) { for (int i = 0; i < this.mEnergyHatches.size(); i++) { if (this.mEnergyHatches.get(i).mTier < 2){ - Utils.LOG_INFO("You require at LEAST MV tier Energy Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO("You require at LEAST MV tier Energy Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); return false; } } @@ -243,9 +243,9 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo for (int i = 0; i < this.mOutputHatches.size(); i++) { if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Utils.LOG_INFO("You require at LEAST MV tier Output Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.INFO("You require at LEAST MV tier Output Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } @@ -254,16 +254,16 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo if (this.mInputHatches != null) { for (int i = 0; i < this.mInputHatches.size(); i++) { if (this.mInputHatches.get(i).mTier < 2){ - Utils.LOG_INFO("You require at LEAST MV tier Input Hatches."); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.INFO("You require at LEAST MV tier Input Hatches."); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } } this.mSolderingTool = true; //turnCasingActive(true); - Utils.LOG_INFO("Multiblock Formed."); + Logger.INFO("Multiblock Formed."); return true; } @@ -326,7 +326,7 @@ public class GregtechMetaTileEntityAnimalFarm extends GT_MetaTileEntity_MultiBlo //System.out.println("After: "+cv.mTextures.hashCode()); return cv; } catch (final NoSuchFieldException e) { - Utils.LOG_INFO("Could not find mTextures."); + Logger.INFO("Could not find mTextures."); return casing; } } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java index a6b3944a06..12329c875f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityGeneratorArray.java @@ -1,5 +1,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; +import java.util.*; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -9,18 +11,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBlockBase { @@ -34,10 +31,12 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityGeneratorArray(this.mName); } + @Override public String[] getDescription() { return new String[]{ "Controller Block for the Generator Array", @@ -51,6 +50,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc "Place up to 16 Single Block GT Generators into the Controller Inventory"}; } + @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[48], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; @@ -58,10 +58,12 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[48]}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png"); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { if (mInventory[1] == null) return null; String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicgenerator\\.", ""); @@ -93,6 +95,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc return null; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { if (aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.")) { return true; @@ -100,11 +103,13 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc return false; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } public String mMachine = ""; + @Override public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(mInventory[1])) { return false; @@ -138,17 +143,17 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null; mMachine = mInventory[1].getUnlocalizedName(); - Utils.LOG_WARNING("mMachine: "+mMachine); + Logger.WARNING("mMachine: "+mMachine); ArrayList tFluids = getStoredFluids(); Collection tRecipeList = this.getRecipeMap().mRecipeList; - Utils.LOG_WARNING("tRecipeList: "+tRecipeList); + Logger.WARNING("tRecipeList: "+tRecipeList); if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel? - Utils.LOG_WARNING("1"); + Logger.WARNING("1"); for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches - Utils.LOG_WARNING("2"); + Logger.WARNING("2"); for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes - Utils.LOG_WARNING("3"); + Logger.WARNING("3"); /*if (aFuel != null){ for (FluidStack x : aFuel.mFluidInputs){ if (x != null){ @@ -158,12 +163,12 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc }*/ FluidStack tLiquid; tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], aFuel.mFluidInputs[0].amount); - Utils.LOG_WARNING("5"); + Logger.WARNING("5"); fuelConsumption = aFuel.mFluidInputs[0].amount; if(depleteInput(tLiquid)) { //Deplete that amount - Utils.LOG_WARNING("6"); + Logger.WARNING("6"); boostEu = true; - Utils.LOG_WARNING("7"); + Logger.WARNING("7"); fuelValue = aFuel.mEUt*aFuel.mDuration; fuelRemaining = hatchFluid1.amount; //Record available fuel @@ -171,7 +176,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc //this.mProgresstime = 1; this.mMaxProgresstime = 20; this.mEfficiencyIncrease = 9500; - Utils.LOG_WARNING("9"); + Logger.WARNING("9"); return true; } } @@ -190,6 +195,7 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc return list.toArray(new ItemStack[list.size()]); } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -218,22 +224,27 @@ public class GregtechMetaTileEntityGeneratorArray extends GregtechMeta_MultiBloc return tAmount >= 16; } + @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; } + @Override public int getAmountOfOutputs() { return 1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java index 6d951b7221..e349ae1f53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java @@ -18,14 +18,12 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.*; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.*; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.players.FakeFarmer; import gtPlusPlus.core.slots.SlotBuzzSaw.SAWTOOL; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.particles.BlockBreakParticles; @@ -36,9 +34,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.*; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -101,7 +97,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase @Override public void saveNBTData(final NBTTagCompound aNBT) { - Utils.LOG_INFO("Called NBT data save"); + Logger.WARNING("Called NBT data save"); aNBT.setLong("mInternalPower", this.mInternalPower); //Save [Buzz]Saw @@ -112,7 +108,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase final NBTTagCompound data = new NBTTagCompound(); stack.writeToNBT(data); data.setInteger("Slot", i); - Utils.LOG_INFO("Saving "+stack.getDisplayName()+" in slot "+i); + Logger.WARNING("Saving "+stack.getDisplayName()+" in slot "+i); list.appendTag(data); } } @@ -132,7 +128,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase final int slot = data.getInteger("Slot"); if((slot >= 0) && (slot < 2)){ this.mInventory[slot] = ItemStack.loadItemStackFromNBT(data); - Utils.LOG_INFO("Loading "+this.mInventory[slot].getDisplayName()+" in slot "+i); + Logger.WARNING("Loading "+this.mInventory[slot].getDisplayName()+" in slot "+i); } } @@ -143,7 +139,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase public boolean drainEnergyInput(final long aEU) { if (this.mInternalPower >= 32){ this.mInternalPower = (this.mInternalPower-32); - Utils.LOG_MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); + Logger.MACHINE_INFO("Draining internal power storage by 32EU. Stored:"+this.mInternalPower); return true;} return false; } @@ -163,7 +159,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } } else { - Utils.LOG_MACHINE_INFO("Bad Power hatch to obtain energy from."); + Logger.MACHINE_INFO("Bad Power hatch to obtain energy from."); } } } @@ -238,7 +234,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide() || aBaseMetaTileEntity.getWorld().isRemote) { - Utils.LOG_INFO("Doing nothing Client Side."); + Logger.WARNING("Doing nothing Client Side."); return false; } aBaseMetaTileEntity.openGUI(aPlayer); @@ -257,7 +253,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase @Override public boolean checkRecipe(final ItemStack aStack) { - Utils.LOG_MACHINE_INFO("Working"); + Logger.MACHINE_INFO("Working"); this.mEfficiency = 0; this.mEfficiencyIncrease = 0; this.mMaxProgresstime = 0; @@ -266,38 +262,38 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - Utils.LOG_WARNING("Step 1"); + Logger.WARNING("Step 1"); final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; for (int i = -7; i <= 7; i++) { - Utils.LOG_WARNING("Step 2"); + Logger.WARNING("Step 2"); for (int j = -7; j <= 7; j++) { - Utils.LOG_WARNING("Step 3"); + Logger.WARNING("Step 3"); for (int h = 0; h <= 1; h++) { - Utils.LOG_WARNING("Step 4"); + Logger.WARNING("Step 4"); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); //Farm Floor inner 14x14 if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) { - Utils.LOG_WARNING("Step 5 - H:"+h); + Logger.WARNING("Step 5 - H:"+h); // Farm Dirt Floor and Inner Air/Log space. if (h == 0) { //Dirt Floor if (!TreefarmManager.isDirtBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_MACHINE_INFO("Dirt like block missing from inner 14x14."); - Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.MACHINE_INFO("Dirt like block missing from inner 14x14."); + Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } } } //Dealt with inner 5x5, now deal with the exterior. else { - Utils.LOG_WARNING("Step 6 - H:"+h); + Logger.WARNING("Step 6 - H:"+h); //Deal with all 4 sides (Fenced area) if (h == 1) { if (!TreefarmManager.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) { - Utils.LOG_MACHINE_INFO("Fence/Gate missing from outside the second layer."); - Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + Logger.MACHINE_INFO("Fence/Gate missing from outside the second layer."); + Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; } } @@ -308,11 +304,11 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller if (tTileEntity.getMetaTileID() != 752) { - Utils.LOG_MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); - Utils.LOG_MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()+" "+tTileEntity.getMetaTileID()); + Logger.MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass()); + Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()+" "+tTileEntity.getMetaTileID()); return false; } - Utils.LOG_WARNING("Found a farm keeper."); + Logger.WARNING("Found a farm keeper."); } } } @@ -325,8 +321,8 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase if (this.mEnergyHatches != null) { for (int i = 0; i < this.mEnergyHatches.size(); i++) { if (this.mEnergyHatches.get(i).mTier < 2){ - Utils.LOG_MACHINE_INFO("You require at LEAST MV tier Energy Hatches."); - Utils.LOG_MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.MACHINE_INFO("You require at LEAST MV tier Energy Hatches."); + Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); return false; } } @@ -336,9 +332,9 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase for (int i = 0; i < this.mOutputHatches.size(); i++) { if ((this.mOutputHatches.get(i).mTier < 2) && (this.mOutputHatches.get(i).getBaseMetaTileEntity() instanceof GregtechMTE_NuclearReactor)){ - Utils.LOG_MACHINE_INFO("You require at LEAST MV tier Output Hatches."); - Utils.LOG_MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.MACHINE_INFO("You require at LEAST MV tier Output Hatches."); + Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); + Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); return false; } } @@ -347,15 +343,15 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase if (this.mInputHatches != null) { for (int i = 0; i < this.mInputHatches.size(); i++) { if (this.mInputHatches.get(i).mTier < 2){ - Utils.LOG_MACHINE_INFO("You require at LEAST MV tier Input Hatches."); - Utils.LOG_MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord()); - Utils.LOG_MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName()); + Logger.MACHINE_INFO("You require at LEAST MV tier Input Hatches."); + Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).ge