Skip to content

Commit

Permalink
Restrict entity mouvement
Browse files Browse the repository at this point in the history
  • Loading branch information
cheyao committed Oct 31, 2024
1 parent 0ad8d6f commit 4b8c8f6
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 205,049 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.2
yarn_mappings=1.21.2+build.1
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7

# Fabric API
fabric_version=0.106.1+1.21.2
fabric_version=0.106.1+1.21.3

# Mod Properties
mod_version=1.0.0
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/com/cyao/PaperWorldGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraft.world.gen.chunk.*;
import net.minecraft.world.gen.noise.NoiseConfig;

import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

Expand Down Expand Up @@ -63,20 +62,13 @@ public CompletableFuture<Chunk> populateNoise(Blender blender, NoiseConfig noise
var19 = false;
} finally {
if (var19) {
Iterator var16 = set.iterator();

while(var16.hasNext()) {
ChunkSection chunkSection3 = (ChunkSection)var16.next();
for (ChunkSection chunkSection3 : set) {
chunkSection3.unlock();
}

}
}

Iterator var22 = set.iterator();

while(var22.hasNext()) {
ChunkSection chunkSection2 = (ChunkSection)var22.next();
for (ChunkSection chunkSection2 : set) {
chunkSection2.unlock();
}

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/cyao/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.cyao.mixin;


import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(Entity.class)
public abstract class EntityMixin {
@ModifyVariable(method = "setPos(DDD)V", at = @At("HEAD"), ordinal = 2, argsOnly = true)
private double clampPos(double z) {
// Positive is towards the camera, negative is away
return MathHelper.clamp(z, -1.0, 0.5);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/cyao/mixin/PlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class PlayerEntityMixin {
@ModifyArgs(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D", ordinal = 1))
private void clampArgs(Args args) {
args.set(1, -0.5);
args.set(1, -1.0);
args.set(2, 0.5);
}
}
Loading

0 comments on commit 4b8c8f6

Please sign in to comment.