Search in sources :

Example 1 with FlywheelTileEntityAccess

use of com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess in project SteamPowered by TeamMoegMC.

the class CastIronFlywheelInstance method beginFrame.

@Override
public void beginFrame() {
    float partialTicks = AnimationTickHolder.getPartialTicks();
    // Mixin
    FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) tile;
    float speed = access.getVisualSpeed().get(partialTicks) * 3 / 10f;
    float angle = access.getAngle() + speed * partialTicks;
    if (Math.abs(angle - lastAngle) < 0.001)
        return;
    animate(angle);
    lastAngle = angle;
}
Also used : FlywheelTileEntityAccess(com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess)

Example 2 with FlywheelTileEntityAccess

use of com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess in project SteamPowered by TeamMoegMC.

the class SteelFlywheelRenderer method renderSafe.

protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
    super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
    if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
        BlockState blockState = te.getBlockState();
        FlywheelTileEntity wte = (FlywheelTileEntity) te;
        // Mixin starts
        FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) wte;
        float speed = access.getVisualSpeed().get(partialTicks) * 3.0F / 10.0F;
        float angle = access.getAngle() + speed * partialTicks;
        // Mixin ends
        IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
        if (FlywheelBlock.isConnected(blockState)) {
            Direction connection = FlywheelBlock.getConnection(blockState);
            light = WorldRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos().relative(connection));
            float rotation = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE ? -angle : angle;
            boolean flip = blockState.getValue(FlywheelBlock.CONNECTION) == FlywheelBlock.ConnectionState.LEFT;
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.STEEL_FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.STEEL_FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.STEEL_FLYWHEEL_UPPER_SLIDING, blockState), connection), true, false, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.STEEL_FLYWHEEL_LOWER_SLIDING, blockState), connection), false, false, rotation, flip).light(light).renderInto(ms, vb);
        }
        this.renderFlywheel(te, ms, light, blockState, angle, vb);
    }
}
Also used : FlywheelTileEntityAccess(com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess) BlockState(net.minecraft.block.BlockState) FlywheelTileEntity(com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity) Direction(net.minecraft.util.Direction) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Example 3 with FlywheelTileEntityAccess

use of com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess in project SteamPowered by TeamMoegMC.

the class BronzeFlywheelInstance method beginFrame.

@Override
public void beginFrame() {
    float partialTicks = AnimationTickHolder.getPartialTicks();
    // Mixin
    FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) tile;
    float speed = access.getVisualSpeed().get(partialTicks) * 3 / 10f;
    float angle = access.getAngle() + speed * partialTicks;
    if (Math.abs(angle - lastAngle) < 0.001)
        return;
    animate(angle);
    lastAngle = angle;
}
Also used : FlywheelTileEntityAccess(com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess)

Example 4 with FlywheelTileEntityAccess

use of com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess in project SteamPowered by TeamMoegMC.

the class SteelFlywheelInstance method beginFrame.

@Override
public void beginFrame() {
    float partialTicks = AnimationTickHolder.getPartialTicks();
    // Mixin
    FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) tile;
    float speed = access.getVisualSpeed().get(partialTicks) * 3 / 10f;
    float angle = access.getAngle() + speed * partialTicks;
    if (Math.abs(angle - lastAngle) < 0.001)
        return;
    animate(angle);
    lastAngle = angle;
}
Also used : FlywheelTileEntityAccess(com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess)

Example 5 with FlywheelTileEntityAccess

use of com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess in project SteamPowered by TeamMoegMC.

the class BronzeFlywheelRenderer method renderSafe.

protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
    super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
    if (!Backend.getInstance().canUseInstancing(te.getLevel())) {
        BlockState blockState = te.getBlockState();
        FlywheelTileEntity wte = (FlywheelTileEntity) te;
        // Mixin starts
        FlywheelTileEntityAccess access = (FlywheelTileEntityAccess) wte;
        float speed = access.getVisualSpeed().get(partialTicks) * 3.0F / 10.0F;
        float angle = access.getAngle() + speed * partialTicks;
        // Mixin ends
        IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
        if (FlywheelBlock.isConnected(blockState)) {
            Direction connection = FlywheelBlock.getConnection(blockState);
            light = WorldRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos().relative(connection));
            float rotation = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE ? -angle : angle;
            boolean flip = blockState.getValue(FlywheelBlock.CONNECTION) == FlywheelBlock.ConnectionState.LEFT;
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState), connection), true, false, rotation, flip).light(light).renderInto(ms, vb);
            this.transformConnector(this.rotateToFacing(PartialBufferer.get(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState), connection), false, false, rotation, flip).light(light).renderInto(ms, vb);
        }
        this.renderFlywheel(te, ms, light, blockState, angle, vb);
    }
}
Also used : FlywheelTileEntityAccess(com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess) BlockState(net.minecraft.block.BlockState) FlywheelTileEntity(com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity) Direction(net.minecraft.util.Direction) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Aggregations

FlywheelTileEntityAccess (com.teammoeg.steampowered.mixin.FlywheelTileEntityAccess)6 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)3 FlywheelTileEntity (com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity)3 BlockState (net.minecraft.block.BlockState)3 Direction (net.minecraft.util.Direction)3