Fix ring of far reach and fix proxy selection

This commit is contained in:
Vincent Lee committed 2016-06-25 14:43:24 -05:00
1 parent 49d79abb83
commit 81c45fb079
3 files changed
+10 -6

No files matched your search

@@ -70,9 +70,11 @@ public class Botania {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
try {
if ("1.10".equals(Loader.MC_VERSION)) {
if ("Minecraft 1.10".equals(Loader.instance().getMCVersionString())) {
Botania.LOGGER.info("Enabling proxy for Minecraft 1.10");
crossVersionProxy = (ICrossVersionProxy) Class.forName("vazkii.botania.common.core.proxy.CrossVersionProxy_110").newInstance();
} else if ("1.9.4".equals(Loader.MC_VERSION)) {
} else if ("Minecraft 1.9.4".equals(Loader.instance().getMCVersionString())) {
Botania.LOGGER.info("Enabling proxy for Minecraft 1.9.4");
crossVersionProxy = (ICrossVersionProxy) Class.forName("vazkii.botania.common.core.proxy.CrossVersionProxy_19").newInstance();
} else {
throw new IllegalStateException("Botania couldn't find a cross version proxy!");
@@ -29,8 +29,9 @@ public class CrossVersionProxy_110 implements ICrossVersionProxy {
public void copyGameType(PlayerControllerMP from, BotaniaPlayerController to) {
try {
Class<?> gameTypeClazz = Class.forName("net.minecraft.world.GameType");
Object gameType = from.getCurrentGameType();
Method m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "setGameType", "func_78746_a", "a" }, gameTypeClazz);
Method m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "getCurrentGameType", "func_178889_l", "l" });
Object gameType = m.invoke(from);
m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "setGameType", "func_78746_a", "a" }, gameTypeClazz);
m.invoke(to, gameType);
} catch (IllegalAccessException | InvocationTargetException | ClassNotFoundException ignored) {}
}
@@ -29,8 +29,9 @@ public class CrossVersionProxy_19 implements ICrossVersionProxy {
public void copyGameType(PlayerControllerMP from, BotaniaPlayerController to) {
try {
Class<?> gameTypeClazz = Class.forName("net.minecraft.world.WorldSettings.GameType");
Object gameType = from.getCurrentGameType();
Method m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "setGameType", "func_78746_a", "a" }, gameTypeClazz);
Method m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "getCurrentGameType", "func_178889_l", "l" });
Object gameType = m.invoke(from);
m = ReflectionHelper.findMethod(PlayerControllerMP.class, null, new String[]{ "setGameType", "func_78746_a", "a" }, gameTypeClazz);
m.invoke(to, gameType);
} catch (IllegalAccessException | InvocationTargetException | ClassNotFoundException ignored) {}
}