Search in sources :

Example 1 with TubeGainRenderOrientation

use of logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation 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)

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 HSTubeGain (logisticspipes.pipes.tubes.HSTubeGain)1 TubeGainRenderOrientation (logisticspipes.pipes.tubes.HSTubeGain.TubeGainRenderOrientation)1 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)1 IBounds (logisticspipes.proxy.object3d.interfaces.IBounds)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