Search in sources :

Example 1 with EntityCreature

use of net.minecraft.server.v1_14_R1.EntityCreature in project Ublisk by Derkades.

the class V1_12_R1 method setTarget.

@Override
public void setTarget(Creature creature, LivingEntity target) {
    CraftCreature craftCreature = (CraftCreature) creature;
    EntityCreature nms = craftCreature.getHandle();
    if (target == null) {
        nms.setGoalTarget(null, null, false);
    } else {
        nms.setGoalTarget(((CraftLivingEntity) target).getHandle(), null, false);
    }
}
Also used : CraftCreature(org.bukkit.craftbukkit.v1_12_R1.entity.CraftCreature) EntityCreature(net.minecraft.server.v1_12_R1.EntityCreature)

Example 2 with EntityCreature

use of net.minecraft.server.v1_14_R1.EntityCreature in project solinia3-core by mixxit.

the class SoliniaLivingEntity method targetSelector.

public void targetSelector() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    final net.minecraft.server.v1_12_R1.EntityInsentient e = (net.minecraft.server.v1_12_R1.EntityInsentient) ((org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity) getBukkitLivingEntity()).getHandle();
    if (!(e instanceof net.minecraft.server.v1_12_R1.EntityCreature) && !(e instanceof net.minecraft.server.v1_12_R1.EntityTameableAnimal))
        return;
    final Field goalsField = net.minecraft.server.v1_12_R1.EntityInsentient.class.getDeclaredField("targetSelector");
    goalsField.setAccessible(true);
    final net.minecraft.server.v1_12_R1.PathfinderGoalSelector goals = (net.minecraft.server.v1_12_R1.PathfinderGoalSelector) goalsField.get(e);
    Field listField = net.minecraft.server.v1_12_R1.PathfinderGoalSelector.class.getDeclaredField("b");
    listField.setAccessible(true);
    Set list = (Set) listField.get(goals);
    list.clear();
    listField = net.minecraft.server.v1_12_R1.PathfinderGoalSelector.class.getDeclaredField("c");
    listField.setAccessible(true);
    list = (Set) listField.get(goals);
    list.clear();
    goals.a(1, (net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer) new net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer(e, (Class) net.minecraft.server.v1_12_R1.EntityHuman.class, 5.0f, 1.0f));
    goals.a(2, (net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer) new net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer(e, (Class) net.minecraft.server.v1_12_R1.EntityHuman.class, 5.0f, 1.0f));
    goals.a(10, (net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer) new net.minecraft.server.v1_12_R1.PathfinderGoalLookAtPlayer(e, (Class) net.minecraft.server.v1_12_R1.EntityHuman.class, 5.0f, 1.0f));
    goals.a(1, new PathfinderGoalOwnerHurtByTarget((EntityTameableAnimal) e));
    goals.a(2, new PathfinderGoalOwnerHurtTarget((EntityTameableAnimal) e));
    goals.a(3, new PathfinderGoalHurtByTarget((EntityCreature) e, true, new Class[0]));
}
Also used : Set(java.util.Set) EntityCreature(net.minecraft.server.v1_12_R1.EntityCreature) EntityTameableAnimal(net.minecraft.server.v1_12_R1.EntityTameableAnimal) Field(java.lang.reflect.Field) EntityTameableAnimal(net.minecraft.server.v1_12_R1.EntityTameableAnimal) PathfinderGoalOwnerHurtTarget(net.minecraft.server.v1_12_R1.PathfinderGoalOwnerHurtTarget) PathfinderGoalOwnerHurtByTarget(net.minecraft.server.v1_12_R1.PathfinderGoalOwnerHurtByTarget) PathfinderGoalHurtByTarget(net.minecraft.server.v1_12_R1.PathfinderGoalHurtByTarget) ISoliniaClass(com.solinia.solinia.Interfaces.ISoliniaClass) EntityCreature(net.minecraft.server.v1_12_R1.EntityCreature)

Example 3 with EntityCreature

use of net.minecraft.server.v1_14_R1.EntityCreature in project UltraCosmetics by iSach.

the class EntityUtil method makePanic.

@Override
public void makePanic(Entity entity) {
    EntityInsentient insentient = (EntityInsentient) ((CraftEntity) entity).getHandle();
    insentient.goalSelector.a(3, new CustomPathFinderGoalPanic((EntityCreature) insentient, 0.4d));
}
Also used : EntityInsentient(net.minecraft.server.v1_8_R3.EntityInsentient) CustomPathFinderGoalPanic(be.isach.ultracosmetics.v1_8_R3.pathfinders.CustomPathFinderGoalPanic) EntityCreature(net.minecraft.server.v1_8_R3.EntityCreature)

Example 4 with EntityCreature

use of net.minecraft.server.v1_14_R1.EntityCreature in project Ublisk by Derkades.

the class V1_14_R1 method setTarget.

@Override
public void setTarget(final Creature creature, final LivingEntity target) {
    final CraftCreature craftCreature = (CraftCreature) creature;
    final EntityCreature nms = craftCreature.getHandle();
    if (target == null) {
        nms.setGoalTarget(null, null, false);
    } else {
        nms.setGoalTarget(((CraftLivingEntity) target).getHandle(), null, false);
    }
}
Also used : CraftCreature(org.bukkit.craftbukkit.v1_14_R1.entity.CraftCreature) EntityCreature(net.minecraft.server.v1_14_R1.EntityCreature)

Example 5 with EntityCreature

use of net.minecraft.server.v1_14_R1.EntityCreature in project UltraCosmetics by iSach.

the class EntityUtil method move.

@Override
public void move(Creature creature, Location loc) {
    EntityCreature ec = ((CraftCreature) creature).getHandle();
    ec.S = 1;
    if (loc == null)
        return;
    ec.getNavigation().a(loc.getX(), loc.getY(), loc.getZ(), (1.0D + 2.0D * 0.5d) * 1.0D);
}
Also used : EntityCreature(net.minecraft.server.v1_8_R3.EntityCreature)

Aggregations

EntityCreature (net.minecraft.server.v1_12_R1.EntityCreature)2 EntityCreature (net.minecraft.server.v1_8_R3.EntityCreature)2 CustomPathFinderGoalPanic (be.isach.ultracosmetics.v1_8_R3.pathfinders.CustomPathFinderGoalPanic)1 ISoliniaClass (com.solinia.solinia.Interfaces.ISoliniaClass)1 Field (java.lang.reflect.Field)1 Set (java.util.Set)1 EntityTameableAnimal (net.minecraft.server.v1_12_R1.EntityTameableAnimal)1 PathfinderGoalHurtByTarget (net.minecraft.server.v1_12_R1.PathfinderGoalHurtByTarget)1 PathfinderGoalOwnerHurtByTarget (net.minecraft.server.v1_12_R1.PathfinderGoalOwnerHurtByTarget)1 PathfinderGoalOwnerHurtTarget (net.minecraft.server.v1_12_R1.PathfinderGoalOwnerHurtTarget)1 EntityCreature (net.minecraft.server.v1_14_R1.EntityCreature)1 EntityInsentient (net.minecraft.server.v1_8_R3.EntityInsentient)1 CraftCreature (org.bukkit.craftbukkit.v1_12_R1.entity.CraftCreature)1 CraftCreature (org.bukkit.craftbukkit.v1_14_R1.entity.CraftCreature)1