Skip to content

Commit

Permalink
Fix too many LivingFallEvent handlers getting registered
Browse files Browse the repository at this point in the history
  • Loading branch information
squeek502 committed Jul 27, 2016
1 parent ee27529 commit 69fa089
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
17 changes: 17 additions & 0 deletions java/squeek/quakemovement/ModQuakeMovement.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,6 +25,7 @@ public class ModQuakeMovement
public void preInit(FMLPreInitializationEvent event)
{
ModConfig.init(event.getSuggestedConfigurationFile());
MinecraftForge.EVENT_BUS.register(this);
}

@EventHandler
Expand All @@ -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);
}
}
}
14 changes: 0 additions & 14 deletions java/squeek/quakemovement/QuakeServerPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 69fa089

Please sign in to comment.