aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java')
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java18
1 files changed, 14 insertions, 4 deletions
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;