@Override public EntityNMSSlime spawnNMSSlime( org.bukkit.World bukkitWorld, double x, double y, double z, CraftTouchSlimeLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece); touchSlime.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, touchSlime)) { DebugHandler.handleSpawnFail(parentPiece); } return touchSlime; }
@Override public NMSArmorStand spawnNMSArmorStand( org.bukkit.World world, double x, double y, double z, CraftHologramLine parentPiece) { WorldServer nmsWorld = ((CraftWorld) world).getHandle(); EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece); invisibleArmorStand.setLocationNMS(x, y, z); if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) { DebugHandler.handleSpawnFail(parentPiece); } return invisibleArmorStand; }
@Override public NMSItem spawnNMSItem( org.bukkit.World bukkitWorld, double x, double y, double z, CraftItemLine parentPiece, ItemStack stack) { WorldServer nmsWorld = ((CraftWorld) bukkitWorld).getHandle(); EntityNMSItem customItem = new EntityNMSItem(nmsWorld, parentPiece); customItem.setLocationNMS(x, y, z); customItem.setItemStackNMS(stack); if (!addEntityToWorld(nmsWorld, customItem)) { DebugHandler.handleSpawnFail(parentPiece); } return customItem; }
@Override public void setPassengerOfNMS(NMSEntityBase vehicleBase) { if (vehicleBase == null || !(vehicleBase instanceof Entity)) { // It should never dismount return; } Entity entity = (Entity) vehicleBase; try { if (super.bz() != null) { Entity oldVehicle = super.bz(); ReflectionUtils.setPrivateField(Entity.class, this, "at", null); oldVehicle.passengers.remove(this); } ReflectionUtils.setPrivateField(Entity.class, this, "at", entity); entity.passengers.clear(); entity.passengers.add(this); } catch (Exception ex) { DebugHandler.handleDebugException(ex); } }