Skip to content

Commit

Permalink
Fix #53
Browse files Browse the repository at this point in the history
Signed-off-by: TreyRuffy <[email protected]>
  • Loading branch information
TreyRuffy committed Dec 6, 2021
1 parent bd88bef commit c644c04
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 84 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import me.cominixo.betterf3.mixin.chunk.ChunkBuilderAccessor;
import me.cominixo.betterf3.mixin.chunk.ClientChunkManagerAccessor;
import me.cominixo.betterf3.mixin.chunk.ClientChunkMapAccessor;
import me.cominixo.betterf3.mixin.chunk.WorldRendererAccessor;
import me.cominixo.betterf3.utils.DebugLine;
import me.cominixo.betterf3.utils.Utils;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -71,16 +70,15 @@ public ChunksModule() {
*/
public void update(final MinecraftClient client) {

final WorldRendererAccessor worldRendererMixin = (WorldRendererAccessor) client.worldRenderer;
final int totalChunks;
if (worldRendererMixin.getChunks() == null) {
if (client.worldRenderer.chunks == null) {
totalChunks = 0;
} else {
totalChunks = worldRendererMixin.getChunks().chunks.length;
totalChunks = client.worldRenderer.chunks.chunks.length;
}
final int renderedChunks = worldRendererMixin.callGetCompletedChunkCount();
final int renderedChunks = client.worldRenderer.getCompletedChunkCount();

final ChunkBuilder chunkBuilder = worldRendererMixin.getChunkBuilder();
final ChunkBuilder chunkBuilder = client.worldRenderer.chunkBuilder;
final ChunkBuilderAccessor chunkBuilderAccessor = (ChunkBuilderAccessor) chunkBuilder;

if (client.world != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import java.util.Arrays;
import java.util.List;
import me.cominixo.betterf3.mixin.chunk.WorldRendererAccessor;
import me.cominixo.betterf3.utils.DebugLine;
import me.cominixo.betterf3.utils.Utils;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -55,13 +54,13 @@ public EntityModule() {
* @param client the Minecraft client
*/
public void update(final MinecraftClient client) {
final WorldRendererAccessor worldRendererMixin = (WorldRendererAccessor) client.worldRenderer;

assert client.worldRenderer.world != null;
final List<Text> entityValues =
Arrays.asList(Utils.styledText(I18n.translate("text.betterf3.line.rendered"), valueColor),
Utils.styledText(I18n.translate("text.betterf3.line.total"), this.totalColor),
Utils.styledText(worldRendererMixin.getRegularEntityCount(), valueColor),
Utils.styledText(worldRendererMixin.getWorld().getRegularEntityCount(), this.totalColor));
Utils.styledText(client.worldRenderer.regularEntityCount, valueColor),
Utils.styledText(client.worldRenderer.world.getRegularEntityCount(), this.totalColor));

final IntegratedServer integratedServer = client.getServer();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.cominixo.betterf3.modules;

import me.cominixo.betterf3.mixin.chunk.WorldRendererAccessor;
import me.cominixo.betterf3.utils.DebugLine;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.ShaderEffect;
Expand Down Expand Up @@ -38,13 +37,12 @@ public GraphicsModule() {
* @param client the Minecraft client
*/
public void update(final MinecraftClient client) {
final WorldRendererAccessor worldRendererMixin = (WorldRendererAccessor) client.worldRenderer;

final String cloudString = client.options.cloudRenderMode == CloudRenderMode.OFF ? I18n.translate("text.betterf3.line.off")
: (client.options.cloudRenderMode == CloudRenderMode.FAST ? I18n.translate("text.betterf3.line.fast") : I18n.translate("text.betterf3.line.fancy") );

// Render Distance
lines.get(0).value(worldRendererMixin.getViewDistance());
lines.get(0).value(client.worldRenderer.viewDistance);
// Graphics
lines.get(1).value(StringUtils.capitalize(client.options.graphicsMode.toString()));
// Clouds
Expand Down
7 changes: 6 additions & 1 deletion common/src/main/resources/betterf3.accesswidener
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
accessWidener v1 named
accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMap
accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMap
accessible field net/minecraft/client/render/WorldRenderer viewDistance I
accessible field net/minecraft/client/render/WorldRenderer chunkBuilder Lnet/minecraft/client/render/chunk/ChunkBuilder;
accessible field net/minecraft/client/render/WorldRenderer world Lnet/minecraft/client/world/ClientWorld;
accessible field net/minecraft/client/render/WorldRenderer chunks Lnet/minecraft/client/render/BuiltChunkStorage;
accessible field net/minecraft/client/render/WorldRenderer regularEntityCount I
3 changes: 1 addition & 2 deletions common/src/main/resources/betterf3.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"KeyboardMixin",
"chunk.ChunkBuilderAccessor",
"chunk.ClientChunkManagerAccessor",
"chunk.ClientChunkMapAccessor",
"chunk.WorldRendererAccessor"
"chunk.ClientChunkMapAccessor"
]
}
7 changes: 6 additions & 1 deletion fabric/src/main/resources/betterf3.accesswidener
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
accessWidener v1 named
accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMap
accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMap
accessible field net/minecraft/client/render/WorldRenderer viewDistance I
accessible field net/minecraft/client/render/WorldRenderer chunkBuilder Lnet/minecraft/client/render/chunk/ChunkBuilder;
accessible field net/minecraft/client/render/WorldRenderer world Lnet/minecraft/client/world/ClientWorld;
accessible field net/minecraft/client/render/WorldRenderer chunks Lnet/minecraft/client/render/BuiltChunkStorage;
accessible field net/minecraft/client/render/WorldRenderer regularEntityCount I
7 changes: 6 additions & 1 deletion forge/src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Access Transformer which makes ClientChunkCache$Storage public
public net.minecraft.client.multiplayer.ClientChunkCache$Storage
public net.minecraft.client.multiplayer.ClientChunkCache$Storage
public net.minecraft.client.renderer.LevelRenderer f_109436_ # chunkRenderDispatcher
public net.minecraft.client.renderer.LevelRenderer f_109438_ # lastViewDistance
public net.minecraft.client.renderer.LevelRenderer f_109439_ # renderedEntities
public net.minecraft.client.renderer.LevelRenderer f_109469_ # viewArea
public net.minecraft.client.renderer.LevelRenderer f_109465_ # level
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.daemon=false
minecraft_version=1.18

archives_base_name=BetterF3
mod_version=1.2.1
mod_version=1.2.2
maven_group=me.treyruffy.betterf3

architectury_version=3.1.44
Expand Down

0 comments on commit c644c04

Please sign in to comment.