Skip to content

Commit

Permalink
remove usage of deprecated slider api, run all rendering as fancy, ap…
Browse files Browse the repository at this point in the history
…ply rounding in IntProperty#setFromProgress
  • Loading branch information
gliscowo committed Jan 14, 2023
1 parent 6e248ca commit 11dc6bc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.19.3
yarn_mappings=1.19.3+build.3
loader_version=0.14.11
# Mod Properties
mod_version=0.4.1
mod_version=0.4.2
maven_group=com.glisco
archives_base_name=isometric-renders
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public double progress() {
}

public void setFromProgress(double progress) {
this.value = (int) (this.min + progress * this.span);
this.value = (int) Math.round(this.min + progress * this.span);
this.invokeListeners();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ public static void drawIntoActiveFramebuffer(Renderable<?> renderable, float asp

IsometricRenders.beginRenderableDraw();

// Emit untransformed vertices
renderable.emitVertices(
new MatrixStack(),
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(),
tickDelta
);

// --> Draw
renderable.draw(modelViewStack.peek().getPositionMatrix());
RenderSystem.runAsFancy(() -> {
// Emit untransformed vertices
renderable.emitVertices(
new MatrixStack(),
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(),
tickDelta
);

// --> Draw
renderable.draw(modelViewStack.peek().getPositionMatrix());
});

IsometricRenders.endRenderableDraw();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public PropertySliderComponent(Sizing horizontalSizing, Text text, int scrollInc

this.message(s -> text);

this.onChanged(this.setting::setFromProgress);
this.onChanged().subscribe(this.setting::setFromProgress);
setting.listen((intSetting, integer) -> ((SliderWidgetInvoker) this).isometric$setValue(setting.progress()));
}

Expand Down

0 comments on commit 11dc6bc

Please sign in to comment.