-
-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Freecam work with F3+G (chunk borders)
- Loading branch information
1 parent
67b8753
commit 3e1df83
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/meteordevelopment/meteorclient/mixin/ChunkBorderDebugRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). | ||
* Copyright (c) Meteor Development. | ||
*/ | ||
|
||
package meteordevelopment.meteorclient.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import meteordevelopment.meteorclient.systems.modules.render.Freecam; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.debug.ChunkBorderDebugRenderer; | ||
import net.minecraft.util.math.ChunkPos; | ||
import net.minecraft.util.math.ChunkSectionPos; | ||
import net.minecraft.util.math.MathHelper; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ChunkBorderDebugRenderer.class) | ||
public class ChunkBorderDebugRendererMixin { | ||
@Shadow | ||
@Final | ||
private MinecraftClient client; | ||
|
||
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getChunkPos()Lnet/minecraft/util/math/ChunkPos;")) | ||
private ChunkPos render$getChunkPos(ChunkPos chunkPos) { | ||
Freecam freecam = Modules.get().get(Freecam.class); | ||
if (!freecam.isActive()) return chunkPos; | ||
|
||
float delta = client.getTickDelta(); | ||
|
||
return new ChunkPos( | ||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getX(delta))), | ||
ChunkSectionPos.getSectionCoord(MathHelper.floor(freecam.getZ(delta))) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters