Skip to content

Commit

Permalink
Smooth AOTE (#963)
Browse files Browse the repository at this point in the history
* init commit

basics working just needs lots of polish

* add setting and base teleport time on ping

now constantly monitors ping and makes the teleport try to last as long as last ping packet recived

* add settings for each wepon type and work with each of them

* add raycast

add raycast so predicted camera can not go though walls.
could use improvement this is not how it is done exactly on hypixels side

* cheak the players mana before assuming they can teleport

* remove un needed setting

and update settings

* add java docs and 3rd person check

* clean

* fix 3rd person check

* apply suggested changes

* do not allow when invalid location

* fix etherwarp logic using wrong tp

* add tooltips to options

* fix : click too fast cause the animation break

adds counter for how many teleports ahead the player is to the server so receiving a teleport for an old use will not reset the camera

* fix mixin

* add more disabled locations and fix for not coded disabled locations

adds other suggested locations to disable but also a timer for if the go to long without the server teleporting them assuming that its disabled and not working until they are teleported again

* improve raycast to be more like hypxiels

still not the same but closer

* add separate cameraStartPos to try and smooth combined animations

* fix extra code

* fix not working when clicking dirt with shovel

* more clean

* fix the init

* fix multiple teleports when looking at a block

there is still debug stuff in this commit

* hopefully improve raycast and add allowed blocks

still debug stuff in

* do bad client side mana calculation

still debug

* only don't check head pos on first block

still debug

* improve head height test

still debug

* add close floor check

still debug

* add can teleport though fire

still debug

* add checking for diagonals

still in debug

* add new is floor check for the close floor check

still debug

* update allowed blocks and improve diagonal collision

still debug

* diagonals only work if its floor block

still debug

* java docs

* remove debug

* can teleport though pots

* Update SmoothAOTE.java

* Apply suggestions from code review

* apply suggested changes

* add check to see if smoothing is enabled

* fix rebase

* make the setting off by default

* fix some glitchyness with changing ping

by not updating the teleport duration while teleporting. this was causing the camera to jump if your ping changed mid teleport

* add option to smooth teleport more

give the user the option to let the annimation lag behind the game so it does not jump to the end

* Clean up ClientPlayNetworkHandlerMixin

* Fix camera flashing when animation finishes before server teleports player

---------

Co-authored-by: viciscat <51047087+viciscat@users.noreply.github.com>
Co-authored-by: Kevin <92656833+kevinthegreat1@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 22, 2025
1 parent ade16c2 commit 080aa30
Show file tree
Hide file tree
Showing 8 changed files with 625 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,61 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.build())
.build())

//Smooth AOTE
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.@Tooltip")))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableWeirdTransmission"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableWeirdTransmission.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.enableWeirdTransmission,
() -> config.uiAndVisuals.smoothAOTE.enableWeirdTransmission,
newValue -> config.uiAndVisuals.smoothAOTE.enableWeirdTransmission = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableInstantTransmission"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableInstantTransmission.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.enableInstantTransmission,
() -> config.uiAndVisuals.smoothAOTE.enableInstantTransmission,
newValue -> config.uiAndVisuals.smoothAOTE.enableInstantTransmission = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableEtherTransmission"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableEtherTransmission.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.enableEtherTransmission,
() -> config.uiAndVisuals.smoothAOTE.enableEtherTransmission,
newValue -> config.uiAndVisuals.smoothAOTE.enableEtherTransmission = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableSinrecallTransmission"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableSinrecallTransmission.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.enableSinrecallTransmission,
() -> config.uiAndVisuals.smoothAOTE.enableSinrecallTransmission,
newValue -> config.uiAndVisuals.smoothAOTE.enableSinrecallTransmission = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableWitherImpact"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.enableWitherImpact.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.enableWitherImpact,
() -> config.uiAndVisuals.smoothAOTE.enableWitherImpact,
newValue -> config.uiAndVisuals.smoothAOTE.enableWitherImpact = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Integer>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.maximumAddedLag"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.smoothAOTE.maximumAddedLag.@Tooltip")))
.binding(defaults.uiAndVisuals.smoothAOTE.maximumAddedLag,
() -> config.uiAndVisuals.smoothAOTE.maximumAddedLag,
newValue -> config.uiAndVisuals.smoothAOTE.maximumAddedLag = newValue)
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 500).step(1))
.build())
.build())

