Search in sources :

Example 1 with SpeedupDirection

use of logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection in project LogisticsPipes by RS485.

the class SpeedupTubeRenderer method renderToList.

@Override
public void renderToList(CoreUnroutedPipe pipe, List<RenderEntry> objectsToRender) {
    if (pipe instanceof HSTubeSpeedup) {
        HSTubeSpeedup tube = (HSTubeSpeedup) pipe;
        if (tube.getOrientation() != null) {
            SpeedupDirection speedupDirection = (SpeedupDirection) tube.getOrientation().getRenderOrientation();
            objectsToRender.addAll(SpeedupTubeRenderer.tubeSpeedupBase.get(speedupDirection).stream().map(model -> new RenderEntry(model, new I3DOperation[] { new LPUVTransformationList(new LPUVTranslation(0, 0)) }, SpeedupTubeRenderer.TEXTURE)).collect(Collectors.toList()));
        }
    }
}
Also used : SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection) HSTubeSpeedup(logisticspipes.pipes.tubes.HSTubeSpeedup) RenderEntry(logisticspipes.renderer.newpipe.RenderEntry) I3DOperation(logisticspipes.proxy.object3d.interfaces.I3DOperation)

Example 2 with SpeedupDirection

use of logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection in project LogisticsPipes by RS485.

the class SpeedupTubeRenderer method renderHighlight.

@Override
public void renderHighlight(ITubeOrientation orientation) {
    SpeedupDirection speedupDirection = (SpeedupDirection) orientation.getRenderOrientation();
    SpeedupTubeRenderer.tubeSpeedup.get(speedupDirection).copy().render(LPColourMultiplier.instance(0xFFFFFFFF));
    LogisticsNewRenderPipe.renderBoxWithDir(((SpeedupDirection) orientation.getRenderOrientation()).getDir1());
}
Also used : SpeedupDirection(logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection)

Example 3 with SpeedupDirection

use of logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection 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

SpeedupDirection (logisticspipes.pipes.tubes.HSTubeSpeedup.SpeedupDirection)3 HSTubeSpeedup (logisticspipes.pipes.tubes.HSTubeSpeedup)2 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 ITubeRenderOrientation (logisticspipes.interfaces.ITubeRenderOrientation)1 CoreUnroutedPipe (logisticspipes.pipes.basic.CoreUnroutedPipe)1 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)1 I3DOperation (logisticspipes.proxy.object3d.interfaces.I3DOperation)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