Added config for block harvest levels.

This commit is contained in:
Blood-Asp 2015-10-25 22:52:57 +01:00
parent 621573fe84
commit 0f288afe8b
3 changed files with 20 additions and 3 deletions

View file

@ -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<gregtechproxy.mHarvestLevel.length&&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);
}

View file

@ -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);

View file

@ -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) {