Search in sources :

Example 1 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class LogisticsNewRenderPipe method loadModels.

public static void loadModels() {
    if (!SimpleServiceLocator.cclProxy.isActivated())
        return;
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/PipeModel_moved.obj"), 7, new LPScale(1 / 100f));
        List<IModel3D> highlightList = new ArrayList<>();
        for (EnumFacing dir : EnumFacing.VALUES) {
            LogisticsNewRenderPipe.sideNormal.put(dir, new ArrayList<>());
            String grp = "Side_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.sideNormal.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.sideNormal.get(dir).size() != 4) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideNormal.get(dir).size());
            }
        }
        for (EnumFacing dir : EnumFacing.VALUES) {
            LogisticsNewRenderPipe.sideBC.put(dir, new ArrayList<>());
            String grp = "Side_BC_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.sideBC.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.sideBC.get(dir).size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideBC.get(dir).size());
            }
        }
        for (Edge edge : Edge.values()) {
            String grp;
            if (edge.part1 == EnumFacing.UP || edge.part1 == EnumFacing.DOWN) {
                grp = "Edge_M_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part1) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part2);
            } else {
                grp = "Edge_M_S_" + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part1) + LogisticsNewRenderPipe.getDirAsString_Type1(edge.part2);
            }
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.edges.put(edge, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.edges.get(edge) == null) {
                throw new RuntimeException("Couldn't load " + edge.name() + " (" + grp + ")");
            }
            highlightList.add(LogisticsNewRenderPipe.edges.get(edge));
        }
        for (Corner corner : Corner.values()) {
            LogisticsNewRenderPipe.corners_M.put(corner, new ArrayList<>());
            String grp = "Corner_M_" + corner.ud.s + "_" + corner.ns.s + corner.ew.s;
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.corners_M.get(corner).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.corners_M.get(corner).size() != 2) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.corners_M.get(corner).size());
            }
            highlightList.addAll(LogisticsNewRenderPipe.corners_M.get(corner));
        }
        for (Corner corner : Corner.values()) {
            LogisticsNewRenderPipe.corners_I3.put(corner, new ArrayList<>());
            String grp = "Corner_I3_" + corner.ud.s + "_" + corner.ns.s + corner.ew.s;
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.corners_I3.get(corner).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.corners_I3.get(corner).size() != 2) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.corners_I3.get(corner).size());
            }
        }
        for (PipeSupport support : PipeSupport.values()) {
            String grp = "Support_" + LogisticsNewRenderPipe.getDirAsString_Type1(support.dir) + "_" + support.ori.s;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.supports.put(support, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.supports.get(support) == null) {
                throw new RuntimeException("Couldn't load " + support.name() + " (" + grp + ")");
            }
        }
        for (PipeTurnCorner corner : PipeTurnCorner.values()) {
            String grp = "Corner_I_" + corner.corner.ud.s + "_" + corner.corner.ns.s + corner.corner.ew.s;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp)) {
                    char c = ' ';
                    if (!entry.getKey().endsWith(" " + grp)) {
                        c = entry.getKey().charAt(entry.getKey().indexOf(" " + grp) + (" " + grp).length());
                    }
                    if (Character.isDigit(c)) {
                        if (c == '2') {
                            if (corner.turn != Turn.NORTH_SOUTH) {
                                continue;
                            }
                        } else if (c == '1') {
                            if (corner.turn != Turn.EAST_WEST) {
                                continue;
                            }
                        } else {
                            throw new UnsupportedOperationException();
                        }
                    } else {
                        if (corner.turn != Turn.UP_DOWN) {
                            continue;
                        }
                    }
                    LogisticsNewRenderPipe.corners_I.put(corner, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.corners_I.get(corner) == null) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + ")");
            }
        }
        for (PipeTurnCorner corner : PipeTurnCorner.values()) {
            String grp = "Spacer" + corner.number;
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.spacers.put(corner, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.spacers.get(corner) == null) {
                throw new RuntimeException("Couldn't load " + corner.name() + " (" + grp + ")");
            }
        }
        for (PipeMount mount : PipeMount.values()) {
            String grp = "Mount_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.dir) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.side);
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)) {
                    LogisticsNewRenderPipe.mounts.put(mount, LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                    break;
                }
            }
            if (LogisticsNewRenderPipe.mounts.get(mount) == null) {
                throw new RuntimeException("Couldn't load " + mount.name() + " (" + grp + ")");
            }
        }
        for (EnumFacing dir : EnumFacing.VALUES) {
            LogisticsNewRenderPipe.texturePlate_Inner.put(dir, new ArrayList<>());
            String grp = "Inner_Plate_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.texturePlate_Inner.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.texturePlate_Inner.get(dir).size() != 2) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.texturePlate_Inner.get(dir).size());
            }
        }
        for (EnumFacing dir : EnumFacing.VALUES) {
            LogisticsNewRenderPipe.texturePlate_Outer.put(dir, new ArrayList<>());
            String grp = "Texture_Plate_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.texturePlate_Outer.get(dir).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)).apply(new LPTranslation(-0.5, -0.5, -0.5)).apply(new LPScale(1.001D)).apply(new LPTranslation(0.5, 0.5, 0.5)))));
            if (LogisticsNewRenderPipe.texturePlate_Outer.get(dir).size() != 2) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.texturePlate_Outer.get(dir).size());
            }
        }
        for (EnumFacing dir : EnumFacing.VALUES) {
            LogisticsNewRenderPipe.sideTexturePlate.put(dir, new Quartet<>(new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()));
            String grp = "Texture_Side_" + LogisticsNewRenderPipe.getDirAsString_Type1(dir);
            for (Entry<String, IModel3D> entry : pipePartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp)) {
                    IModel3D model = LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)));
                    double sizeA = (model.bounds().max().x() - model.bounds().min().x()) + (model.bounds().max().y() - model.bounds().min().y()) + (model.bounds().max().z() - model.bounds().min().z());
                    double dis = Math.pow(model.bounds().min().x() - 0.5D, 2) + Math.pow(model.bounds().min().y() - 0.5D, 2) + Math.pow(model.bounds().min().z() - 0.5D, 2);
                    if (sizeA < 0.5D) {
                        if ((dis > 0.22 && dis < 0.24) || (dis > 0.38 && dis < 0.40)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().add(model);
                        } else if ((dis < 0.2 && dis > 0.18) || (dis < 0.36 && dis > 0.34)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().add(model);
                        } else {
                            throw new UnsupportedOperationException("Dis: " + dis);
                        }
                    } else {
                        if ((dis > 0.22 && dis < 0.24) || (dis > 0.38 && dis < 0.40)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().add(model);
                        } else if ((dis < 0.2 && dis > 0.18) || (dis < 0.36 && dis > 0.34)) {
                            LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().add(model);
                        } else {
                            throw new UnsupportedOperationException("Dis: " + dis);
                        }
                    }
                }
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue1().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue2().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue3().size());
            }
            if (LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().size() != 8) {
                throw new RuntimeException("Couldn't load " + dir.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.sideTexturePlate.get(dir).getValue4().size());
            }
        }
        for (PipeMount mount : PipeMount.values()) {
            LogisticsNewRenderPipe.textureConnectorPlate.put(mount, new ArrayList<>());
            String grp = "Texture_Connector_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.dir) + "_" + LogisticsNewRenderPipe.getDirAsString_Type1(mount.side);
            pipePartModels.entrySet().stream().filter(entry -> entry.getKey().contains(" " + grp + " ") || entry.getKey().endsWith(" " + grp)).forEach(entry -> LogisticsNewRenderPipe.textureConnectorPlate.get(mount).add(LogisticsNewRenderPipe.compute(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)))));
            if (LogisticsNewRenderPipe.textureConnectorPlate.get(mount).size() != 4) {
                throw new RuntimeException("Couldn't load " + mount.name() + " (" + grp + "). Only loaded " + LogisticsNewRenderPipe.textureConnectorPlate.get(mount).size());
            }
        }
        highlight = SimpleServiceLocator.cclProxy.combine(highlightList);
        pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/PipeModel_Transport_Box.obj"), 7, new LPScale(1 / 100f));
        LogisticsNewRenderPipe.innerTransportBox = LogisticsNewRenderPipe.compute(pipePartModels.get("InnerTransportBox").backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)).apply(new LPTranslation(-0.5, -0.5, -0.5)).apply(new LPScale(0.99D)).apply(new LPTranslation(0.5, 0.5, 0.5)));
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : Arrays(java.util.Arrays) IVec3(logisticspipes.proxy.object3d.interfaces.IVec3) Textures(logisticspipes.textures.Textures) LogisticsPipes(logisticspipes.LogisticsPipes) Quartet(logisticspipes.utils.tuples.Quartet) MainProxy(logisticspipes.proxy.MainProxy) Block(net.minecraft.block.Block) Side(net.minecraftforge.fml.relauncher.Side) ClientConfiguration(network.rs485.logisticspipes.config.ClientConfiguration) Map(java.util.Map) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) GL11(org.lwjgl.opengl.GL11) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) VertexFormat(net.minecraft.client.renderer.vertex.VertexFormat) CoordinateUtils(network.rs485.logisticspipes.world.CoordinateUtils) BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Entry(java.util.Map.Entry) PipeRenderState(logisticspipes.renderer.state.PipeRenderState) EntityModelFX(logisticspipes.pipefxhandlers.EntityModelFX) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) HashMap(java.util.HashMap) PipeItemsBasicLogistics(logisticspipes.pipes.PipeItemsBasicLogistics) LPUVTranslation(logisticspipes.proxy.object3d.operation.LPUVTranslation) LPUVTransformationList(logisticspipes.proxy.object3d.operation.LPUVTransformationList) ArrayList(java.util.ArrayList) DefaultVertexFormats(net.minecraft.client.renderer.vertex.DefaultVertexFormats) Lists(com.google.common.collect.Lists) Minecraft(net.minecraft.client.Minecraft) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) LinkedList(java.util.LinkedList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) LPConstants(logisticspipes.LPConstants) Nonnull(javax.annotation.Nonnull) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) Iterator(java.util.Iterator) World(net.minecraft.world.World) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) TextureMap(net.minecraft.client.renderer.texture.TextureMap) EnumFacing(net.minecraft.util.EnumFacing) LPUVScale(logisticspipes.proxy.object3d.operation.LPUVScale) ParticleManager(net.minecraft.client.particle.ParticleManager) ResourceLocation(net.minecraft.util.ResourceLocation) Data(lombok.Data) TextureTransformation(logisticspipes.proxy.object3d.interfaces.TextureTransformation) TileEntity(net.minecraft.tileentity.TileEntity) LPScale(logisticspipes.proxy.object3d.operation.LPScale) AllArgsConstructor(lombok.AllArgsConstructor) Collections(java.util.Collections) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 2 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class GainTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Gain_result.obj"), 7, new LPScale(1 / 100f));
        // tubeTurnMounts
        for (TubeGainRenderOrientation turn : TubeGainRenderOrientation.values()) {
            GainTubeRenderer.tubeTurnBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Lane ") || entry.getKey().contains(" Lane ") || entry.getKey().endsWith(" Lane")).forEach(entry -> {
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 1.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 0.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Lanes. Only loaded " + GainTubeRenderer.tubeTurnBase.get(TubeGainRenderOrientation.NORTH).size());
        }
        for (TubeGainRenderOrientation turn : TubeGainRenderOrientation.values()) {
            GainTubeRenderer.tubeGain.put(turn, SimpleServiceLocator.cclProxy.combine(GainTubeRenderer.tubeTurnBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) Map(java.util.Map) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) IBounds(logisticspipes.proxy.object3d.interfaces.IBounds) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) Nonnull(javax.annotation.Nonnull) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) TubeGainRenderOrientation(logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation) Objects(java.util.Objects) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) HSTubeGain(logisticspipes.pipes.tubes.HSTubeGain) Pair(logisticspipes.utils.tuples.Pair) ResourceLocation(net.minecraft.util.ResourceLocation) LPScale(logisticspipes.proxy.object3d.operation.LPScale) Collections(java.util.Collections) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale) TubeGainRenderOrientation(logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation)

