Hi there! I've been racking my brain trying to figure out 1.12's difficulty management coding. I'm looking to basically cancel fall damage from happening on the damage event as long as the difficulty of the world is on peaceful. Can anybody help see where I've gone wrong?
@Mod(
modid = "peacefulfalldamage",
name = "Peaceful Fall Damage",
version = "1.0.0",
acceptableRemoteVersions = "*"
)
public class fallDamage {
public fallDamage () {
}
@EventBusSubscriber
public static class FallEventHandler {
public FallEventHandler() {
}
@SubscribeEvent
public void onFallEvent(LivingDamageEvent event) {
if (event.getSource().equals(DamageSource.FALL) && event.getEntity() instanceof EntityPlayer)
{
if (world.getDifficulty() == EnumDifficulty.PEACEFUL)
{
event.setCanceled(true);
}
}
}
}
}
Hi there! I've been racking my brain trying to figure out 1.12's difficulty management coding. I'm looking to basically cancel fall damage from happening on the damage event as long as the difficulty of the world is on peaceful. Can anybody help see where I've gone wrong?