mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
Fix/Replace player visibility event (#7573)
This commit is contained in:
1 parent
75570079ae
commit
9017e24b40
4 files changed
+65
No files matched your search
@@ -147,6 +147,7 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDamageEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
@@ -394,6 +395,11 @@ public class ForgeHooks
|
||||
return event.getLootingLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 1.17 remove
|
||||
* Unused
|
||||
*/
|
||||
@Deprecated
|
||||
public static double getPlayerVisibilityDistance(PlayerEntity player, double xzDistance, double maxXZDistance)
|
||||
{
|
||||
PlayerEvent.Visibility event = new PlayerEvent.Visibility(player);
|
||||
@@ -402,6 +408,12 @@ public class ForgeHooks
|
||||
return value >= maxXZDistance ? maxXZDistance : value;
|
||||
}
|
||||
|
||||
public static double getEntityVisibilityMultiplier(LivingEntity entity, Entity lookingEntity, double originalMultiplier){
|
||||
LivingEvent.LivingVisibilityEvent event = new LivingEvent.LivingVisibilityEvent(entity, lookingEntity, originalMultiplier);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return Math.max(0,event.getVisibilityModifier());
|
||||
}
|
||||
|
||||
public static boolean isLivingOnLadder(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
|
||||
{
|
||||
boolean isSpectator = (entity instanceof PlayerEntity && ((PlayerEntity)entity).isSpectator());
|
||||
|
||||
Reference in new issue
Block a user