use of me.desht.pneumaticcraft.common.entity.living.EntityLogisticsDrone in project pnc-repressurized by TeamPneumatic.
the class ItemLogisticsDrone method spawnDrone.
@Override
public void spawnDrone(EntityPlayer player, World world, BlockPos placePos, ItemStack iStack) {
EntityDrone drone = new EntityLogisticsDrone(world, player);
drone.setPosition(placePos.getX() + 0.5, placePos.getY() + 0.5, placePos.getZ() + 0.5);
world.spawnEntity(drone);
NBTTagCompound stackTag = iStack.getTagCompound();
NBTTagCompound entityTag = new NBTTagCompound();
drone.writeEntityToNBT(entityTag);
if (stackTag != null) {
entityTag.setFloat("currentAir", stackTag.getFloat("currentAir"));
entityTag.setInteger("color", stackTag.getInteger("color"));
entityTag.setTag(ChargeableItemHandler.NBT_UPGRADE_TAG, stackTag.getCompoundTag(ChargeableItemHandler.NBT_UPGRADE_TAG));
}
drone.readEntityFromNBT(entityTag);
addLogisticsProgram(placePos, drone.progWidgets);
if (iStack.hasDisplayName())
drone.setCustomNameTag(iStack.getDisplayName());
drone.naturallySpawned = false;
// TODO 1.8 check if valid replacement drone.onSpawnWithEgg(null);
drone.onInitialSpawn(world.getDifficultyForLocation(placePos), null);
}
Aggregations