Skip to content

Commit

Permalink
Save
Browse files Browse the repository at this point in the history
  • Loading branch information
cheyao committed Oct 11, 2024
1 parent e9b5f65 commit 543f16f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/cyao/mixin/CameraMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cyao.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/cyao/mixin/ChunkMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.cyao.mixin;

import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
import net.minecraft.world.gen.noise.NoiseConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(NoiseChunkGenerator.class)
public class ChunkMixin {
@Inject(
method = "populateNoise(Lnet/minecraft/world/gen/chunk/Blender;Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/world/gen/noise/NoiseConfig;Lnet/minecraft/world/chunk/Chunk;II)Lnet/minecraft/world/chunk/Chunk;",
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ChunkPos;getStartZ()I"),
cancellable = true
)
private void injected(CallbackInfoReturnable<Chunk> cir) {
cir.cancel();
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/cyao/mixin/GameOptionsMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected Perspective thirdPerson(Perspective value) {
}

@Redirect(method = "getPerspective", at = @At(value = "FIELD", target = "Lnet/minecraft/client/option/GameOptions;perspective:Lnet/minecraft/client/option/Perspective;", opcode = Opcodes.GETFIELD))
private Perspective injected(GameOptions instance) {
private Perspective getPerspective(GameOptions instance) {
return Perspective.THIRD_PERSON_BACK;
}
}
8 changes: 0 additions & 8 deletions src/main/java/com/cyao/mixin/HUDMixin.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/2d-minecraft.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"mixins": [
"CameraMixin",
"GameOptionsMixin",
"HUDMixin"
"ChunkMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 543f16f

Please sign in to comment.