diff options
9 files changed, 87 insertions, 56 deletions
diff --git a/build.gradle b/build.gradle index ae81b8c95d..026d31c14c 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ sourceCompatibility = 1.7 targetCompatibility = 1.7 archivesBaseName = "GT-PlusPlus" -version = "1.6.101-prerelease" +version = "1.6.102-prerelease" minecraft.version = "1.7.10-10.13.4.1448-1.7.10" diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 5306b2610c..6d28dd3662 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -41,7 +41,7 @@ import net.minecraft.launchwrapper.Launch; import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") -@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; beyondrealitycore;") +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore;") public class GTplusplus implements ActionListener { //Mod Instance diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 78b7cf4326..11ed154d5a 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -55,7 +55,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.6.101-prerelease"; + public static final String VERSION = "1.6.102-prerelease"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); diff --git a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java index 3578eaedf1..af7c7c9c59 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -31,25 +31,36 @@ public class SlotBuzzSaw extends Slot { if (OrePrefixes.craftingTool.contains(itemstack)) { if (itemstack.getDisplayName().toLowerCase().contains("saw") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.110") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { if (itemstack.getItemDamage() == 10) { isValid = true; this.currentTool = SAWTOOL.SAW; } - if (itemstack.getItemDamage() == 140) { + else if (itemstack.getItemDamage() == 110) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 112) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 114) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 140) { isValid = true; this.currentTool = SAWTOOL.BUZZSAW; } + return isValid; } - } else { - this.currentTool = SAWTOOL.NONE; - } - } else { - this.currentTool = SAWTOOL.NONE; - } - } else { - this.currentTool = SAWTOOL.NONE; - } + } + } + } + this.currentTool = SAWTOOL.NONE; return isValid; } @@ -59,7 +70,7 @@ public class SlotBuzzSaw extends Slot { } public enum SAWTOOL { - NONE, SAW, BUZZSAW + NONE, SAW, BUZZSAW, CHAINSAW } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index fdcdab63fe..484a156e0f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -5,8 +5,10 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; +import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; 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; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; @@ -19,6 +21,7 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.items.tools.GT_MetaGenTool; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import net.minecraft.entity.player.InventoryPlayer; @@ -213,6 +216,15 @@ GT_MetaTileEntity_MultiBlockBase { } super.updateSlots(); } + + public boolean isToolCreative(ItemStack mStack){ + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(mStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(mStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + return true; + } + return false; + } @Override public boolean addToMachineList(final IGregTechTileEntity aTileEntity, 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 diff --git a/src/resources/mcmod.info b/src/resources/mcmod.info index 0c16205538..3864d3b1af 100644 --- a/src/resources/mcmod.info +++ b/src/resources/mcmod.info @@ -5,7 +5,7 @@ "description": "Adds a few various Multiblocks, Machines, etc to Gregtech and a plethora of other mods (Nearly 30!)", "credits": "", "logoFile": "", - "version": "1.6.101-prerelease", + "version": "1.6.102-prerelease", "mcversion": "1.7.10", "url": "https://github.com/draknyte1/GTplusplus/wiki", "updateUrl": "https://github.com/draknyte1/GTplusplus/releases/latest", |