Skip to content

Commit

Permalink
Merge pull request #7 from JustaSqu1d/main
Browse files Browse the repository at this point in the history
feat: camera movement smoothing
  • Loading branch information
MarvionKirito authored Mar 29, 2023
2 parents 22bad21 + 7567dce commit 067222e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/adris/altoclef/AltoClef.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ private void initializeBaritoneSettings() {
// Water bucket placement will be handled by us exclusively
getExtraBaritoneSettings().configurePlaceBucketButDontFall(true);

// For render smoothing
getClientBaritoneSettings().randomLooking.value = 0.0;
getClientBaritoneSettings().randomLooking113.value = 0.0;

// Give baritone more time to calculate paths. Sometimes they can be really far away.
// Was: 2000L
getClientBaritoneSettings().failureTimeoutMS.reset();
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/adris/altoclef/mixins/MixinLocalPlayer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package adris.altoclef.mixins;

import com.mojang.authlib.GameProfile;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.network.encryption.PlayerPublicKey;
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.CallbackInfoReturnable;

@Mixin(ClientPlayerEntity.class)
public abstract class MixinLocalPlayer extends AbstractClientPlayerEntity {

public MixinLocalPlayer(ClientWorld world, GameProfile profile, PlayerPublicKey publicKey) {
super(world, profile);
}

@Inject(method = "getPitch", at = @At("RETURN"), cancellable = true)
public void getPitch(float tickDelta, CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(super.getPitch(tickDelta));
}

@Inject(method = "getYaw", at = @At("RETURN"), cancellable = true)
public void getYaw(float tickDelta, CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(super.getYaw(tickDelta));
}
}
1 change: 1 addition & 0 deletions src/main/resources/altoclef.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ClientTickMixin",
"EntryMixin",
"LoadChunkMixin",
"MixinLocalPlayer",
"PlayerCollidesWithEntityMixin"
],
"injectors": {
Expand Down

0 comments on commit 067222e

Please sign in to comment.