Search in sources :

Example 1 with TurnDirection

use of logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection 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)

Aggregations

ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Nonnull (javax.annotation.Nonnull)1 LogisticsPipes (logisticspipes.LogisticsPipes)1 ITubeOrientation (logisticspipes.interfaces.ITubeOrientation)1 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)1 HSTubeCurve (logisticspipes.pipes.tubes.HSTubeCurve)1 TurnDirection (logisticspipes.pipes.tubes.HSTubeCurve.TurnDirection)1 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)1 IModel3D (logisticspipes.proxy.object3d.interfaces.IModel3D)1 LPColourMultiplier (logisticspipes.proxy.object3d.operation.LPColourMultiplier)1 LPRotation (logisticspipes.proxy.object3d.operation.LPRotation)1 LPScale (logisticspipes.proxy.object3d.operation.LPScale)1 LPTranslation (logisticspipes.proxy.object3d.operation.LPTranslation)1 IHighlightPlacementRenderer (logisticspipes.renderer.newpipe.IHighlightPlacementRenderer)1 ISpecialPipeRenderer (logisticspipes.renderer.newpipe.ISpecialPipeRenderer)1