finish first implementation of fluid transporter, #1985

This commit is contained in:
SpaceToad 2014-08-16 18:03:20 +02:00
parent 746b7d4b7a
commit 2c69299172
13 changed files with 776 additions and 4 deletions

View file

@ -14,10 +14,12 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.core.IZone;
public abstract class EntityRobotBase extends EntityLiving implements IInventory {
public abstract class EntityRobotBase extends EntityLiving implements IInventory, IFluidHandler {
public static final double MAX_ENERGY = 10000;
public static final double SAFETY_ENERGY = MAX_ENERGY / 4;

View file

@ -5,6 +5,7 @@ buildcraft.boardRobotLumberjack=Lumberjack
buildcraft.boardRobotPlanter=Planter
buildcraft.boardRobotLeaveCutter=Leave Cutter
buildcraft.boardRobotCarrier=Carrier
buildcraft.boardRobotFluidCarrier=Tank
buildcraft.boardRobotBomber=Bomber
buildcraft.boardRobotKnight=Knight
buildcraft.boardRobotMiner=Miner

View file

@ -54,6 +54,7 @@ import buildcraft.core.robots.boards.BoardRobotCarrierNBT;
import buildcraft.core.robots.boards.BoardRobotCrafterNBT;
import buildcraft.core.robots.boards.BoardRobotDeliveryNBT;
import buildcraft.core.robots.boards.BoardRobotFarmerNBT;
import buildcraft.core.robots.boards.BoardRobotFluidCarrierNBT;
import buildcraft.core.robots.boards.BoardRobotHarvesterNBT;
import buildcraft.core.robots.boards.BoardRobotKnightNBT;
import buildcraft.core.robots.boards.BoardRobotLeaveCutterNBT;
@ -216,6 +217,8 @@ public class BuildCraftSilicon extends BuildCraftMod {
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLumberjackNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotHarvesterNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotMinerNBT.instance, 10);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFluidCarrierNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotPlanterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotFarmerNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotLeaveCutterNBT.instance, 5);
@ -223,8 +226,10 @@ public class BuildCraftSilicon extends BuildCraftMod {
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotShovelmanNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotCrafterNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotDeliveryNBT.instance, 5);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotKnightNBT.instance, 1);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBomberNBT.instance, 1);
RedstoneBoardRegistry.instance.registerBoardClass(BoardRobotBuilderNBT.instance, 0.5F);
StatementManager.registerActionProvider(new RobotsActionProvider());

View file

@ -0,0 +1,51 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
public class AIRobotGotoStationAndLoadFluids extends AIRobot {
private boolean found = false;
private IZone zone;
public AIRobotGotoStationAndLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotGotoStationAndLoadFluids(EntityRobotBase iRobot, IZone iZone) {
super(iRobot);
zone = iZone;
}
@Override
public void start() {
startDelegateAI(new AIRobotGotoStationToLoadFluids(robot, zone));
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationToLoadFluids) {
if (ai.success()) {
found = true;
startDelegateAI(new AIRobotLoadFluids(robot));
} else {
terminate();
}
}
}
@Override
public boolean success() {
return found;
}
}

View file