Example 3 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class LineTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Line_result.obj"), 7, new LPScale(1 / 100f));
        // tubeTurnMounts
        for (TubeLineRenderOrientation turn : TubeLineRenderOrientation.values()) {
            LineTubeRenderer.tubeLineBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Side ") || entry.getKey().contains(" Side ") || entry.getKey().endsWith(" Side")).forEach(entry -> {
            LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.NORTH_SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
        });
        if (LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_WEST).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Side. Only loaded " + LineTubeRenderer.tubeLineBase.get(TubeLineRenderOrientation.EAST_WEST).size());
        }
        for (TubeLineRenderOrientation turn : TubeLineRenderOrientation.values()) {
            LineTubeRenderer.tubeLine.put(turn, SimpleServiceLocator.cclProxy.combine(LineTubeRenderer.tubeLineBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) HSTubeLine(logisticspipes.pipes.tubes.HSTubeLine) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) HashMap(java.util.HashMap) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) ArrayList(java.util.ArrayList) Objects(java.util.Objects) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Map(java.util.Map) TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation) ResourceLocation(net.minecraft.util.ResourceLocation) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) LPScale(logisticspipes.proxy.object3d.operation.LPScale) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) Collections(java.util.Collections) Nonnull(javax.annotation.Nonnull) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) TubeLineRenderOrientation(logisticspipes.pipes.tubes.HSTubeLine.TubeLineRenderOrientation) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 4 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class CurveTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Turn_result.obj"), 7, new LPScale(1 / 100f));
        // tubeTurnMounts
        for (TurnDirection turn : TurnDirection.values()) {
            CurveTubeRenderer.tubeTurnBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Lane ") || entry.getKey().contains(" Lane ") || entry.getKey().endsWith(" Lane")).forEach(entry -> {
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.SOUTH_WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.EAST_SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 1.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            CurveTubeRenderer.tubeTurnBase.get(TurnDirection.WEST_NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 0.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Lanes. Only loaded " + CurveTubeRenderer.tubeTurnBase.get(TurnDirection.NORTH_EAST).size());
        }
        for (TurnDirection turn : TurnDirection.values()) {
            CurveTubeRenderer.tubeCurve.put(turn, SimpleServiceLocator.cclProxy.combine(CurveTubeRenderer.tubeTurnBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) LogisticsPipes(logisticspipes.LogisticsPipes) HSTubeCurve(logisticspipes.pipes.tubes.HSTubeCurve) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) HashMap(java.util.HashMap) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) ArrayList(java.util.ArrayList) Objects(java.util.Objects) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) Map(java.util.Map) Pair(logisticspipes.utils.tuples.Pair) ResourceLocation(net.minecraft.util.ResourceLocation) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) TurnDirection(logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection) LPScale(logisticspipes.proxy.object3d.operation.LPScale) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) Collections(java.util.Collections) Nonnull(javax.annotation.Nonnull) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) TurnDirection(logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 5 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class SpeedupTubeRenderer method loadModels.

public static void loadModels() {
    try {
        Map<String, IModel3D> pipePartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/HSTube-Speedup_result.obj"), 7, new LPScale(1 / 100f));
        // tubeTurnMounts
        for (SpeedupDirection turn : SpeedupDirection.values()) {
            SpeedupTubeRenderer.tubeSpeedupBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Side ") || entry.getKey().contains(" Side ") || entry.getKey().endsWith(" Side")).forEach(entry -> {
            SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
            SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.WEST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 1.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.SOUTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPTranslation(-1.0, 0.0, 0.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.NORTH).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Side. Only loaded " + SpeedupTubeRenderer.tubeSpeedupBase.get(SpeedupDirection.NORTH).size());
        }
        for (SpeedupDirection turn : SpeedupDirection.values()) {
            SpeedupTubeRenderer.tubeSpeedup.put(turn, SimpleServiceLocator.cclProxy.combine(SpeedupTubeRenderer.tubeSpeedupBase.get(turn)));
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LogisticsNewRenderPipe(logisticspipes.renderer.newpipe.LogisticsNewRenderPipe) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) HSTubeSpeedup(logisticspipes.pipes.tubes.HSTubeSpeedup) LogisticsPipes(logisticspipes.LogisticsPipes) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) HashMap(java.util.HashMap) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) ArrayList(java.util.ArrayList) Objects(java.util.Objects) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) ITubeRenderOrientation(logisticspipes.interfaces.ITubeRenderOrientation) Map(java.util.Map) ResourceLocation(net.minecraft.util.ResourceLocation) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) LPScale(logisticspipes.proxy.object3d.operation.LPScale) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) Collections(java.util.Collections) Nonnull(javax.annotation.Nonnull) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Aggregations

LogisticsPipes (logisticspipes.LogisticsPipes)7 IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)7 LPScale (logisticspipes.proxy.object3d.operation.LPScale)7 LPTranslation (logisticspipes.proxy.object3d.operation.LPTranslation)7 ArrayList (java.util.ArrayList)6 Collections (java.util.Collections)6 HashMap (java.util.HashMap)6 List (java.util.List)6 Map (java.util.Map)6 Nonnull (javax.annotation.Nonnull)6 ITubeOrientation (logisticspipes.interfaces.ITubeOrientation)6 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)6 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)6 LPColourMultiplier (logisticspipes.proxy.object3d.operation.LPColourMultiplier)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 Objects (java.util.Objects)5 LPRotation (logisticspipes.proxy.object3d.operation.LPRotation)5 IHighlightPlacementRenderer (logisticspipes.renderer.newpipe.IHighlightPlacementRenderer)5 ISpecialPipeRenderer (logisticspipes.renderer.newpipe.ISpecialPipeRenderer)5 LogisticsNewRenderPipe (logisticspipes.renderer.newpipe.LogisticsNewRenderPipe)5