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);
}
}
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);
}
}
}
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();
}
}
}
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;
}
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;
}
Aggregations