Search in sources :

Example 1 with IDebuggable

use of buildcraft.api.tiles.IDebuggable in project BuildCraft by BuildCraft.

the class EntityRobot method getDebugInfo.

@Override
public void getDebugInfo(List<String> left, List<String> right, EnumFacing side) {
    left.add("Robot:");
    if (board != null) {
        if (board.getNBTHandler() != null) {
            left.add("  " + board.getNBTHandler().getID());
        } else {
            left.add("  " + board.getClass());
        }
    } else {
        left.add("  Unknown type");
    }
    if (getBattery() != null) {
        left.add("  Battery " + getBattery().getEnergyStored() + "/" + getBattery().getMaxEnergyStored() + " RF");
    }
    left.add(String.format("Position: %.2f, %.2f, %.2f", posX, posY, posZ));
    left.add("AI tree:");
    AIRobot aiRobot = mainAI;
    while (aiRobot != null) {
        left.add("- " + RobotManager.getAIRobotName(aiRobot.getClass()) + " (" + aiRobot.getEnergyCost() + " RF/t)");
        if (aiRobot instanceof IDebuggable) {
            ((IDebuggable) aiRobot).getDebugInfo(left, right, side);
        }
        aiRobot = aiRobot.getDelegateAI();
    }
}
Also used : IDebuggable(buildcraft.api.tiles.IDebuggable) AIRobot(buildcraft.api.robots.AIRobot)

Example 2 with IDebuggable

use of buildcraft.api.tiles.IDebuggable in project BuildCraft by BuildCraft.

the class BuildCraftCore method renderOverlay.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderOverlay(RenderGameOverlayEvent.Text event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.gameSettings.showDebugInfo)
        return;
    if (mc.thePlayer.hasReducedDebug() || mc.gameSettings.reducedDebugInfo || !mc.thePlayer.capabilities.isCreativeMode) {
        return;
    }
    event.right.add("");
    event.right.add("BC PQS|" + PacketHandler.packetQueueSize());
    MovingObjectPosition object = mc.objectMouseOver;
    if (object == null) {
        return;
    }
    MovingObjectType type = object.typeOfHit;
    if (type == MovingObjectType.BLOCK && object.getBlockPos() != null) {
        BlockPos pos = object.getBlockPos();
        TileEntity tile = mc.theWorld.getTileEntity(pos);
        if (tile instanceof IDebuggable) {
            ((IDebuggable) tile).getDebugInfo(event.left, event.right, object.sideHit);
        }
    } else if (type == MovingObjectType.ENTITY) {
        Entity ent = object.entityHit;
        if (ent instanceof IDebuggable) {
            ((IDebuggable) ent).getDebugInfo(event.left, event.right, object.sideHit);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntity(net.minecraft.tileentity.TileEntity) Entity(net.minecraft.entity.Entity) IDebuggable(buildcraft.api.tiles.IDebuggable) BlockPos(net.minecraft.util.math.BlockPos) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with IDebuggable

use of buildcraft.api.tiles.IDebuggable in project BuildCraft by BuildCraft.

the class ClientDebuggables method getDebuggableObject.

@Nullable
public static IDebuggable getDebuggableObject(RayTraceResult mouseOver) {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.gameSettings.reducedDebugInfo || mc.player.hasReducedDebug() || !mc.gameSettings.showDebugInfo || !ItemDebugger.isShowDebugInfo(mc.player)) {
        return null;
    }
    if (mouseOver == null) {
        return null;
    }
    RayTraceResult.Type type = mouseOver.typeOfHit;
    WorldClient world = mc.world;
    if (world == null) {
        return null;
    }
    if (type == RayTraceResult.Type.BLOCK) {
        BlockPos pos = mouseOver.getBlockPos();
        TileEntity tile = world.getTileEntity(pos);
        if (tile instanceof IDebuggable) {
            return (IDebuggable) tile;
        }
    } else if (type == RayTraceResult.Type.ENTITY) {
        Entity entity = mouseOver.entityHit;
        if (entity instanceof IDebuggable) {
            return (IDebuggable) entity;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) IDebuggable(buildcraft.api.tiles.IDebuggable) RayTraceResult(net.minecraft.util.math.RayTraceResult) BlockPos(net.minecraft.util.math.BlockPos) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient) Nullable(javax.annotation.Nullable)

Example 4 with IDebuggable

use of buildcraft.api.tiles.IDebuggable in project BuildCraft by BuildCraft.

the class RenderTickListener method renderOverlay.

@SubscribeEvent
public static void renderOverlay(RenderGameOverlayEvent.Text event) {
    Minecraft mc = Minecraft.getMinecraft();
    IDebuggable debuggable = ClientDebuggables.getDebuggableObject(mc.objectMouseOver);
    if (debuggable != null) {
        List<String> clientLeft = new ArrayList<>();
        List<String> clientRight = new ArrayList<>();
        debuggable.getDebugInfo(clientLeft, clientRight, mc.objectMouseOver.sideHit);
        String headerFirst = DIFF_HEADER_FORMATTING + "SERVER:";
        String headerSecond = DIFF_HEADER_FORMATTING + "CLIENT:";
        appendDiff(event.getLeft(), ClientDebuggables.SERVER_LEFT, clientLeft, headerFirst, headerSecond);
        appendDiff(event.getRight(), ClientDebuggables.SERVER_RIGHT, clientRight, headerFirst, headerSecond);
        debuggable.getClientDebugInfo(event.getLeft(), event.getRight(), mc.objectMouseOver.sideHit);
    }
}
Also used : IDebuggable(buildcraft.api.tiles.IDebuggable) ArrayList(java.util.ArrayList) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with IDebuggable

use of buildcraft.api.tiles.IDebuggable in project BuildCraft by BuildCraft.

the class Pipe method getDebugInfo.

@Override
public void getDebugInfo(List<String> left, List<String> right, EnumFacing side) {
    left.add("Colour = " + colour);
    left.add("Definition = " + definition.identifier);
    if (behaviour instanceof IDebuggable) {
        left.add("Behaviour:");
        ((IDebuggable) behaviour).getDebugInfo(left, right, side);
        left.add("");
    } else {
        left.add("Behaviour = " + behaviour.getClass());
    }
    if (flow instanceof IDebuggable) {
        left.add("Flow:");
        ((IDebuggable) flow).getDebugInfo(left, right, side);
        left.add("");
    } else {
        left.add("Flow = " + flow.getClass());
    }
    for (EnumFacing face : EnumFacing.VALUES) {
        right.add(face + " = " + types.get(face) + ", " + getConnectedDist(face));
    }
}
Also used : IDebuggable(buildcraft.api.tiles.IDebuggable) EnumFacing(net.minecraft.util.EnumFacing)

Aggregations

IDebuggable (buildcraft.api.tiles.IDebuggable)5 Minecraft (net.minecraft.client.Minecraft)3 Entity (net.minecraft.entity.Entity)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.math.BlockPos)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 AIRobot (buildcraft.api.robots.AIRobot)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1 WorldClient (net.minecraft.client.multiplayer.WorldClient)1 EnumFacing (net.minecraft.util.EnumFacing)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1