From 69fa0891655a0179e3708f7f6aa99487e23ed5d9 Mon Sep 17 00:00:00 2001 From: squeek Date: Tue, 26 Jul 2016 22:24:12 -0700 Subject: [PATCH] Fix too many LivingFallEvent handlers getting registered --- java/squeek/quakemovement/ModQuakeMovement.java | 17 +++++++++++++++++ .../squeek/quakemovement/QuakeServerPlayer.java | 14 -------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/java/squeek/quakemovement/ModQuakeMovement.java b/java/squeek/quakemovement/ModQuakeMovement.java index b194145..f1b4fc2 100644 --- a/java/squeek/quakemovement/ModQuakeMovement.java +++ b/java/squeek/quakemovement/ModQuakeMovement.java @@ -9,6 +9,10 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingFallEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, acceptedMinecraftVersions="[1.8,1.9)", dependencies = "required-after:PlayerAPI;after:Squeedometer") public class ModQuakeMovement @@ -21,6 +25,7 @@ public class ModQuakeMovement public void preInit(FMLPreInitializationEvent event) { ModConfig.init(event.getSuggestedConfigurationFile()); + MinecraftForge.EVENT_BUS.register(this); } @EventHandler @@ -33,4 +38,16 @@ public void postInit(FMLPostInitializationEvent event) FMLInterModComms.sendRuntimeMessage(ModInfo.MODID, "VersionChecker", "addVersionCheck", "http://www.ryanliptak.com/minecraft/versionchecker/squeek502/Squake"); } + + @SubscribeEvent + public void onLivingFall(LivingFallEvent event) + { + if (!(event.entity instanceof EntityPlayer)) + return; + + if (ModConfig.INCREASED_FALL_DISTANCE != 0.0D) + { + event.distance = (float) (event.distance - ModConfig.INCREASED_FALL_DISTANCE); + } + } } diff --git a/java/squeek/quakemovement/QuakeServerPlayer.java b/java/squeek/quakemovement/QuakeServerPlayer.java index b691c81..9a9903f 100644 --- a/java/squeek/quakemovement/QuakeServerPlayer.java +++ b/java/squeek/quakemovement/QuakeServerPlayer.java @@ -15,20 +15,6 @@ public class QuakeServerPlayer extends ServerPlayerBase public QuakeServerPlayer(ServerPlayerAPI playerapi) { super(playerapi); - - MinecraftForge.EVENT_BUS.register(this); - } - - @SubscribeEvent - public void onLivingFall(LivingFallEvent event) - { - if (!(event.entity instanceof EntityPlayer)) - return; - - if (ModConfig.INCREASED_FALL_DISTANCE != 0.0D) - { - event.distance = (float) (event.distance - ModConfig.INCREASED_FALL_DISTANCE); - } } @Override