Search in sources :

Example 6 with EntityDrone

use of pneumaticCraft.common.entity.living.EntityDrone in project PneumaticCraft by MineMaarten.

the class PacketSendDroneDebugEntry method handleClientSide.

@Override
public void handleClientSide(PacketSendDroneDebugEntry message, EntityPlayer player) {
    Entity entity = player.worldObj.getEntityByID(message.entityId);
    if (entity instanceof EntityDrone) {
        EntityDrone drone = (EntityDrone) entity;
        drone.addDebugEntry(message.entry);
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone)

Example 7 with EntityDrone

use of pneumaticCraft.common.entity.living.EntityDrone in project PneumaticCraft by MineMaarten.

the class PacketUpdateDebuggingDrone method handleServerSide.

@Override
public void handleServerSide(PacketUpdateDebuggingDrone message, EntityPlayer player) {
    ItemStack stack = player.inventory.armorItemInSlot(3);
    if (stack != null) {
        NBTUtil.setInteger(stack, NBTKeys.PNEUMATIC_HELMET_DEBUGGING_DRONE, message.entityId);
        Entity entity = player.worldObj.getEntityByID(message.entityId);
        if (entity instanceof EntityDrone) {
            ((EntityDrone) entity).trackAsDebugged((EntityPlayerMP) player);
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) ItemStack(net.minecraft.item.ItemStack)

Example 8 with EntityDrone

use of pneumaticCraft.common.entity.living.EntityDrone in project PneumaticCraft by MineMaarten.

the class AmadronOfferManager method tryRestockCustomOffers.

public void tryRestockCustomOffers() {
    for (AmadronOffer offer : allOffers) {
        if (offer instanceof AmadronOfferCustom) {
            AmadronOfferCustom custom = (AmadronOfferCustom) offer;
            TileEntity input = custom.getProvidingTileEntity();
            TileEntity output = custom.getReturningTileEntity();
            int possiblePickups = ContainerAmadron.capShoppingAmount(custom.invert(), 50, input instanceof IInventory ? (IInventory) input : null, output instanceof IInventory ? (IInventory) output : null, input instanceof IFluidHandler ? (IFluidHandler) input : null, output instanceof IFluidHandler ? (IFluidHandler) output : null, null);
            if (possiblePickups > 0) {
                ChunkPosition pos = new ChunkPosition(input.xCoord, input.yCoord, input.zCoord);
                EntityDrone drone = ContainerAmadron.retrieveOrderItems(custom, possiblePickups, input.getWorldObj(), pos, input.getWorldObj(), pos);
                if (drone != null) {
                    drone.setHandlingOffer(custom.copy(), possiblePickups, null, "Restock");
                }
            }
            custom.invert();
            custom.payout();
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IInventory(net.minecraft.inventory.IInventory) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) ChunkPosition(net.minecraft.world.ChunkPosition) IFluidHandler(net.minecraftforge.fluids.IFluidHandler)

Example 9 with EntityDrone

use of pneumaticCraft.common.entity.living.EntityDrone in project PneumaticCraft by MineMaarten.

the class TileEntityDroneInterface method onDataPacket.

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
    Entity entity = worldObj.getEntityByID(pkt.func_148857_g().getInteger("drone"));
    drone = entity instanceof EntityDrone ? (EntityDrone) entity : null;
}
Also used : S35PacketUpdateTileEntity(net.minecraft.network.play.server.S35PacketUpdateTileEntity) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone)

Example 10 with EntityDrone

use of pneumaticCraft.common.entity.living.EntityDrone in project PneumaticCraft by MineMaarten.

the class ProgrammedDroneUtils method deliverFluidAmazonStyle.

public static EntityCreature deliverFluidAmazonStyle(World world, int x, int y, int z, FluidStack deliveredFluid) {
    if (world.isRemote)
        return null;
    if (deliveredFluid == null)
        throw new IllegalArgumentException("Can't deliver a null FluidStack");
    if (deliveredFluid.amount <= 0)
        throw new IllegalArgumentException("Can't deliver a FluidStack with an amount of <= 0");
    EntityDrone drone = getChargedDispenserUpgradeDrone(world);
    //Program the drone
    int startY = world.getHeightValue(x + 30, z) + 30;
    drone.setPosition(x + 30, startY, z);
    List<IProgWidget> widgets = drone.progWidgets;
    ProgWidgetStart start = new ProgWidgetStart();
    start.setX(92);
    start.setY(41);
    widgets.add(start);
    ProgWidgetLiquidExport export = new ProgWidgetLiquidExport();
    export.setX(92);
    export.setY(52);
    widgets.add(export);
    ProgWidgetGoToLocation gotoPiece = new ProgWidgetGoToLocation();
    gotoPiece.setX(92);
    gotoPiece.setY(74);
    widgets.add(gotoPiece);
    ProgWidgetSuicide suicide = new ProgWidgetSuicide();
    suicide.setX(92);
    suicide.setY(85);
    widgets.add(suicide);
    ProgWidgetArea area = new ProgWidgetArea();
    area.setX(107);
    area.setY(52);
    area.x1 = x;
    area.y1 = y;
    area.z1 = z;
    widgets.add(area);
    area = new ProgWidgetArea();
    area.setX(107);
    area.setY(74);
    area.x1 = x + 30;
    area.y1 = startY;
    area.z1 = z;
    widgets.add(area);
    TileEntityProgrammer.updatePuzzleConnections(widgets);
    drone.getTank().fill(deliveredFluid, true);
    world.spawnEntityInWorld(drone);
    return drone;
}
Also used : IProgWidget(pneumaticCraft.common.progwidgets.IProgWidget) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) ProgWidgetGoToLocation(pneumaticCraft.common.progwidgets.ProgWidgetGoToLocation) ProgWidgetArea(pneumaticCraft.common.progwidgets.ProgWidgetArea) ProgWidgetLiquidExport(pneumaticCraft.common.progwidgets.ProgWidgetLiquidExport) ProgWidgetSuicide(pneumaticCraft.common.progwidgets.ProgWidgetSuicide) ProgWidgetStart(pneumaticCraft.common.progwidgets.ProgWidgetStart)

Aggregations

EntityDrone (pneumaticCraft.common.entity.living.EntityDrone)25 ItemStack (net.minecraft.item.ItemStack)10 IProgWidget (pneumaticCraft.common.progwidgets.IProgWidget)6 Entity (net.minecraft.entity.Entity)5 ProgWidgetStart (pneumaticCraft.common.progwidgets.ProgWidgetStart)5 World (net.minecraft.world.World)4 ProgWidgetArea (pneumaticCraft.common.progwidgets.ProgWidgetArea)4 ProgWidgetGoToLocation (pneumaticCraft.common.progwidgets.ProgWidgetGoToLocation)4 ProgWidgetSuicide (pneumaticCraft.common.progwidgets.ProgWidgetSuicide)4 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 ChunkPosition (net.minecraft.world.ChunkPosition)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 AmadronOffer (pneumaticCraft.common.recipes.AmadronOffer)3 ArrayList (java.util.ArrayList)2 ItemBlock (net.minecraft.item.ItemBlock)2 TileEntity (net.minecraft.tileentity.TileEntity)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 Block (net.minecraft.block.Block)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1