diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-12-15 18:15:08 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 18:15:08 +1000 |
commit | 2214833189caf3eb262f049746be4987b97aa6a7 (patch) | |
tree | f5557be9adb62bb1d10a846355aeeba206d9f7ea /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | 86dac7e948cff5c9b975ff86fef149377285eab8 (diff) | |
download | GT5-Unofficial-2214833189caf3eb262f049746be4987b97aa6a7.tar.gz GT5-Unofficial-2214833189caf3eb262f049746be4987b97aa6a7.tar.bz2 GT5-Unofficial-2214833189caf3eb262f049746be4987b97aa6a7.zip |
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.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
3 files changed, 49 insertions, 41 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index ed11baa5ed..3a0031c5d3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -239,6 +239,15 @@ public class TreeFarmHelper { else if (aStack.getItemDamage() == 140 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")){ return SAWTOOL.BUZZSAW; } + else if (aStack.getItemDamage() == 110 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.110")){ + return SAWTOOL.CHAINSAW; + } + else if (aStack.getItemDamage() == 112 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.112")){ + return SAWTOOL.CHAINSAW; + } + else if (aStack.getItemDamage() == 114 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.114")){ + return SAWTOOL.CHAINSAW; + } else { return SAWTOOL.NONE; } 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<list.tagCount();i++){ @@ -137,7 +135,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock Utils.LOG_INFO("Loading "+this.mInventory[slot].getDisplayName()+" in slot "+i); } } - + super.loadNBTData(aNBT); } @@ -229,12 +227,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); + return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png"); } @Override public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity); + return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity); } @Override @@ -251,16 +249,9 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock public boolean isCorrectMachinePart(final ItemStack aStack) { boolean isValid = false; final SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack); - if (currentInputItem != SAWTOOL.NONE){ - if (currentInputItem == SAWTOOL.SAW){ - } - else { - } + if (currentInputItem != SAWTOOL.NONE){ isValid = true; } - else { - //Utils.LOG_MACHINE_INFO("Found "+aStack.getDisplayName()); - } return isValid; } @@ -312,17 +303,18 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~? else if (h == 0) { - if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX)))) { - 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()); - return false; + if (tTileEntity != null) + if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX)))) { + 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()); + return false; + } + Utils.LOG_WARNING("Found a farm keeper."); } - Utils.LOG_WARNING("Found a farm keeper."); } - } } } } @@ -363,8 +355,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock } } this.mSolderingTool = true; - //turnCasingActive(true); - //Utils.LOG_MACHINE_INFO("Multiblock Formed."); + Utils.LOG_MACHINE_INFO("Multiblock Formed."); return true; } @@ -673,12 +664,13 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Utils.LOG_MACHINE_INFO("Cutting Log"); try { //Actually damage item... - if(!GT_ModHandler.damageOrDechargeItem(this.mInventory[1], 1, 10, this.farmerAI)){ + if (!isToolCreative(this.mInventory[1])){ + if(!GT_ModHandler.damageOrDechargeItem(this.mInventory[1], 1, 10, this.farmerAI)){ + if (mInventory[1].stackSize == 0) mInventory[1] = null; + return false; + } if (mInventory[1].stackSize == 0) mInventory[1] = null; - return false; } - if (mInventory[1].stackSize == 0) mInventory[1] = null; - final Block block = world.getBlock(x, y, z); int chanceForLeaves = 1000; //is it leaves or a log? if leaves, heavily reduce chance to obtain rubber/output @@ -964,7 +956,10 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock if (this.plantSaplingTicks == 100){ Utils.LOG_MACHINE_INFO("Looking For space to plant saplings - Serverside | "+this.plantSaplingTicks); //Plant Some Saplings - this.plantSaplings(aBaseMetaTileEntity); + + if (aBaseMetaTileEntity != null){ + this.plantSaplings(aBaseMetaTileEntity); + } } else if (this.plantSaplingTicks == 200){ Utils.LOG_MACHINE_INFO("Looking For Saplings to grow - Serverside | "+this.plantSaplingTicks); @@ -977,7 +972,9 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock //Set can work state this.mInputBusses = new ArrayList<>(); 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 |