Search in sources :

Example 6 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class LogisticsNewSolidBlockWorldRenderer method loadModels.

public static void loadModels() {
    if (!SimpleServiceLocator.cclProxy.isActivated())
        return;
    try {
        Map<String, IModel3D> blockPartModels = SimpleServiceLocator.cclProxy.parseObjModels(LogisticsPipes.class.getResourceAsStream("/logisticspipes/models/BlockModel_result.obj"), 7, new LPScale(1 / 100f));
        LogisticsNewSolidBlockWorldRenderer.block = null;
        for (Entry<String, IModel3D> entry : blockPartModels.entrySet()) {
            if (entry.getKey().contains(" Block ")) {
                if (LogisticsNewSolidBlockWorldRenderer.block != null) {
                    throw new UnsupportedOperationException();
                }
                LogisticsNewSolidBlockWorldRenderer.block = LogisticsNewSolidBlockWorldRenderer.computeRotated(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0)));
            }
        }
        LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.clear();
        LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.clear();
        for (CoverSides side : CoverSides.values()) {
            String grp_Outer = "OutSide_" + side.getLetter();
            String grp_Inside = "Inside_" + side.getLetter();
            for (Entry<String, IModel3D> entry : blockPartModels.entrySet()) {
                if (entry.getKey().contains(" " + grp_Outer + " ")) {
                    LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.put(side, LogisticsNewSolidBlockWorldRenderer.computeRotated(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                }
                if (entry.getKey().contains(" " + grp_Inside + " ")) {
                    LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.put(side, LogisticsNewSolidBlockWorldRenderer.computeRotated(entry.getValue().backfacedCopy().apply(new LPTranslation(0.0, 0.0, 1.0))));
                }
            }
            if (LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side) == null) {
                throw new RuntimeException("Couldn't load OutSide " + side.name() + " (" + grp_Outer + ").");
            }
            if (LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.get(side) == null) {
                throw new RuntimeException("Couldn't load OutSide " + side.name() + " (" + grp_Outer + ").");
            }
        }
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 7 with LogisticsPipes

use of logisticspipes.LogisticsPipes in project LogisticsPipes by RS485.

the class SCurveTubeRenderer 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 (TurnSDirection turn : TurnSDirection.values()) {
            SCurveTubeRenderer.tubeSCurveBase.put(turn, new ArrayList<>());
        }
        pipePartModels.entrySet().stream().filter(entry -> entry.getKey().startsWith("Lane ") || entry.getKey().contains(" Lane ") || entry.getKey().endsWith(" Lane")).forEach(entry -> {
            SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.EAST).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPRotation(Math.PI / 2, 0, 0, 1)).apply(new LPTranslation(1.0, 0.0, 0.0)).apply(new LPRotation(-Math.PI / 2, 0, 1, 0))));
            SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.NORTH).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPRotation(Math.PI / 2, 0, 0, 1)).apply(new LPTranslation(1.0, 0.0, 1.0))));
            SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.EAST_INV).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPRotation(-Math.PI / 2, 0, 0, 1)).apply(new LPTranslation(-2.0, 1.0, 4.0)).apply(new LPRotation(Math.PI / 2, 0, 1, 0))));
            SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.NORTH_INV).add(LogisticsNewRenderPipe.compute(entry.getValue().twoFacedCopy().apply(new LPRotation(-Math.PI / 2, 0, 0, 1)).apply(new LPTranslation(-2.0, 1.0, 3.0)).apply(new LPRotation(Math.PI, 0, 1, 0))));
        });
        if (SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.NORTH).size() != 4) {
            throw new RuntimeException("Couldn't load Tube Lanes. Only loaded " + SCurveTubeRenderer.tubeSCurveBase.get(TurnSDirection.NORTH).size());
        }
        for (TurnSDirection turn : TurnSDirection.values()) {
            SCurveTubeRenderer.tubeSCurve.put(turn, SimpleServiceLocator.cclProxy.combine(SCurveTubeRenderer.tubeSCurveBase.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) HSTubeSCurve(logisticspipes.pipes.tubes.HSTubeSCurve) HashMap(java.util.HashMap) LPUVTranslation(logisticspipes.proxy.object3d.operation.LPUVTranslation) LPUVTransformationList(logisticspipes.proxy.object3d.operation.LPUVTransformationList) 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) TurnSDirection(logisticspipes.pipes.tubes.HSTubeSCurve.TurnSDirection) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) Vec3(net.minecraft.util.Vec3) LPColourMultiplier(logisticspipes.proxy.object3d.operation.LPColourMultiplier) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) AxisAlignedBB(net.minecraft.util.AxisAlignedBB) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) Collectors(java.util.stream.Collectors) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) Pair(logisticspipes.utils.tuples.Pair) Entry(java.util.Map.Entry) ResourceLocation(net.minecraft.util.ResourceLocation) LPScale(logisticspipes.proxy.object3d.operation.LPScale) LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) LPRotation(logisticspipes.proxy.object3d.operation.LPRotation) TurnSDirection(logisticspipes.pipes.tubes.HSTubeSCurve.TurnSDirection) LogisticsPipes(logisticspipes.LogisticsPipes) LPScale(logisticspipes.proxy.object3d.operation.LPScale)

Example 8 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) HSTubeSpeedup(logisticspipes.pipes.tubes.HSTubeSpeedup) LogisticsPipes(logisticspipes.LogisticsPipes) ITubeOrientation(logisticspipes.interfaces.ITubeOrientation) HashMap(java.util.HashMap) logisticspipes.proxy.object3d.operation(logisticspipes.proxy.object3d.operation) IHighlightPlacementRenderer(logisticspipes.renderer.newpipe.IHighlightPlacementRenderer) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection) List(java.util.List) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) Map(java.util.Map) Entry(java.util.Map.Entry) CoreUnroutedPipe(logisticspipes.pipes.basic.CoreUnroutedPipe) ResourceLocation(net.minecraft.util.ResourceLocation) ISpecialPipeRenderer(logisticspipes.renderer.newpipe.ISpecialPipeRenderer) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation) IModel3D(logisticspipes.proxy.object3d.interfaces.IModel3D) SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection) LogisticsPipes(logisticspipes.LogisticsPipes)

Aggregations

LogisticsPipes (logisticspipes.LogisticsPipes)8 ITubeOrientation (logisticspipes.interfaces.ITubeOrientation)7 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)7 IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)7 ResourceLocation (net.minecraft.util.ResourceLocation)7 Collectors (java.util.stream.Collectors)6 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)6 I3DOperation (logisticspipes.proxy.object3d.interfaces.I3DOperation)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 List (java.util.List)5 Map (java.util.Map)5 IHighlightPlacementRenderer (logisticspipes.renderer.newpipe.IHighlightPlacementRenderer)5 ISpecialPipeRenderer (logisticspipes.renderer.newpipe.ISpecialPipeRenderer)5 LogisticsNewRenderPipe (logisticspipes.renderer.newpipe.LogisticsNewRenderPipe)5 RenderEntry (logisticspipes.renderer.newpipe.RenderEntry)5 Entry (java.util.Map.Entry)4 LPScale (logisticspipes.proxy.object3d.operation.LPScale)4 LPTranslation (logisticspipes.proxy.object3d.operation.LPTranslation)4 IBounds (logisticspipes.proxy.object3d.interfaces.IBounds)3