//Search overlay
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.searchOverlay"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public class UIAndVisualsConfig {
@SerialEntry
public TeleportOverlay teleportOverlay = new TeleportOverlay();

@SerialEntry
public SmoothAOTE smoothAOTE = new SmoothAOTE();

@SerialEntry
public SearchOverlay searchOverlay = new SearchOverlay();

Expand Down Expand Up @@ -328,6 +331,27 @@ public static class TeleportOverlay {
public boolean enableWitherImpact = true;
}

public static class SmoothAOTE {

@SerialEntry
public boolean enableWeirdTransmission = false;

@SerialEntry
public boolean enableInstantTransmission = false;

@SerialEntry
public boolean enableEtherTransmission = false;

@SerialEntry
public boolean enableSinrecallTransmission = false;

@SerialEntry
public boolean enableWitherImpact = false;

@SerialEntry
public int maximumAddedLag = 100;
}

public static class SearchOverlay {
@SerialEntry
public boolean enableBazaar = true;
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/de/hysky/skyblocker/mixins/CameraMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.hysky.skyblocker.mixins;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import de.hysky.skyblocker.skyblock.SmoothAOTE;
import net.minecraft.client.render.Camera;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(Camera.class)
public class CameraMixin {

@ModifyReturnValue(method = "getPos", at = @At("RETURN"))
private Vec3d skyblocker$onCameraUpdate(Vec3d original) {
Vec3d pos = SmoothAOTE.getInterpolatedPos();
if (pos != null) {
return pos;
}

return original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.llamalad7.mixinextras.sugar.Local;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.config.configs.SlayersConfig;
import de.hysky.skyblocker.config.configs.UIAndVisualsConfig;
import de.hysky.skyblocker.skyblock.CompactDamage;
import de.hysky.skyblocker.skyblock.FishingHelper;
import de.hysky.skyblocker.skyblock.SmoothAOTE;
import de.hysky.skyblocker.skyblock.chocolatefactory.EggFinder;
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.dungeon.DungeonScore;
Expand Down Expand Up @@ -40,6 +42,9 @@
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

/**
* All mixins in this file should be arranged in the order of the methods they inject into.
*/
@Mixin(ClientPlayNetworkHandler.class)
public abstract class ClientPlayNetworkHandlerMixin {
@Shadow
Expand Down Expand Up @@ -73,6 +78,12 @@ public abstract class ClientPlayNetworkHandlerMixin {
}
}

@Inject(method = "onPlayerPositionLook", at = @At("TAIL"))
private void onPlayerTeleported(PlayerPositionLookS2CPacket packet, CallbackInfo ci) {
//player has been teleported by the server tell the smooth AOTE this
SmoothAOTE.playerTeleported();
}

@ModifyVariable(method = "onItemPickupAnimation", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;removeEntity(ILnet/minecraft/entity/Entity$RemovalReason;)V", ordinal = 0))
private ItemEntity skyblocker$onItemPickup(ItemEntity itemEntity) {
DungeonManager.onItemPickup(itemEntity);
Expand Down Expand Up @@ -150,4 +161,15 @@ public abstract class ClientPlayNetworkHandlerMixin {
EnderNodes.onParticle(packet);
WishingCompassSolver.onParticle(packet);
}

@ModifyExpressionValue(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowPacketSizeAndPingCharts()Z"))
private boolean shouldShowPacketSizeAndPingCharts(boolean original) {
//make the f3+3 screen always send ping packets even when closed
//this is needed to make smooth AOTE work so check if its enabled
UIAndVisualsConfig.SmoothAOTE options = SkyblockerConfigManager.get().uiAndVisuals.smoothAOTE;
if (Utils.isOnSkyblock() && !SmoothAOTE.teleportDisabled && (options.enableWeirdTransmission || options.enableEtherTransmission || options.enableInstantTransmission || options.enableSinrecallTransmission || options.enableWitherImpact)) {
return true;
}
return original;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.hysky.skyblocker.mixins;

import de.hysky.skyblocker.skyblock.SmoothAOTE;
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.utils.Utils;
import net.minecraft.client.network.PingMeasurer;
Expand All @@ -15,6 +16,7 @@ public class PingMeasurerMixin {
if (Utils.isInCrimson()) {
DojoManager.onPingResult(ping);
}
SmoothAOTE.updatePing(ping);

return ping;
}
Expand Down
Loading

0 comments on commit 080aa30

Please sign in to comment.