Move Aikar's EAR 1 into EAR 2 patch

This commit is contained in:
Nassim Jahnke
2024-12-16 14:08:25 +01:00
parent 47c06357f7
commit f8cb014d20
13 changed files with 666 additions and 645 deletions

View File

@@ -0,0 +1,47 @@
package io.papermc.paper.entity.activation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.monster.Enemy;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.raid.Raider;
import net.minecraft.world.phys.AABB;
public enum ActivationType {
WATER,
FLYING_MONSTER,
VILLAGER,
MONSTER,
ANIMAL,
RAIDER,
MISC;
AABB boundingBox = new AABB(0, 0, 0, 0, 0, 0);
/**
* Returns the activation type for the given entity.
*
* @param entity entity to get the activation type for
* @return activation type
*/
public static ActivationType activationTypeFor(final Entity entity) {
if (entity instanceof WaterAnimal) {
return ActivationType.WATER;
} else if (entity instanceof Villager) {
return ActivationType.VILLAGER;
} else if (entity instanceof FlyingMob && entity instanceof Enemy) {
return ActivationType.FLYING_MONSTER;
} else if (entity instanceof Raider) {
return ActivationType.RAIDER;
} else if (entity instanceof Enemy) {
return ActivationType.MONSTER;
} else if (entity instanceof PathfinderMob || entity instanceof AmbientCreature) {
return ActivationType.ANIMAL;
} else {
return ActivationType.MISC;
}
}
}