+1
-1
@@ -36,7 +36,7 @@ import net.minecraft.client.render.RenderSetup;
|
||||
|
||||
Stonecutter rewrites inactive code into its own layout when switching versions (a single inactive line becomes `//code`), so write it that way to begin with, or run a switch and a reset before committing.
|
||||
|
||||
When a newer version leaves something out that an older one implements, keep the older version's code behind a condition and mark the newer branch with a `TODO`, rather than dropping it for every version. `WorldFeatureImpl.getWorldAge` and `SaturnScreenFabric.resize` are examples. Search for `TODO` to find what newer versions still lack.
|
||||
When a newer version leaves something out that an older one implements, keep the older version's code behind a condition and mark the newer branch with a `TODO`, rather than dropping it for every version. `NametagsMixin` and the panorama in `SaturnScreenFabric.render` are examples. Search for `TODO` to find what newer versions still lack (tracked in #30), and remove the condition once a version gap is fixed.
|
||||
|
||||
A whole class that only exists for some versions (such as `NametagsMixin`, which hooks a method that 1.21.9 changed) can keep an empty class body on the other versions. An empty mixin changes nothing, and it keeps the mixin configs the same for every version, since JSON can't hold version comments.
|
||||
|
||||
|
||||
@@ -31,10 +31,7 @@ public class WorldFeatureImpl implements WorldFeature {
|
||||
*/
|
||||
@Override
|
||||
public long getWorldAge() {
|
||||
//? if >=1.21.11 {
|
||||
// TODO: not implemented on 1.21.11 yet.
|
||||
return 0L;
|
||||
//?} else
|
||||
//return hasWorld() ? mc.world.getTime() : 0L;
|
||||
// World.getTime() was a shortcut for this, and 1.21.11 removed it.
|
||||
return hasWorld() ? mc.world.getLevelProperties().getTime() : 0L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,8 +115,8 @@ public class SaturnScreenFabric extends Screen implements ScreenProvider {
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(Click click, double offsetX, double offsetY) {
|
||||
// TODO: 1.21.8 passes the drag deltas; check whether offsetX/offsetY are the same on 1.21.9+.
|
||||
if (screen.mouseDragged(click.x(), click.y(), click.button(), 0.0, 0.0)) {
|
||||
// offsetX and offsetY are the drag deltas, as mouseDragged's deltaX and deltaY were before 1.21.9.
|
||||
if (screen.mouseDragged(click.x(), click.y(), click.button(), offsetX, offsetY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,13 @@ public class SaturnScreenFabric extends Screen implements ScreenProvider {
|
||||
}
|
||||
*///?}
|
||||
|
||||
// TODO: resize isn't hooked on 1.21.11 yet.
|
||||
//? if <1.21.11 {
|
||||
//? if >=1.21.11 {
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
screen.resize(width, height);
|
||||
super.resize(width, height);
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
public void resize(MinecraftClient client, int width, int height) {
|
||||
screen.resize(width, height);
|
||||
|
||||
@@ -40,16 +40,15 @@ public abstract class PlayerEntityRendererMixin
|
||||
this.addFeature(new CloakFeatureRenderer(this, ctx.getEquipmentModelLoader()));
|
||||
}
|
||||
|
||||
// Stores the SaturnPlayer in the render state and adds the role icon to the name. Render state
|
||||
// data only exists from 1.21.8.
|
||||
// TODO: 1.21.6 and 1.21.7 don't show the role icon in player names.
|
||||
// Adds the role icon to the player's name, and stores the SaturnPlayer in the render state for the
|
||||
// cloak and hat (Fabric API only has render state data from 1.21.8).
|
||||
//? if >=1.21.9 {
|
||||
@Inject(method = "updateRenderState", at = @At("TAIL"))
|
||||
public <A extends PlayerLikeEntity & ClientPlayerLikeEntity> void updateRenderState(
|
||||
A entity, PlayerEntityRenderState state, float f, CallbackInfo ci) {
|
||||
saturn$applyPlayer(entity, state);
|
||||
}
|
||||
//?} else if >=1.21.8 {
|
||||
//?} else {
|
||||
/*@Inject(method = "updateRenderState", at = @At("TAIL"))
|
||||
public void updateRenderState(
|
||||
AbstractClientPlayerEntity entity, PlayerEntityRenderState state, float f, CallbackInfo ci) {
|
||||
@@ -57,7 +56,6 @@ public abstract class PlayerEntityRendererMixin
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if >=1.21.8 {
|
||||
private void saturn$applyPlayer(Entity entity, PlayerEntityRenderState state) {
|
||||
if (entity == null) {
|
||||
return;
|
||||
@@ -65,6 +63,7 @@ public abstract class PlayerEntityRendererMixin
|
||||
|
||||
SaturnPlayer player = SaturnPlayer.get(entity.getUuid());
|
||||
|
||||
//? if >=1.21.8
|
||||
state.setData(SaturnRenderState.saturnDataKey, player);
|
||||
|
||||
if (player != null && state.displayName != null) {
|
||||
@@ -77,5 +76,4 @@ public abstract class PlayerEntityRendererMixin
|
||||
.append(state.displayName.copy());
|
||||
}
|
||||
}
|
||||
//?}
|
||||
}
|
||||
@@ -126,8 +126,9 @@ public abstract class SplashOverlayMixin {
|
||||
private void renderProgressBar(RenderScope scope, DrawContext context, int screenWidth, int screenHeight,
|
||||
int alpha) {
|
||||
int progressY = ((screenHeight - 5) / 2) + 25;
|
||||
// TODO: the loading bar's border isn't drawn on 1.21.9+ yet.
|
||||
//? if <1.21.9
|
||||
//? if >=1.21.9 {
|
||||
context.drawStrokedRectangle((screenWidth - 120) / 2, progressY, 120, 5, Theme.withAlpha(alpha, 0xFFFFFFFF));
|
||||
//?} else
|
||||
//context.drawBorder((screenWidth - 120) / 2, progressY, 120, 5, Theme.withAlpha(alpha, 0xFFFFFFFF));
|
||||
|
||||
int progressWidth = Math.min((int) (progress * 120), 120);
|
||||
|
||||
Reference in New Issue
Block a user