@ -0,0 +1,51 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
public class AIRobotGotoStationAndUnloadFluids extends AIRobot {
private boolean found = false;
private IZone zone;
public AIRobotGotoStationAndUnloadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotGotoStationAndUnloadFluids(EntityRobotBase iRobot, IZone iZone) {
super(iRobot);
zone = iZone;
}
@Override
public void start() {
startDelegateAI(new AIRobotGotoStationToUnloadFluids(robot, zone));
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationToUnloadFluids) {
if (ai.success()) {
found = true;
startDelegateAI(new AIRobotUnloadFluids(robot));
} else {
terminate();
}
}
}
@Override
public boolean success() {
return found;
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
drainable * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public

View file

@ -0,0 +1,105 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
import buildcraft.silicon.statements.ActionStationProvideFluids;
import buildcraft.transport.Pipe;
import buildcraft.transport.gates.ActionIterator;
import buildcraft.transport.gates.ActionSlot;
public class AIRobotGotoStationToLoadFluids extends AIRobot {
private boolean found = false;
private IZone zone;
public AIRobotGotoStationToLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotGotoStationToLoadFluids(EntityRobotBase iRobot, IZone iZone) {
super(iRobot);
zone = iZone;
}
@Override
public void update() {
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), zone));
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotSearchAndGotoStation) {
found = ai.success();
terminate();
}
}
@Override
public boolean success() {
return found;
}
private class StationFilter implements IStationFilter {
@Override
public boolean matches(DockingStation station) {
boolean actionFound = false;
Pipe pipe = station.getPipe().pipe;
for (ActionSlot s : new ActionIterator(pipe)) {
if (s.action instanceof ActionStationProvideFluids) {
StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);
/*
* if (!param.hasFilter() || param.matches(filter)) {
* actionFound = true; break; }
*/
actionFound = true;
break;
}
}
if (!actionFound) {
return false;
}
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity nearbyTile = robot.worldObj.getTileEntity(station.x() + dir.offsetX, station.y()
+ dir.offsetY, station.z()
+ dir.offsetZ);
if (nearbyTile != null && nearbyTile instanceof IFluidHandler) {
IFluidHandler handler = (IFluidHandler) nearbyTile;
FluidStack drainable = handler.drain(station.side, 1, false);
if (robot.canFill(ForgeDirection.UNKNOWN, drainable.getFluid())) {
return true;
}
}
}
return false;
}
}
}

View file

@ -0,0 +1,106 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.core.IZone;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
import buildcraft.silicon.statements.ActionStationAcceptFluids;
import buildcraft.transport.Pipe;
import buildcraft.transport.gates.ActionIterator;
import buildcraft.transport.gates.ActionSlot;
public class AIRobotGotoStationToUnloadFluids extends AIRobot {
private boolean found = false;
private IZone zone;
public AIRobotGotoStationToUnloadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotGotoStationToUnloadFluids(EntityRobotBase iRobot, IZone iZone) {
super(iRobot);
zone = iZone;
}
@Override
public void update() {
startDelegateAI(new AIRobotSearchAndGotoStation(robot, new StationFilter(), zone));
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotSearchAndGotoStation) {
found = ((AIRobotSearchAndGotoStation) ai).targetStation != null;
terminate();
}
}
@Override
public boolean success() {
return found;
}
private class StationFilter implements IStationFilter {
@Override
public boolean matches(DockingStation station) {
boolean actionFound = false;
Pipe pipe = station.getPipe().pipe;
for (ActionSlot s : new ActionIterator(pipe)) {
if (s.action instanceof ActionStationAcceptFluids) {
StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);
/*
* if (!param.hasFilter() || param.matches(filter)) {
* actionFound = true; break; }
*/
actionFound = true;
break;
}
}
if (!actionFound) {
return false;
}
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity nearbyTile = robot.worldObj.getTileEntity(station.x() + dir.offsetX, station.y()
+ dir.offsetY, station.z()
+ dir.offsetZ);
if (nearbyTile != null && nearbyTile instanceof IFluidHandler) {
IFluidHandler handler = (IFluidHandler) nearbyTile;
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, 1, false);
if (handler.canFill(station.side, drainable.getFluid())) {
return true;
}
}
}
return false;
}
}
}

View file

@ -0,0 +1,114 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.inventory.filters.IStackFilter;
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
import buildcraft.silicon.statements.ActionStationProvideFluids;
import buildcraft.transport.Pipe;
import buildcraft.transport.gates.ActionIterator;
import buildcraft.transport.gates.ActionSlot;
public class AIRobotLoadFluids extends AIRobot {
private int loaded = 0;
private int waitedCycles = 0;
public AIRobotLoadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotLoadFluids(EntityRobotBase iRobot, IStackFilter iFilter) {
super(iRobot);
}
@Override
public void update() {
waitedCycles++;
if (waitedCycles > 40) {
int previousLoaded = loaded;
doLoad();
if (loaded == previousLoaded) {
terminate();
} else {
waitedCycles = 0;
}
}
}
private void doLoad() {
if (robot.getDockingStation() != null) {
boolean actionFound = false;
DockingStation station = (DockingStation) robot.getDockingStation();
Pipe pipe = station.getPipe().pipe;
for (ActionSlot s : new ActionIterator(pipe)) {
if (s.action instanceof ActionStationProvideFluids) {
StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);
/*
* if (!param.hasFilter() || param.matches(filter)) {
* actionFound = true; break; }
*/
actionFound = true;
break;
}
}
if (!actionFound) {
return;
}
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity nearbyTile = robot.worldObj.getTileEntity(station.x() + dir.offsetX, station.y()
+ dir.offsetY, station.z()
+ dir.offsetZ);
if (nearbyTile != null && nearbyTile instanceof IFluidHandler) {
IFluidHandler handler = (IFluidHandler) nearbyTile;
FluidStack drainable = handler.drain(station.side, FluidContainerRegistry.BUCKET_VOLUME, false)
.copy();
int filled = robot.fill(ForgeDirection.UNKNOWN, drainable, true);
if (filled > 0) {
drainable.amount = filled;
handler.drain(station.side, drainable, true);
loaded += filled;
return;
}
}
}
}
}
@Override
public double getEnergyCost() {
return 2;
}
@Override
public boolean success() {
return loaded > 0;
}
}

