diff options
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/fixes')
-rw-r--r-- | src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java | 40 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java | 18 |
2 files changed, 49 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java index 8e7b73ccdf..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 { @@ -10,7 +14,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."); } @@ -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); + } } diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index e0fef80b52..5f3b1d8abd 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -5,8 +5,10 @@ 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; import gtPlusPlus.plugin.fixes.interfaces.IBugFix; import gtPlusPlus.preloader.DevHelper; import net.minecraft.entity.player.EntityPlayer; @@ -15,13 +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 = DevHelper.getForgeMethod(EntityPlayer.class, "sleepInBedAt", int.class, int.class, - int.class); + 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 Height Fix."); Utils.registerEvent(this); } else { mSleepInBedAt = null; |