add debugger warning, improve pipe/robot debugging capabilities, fix lang
This commit is contained in:
parent
8d3514ab4b
commit
fe76b79d4e
8 changed files with 64 additions and 31 deletions
|
@ -261,12 +261,13 @@ item.FacadePhased.state_transparent=Transparent
|
|||
item.PipePlug.name=Pipe Plug
|
||||
item.Lens.name=Lens
|
||||
item.Filter.name=Filter
|
||||
item.debugger.name=Debugger
|
||||
item.debugger.warning=Use only for testing! Leaks secrets.
|
||||
|
||||
itemGroup.buildcraft.blocks=Buildcraft Blocks
|
||||
itemGroup.buildcraft.boards=Buildcraft Robots
|
||||
itemGroup.buildcraft.items=Buildcraft Items
|
||||
itemGroup.buildcraft.pipes=Buildcraft Pipes
|
||||
itemGroup.buildcraft.facades=Buildcraft Facades
|
||||
itemGroup.buildcraft.boards=BuildCraft Robots
|
||||
itemGroup.buildcraft.main=BuildCraft
|
||||
itemGroup.buildcraft.pipes=BuildCraft Pipes
|
||||
itemGroup.buildcraft.facades=BuildCraft Facades
|
||||
|
||||
tile.architectBlock.name=Architect Table
|
||||
tile.assemblyTableBlock.name=Assembly Table
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -10,6 +11,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.tiles.IDebuggable;
|
||||
import buildcraft.core.lib.items.ItemBuildCraft;
|
||||
import buildcraft.core.lib.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* Created by asie on 3/7/15.
|
||||
|
@ -43,4 +45,9 @@ public class ItemDebugger extends ItemBuildCraft {
|
|||
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean debug) {
|
||||
list.add(StringUtils.localize("item.debugger.warning"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package buildcraft.robotics;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
@ -55,6 +56,7 @@ import buildcraft.api.robots.AIRobot;
|
|||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.tiles.IDebuggable;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.lib.RFBattery;
|
||||
|
@ -70,7 +72,7 @@ import buildcraft.transport.gates.ActionIterator;
|
|||
import buildcraft.transport.gates.StatementSlot;
|
||||
|
||||
public class EntityRobot extends EntityRobotBase implements
|
||||
IEntityAdditionalSpawnData, IInventory, IFluidHandler, ICommandReceiver {
|
||||
IEntityAdditionalSpawnData, IInventory, IFluidHandler, ICommandReceiver, IDebuggable {
|
||||
|
||||
public static final ResourceLocation ROBOT_BASE = new ResourceLocation("buildcraft",
|
||||
DefaultProps.TEXTURE_PATH_ENTITIES + "/robot_base.png");
|
||||
|
@ -1124,4 +1126,10 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
return iicon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDebugInfo(List<String> info, ForgeDirection side, ItemStack debugger, EntityPlayer player) {
|
||||
// TODO: Add AI information
|
||||
info.add("Robot " + board.getNBTHandler().getID() + " (" + getBattery().getEnergyStored() + "/" + getBattery().getMaxEnergyStored() + " RF)");
|
||||
info.add("Position: " + posX + ", " + posY + ", " + posZ);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import buildcraft.core.lib.items.ItemBuildCraft;
|
|||
public class ItemRobotStation extends ItemBuildCraft implements IPipePluggableItem {
|
||||
|
||||
public ItemRobotStation() {
|
||||
super(BCCreativeTab.get("robots"));
|
||||
super(BCCreativeTab.get("boards"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package buildcraft.robotics;
|
||||
|
||||
import java.util.List;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -14,6 +16,7 @@ import buildcraft.BuildCraftRobotics;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.robots.RobotManager;
|
||||
import buildcraft.api.tiles.IDebuggable;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.pluggable.IPipePluggableItem;
|
||||
|
@ -23,7 +26,7 @@ import buildcraft.core.lib.utils.MatrixTranformations;
|
|||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver {
|
||||
public class RobotStationPluggable extends PipePluggable implements IPipePluggableItem, IEnergyReceiver, IDebuggable {
|
||||
public class RobotStationPluggableRenderer implements IPipePluggableRenderer {
|
||||
private float zFightOffset = 1 / 4096.0F;
|
||||
|
||||
|
@ -228,6 +231,12 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
return AxisAlignedBB.getBoundingBox(bounds[0][0], bounds[1][0], bounds[2][0], bounds[0][1], bounds[1][1], bounds[2][1]);
|
||||
}
|
||||
|
||||
private void refreshRenderState() {
|
||||
this.renderState = station.isTaken()
|
||||
? (station.isMainStation() ? RobotStationState.Linked : RobotStationState.Reserved)
|
||||
: RobotStationState.Available;
|
||||
}
|
||||
|
||||
public RobotStationState getRenderState() {
|
||||
return renderState;
|
||||
}
|
||||
|
@ -239,9 +248,7 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
|
||||
@Override
|
||||
public void writeData(ByteBuf data) {
|
||||
this.renderState = station.isTaken()
|
||||
? (station.isMainStation() ? RobotStationState.Linked : RobotStationState.Reserved)
|
||||
: RobotStationState.Available;
|
||||
refreshRenderState();
|
||||
data.writeByte(getRenderState().ordinal());
|
||||
}
|
||||
|
||||
|
@ -278,4 +285,17 @@ public class RobotStationPluggable extends PipePluggable implements IPipePluggab
|
|||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDebugInfo(List<String> info, ForgeDirection side, ItemStack debugger, EntityPlayer player) {
|
||||
if (station == null) {
|
||||
info.add("RobotStationPluggable: No station found!");
|
||||
} else {
|
||||
refreshRenderState();
|
||||
info.add("Docking Station (side " + side.name() + ", " + renderState.name() + ")");
|
||||
if (station.robotTaking() != null && station.robotTaking() instanceof IDebuggable) {
|
||||
((IDebuggable) station.robotTaking()).getDebugInfo(info, ForgeDirection.UNKNOWN, debugger, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -30,6 +31,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.BCLog;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.tiles.IDebuggable;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.lib.inventory.Transactor;
|
||||
|
@ -40,7 +42,7 @@ import buildcraft.transport.network.PacketPipeTransportTraveler;
|
|||
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||
import buildcraft.transport.utils.TransportUtils;
|
||||
|
||||
public class PipeTransportItems extends PipeTransport {
|
||||
public class PipeTransportItems extends PipeTransport implements IDebuggable {
|
||||
|
||||
public static final int MAX_PIPE_STACKS = 64;
|
||||
public static final int MAX_PIPE_ITEMS = 1024;
|
||||
|
@ -124,13 +126,7 @@ public class PipeTransportItems extends PipeTransport {
|
|||
return;
|
||||
}
|
||||
|
||||
int numItems = 0;
|
||||
for (TravelingItem travellingItem : items) {
|
||||
ItemStack stack = travellingItem.getItemStack();
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
numItems += stack.stackSize;
|
||||
}
|
||||
}
|
||||
int numItems = getNumberOfItems();
|
||||
|
||||
if (numItems > MAX_PIPE_ITEMS) {
|
||||
BCLog.logger.log(Level.WARN, String.format("Pipe exploded at %d,%d,%d because it had too many items: %d", container.xCoord, container.yCoord, container.zCoord, numItems));
|
||||
|
@ -468,10 +464,9 @@ public class PipeTransportItems extends PipeTransport {
|
|||
public int getNumberOfItems() {
|
||||
int num = 0;
|
||||
for (TravelingItem item : items) {
|
||||
if (item.getItemStack() == null) {
|
||||
continue;
|
||||
if (item.getItemStack() != null) {
|
||||
num += item.getItemStack().stackSize;
|
||||
}
|
||||
num += item.getItemStack().stackSize;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
@ -544,4 +539,10 @@ public class PipeTransportItems extends PipeTransport {
|
|||
public boolean delveIntoUnloadedChunks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDebugInfo(List<String> info, ForgeDirection side, ItemStack debugger, EntityPlayer player) {
|
||||
info.add("PipeTransportItems");
|
||||
info.add("- Items: " + getNumberOfStacks() + "/" + MAX_PIPE_STACKS + " (" + getNumberOfItems() + "/" + MAX_PIPE_ITEMS + ")");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,8 +358,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
|||
* All power input MUST go through designated input pipes, such as Wooden
|
||||
* Power Pipes or a subclass thereof.
|
||||
*/
|
||||
public int receiveEnergy(ForgeDirection from, int valI) {
|
||||
int val = valI;
|
||||
public int receiveEnergy(ForgeDirection from, int val) {
|
||||
step();
|
||||
if (this.container.pipe instanceof IPipeTransportPowerHook) {
|
||||
int ret = ((IPipeTransportPowerHook) this.container.pipe).receiveEnergy(from, val);
|
||||
|
@ -460,13 +459,9 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
|||
@Override
|
||||
public void getDebugInfo(List<String> info, ForgeDirection side, ItemStack debugger, EntityPlayer player) {
|
||||
info.add("PipeTransportPower (" + maxPower + " RF/t)");
|
||||
info.add("- internalPower: " + Arrays.toString(internalPower));
|
||||
info.add("- internalNextPower: " + Arrays.toString(internalNextPower));
|
||||
info.add("- powerQuery: " + Arrays.toString(powerQuery));
|
||||
info.add("- nextPowerQuery: " + Arrays.toString(nextPowerQuery));
|
||||
info.add("- displayPower: " + Arrays.toString(displayPower));
|
||||
info.add("- energyInput: " + Arrays.toString(dbgEnergyInput));
|
||||
info.add("- energyOutput: " + Arrays.toString(dbgEnergyOutput));
|
||||
info.add("- internalPower: " + Arrays.toString(internalPower) + " <- " + Arrays.toString(internalNextPower));
|
||||
info.add("- powerQuery: " + Arrays.toString(powerQuery) + " <- " + Arrays.toString(nextPowerQuery));
|
||||
info.add("- energy: IN " + Arrays.toString(dbgEnergyInput) + ", OUT " + Arrays.toString(dbgEnergyOutput));
|
||||
|
||||
int[] totalPowerQuery = new int[6];
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import cofh.api.energy.IEnergyProvider;
|
|||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.api.power.IRedstoneEngine;
|
||||
import buildcraft.api.power.IRedstoneEngineReceiver;
|
||||
import buildcraft.api.tiles.IDebuggable;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
|
Loading…
Reference in a new issue