View file

@ -0,0 +1,121 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.inventory.filters.IStackFilter;
import buildcraft.core.inventory.filters.StatementParameterStackFilter;
import buildcraft.silicon.statements.ActionStationAcceptFluids;
import buildcraft.transport.Pipe;
import buildcraft.transport.gates.ActionIterator;
import buildcraft.transport.gates.ActionSlot;
public class AIRobotUnloadFluids extends AIRobot {
private int unloaded = 0;
private int waitedCycles = 0;
public AIRobotUnloadFluids(EntityRobotBase iRobot) {
super(iRobot);
}
public AIRobotUnloadFluids(EntityRobotBase iRobot, IStackFilter iFilter) {
super(iRobot);
}
@Override
public void update() {
waitedCycles++;
if (waitedCycles > 40) {
int previousUnloaded = unloaded;
doLoad();
if (unloaded == previousUnloaded) {
terminate();
} else {
waitedCycles = 0;
}
}
}
private void doLoad() {
if (robot.getDockingStation() != null) {
boolean actionFound = false;
DockingStation station = (DockingStation) robot.getDockingStation();
Pipe pipe = station.getPipe().pipe;
for (ActionSlot s : new ActionIterator(pipe)) {
if (s.action instanceof ActionStationAcceptFluids) {
StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);
/*
* if (!param.hasFilter() || param.matches(filter)) {
* actionFound = true; break; }
*/
actionFound = true;
break;
}
}
if (!actionFound) {
return;
}
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity nearbyTile = robot.worldObj.getTileEntity(station.x() + dir.offsetX, station.y()
+ dir.offsetY, station.z()
+ dir.offsetZ);
if (nearbyTile != null && nearbyTile instanceof IFluidHandler) {
IFluidHandler handler = (IFluidHandler) nearbyTile;
FluidStack drainable = robot.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.BUCKET_VOLUME,
false);
if (drainable == null) {
return;
}
drainable = drainable.copy();
int filled = handler.fill(station.side, drainable, true);
if (filled > 0) {
drainable.amount = filled;
robot.drain(ForgeDirection.UNKNOWN, drainable, true);
unloaded += filled;
return;
}
}
}
}
}
@Override
public double getEnergyCost() {
return 2;
}
@Override
public boolean success() {
return unloaded > 0;
}
}

View file

