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;
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations