Search in sources :

Example 6 with IIconTransformation

use of logisticspipes.proxy.object3d.interfaces.IIconTransformation in project LogisticsPipes by RS485.

the class LogisticsNewRenderPipe method renderBoxWithDir.

public static void renderBoxWithDir(ForgeDirection dir) {
    List<RenderEntry> objectsToRender = new ArrayList<>();
    List<Edge> edgesToRender = new ArrayList<>(Arrays.asList(Edge.values()));
    Map<Corner, Integer> connectionAtCorner = new HashMap<>();
    for (Edge edge : Edge.values()) {
        if (edge.part1 == dir || edge.part2 == dir) {
            edgesToRender.remove(edge);
        }
    }
    for (Corner corner : Corner.values()) {
        if (corner.ew.dir == dir || corner.ns.dir == dir || corner.ud.dir == dir) {
            if (!connectionAtCorner.containsKey(corner)) {
                connectionAtCorner.put(corner, 1);
            } else {
                connectionAtCorner.put(corner, connectionAtCorner.get(corner) + 1);
            }
        }
    }
    for (Corner corner : Corner.values()) {
        IIconTransformation cornerTexture = LogisticsNewRenderPipe.basicPipeTexture;
        int count = connectionAtCorner.containsKey(corner) ? connectionAtCorner.get(corner) : 0;
        if (count == 0) {
            objectsToRender.addAll(LogisticsNewRenderPipe.corners_M.get(corner).stream().map(model -> new RenderEntry(model, new I3DOperation[] { cornerTexture })).collect(Collectors.toList()));
        } else if (count == 1) {
            for (PipeTurnCorner turn : PipeTurnCorner.values()) {
                if (turn.corner != corner) {
                    continue;
                }
                if (turn.getPointer() == dir) {
                    objectsToRender.add(new RenderEntry(LogisticsNewRenderPipe.spacers.get(turn), new I3DOperation[] { cornerTexture }));
                    break;
                }
            }
        } else if (count == 2) {
            for (PipeTurnCorner turn : PipeTurnCorner.values()) {
                if (turn.corner != corner) {
                    continue;
                }
                if (turn.getPointer() == dir) {
                    objectsToRender.add(new RenderEntry(LogisticsNewRenderPipe.corners_I.get(turn), new I3DOperation[] { cornerTexture }));
                    break;
                }
            }
        } else if (count == 3) {
            objectsToRender.addAll(LogisticsNewRenderPipe.corners_I3.get(corner).stream().map(model -> new RenderEntry(model, new I3DOperation[] { cornerTexture })).collect(Collectors.toList()));
        }
    }
    objectsToRender.addAll(edgesToRender.stream().map(edge -> new RenderEntry(LogisticsNewRenderPipe.edges.get(edge), new I3DOperation[] { LogisticsNewRenderPipe.basicPipeTexture })).collect(Collectors.toList()));
    for (RenderEntry model : objectsToRender) {
        model.getModel().render(model.getOperations());
    }
}
Also used : java.util(java.util) IVec3(logisticspipes.proxy.object3d.interfaces.IVec3) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) Textures(logisticspipes.textures.Textures) LogisticsPipes(logisticspipes.LogisticsPipes) IIconTransformation(logisticspipes.proxy.object3d.interfaces.IIconTransformation) Quartet(logisticspipes.utils.tuples.Quartet) logisticspipes.proxy.object3d.operation(logisticspipes.proxy.object3d.operation) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) GL11(org.lwjgl.opengl.GL11) LPConstants(logisticspipes.LPConstants) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) IIconRegister(net.minecraft.client.renderer.texture.IIconRegister) EffectRenderer(net.minecraft.client.particle.EffectRenderer) World(net.minecraft.world.World) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) CoordinateUtils(network.rs485.logisticspipes.world.CoordinateUtils) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Collectors(java.util.stream.Collectors) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Entry(java.util.Map.Entry) ResourceLocation(net.minecraft.util.ResourceLocation) Data(lombok.Data) TileEntity(net.minecraft.tileentity.TileEntity) PlayerConfig(logisticspipes.config.PlayerConfig) PipeRenderState(logisticspipes.renderer.state.PipeRenderState) AllArgsConstructor(lombok.AllArgsConstructor) EntityModelFX(logisticspipes.pipefxhandlers.EntityModelFX) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) IIconTransformation(logisticspipes.proxy.object3d.interfaces.IIconTransformation)

Example 7 with IIconTransformation

use of logisticspipes.proxy.object3d.interfaces.IIconTransformation in project LogisticsPipes by RS485.

the class LogisticsNewSolidBlockWorldRenderer method renderInventoryBlock.

public void renderInventoryBlock(Block block2, int metadata) {
    //don't break other mods' guis when holding a pipe
    GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
    //force transparency
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    Block block = LogisticsPipes.LogisticsPipeBlock;
    Tessellator tess = Tessellator.instance;
    BlockRotation rotation = BlockRotation.ZERO;
    tess.startDrawingQuads();
    IIconTransformation icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(metadata));
    //Draw
    LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(icon);
    if (metadata != LogisticsSolidBlock.LOGISTICS_BLOCK_FRAME) {
        for (CoverSides side : CoverSides.values()) {
            LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(icon);
        }
    }
    tess.draw();
    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    // nicely leave the rendering how it was
    GL11.glPopAttrib();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) Block(net.minecraft.block.Block) LogisticsSolidBlock(logisticspipes.blocks.LogisticsSolidBlock) IIconTransformation(logisticspipes.proxy.object3d.interfaces.IIconTransformation)

Aggregations

IIconTransformation (logisticspipes.proxy.object3d.interfaces.IIconTransformation)7 Block (net.minecraft.block.Block)6 TileEntity (net.minecraft.tileentity.TileEntity)5 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)4 Tessellator (net.minecraft.client.renderer.Tessellator)4 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)4 I3DOperation (logisticspipes.proxy.object3d.interfaces.I3DOperation)3 IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)3 IVec3 (logisticspipes.proxy.object3d.interfaces.IVec3)3 LPConstants (logisticspipes.LPConstants)2 LogisticsSolidTileEntity (logisticspipes.blocks.LogisticsSolidTileEntity)2 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)2 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)2 IBCPipePluggable (logisticspipes.proxy.buildcraft.subproxies.IBCPipePluggable)2 IBounds (logisticspipes.proxy.object3d.interfaces.IBounds)2 LPScale (logisticspipes.proxy.object3d.operation.LPScale)2 PipeRenderState (logisticspipes.renderer.state.PipeRenderState)2 IIconRegister (net.minecraft.client.renderer.texture.IIconRegister)2 World (net.minecraft.world.World)2