diff options
| author | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 01:25:58 +0100 |
|---|---|---|
| committer | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 01:25:58 +0100 |
| commit | 75ea33600537047847091b55a46f5b88c3c75dbb (patch) | |
| tree | 3050dc52746859cb9003e09f75dc91a7d7eb5911 /src/Java | |
| parent | b5cbe510e959ae0fe8803b5df1031f2752c50e30 (diff) | |
| download | GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.tar.gz GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.tar.bz2 GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.zip | |
+ Added Custom NEI Handler for IsaMIll.
+ Added Death by IsaMIll.
% Moved debug mode switch to AsmConfig.
$ Fixed handling of custom OrePrefixes.
$ Fixed OreDict registration of MetaFoodItems.
$ Improved handling of Core Classes being static initialised too early.
$ Fixed client-side bug in Distillus which would cause an infinite loop.
$ Fixed bug in ForgeEnumHelper.
$ Fixed bug in setField methods from ReflectionUtils.
Diffstat (limited to 'src/Java')
40 files changed, 969 insertions, 157 deletions
diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index d31e1e3a82..3ddb25e754 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -249,7 +249,7 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ public static final GT_Recipe_Map sGeoThermalFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); public static final GT_Recipe_Map sChemicalDehydratorRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.chemicaldehydrator", "Chemical Dehydrator", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); + public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(500), "gt.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 2, 2, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); public static final GT_Recipe_Map sAlloyBlastSmelterRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gt.recipe.alloyblastsmelter", "Alloy Blast Smelter", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 9, 9, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sSteamTurbineFuels = new GT_Recipe_Map(new HashSet<GT_Recipe>(10), "gt.recipe.geothermalfuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); @@ -258,7 +258,7 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipesEx = new GT_Recipe_Map(new NoConflictGTRecipeMap(), "gt.recipe.lftr.2", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); // Ore Milling Map - public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map_Macerator(new HashSet<GT_Recipe>(10000), "gt.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 1, 4, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(10000), "gt.recipe.oremill", "Milling", null, RES_PATH_GUI + "basicmachines/LFTR", 3, 4, 1, 0, 1, E, 1, E, true, true); //Fission Fuel Plant Recipes //public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map(new HashSet<GT_Recipe>(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 9, 1, E, 1, E, true, true); diff --git a/src/Java/gtPlusPlus/api/enums/ParticleNames.java b/src/Java/gtPlusPlus/api/enums/ParticleNames.java new file mode 100644 index 0000000000..d082cd6779 --- /dev/null +++ b/src/Java/gtPlusPlus/api/enums/ParticleNames.java @@ -0,0 +1,37 @@ +package gtPlusPlus.api.enums; + +public enum ParticleNames { + + explode, + largeexplode, + hugeexplosion, + bubble, + splash, + suspended, + depthsuspend, + crit, + magicCrit, + smoke, + largesmoke, + spell, + instantSpell, + mobSpell, + dripWater, + dripLava, + townaura, + note, + portal, + enchantmenttable, + flame, + lava, + footstep, + cloud, + reddust, + snowballpoof, + snowshovel, + slime, + heart, + iconcrack_, + tilecrack_; + +} diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index 9c1e3d4338..6b7ca18590 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.LogManager; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.proxy.ClientProxy; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; public class Logger { @@ -39,19 +39,7 @@ public class Logger { // Non-Dev Comments public static void MACHINE_INFO(final String s) { if (enabled) { - - boolean localPlayer = false; - try { - if (ClientProxy.playerName != null){ - if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - localPlayer = true; - } - } - } - catch (final Throwable t){ - - } - + boolean localPlayer = CORE_Preloader.DEV_ENVIRONMENT; if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); modLogger.info("Machine Info: " + s + " | " + name1); @@ -62,7 +50,7 @@ public class Logger { // Developer Comments public static void WARNING(final String s) { if (enabled) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { modLogger.warn(s); } } @@ -71,7 +59,7 @@ public class Logger { // Errors public static void ERROR(final String s) { if (enabled) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { modLogger.fatal(s); } } @@ -80,7 +68,7 @@ public class Logger { // Developer Logger public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { if (enabled) { - // if (!CORE.DEBUG){ + // if (!CORE_Preloader.DEBUG_MODE){ FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); // } } @@ -111,7 +99,7 @@ public class Logger { */ public static void BEES(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Bees] "+s); } } @@ -121,7 +109,7 @@ public class Logger { */ public static void DEBUG_BEES(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Debug][Bees] "+s); } } @@ -134,7 +122,7 @@ public class Logger { */ public static void MATERIALS(final String s) { if (enabled) { - if (/* CORE.DEVENV || */CORE.DEBUG) { + if (/* CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) { modLogger.info("[Materials] "+s); } } @@ -144,7 +132,7 @@ public class Logger { */ public static void DEBUG_MATERIALS(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Debug][Materials] "+s); } } @@ -155,7 +143,7 @@ public class Logger { */ public static void REFLECTION(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[Reflection] "+s); } } @@ -167,7 +155,7 @@ public class Logger { */ public static void WORLD(final String s) { if (enabled) { - if (CORE.DEVENV || CORE.DEBUG) { + if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { modLogger.info("[WorldGen] "+s); } } @@ -175,7 +163,7 @@ public class Logger { public static void RECIPE(String string) { if (enabled) { - if (/*CORE.DEVENV || */CORE.DEBUG) { + if (/*CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) { modLogger.info("[Recipe] "+string); } } diff --git a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java index 77562f5691..9a16ad1785 100644 --- a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java +++ b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java @@ -26,6 +26,7 @@ import gtPlusPlus.australia.gen.map.structure.StructureManager; import gtPlusPlus.australia.world.AustraliaWorldGenerator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.CORE.Australia; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.Configuration; @@ -126,7 +127,7 @@ public class GTplusplus_Australia implements ActionListener { WorldGen_GT_Australia_Base.oreveinPercentage = 16; WorldGen_GT_Australia_Base.oreveinAttempts = 16; WorldGen_GT_Australia_Base.oreveinMaxPlacementAttempts = 2; - if (CORE.DEBUG || CORE.DEVENV){ + if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){ WorldGen_GT_Australia_Base.debugWorldGen = true; } AustraliaContentLoader.run(); diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 5e0a5594d5..903730f767 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -6,12 +6,12 @@ import java.util.Map; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; @@ -81,8 +81,8 @@ public class CommandEnableDebugWhileRunning implements ICommand Logger.INFO("Toggling Debug Mode."); final EntityPlayer P = CommandUtils.getPlayer(S); if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + CORE_Preloader.DEBUG_MODE = Utils.invertBoolean(CORE_Preloader.DEBUG_MODE); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE_Preloader.DEBUG_MODE); } } else if (argString[0].toLowerCase().equals("logging")) { diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 0398b1619f..0aeff5ae16 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.common; -import static gtPlusPlus.core.lib.CORE.DEBUG; - import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -49,8 +47,10 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; import net.minecraft.enchantment.Enchantment; @@ -80,15 +80,19 @@ public class CommonProxy { LoadedMods.checkLoaded(); Logger.INFO("Making sure we're ready to party!"); - if (!DEBUG) { + if (!CORE_Preloader.DEBUG_MODE) { Logger.WARNING("Development mode not enabled."); - } else if (DEBUG) { + } else if (CORE_Preloader.DEBUG_MODE) { Logger.INFO("Development mode enabled."); } else { Logger.WARNING("Development mode not set."); } AddToCreativeTab.initialiseTabs(); + + if (LoadedMods.Gregtech) { + HANDLER_GT.addNewOrePrefixes(); + } // Moved from Init after Debug Loading. // 29/01/18 - Alkalus @@ -119,7 +123,7 @@ public class CommonProxy { public void init(final FMLInitializationEvent e) { // Debug Loading - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { DEBUG_INIT.registerHandlers(); } diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index 61e7045192..0760dfc2cc 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -22,8 +22,8 @@ public class ConfigHandler { "Stops mod checking for updates."); // Debug - DEBUG = config.getBoolean("debugMode", "debug", false, - "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"); + /* DEBUG = config.getBoolean("debugMode", "debug", false, + "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)");*/ disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, "Disables EnderIO Integration."); disableEnderIOIngotTooltips = config.getBoolean("disableEnderIOIngotTooltips", "debug", false, diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 6f3e62659f..fd2b98c7be 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -96,6 +96,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.GTplusplus_Everglades; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.cofh.HANDLER_COFH; import gtPlusPlus.xmod.eio.material.MaterialEIO; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; @@ -388,7 +389,7 @@ public final class ModItems { itemDummyResearch = new ItemDummyResearch(); //Debug Loading - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ DEBUG_INIT.registerItems(); } diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java index 24c87c3334..356fdac24e 100644 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java @@ -18,6 +18,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -92,7 +93,7 @@ public class BaseOreComponent extends Item{ aKey = OrePrefixes.dustPure.name(); } else if (componentType == ComponentTypes.MILLED) { - aKey = "milled"; + aKey = CustomOrePrefix.milled.get().name(); } ItemStack x = aMap.get(aKey); diff --git a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java index d6922fbf92..94d5a8e80f 100644 --- a/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java +++ b/src/Java/gtPlusPlus/core/item/food/BaseItemMetaFood.java @@ -102,16 +102,17 @@ public class BaseItemMetaFood extends ItemFood { mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour); } mOreDictNames.put(aMetaID, aOreDictNames); - registerFoodToOreDict(aMetaID); } - private static void registerFoodToOreDict(int aMetaID) { - ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID); - if (aOreDictNames != null && !aOreDictNames.isEmpty()) { - ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1); - for (String aOreName : aOreDictNames) { - ItemUtils.addItemToOreDictionary(aFoodStack, aOreName); - } + public static void registerFoodsToOreDict() { + for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) { + ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID); + if (aOreDictNames != null && !aOreDictNames.isEmpty()) { + ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1); + for (String aOreName : aOreDictNames) { + ItemUtils.addItemToOreDictionary(aFoodStack, aOreName); + } + } } } diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java index 7f1ba720cc..e5c403c503 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java @@ -48,6 +48,7 @@ public class ItemsFoods { GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1)); ModItems.itemMetaFood = new BaseItemMetaFood(); + BaseItemMetaFood.registerFoodsToOreDict(); addCookingRecipes(); addFoodDropsToMobs(); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 06d8331606..9e29a381e2 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -46,7 +46,6 @@ public class CORE { public static Configuration Config; public static boolean DEVENV = false; - public static boolean DEBUG = false; public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false; //Only can be set in Dev, no config or setting elsewhere. public static final boolean LOAD_ALL_CONTENT = false;; diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 9cdf16fe01..7d49a8d635 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -892,7 +892,7 @@ public class Material { return getComponentByPrefix(OrePrefixes.dustImpure, stacksize); } public final ItemStack getMilled(final int stacksize){ - return getComponentByPrefix(CustomOrePrefix.get(CustomOrePrefix.Milled), stacksize); + return getComponentByPrefix(CustomOrePrefix.milled.get(), stacksize); } public final boolean hasSolidForm() { diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index b1cd1697f5..f8fc15c778 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.CORE_Preloader; public class DEBUG_INIT { public static void registerBlocks(){ //Debug Loading - if (CORE.DEBUG){ + if (CORE_Preloader.DEBUG_MODE){ } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java index bba2e55bc2..66f9e2453d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -74,6 +74,13 @@ public class EntityUtils { final int blockZ = MathHelper.floor_double(parEntity.posZ); return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); } + + public static BlockPos findBlockPosOfEntity(final Entity parEntity){ + final int blockX = MathHelper.floor_double(parEntity.posX); + final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY); + final int blockZ = MathHelper.floor_double(parEntity.posZ); + return new BlockPos(blockX, blockY, blockZ, parEntity.worldObj); + } //TODO public static void registerEntityToBiomeSpawns(final Class<EntityLiving> classy, final EnumCreatureType EntityType, final BiomeGenBase baseBiomeGen){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index b2f048565f..725799a43d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -37,6 +37,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; @@ -354,7 +355,7 @@ public class ItemUtils { } public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) { - if (CORE.DEBUG) { + if (CORE_Preloader.DEBUG_MODE) { Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(1)); Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(2)); Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(3)); @@ -1275,6 +1276,16 @@ public class ItemUtils { } return false; } + + public static boolean isMillingBall(ItemStack aStack) { + if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) { + return true; + } + if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) { + return true; + } + return false; + } public static String getLocalizedNameOfBlock(Block aBlock, int aMeta) { return LangUtils.getLocalizedNameOfBlock(aBlock, aMeta); diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index 9a8a8e691c..e64414b493 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -188,4 +188,12 @@ public class PlayerUtils { Utils.sendServerMessage(string); } + public static boolean isCreative(EntityPlayer aPlayer) { + return aPlayer.capabilities.isCreativeMode; + } + + public static boolean canTakeDamage(EntityPlayer aPlayer) { + return !aPlayer.capabilities.disableDamage; + } + } diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 4d8a02d800..e45d27b926 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -365,7 +365,13 @@ public class ReflectionUtils { public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { - Class<?> clazz = object.getClass(); + Class<?> clazz; + if (object instanceof Class) { + clazz = (Class<?>) object; + } + else { + clazz = object.getClass(); + } while (clazz != null) { try { final Field field = getField(clazz, fieldName); @@ -387,7 +393,13 @@ public class Re |
