From 0f288afe8b7ccb8dd164200330677b131408c1b4 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sun, 25 Oct 2015 22:52:57 +0100 Subject: [PATCH] Added config for block harvest levels. --- src/main/java/gregtech/GT_Mod.java | 12 ++++++++++-- src/main/java/gregtech/common/GT_Proxy.java | 4 ++++ .../gregtech/common/blocks/GT_TileEntity_Ores.java | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index cf85dd6f..4325ce24 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -55,8 +55,6 @@ import java.io.PrintStream; import java.util.*; import java.util.Map.Entry; -//import gregtech.loaders.misc.GT_BeeDefinition; -//import gregtech.loaders.misc.GT_Bees; @Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false, dependencies = "required-after:IC2; after:Forestry; after:PFAAGeologica; after:Thaumcraft; after:Railcraft; after:appliedenergistics2; after:ThermalExpansion; after:TwilightForest; after:harvestcraft; after:magicalcrops; after:BuildCraft|Transport; after:BuildCraft|Silicon; after:BuildCraft|Factory; after:BuildCraft|Energy; after:BuildCraft|Core; after:BuildCraft|Builders; after:GalacticraftCore; after:GalacticraftMars; after:GalacticraftPlanets; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; after:RedPowerCore; after:RedPowerBase; after:RedPowerMachine; after:RedPowerCompat; after:RedPowerWiring; after:RedPowerLogic; after:RedPowerLighting; after:RedPowerWorld; after:RedPowerControl;") public class GT_Mod @@ -237,6 +235,16 @@ public class GT_Mod GregTech_API.mRFExplosions = GregTech_API.sOPStuff.get(ConfigCategories.general, "RFExplosions", false); GregTech_API.meIOLoaded = Loader.isModLoaded("EnderIO"); + gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("havestLevel", "activateHarvestLevelChange", false); + if(gregtechproxy.mChangeHarvestLevels){ + gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); + gregtechproxy.mMaxHarvestLevel=(int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel",7)); + for(Materials tMaterial : Materials.values()){ + if(tMaterial!=null&&tMaterial.mToolQuality>0&&tMaterial.mMetaItemSubID=0){ + gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality); + } + }} + if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) { Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F); } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index c9770a55..298c72a9 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -152,6 +152,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { private World mUniverse = null; private boolean isFirstServerWorldTick = true; private boolean mOreDictActivated = false; + public int[] mHarvestLevel= new int[1000]; + public int mGraniteHavestLevel=3; + public int mMaxHarvestLevel=7; + public boolean mChangeHarvestLevels=false; public GT_Proxy() { GameRegistry.registerFuelHandler(this); diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 6d70067e..787c1bc9 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -1,5 +1,6 @@ package gregtech.common.blocks; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -32,7 +33,11 @@ public class GT_TileEntity_Ores public static byte getHarvestData(short aMetaData) { Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)]; - return aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? 3 : 0, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1))); + byte tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? 3 : 0, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1))); + if(GT_Mod.gregtechproxy.mChangeHarvestLevels ){ + tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? GT_Mod.gregtechproxy.mGraniteHavestLevel : 0, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1))); + } + return tByte; } public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData) {