Skip to content

Commit

Permalink
No fall damage in soulhomes for entities
Browse files Browse the repository at this point in the history
  • Loading branch information
leafreynolds committed Jan 13, 2025
1 parent ff0c810 commit 678d796
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main/java/leaf/soulhome/handlers/CommonEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,23 @@ public static void registerCommands(RegisterCommandsEvent event)
public static void onLivingHurt(LivingHurtEvent event)
{
final LivingEntity entityLiving = event.getEntity();
if (entityLiving instanceof Player
&& DimensionHelper.isInSoulDimension(entityLiving))
final boolean inSoulDimension = DimensionHelper.isInSoulDimension(entityLiving);

if (!inSoulDimension)
{
return;
}

//no fall damage in soul homes for any entity
if (event.getSource() == entityLiving.damageSources().fall())
{
entityLiving.fallDistance = 0;
event.setCanceled(true);
return;
}


if (entityLiving instanceof Player)
{
event.setCanceled(true);
entityLiving.fallDistance = 0;
Expand Down

0 comments on commit 678d796

Please sign in to comment.