use of net.minecraft.server.v1_10_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method removeHookIfNecessary.
@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
if (hook.hooked == null)
return;
NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
if (npc == null)
return;
if (npc.isProtected()) {
hook.hooked = null;
hook.die();
}
}
use of net.minecraft.server.v1_10_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
if ((f != entity.width) || (f1 != entity.length)) {
float f2 = entity.width;
entity.width = f;
entity.length = f1;
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, entity.getBoundingBox().c + entity.width));
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
entity.move((f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
}
}
use of net.minecraft.server.v1_10_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method removeFromWorld.
@Override
public void removeFromWorld(org.bukkit.entity.Entity entity) {
Preconditions.checkNotNull(entity);
Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.world.removeEntity(nmsEntity);
}
use of net.minecraft.server.v1_10_R1.Entity in project Citizens2 by CitizensDev.
the class FallingBlockController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Block id = Blocks.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
}
final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.fromLegacyData(data));
return handle.getBukkitEntity();
}
use of net.minecraft.server.v1_10_R1.Entity in project Citizens2 by CitizensDev.
the class ItemController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Material id = Material.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
if (npc.data().has(NPC.ITEM_ID_METADATA)) {
id = Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA));
}
final EntityItemNPC handle = new EntityItemNPC(ws, npc, at.getX(), at.getY(), at.getZ(), CraftItemStack.asNMSCopy(new org.bukkit.inventory.ItemStack(id, 1, (short) data)));
return handle.getBukkitEntity();
}
Aggregations