@ -34,6 +34,11 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import buildcraft.BuildCraftSilicon;
import buildcraft.api.boards.RedstoneBoardNBT;
@ -59,7 +64,7 @@ import buildcraft.transport.gates.ActionIterator;
import buildcraft.transport.gates.ActionSlot;
public class EntityRobot extends EntityRobotBase implements
IEntityAdditionalSpawnData, IInventory {
IEntityAdditionalSpawnData, IInventory, IFluidHandler {
public static final ResourceLocation ROBOT_BASE = new ResourceLocation("buildcraft",
DefaultProps.TEXTURE_PATH_ENTITIES + "/robot_base.png");
@ -99,6 +104,8 @@ public class EntityRobot extends EntityRobotBase implements
private boolean needsUpdate = false;
private ItemStack[] inv = new ItemStack[4];
private FluidStack tank;
private int maxFluid = FluidContainerRegistry.BUCKET_VOLUME * 4;
private String boardID;
private ResourceLocation texture;
@ -258,7 +265,7 @@ public class EntityRobot extends EntityRobotBase implements
worldObj,
posX + steamDx * 0.25, posY + steamDy * 0.25, posZ + steamDz * 0.25,
steamDx * 0.05, steamDy * 0.05, steamDz * 0.05,
energySpendPerCycle < 1 ? 1 : energySpendPerCycle));
energySpendPerCycle * 0.75F < 1 ? 1 : energySpendPerCycle * 0.75F));
}
}
@ -468,6 +475,14 @@ public class EntityRobot extends EntityRobotBase implements
}
nbt.setLong("robotId", robotId);
if (tank != null) {
NBTTagCompound tankNBT = new NBTTagCompound();
tank.writeToNBT(tankNBT);
nbt.setTag("tank", tankNBT);
}
}
@Override
@ -516,6 +531,12 @@ public class EntityRobot extends EntityRobotBase implements
if (nbt.hasKey("robotId")) {
robotId = nbt.getLong("robotId");
}
if (nbt.hasKey("tank")) {
tank = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("tank"));
} else {
tank = null;
}
}
@Override
@ -927,4 +948,90 @@ public class EntityRobot extends EntityRobotBase implements
return stack;
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
int result = 0;
if (tank == null) {
tank = new FluidStack(resource.getFluid(), 0);
}
if (tank.amount + resource.amount <= maxFluid) {
result = resource.amount;
if (doFill) {
tank.amount += resource.amount;
}
} else {
result = maxFluid - tank.amount;
if (doFill) {
tank.amount = maxFluid;
}
}
if (tank != null && tank.amount == 0) {
tank = null;
}
return result;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
if (tank != null && tank.fluidID == resource.fluidID) {
return drain(from, resource.amount, doDrain);
} else {
return null;
}
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
FluidStack result = null;
if (tank == null) {
result = null;
} else if (tank.amount <= maxDrain) {
result = tank.copy();
if (doDrain) {
tank = null;
}
} else {
result = tank.copy();
result.amount = maxDrain;
if (doDrain) {
tank.amount -= maxDrain;
}
}
if (tank != null && tank.amount == 0) {
tank = null;
}
return result;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return tank == null
|| tank.amount == 0
|| (tank.amount < maxFluid
&& tank.fluidID == fluid.getID());
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return tank != null
&& tank.amount != 0
&& tank.fluidID == fluid.getID();
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return new FluidTankInfo[] {new FluidTankInfo(tank, maxFluid)};
}
}

View file

@ -0,0 +1,45 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots.boards;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.robots.AIRobotGotoSleep;
import buildcraft.core.robots.AIRobotGotoStationAndLoadFluids;
import buildcraft.core.robots.AIRobotGotoStationAndUnloadFluids;
public class BoardRobotFluidCarrier extends RedstoneBoardRobot {
public BoardRobotFluidCarrier(EntityRobotBase iRobot) {
super(iRobot);
}
@Override
public RedstoneBoardRobotNBT getNBTHandler() {
return BoardRobotFluidCarrierNBT.instance;
}
@Override
public void update() {
startDelegateAI(new AIRobotGotoStationAndLoadFluids(robot, robot.getZoneToWork()));
}
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationAndLoadFluids) {
startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot, robot.getZoneToWork()));
} else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
if (!ai.success()) {
startDelegateAI(new AIRobotGotoSleep(robot));
}
}
}
}

View file

@ -0,0 +1,64 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots.boards;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import buildcraft.api.boards.RedstoneBoardRobot;
import buildcraft.api.boards.RedstoneBoardRobotNBT;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.DefaultProps;
import buildcraft.core.utils.StringUtils;
public final class BoardRobotFluidCarrierNBT extends RedstoneBoardRobotNBT {
public static BoardRobotFluidCarrierNBT instance = new BoardRobotFluidCarrierNBT();
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft",
DefaultProps.TEXTURE_PATH_ENTITIES + "/robot_fluid_carrier.png");
private IIcon icon;
@Override
public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) {
return new BoardRobotFluidCarrier(robot);
}
@Override
public ResourceLocation getRobotTexture() {
return TEXTURE;
}
@Override
public String getID() {
return "buildcraft:boardRobotFluidCarrier";
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
list.add(StringUtils.localize("buildcraft.boardRobotFluidCarrier"));
}
@Override
public void registerIcons(IIconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcraft:board_green");
}
@Override
public IIcon getIcon(NBTTagCompound nbt) {
return icon;
}
}