Search in sources :

Example 6 with EntityDrone

use of me.desht.pneumaticcraft.common.entity.living.EntityDrone in project pnc-repressurized by TeamPneumatic.

the class CoordTrackUpgradeHandler method getDronePath.

public static Path getDronePath(EntityPlayer player, BlockPos pos) {
    World world = player.world;
    EntityDrone drone = new EntityDrone(world);
    drone.setPosition(player.posX, player.posY - 2, player.posZ);
    return new EntityPathNavigateDrone(drone, world).getPathToPos(pos);
}
Also used : EntityPathNavigateDrone(me.desht.pneumaticcraft.common.ai.EntityPathNavigateDrone) EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone) World(net.minecraft.world.World)

Example 7 with EntityDrone

use of me.desht.pneumaticcraft.common.entity.living.EntityDrone in project pnc-repressurized by TeamPneumatic.

the class ModelDroneMinigun method render.

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    EntityDrone drone = (EntityDrone) entity;
    renderMinigun(drone != null ? drone.getMinigun() : null, f5, 0, true);
}
Also used : EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone)

Example 8 with EntityDrone

use of me.desht.pneumaticcraft.common.entity.living.EntityDrone in project pnc-repressurized by TeamPneumatic.

the class ItemDrone method spawnDrone.

public void spawnDrone(EntityPlayer player, World world, BlockPos placePos, ItemStack iStack) {
    EntityDrone drone = new EntityDrone(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.setTag("widgets", stackTag.getTagList("widgets", 10).copy());
        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);
    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) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 9 with EntityDrone

use of me.desht.pneumaticcraft.common.entity.living.EntityDrone 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)

Example 10 with EntityDrone

use of me.desht.pneumaticcraft.common.entity.living.EntityDrone in project pnc-repressurized by TeamPneumatic.

the class ContainerAmadron method handleGUIButtonPress.

@Override
public void handleGUIButtonPress(int guiID, EntityPlayer player) {
    super.handleGUIButtonPress(guiID, player);
    if (guiID == 1) {
        for (int i = 0; i < shoppingItems.length; i++) {
            if (shoppingItems[i] >= 0) {
                AmadronOffer offer = offers.get(shoppingItems[i]);
                BlockPos itemPos = ItemAmadronTablet.getItemProvidingLocation(player.getHeldItemMainhand());
                World itemWorld;
                if (itemPos == null) {
                    itemPos = new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ);
                    itemWorld = player.world;
                } else {
                    itemWorld = DimensionManager.getWorld(ItemAmadronTablet.getItemProvidingDimension(player.getHeldItemMainhand()));
                }
                BlockPos liquidPos = ItemAmadronTablet.getLiquidProvidingLocation(player.getHeldItemMainhand());
                World liquidWorld = null;
                if (liquidPos != null) {
                    liquidWorld = DimensionManager.getWorld(ItemAmadronTablet.getLiquidProvidingDimension(player.getHeldItemMainhand()));
                }
                EntityDrone drone = retrieveOrderItems(offer, shoppingAmounts[i], itemWorld, itemPos, liquidWorld, liquidPos);
                if (drone != null)
                    drone.setHandlingOffer(offer, shoppingAmounts[i], player.getHeldItemMainhand(), player.getName());
            }
        }
        Arrays.fill(shoppingAmounts, 0);
        Arrays.fill(shoppingItems, -1);
    } else if (guiID == 2) {
        player.openGui(PneumaticCraftRepressurized.instance, CommonProxy.EnumGuiId.AMADRON_ADD_TRADE.ordinal(), player.world, 0, 0, 0);
    }
}
Also used : EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone) AmadronOffer(me.desht.pneumaticcraft.common.recipes.AmadronOffer) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

Aggregations

EntityDrone (me.desht.pneumaticcraft.common.entity.living.EntityDrone)26 ItemStack (net.minecraft.item.ItemStack)10 Entity (net.minecraft.entity.Entity)6 BlockPos (net.minecraft.util.math.BlockPos)4 World (net.minecraft.world.World)4 AmadronOffer (me.desht.pneumaticcraft.common.recipes.AmadronOffer)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 IProgWidget (me.desht.pneumaticcraft.common.progwidgets.IProgWidget)2 Block (net.minecraft.block.Block)2 ItemBlock (net.minecraft.item.ItemBlock)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 ArrayList (java.util.ArrayList)1 IEntityTrackEntry (me.desht.pneumaticcraft.api.client.pneumaticHelmet.IEntityTrackEntry)1 IGuiScreen (me.desht.pneumaticcraft.api.client.pneumaticHelmet.IGuiScreen)1 AmadronRetrievalEvent (me.desht.pneumaticcraft.api.drone.AmadronRetrievalEvent)1 EntityPathNavigateDrone (me.desht.pneumaticcraft.common.ai.EntityPathNavigateDrone)1