Search in sources :

Example 1 with EntityLogisticsDrone

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);
}
Also used : EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone) EntityLogisticsDrone(me.desht.pneumaticcraft.common.entity.living.EntityLogisticsDrone) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

EntityDrone (me.desht.pneumaticcraft.common.entity.living.EntityDrone)1 EntityLogisticsDrone (me.desht.pneumaticcraft.common.entity.living.EntityLogisticsDrone)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1