use of net.minecraft.world.entity.player.EntityHuman in project BedWars1058 by andrei1058.
the class Silverfish method u.
@Override
protected void u() {
this.bR.a(1, new PathfinderGoalFloat(this));
this.bR.a(2, new PathfinderGoalMeleeAttack(this, 1.9D, false));
this.bS.a(1, new PathfinderGoalHurtByTarget(this));
this.bR.a(3, new PathfinderGoalRandomStroll(this, 2D));
this.bS.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 20, true, false, player -> {
return (!((EntityHuman) player).getBukkitEntity().isDead()) && (!team.wasMember(((EntityHuman) player).getBukkitEntity().getUniqueId())) && (!team.getArena().isReSpawning(((EntityHuman) player).getBukkitEntity().getUniqueId())) && (!team.getArena().isSpectator(((EntityHuman) player).getBukkitEntity().getUniqueId()));
}));
this.bS.a(3, new PathfinderGoalNearestAttackableTarget(this, IGolem.class, 20, true, false, golem -> {
return ((IGolem) golem).getTeam() != team;
}));
this.bS.a(4, new PathfinderGoalNearestAttackableTarget(this, Silverfish.class, 20, true, false, sf -> {
return ((Silverfish) sf).getTeam() != team;
}));
}
use of net.minecraft.world.entity.player.EntityHuman in project LaBoulangerieMmo by LaBoulangerie.
the class Dodging method trigger.
@Override
public void trigger(Event baseEvent, int level) {
ComboCompletedEvent event = (ComboCompletedEvent) baseEvent;
Player player = event.getPlayer();
EntityHuman human = (EntityHuman) ((CraftPlayer) event.getPlayer()).getHandle();
/**
* See ItemTrident.java in craftbukkit or TridentItem.java in paper
* Mapping:
* k -> power (originally the riptide level)
* f -> yRot
* f1 -> xRot
*/
float power = 1;
float yRot = human.getYRot();
float xRot = human.getXRot();
float f2 = -MathHelper.sin(yRot * 0.017453292F) * MathHelper.cos(xRot * 0.017453292F);
float f3 = -MathHelper.sin(xRot * 0.017453292F);
float f4 = MathHelper.cos(yRot * 0.017453292F) * MathHelper.cos(xRot * 0.017453292F);
float f5 = MathHelper.c(f2 * f2 + f3 * f3 + f4 * f4);
float f6 = 3.0F * ((1.0F + power) / 4.0F);
f2 *= f6 / f5;
f3 *= f6 / f5;
f4 *= f6 / f5;
// human.i((double) f2, (double) f3, (double) f4); // = human.push doesn't work
// but next line replaced it maybe try again in 1.18
player.setVelocity(new Vector((double) f2, (double) f3, (double) f4));
human.s(20);
player.getWorld().playSound(player.getLocation(), Sound.ITEM_TRIDENT_RIPTIDE_1, 1, 1);
}
use of net.minecraft.world.entity.player.EntityHuman in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_17_R1 method dropItemAsPlayer.
@Override
public void dropItemAsPlayer(HumanEntity humanEntity, org.bukkit.inventory.ItemStack bukkitItem) {
EntityHuman entityHuman = ((CraftHumanEntity) humanEntity).getHandle();
ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
entityHuman.drop(itemStack, false);
}
use of net.minecraft.world.entity.player.EntityHuman in project NyaaCore by NyaaCat.
the class NmsUtils method setEntityTag.
/* see CommandEntityData.java */
public static void setEntityTag(Entity e, String tag) {
net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) e).getHandle();
if (nmsEntity instanceof EntityHuman) {
throw new IllegalArgumentException("Player NBT cannot be edited");
} else {
NBTTagCompound nbtToBeMerged;
try {
nbtToBeMerged = MojangsonParser.parseTag(tag);
} catch (CommandSyntaxException ex) {
throw new IllegalArgumentException("Invalid NBTTag string");
}
// entity to nbt
NBTTagCompound nmsOrigNBT = CriterionConditionNBT.getEntityTagToCompare(nmsEntity);
// clone
NBTTagCompound nmsClonedNBT = nmsOrigNBT.copy();
// merge NBT
nmsClonedNBT.merge(nbtToBeMerged);
if (nmsClonedNBT.equals(nmsOrigNBT)) {
return;
} else {
// store UUID
UUID uuid = nmsEntity.getUUID();
// set nbt
nmsEntity.load(nmsClonedNBT);
// set uuid
nmsEntity.setUUID(uuid);
}
}
}
Aggregations