mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
fix crash mobs
This commit is contained in:
parent
b43a9b6749
commit
12a0b6961b
@ -33,6 +33,29 @@ public class MobBlocker extends FreedomService
|
||||
{
|
||||
}
|
||||
|
||||
//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…
Reference in New Issue
Block a user