Created
January 5, 2015 19:41
-
-
Save Unh0lyTigg/7d3e56115137fe1d94e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeVoid { | |
@AutoSubscribe | |
public static DeVoid INSTANCE = new DeVoid(); | |
@SubscribeEvent | |
public void worldLoad(WorldEvent.Load event) { | |
if (!event.world.getGameRules().hasRule("doesVoidKillPlayer")) { | |
event.world.getGameRules().addGameRule("doesVoidKillPlayer", "true", ValueType.BOOLEAN_VALUE); | |
TiggCore.LOGGER.info("Added doesVoidKillPlayer gamerule to " + event.world.getSaveHandler().getWorldDirectoryName() + "\\" + event.world.provider.getDimensionName()); | |
} | |
} | |
@SubscribeEvent | |
public void undoDamage(LivingAttackEvent event) { | |
if (event.entity.worldObj.getGameRules().getGameRuleBooleanValue("doesVoidKillPlayer")) | |
return; | |
if (event.source == DamageSource.outOfWorld) { | |
if (event.entityLiving instanceof EntityPlayer) | |
event.setCanceled(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment