Skip to content

Commit

Permalink
Merge pull request #4 from olim88/smoothAOTE
Browse files Browse the repository at this point in the history
Smooth aote
  • Loading branch information
AC19970 authored Jan 15, 2025
2 parents 5ddf509 + 2e80c41 commit 08d4e72
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 08d4e72

Please sign in to comment.