mirror of
https://github.com/TotalFreedomMC/TotalFreedomMod.git
synced 2025-07-27 07:51:35 +00:00
fix crash mobs
This commit is contained in:
parent
b43a9b6749
commit
12a0b6961b
1 changed files with 23 additions and 0 deletions
|
@ -32,6 +32,29 @@ public class MobBlocker extends FreedomService
|
|||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
//fixes crash mobs, credit to Mafrans
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onEntitySpawn(EntitySpawnEvent e)
|
||||
{
|
||||
if (!(e instanceof LivingEntity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = e.getEntity();
|
||||
if (entity instanceof Attributable)
|
||||
{
|
||||
if (((Attributable) entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getBaseValue() > 255.0)
|
||||
{
|
||||
((Attributable) entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(255.0);
|
||||
}
|
||||
if (((Attributable) entity).getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue() > 10.0)
|
||||
{
|
||||
((Attributable) entity).getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(10.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue