From 4f435ae75b176a9d90c7afa6b1ff40e9ba9c286a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 28 Feb 2019 20:06:01 +0000 Subject: + Added a new debug tool. + Added support for Crops++. + Added Custom Crops & framework to support more in future. + Added basic support for all GT++ Materials within Tinkers Construct. [WIP] + Moderately bad attempt at generating custom Plasma Cooling recipes in the Adv. Vacuum Freezer. [WIP #424] % Reworked logic for Material.java handling Durability, Tool Quality & Harvest Level. % Adjusted frequency of structural checks on the Cyclotron, Now 100x less frequent. % Cleaned up ReflectionUtils.java and made all getters cache their results, for much faster access. % Attempted to adjust logic of FFPP, but I probably broke it. [WIP] % Moved static array of Element Names from IonParticles.java -> ELEMENT.java. $ Greatly improved reflective performance across the mod. --- .../villagers/entity/EntityBaseVillager.java | 62 +++++++--------------- .../villagers/entity/EntityNativeAustralian.java | 61 +++++++-------------- .../villagers/tile/TileEntityGenericSpawner.java | 2 +- 3 files changed, 38 insertions(+), 87 deletions(-) (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java index 98e6d7ae1a..4dc5a15b4b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java @@ -169,15 +169,10 @@ public class EntityBaseVillager extends EntityVillager { */ protected float getField_82191_bN() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); try { - v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); - try { - return v82191 != null ? v82191.getFloat(this) : 0f; - } catch (IllegalArgumentException | IllegalAccessException e) { - return 0f; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getFloat(this) : 0f; + } catch (IllegalArgumentException | IllegalAccessException e) { return 0f; } } @@ -190,15 +185,10 @@ public class EntityBaseVillager extends EntityVillager { } protected boolean getNeedsInitilization() { - Field v82191; + Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); try { - v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); - try { - return v82191 != null ? v82191.getBoolean(this) : false; - } catch (IllegalArgumentException | IllegalAccessException e) { - return false; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getBoolean(this) : false; + } catch (IllegalArgumentException | IllegalAccessException e) { return false; } } @@ -213,20 +203,16 @@ public class EntityBaseVillager extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; MerchantRecipeList o; + v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { - v82191 = ReflectionUtils.getField(getClass(), "buyingList"); - try { - o = (MerchantRecipeList) v82191.get(this); - Logger.WARNING("Is BuyingList Valid? "+(v82191 != null)); - return v82191 != null ? o : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - return null; - } - } catch (NoSuchFieldException e1) { - e1.printStackTrace(); + o = (MerchantRecipeList) v82191.get(this); + Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); + return v82191 != null ? o : null; + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); return null; } + } protected void setBuyingList(MerchantRecipeList f) { @@ -238,29 +224,19 @@ public class EntityBaseVillager extends EntityVillager { } protected Village getVillageObject() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "villageObj"); try { - v82191 = ReflectionUtils.getField(getClass(), "villageObj"); - try { - return v82191 != null ? (Village) v82191.get(this) : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (Village) v82191.get(this) : null; + } catch (IllegalArgumentException | IllegalAccessException e) { return null; } } protected String getLastBuyingPlayer() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); try { - v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); - try { - return v82191 != null ? (String) v82191.get(this) : ""; - } catch (IllegalArgumentException | IllegalAccessException e) { - return ""; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (String) v82191.get(this) : ""; + } catch (IllegalArgumentException | IllegalAccessException e) { return ""; } } diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java index 6e7234297e..967647cff6 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java @@ -157,15 +157,10 @@ public class EntityNativeAustralian extends EntityVillager { */ protected float getField_82191_bN() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); try { - v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN"); - try { - return v82191 != null ? v82191.getFloat(this) : 0f; - } catch (IllegalArgumentException | IllegalAccessException e) { - return 0f; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getFloat(this) : 0f; + } catch (IllegalArgumentException | IllegalAccessException e) { return 0f; } } @@ -178,15 +173,10 @@ public class EntityNativeAustralian extends EntityVillager { } protected boolean getNeedsInitilization() { - Field v82191; + Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); try { - v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization"); - try { - return v82191 != null ? v82191.getBoolean(this) : false; - } catch (IllegalArgumentException | IllegalAccessException e) { - return false; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? v82191.getBoolean(this) : false; + } catch (IllegalArgumentException | IllegalAccessException e) { return false; } } @@ -201,18 +191,13 @@ public class EntityNativeAustralian extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; MerchantRecipeList o; + v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { - v82191 = ReflectionUtils.getField(getClass(), "buyingList"); - try { - o = (MerchantRecipeList) v82191.get(this); - Logger.WARNING("Is BuyingList Valid? "+(v82191 != null)); - return v82191 != null ? o : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - return null; - } - } catch (NoSuchFieldException e1) { - e1.printStackTrace(); + o = (MerchantRecipeList) v82191.get(this); + Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); + return v82191 != null ? o : null; + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); return null; } } @@ -226,29 +211,19 @@ public class EntityNativeAustralian extends EntityVillager { } protected Village getVillageObject() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "villageObj"); try { - v82191 = ReflectionUtils.getField(getClass(), "villageObj"); - try { - return v82191 != null ? (Village) v82191.get(this) : null; - } catch (IllegalArgumentException | IllegalAccessException e) { - return null; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (Village) v82191.get(this) : null; + } catch (IllegalArgumentException | IllegalAccessException e) { return null; } } protected String getLastBuyingPlayer() { - Field v82191; + Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); try { - v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer"); - try { - return v82191 != null ? (String) v82191.get(this) : ""; - } catch (IllegalArgumentException | IllegalAccessException e) { - return ""; - } - } catch (NoSuchFieldException e1) { + return v82191 != null ? (String) v82191.get(this) : ""; + } catch (IllegalArgumentException | IllegalAccessException e) { return ""; } } diff --git a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java index 232b6b6e87..45b8c9941b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java +++ b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java @@ -221,7 +221,7 @@ public class TileEntityGenericSpawner extends TileEntityMobSpawner { } } }*/ - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + } catch (IllegalArgumentException | IllegalAccessException e) { } } return false; -- cgit From 0e8070f3eb5149c7223049f93b4df86adb63ea57 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 4 Mar 2019 23:03:46 +0000 Subject: - Removing some logging. $ Fixed Bed Height > 128 not working as intended. $ Fixed IC2 ASM for wrench harvesting. $ Fixed TC4 ASM. $ Fixed Invalid Giant Chicken Texture handling. --- .../gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index e0fef80b52..4a0c8d3d6c 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -7,6 +7,7 @@ import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.fixes.interfaces.IBugFix; import gtPlusPlus.preloader.DevHelper; import net.minecraft.entity.player.EntityPlayer; @@ -17,9 +18,11 @@ public class VanillaBedHeightFix implements IBugFix { private final Method mSleepInBedAt; public VanillaBedHeightFix() { - if (DevHelper.isValidHelperObject()) { - Method m = DevHelper.getForgeMethod(EntityPlayer.class, "sleepInBedAt", int.class, int.class, - int.class); + if (DevHelper.isValidHelperObject()) { + Method m = ReflectionUtils.getMethod(EntityPlayer.class, "sleepInBedAt", int.class, int.class, int.class); + if (m == null) { + m = ReflectionUtils.getMethod(EntityPlayer.class, "func_71018_a", int.class, int.class, int.class); + } if (m != null) { mSleepInBedAt = m; Utils.registerEvent(this); -- cgit From 2ed346ae95241029f999ec4caa387fca102896c0 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 4 Mar 2019 23:42:57 +0000 Subject: $ More minor ASM Fixes/Cleanup. % Cleaned up some logging. --- .../plugin/fixes/vanilla/Core_VanillaFixes.java | 2 +- .../plugin/fixes/vanilla/VanillaBedHeightFix.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java index 8e7b73ccdf..f6af6e6e5f 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java @@ -10,7 +10,7 @@ public class Core_VanillaFixes implements IPlugin { static { mInstance = new Core_VanillaFixes(); - mBedFixInstance = new VanillaBedHeightFix(); + mBedFixInstance = new VanillaBedHeightFix(mInstance); mInstance.log("Preparing "+mInstance.getPluginName()+" for use."); } diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index 4a0c8d3d6c..25be6679ed 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -5,6 +5,7 @@ import java.lang.reflect.Method; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.interfaces.IPlugin; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -16,15 +17,21 @@ import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; public class VanillaBedHeightFix implements IBugFix { private final Method mSleepInBedAt; + private final IPlugin mParent; - public VanillaBedHeightFix() { - if (DevHelper.isValidHelperObject()) { - Method m = ReflectionUtils.getMethod(EntityPlayer.class, "sleepInBedAt", int.class, int.class, int.class); - if (m == null) { + public VanillaBedHeightFix(IPlugin minstance) { + mParent = minstance; + if (DevHelper.isValidHelperObject()) { + Method m; + if (DevHelper.IsObfuscatedEnvironment()) { m = ReflectionUtils.getMethod(EntityPlayer.class, "func_71018_a", int.class, int.class, int.class); + } + else { + m = ReflectionUtils.getMethod(net.minecraft.entity.player.EntityPlayer.class, "sleepInBedAt", int.class, int.class, int.class); } if (m != null) { mSleepInBedAt = m; + mParent.log("Registering Bed Heigh Fix."); Utils.registerEvent(this); } else { mSleepInBedAt = null; -- cgit From d5ae6aa30263d7da551ffa592e285b01aef95707 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 5 Mar 2019 00:09:50 +0000 Subject: $ More small fixes, Added Tooltips and Proper Localisation for TC4 Aspects. --- src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index 25be6679ed..5f3b1d8abd 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -31,7 +31,7 @@ public class VanillaBedHeightFix implements IBugFix { } if (m != null) { mSleepInBedAt = m; - mParent.log("Registering Bed Heigh Fix."); + mParent.log("Registering Bed Height Fix."); Utils.registerEvent(this); } else { mSleepInBedAt = null; -- cgit From 064c0dc0cfab1cc677dfffc4b3b56642017e412b Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 8 Mar 2019 03:14:13 +0000 Subject: + Added some AgriChem. (You can now use Raw waste as a fuel source) + Added OreDict names to vanilla items, as was done in Forge 1.8.9. + Added functions to allow other mods to add Semifluid Fuels. + Added functions to handle String data into StringUtils.java. % Renamed getItemStack -> getItemStackFromFQRN. $ Fixed handling of custom cells for fluids using '.' within their names. $ Fixed HF exploit. --- .../plugin/fixes/vanilla/Core_VanillaFixes.java | 38 +++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java index f6af6e6e5f..cf9676635d 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java @@ -1,7 +1,11 @@ package gtPlusPlus.plugin.fixes.vanilla; import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.plugin.manager.Core_Manager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; public class Core_VanillaFixes implements IPlugin { @@ -19,18 +23,18 @@ public class Core_VanillaFixes implements IPlugin { } @Override - public boolean preInit() { - return false; + public boolean preInit() { + return fixVanillaOD(); } @Override public boolean init() { - return false; + return true; } @Override public boolean postInit() { - return false; + return true; } @Override @@ -42,5 +46,31 @@ public class Core_VanillaFixes implements IPlugin { public String getPluginAbbreviation() { return "VFIX"; } + + private boolean fixVanillaOD() { + registerToOreDict(ItemUtils.getSimpleStack(Items.nether_wart), "cropNetherWart"); + registerToOreDict(ItemUtils.getSimpleStack(Items.reeds), "sugarcane"); + registerToOreDict(ItemUtils.getSimpleStack(Items.paper), "paper"); + registerToOreDict(ItemUtils.getSimpleStack(Items.ender_pearl), "enderpearl"); + registerToOreDict(ItemUtils.getSimpleStack(Items.bone), "bone"); + registerToOreDict(ItemUtils.getSimpleStack(Items.gunpowder), "gunpowder"); + registerToOreDict(ItemUtils.getSimpleStack(Items.string), "string"); + registerToOreDict(ItemUtils.getSimpleStack(Items.nether_star), "netherStar"); + registerToOreDict(ItemUtils.getSimpleStack(Items.leather), "leather"); + registerToOreDict(ItemUtils.getSimpleStack(Items.feather), "feather"); + registerToOreDict(ItemUtils.getSimpleStack(Items.egg), "egg"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.end_stone), "endstone"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.vine), "vine"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.cactus), "blockCactus"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.grass), "grass"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.obsidian), "obsidian"); + registerToOreDict(ItemUtils.getSimpleStack(Blocks.crafting_table), "workbench"); + return true; + } + + private void registerToOreDict(ItemStack aStack, String aString) { + mInstance.log("Registering "+aStack.getDisplayName()+" to OreDictionary under the tag '"+aString+"'. (Added to Forge in 1.8.9)"); + ItemUtils.addItemToOreDictionary(aStack, aString); + } } -- cgit From 15beaef7c208a5ec84c7ef92288c50e39387cdbd Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 8 Mar 2019 21:27:30 +0000 Subject: % Allowed Hand-Pumps to function on all Tanks again & also allowed GT output slots. Closes #423. % Adjusted Generic Bucket handling of Textures and Colouring. $ Fixed several issues with Hand-Pump logic, Fixes #353. $ Fixed load issues with FluidFactory.java. --- .../gtPlusPlus/plugin/agrichem/Core_Agrichem.java | 43 ++++++++++++++++++++++ .../plugin/agrichem/fluids/FluidLoader.java | 21 +++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java create mode 100644 src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java (limited to 'src/Java/gtPlusPlus/plugin') diff --git a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java new file mode 100644 index 0000000000..d515375149 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java @@ -0,0 +1,43 @@ +package gtPlusPlus.plugin.agrichem; + +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.plugin.agrichem.fluids.FluidLoader; +import gtPlusPlus.plugin.manager.Core_Manager; + +public class Core_Agrichem implements IPlugin { + + final static Core_Agrichem mInstance; + + static { + mInstance = new Core_Agrichem(); + Core_Manager.registerPlugin(mInstance); + mInstance.log("Preparing "+mInstance.getPluginName()+" for use."); + } + + @Override + public boolean preInit() { + FluidLoader.generate(); + return true; + } + + @Override + public boolean init() { + return true; + } + + @Override + public boolean postInit() { + return true; + } + + @Override + public String getPluginName() { + return "GT++ Agrichemistry Module"; + } + + @Override + public String getPluginAbbreviation() { + return "FARM"; + } + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java b/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java new file mode 100644 index 0000000000..a60a8c09de --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java @@ -0,0 +1,21 @@ +package gtPlusPlus.plugin.agrichem.fluids; + +import gtPlusPlus.core.fluids.FluidFactory; + +public class FluidLoader { + + private static final int ID_DIRTY_WATER = 50; + private static final int ID_RAW_SEWERAGE = 51; + private static final int ID_GUANO = 52; + private static final int ID_POOPJUICE = 53; + + public static void generate() { + + FluidFactory.generate(ID_DIRTY_WATER, "dirtywater", new short[] {25, 25, 180}); + FluidFactory.generate(ID_RAW_SEWERAGE, "sewerage", new short[] {100, 45, 25}); + FluidFactory.generate(ID_GUANO, "guano", new short[] {175, 175, 180}); + FluidFactory.generate(ID_POOPJUICE, "poo", new short[] {75, 45, 10}); + + } + +} -- cgit