Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth AOTE #963

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0921dd3
init commit
olim88 Aug 20, 2024
ee3707a
add setting and base teleport time on ping
olim88 Aug 20, 2024
be16f78
add settings for each wepon type and work with each of them
olim88 Aug 22, 2024
a4f885f
add raycast
olim88 Aug 26, 2024
f80becd
cheak the players mana before assuming they can teleport
olim88 Aug 27, 2024
f204392
remove un needed setting
olim88 Aug 27, 2024
b82c18b
add java docs and 3rd person check
olim88 Aug 27, 2024
6615a46
clean
olim88 Aug 28, 2024
24a6898
fix 3rd person check
olim88 Aug 28, 2024
3b2123e
apply suggested changes
olim88 Aug 29, 2024
6b443c0
do not allow when invalid location
olim88 Aug 29, 2024
4f0431d
fix etherwarp logic using wrong tp
olim88 Aug 29, 2024
8c5232c
add tooltips to options
olim88 Aug 29, 2024
dbb3b66
fix : click too fast cause the animation break
olim88 Aug 29, 2024
fbfaec0
fix mixin
viciscat Aug 29, 2024
af8a40c
add more disabled locations and fix for not coded disabled locations
olim88 Aug 29, 2024
7daca34
improve raycast to be more like hypxiels
olim88 Aug 30, 2024
03ad743
add separate cameraStartPos to try and smooth combined animations
olim88 Aug 30, 2024
afcdd33
fix extra code
olim88 Aug 30, 2024
f81386a
fix not working when clicking dirt with shovel
olim88 Aug 30, 2024
055f710
more clean
olim88 Aug 30, 2024
7924e1e
fix the init
olim88 Sep 4, 2024
a9f591e
fix multiple teleports when looking at a block
olim88 Sep 12, 2024
b6ed1a5
hopefully improve raycast and add allowed blocks
olim88 Sep 12, 2024
91bc404
do bad client side mana calculation
olim88 Sep 12, 2024
5e930dd
only don't check head pos on first block
olim88 Sep 12, 2024
0d59dab
improve head height test
olim88 Sep 13, 2024
61cf9fb
add close floor check
olim88 Sep 13, 2024
66fd33f
add can teleport though fire
olim88 Sep 13, 2024
6f1e967
add checking for diagonals
olim88 Sep 13, 2024
94d08a8
add new is floor check for the close floor check
olim88 Sep 13, 2024
68bb2a3
update allowed blocks and improve diagonal collision
olim88 Sep 13, 2024
4413d74
diagonals only work if its floor block
olim88 Sep 13, 2024
b1130e9
java docs
olim88 Sep 13, 2024
0e46709
remove debug
olim88 Sep 13, 2024
23f09cf
can teleport though pots
olim88 Sep 13, 2024
96abfd8
Update SmoothAOTE.java
olim88 Sep 14, 2024
48361f1
Apply suggestions from code review
kevinthegreat1 Sep 15, 2024
456ba1a
apply suggested changes
olim88 Sep 18, 2024
ea28405
add check to see if smoothing is enabled
olim88 Sep 29, 2024
466a2df
fix rebase
olim88 Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,53 @@ 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())
.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 @@ -55,6 +55,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 @@ -223,6 +226,24 @@ public static class TeleportOverlay {
public boolean enableWitherImpact = true;
}

public static class SmoothAOTE {

@SerialEntry
public boolean enableWeirdTransmission = true;

@SerialEntry
public boolean enableInstantTransmission = true;

@SerialEntry
public boolean enableEtherTransmission = true;

@SerialEntry
public boolean enableSinrecallTransmission = true;

@SerialEntry
public boolean enableWitherImpact = true;
}

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,15 +5,17 @@
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.crimson.slayer.FirePillarAnnouncer;
import de.hysky.skyblocker.skyblock.dungeon.DungeonScore;
import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonManager;
import de.hysky.skyblocker.skyblock.dwarven.WishingCompassSolver;
import de.hysky.skyblocker.skyblock.dwarven.CrystalsChestHighlighter;
import de.hysky.skyblocker.skyblock.dwarven.WishingCompassSolver;
import de.hysky.skyblocker.skyblock.end.EnderNodes;
import de.hysky.skyblocker.skyblock.end.TheEnd;
import de.hysky.skyblocker.skyblock.slayers.SlayerEntitiesGlow;
Expand Down Expand Up @@ -41,9 +43,9 @@ public abstract class ClientPlayNetworkHandlerMixin {
@Shadow
private ClientWorld world;

@Shadow
@Final
private static Logger LOGGER;
@Shadow
@Final
private static Logger LOGGER;

@Inject(method = "method_64896", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;removeEntity(ILnet/minecraft/entity/Entity$RemovalReason;)V"))
private void skyblocker$onItemDestroy(int entityId, CallbackInfo ci) {
Expand All @@ -52,87 +54,106 @@ public abstract class ClientPlayNetworkHandlerMixin {
}
}

@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);
return itemEntity;
}

@WrapWithCondition(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V", remap = false))
private boolean skyblocker$cancelEntityPassengersWarning(Logger instance, String msg) {
return !Utils.isOnHypixel();
}

@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelPlayerListWarning(Logger instance, String format, Object arg1, Object arg2) {
return !Utils.isOnHypixel();
}

@Inject(method = "onPlaySound", at = @At("RETURN"))
private void skyblocker$onPlaySound(PlaySoundS2CPacket packet, CallbackInfo ci) {
FishingHelper.onSound(packet);
CrystalsChestHighlighter.onSound(packet);
}

@WrapWithCondition(method = "warnOnUnknownPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$dropBadlionPacketWarnings(Logger instance, String message, Object identifier) {
return !(Utils.isOnHypixel() && ((Identifier) identifier).getNamespace().equals("badlion"));
}

@WrapWithCondition(method = {"onScoreboardScoreUpdate", "onScoreboardScoreReset"}, at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelUnknownScoreboardObjectiveWarnings(Logger instance, String message, Object objectiveName) {
return !Utils.isOnHypixel();
}

@WrapWithCondition(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelTeamWarning(Logger instance, String format, Object... arg) {
return !Utils.isOnHypixel();
}

@Inject(method = "onParticle", at = @At("RETURN"))
private void skyblocker$onParticle(ParticleS2CPacket packet, CallbackInfo ci) {
MythologicalRitual.onParticle(packet);
DojoManager.onParticle(packet);
CrystalsChestHighlighter.onParticle(packet);
EnderNodes.onParticle(packet);
WishingCompassSolver.onParticle(packet);
}

@ModifyExpressionValue(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/EntityStatusS2CPacket;getEntity(Lnet/minecraft/world/World;)Lnet/minecraft/entity/Entity;"))
private Entity skyblocker$onEntityDeath(Entity entity, @Local(argsOnly = true) EntityStatusS2CPacket packet) {
if (packet.getStatus() == EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES) {
DungeonScore.handleEntityDeath(entity);
TheEnd.onEntityDeath(entity);
SlayerEntitiesGlow.onEntityDeath(entity);
}
return entity;
}

@Inject(method = "onEntityTrackerUpdate", at = @At("TAIL"))
private void skyblocker$onEntityTrackerUpdate(EntityTrackerUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
if (!(entity instanceof ArmorStandEntity armorStandEntity)) return;

if (SkyblockerConfigManager.get().slayers.highlightMinis == SlayersConfig.HighlightSlayerEntities.GLOW && SlayerEntitiesGlow.isSlayerMiniMob(armorStandEntity)
|| SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW && SlayerEntitiesGlow.isSlayer(armorStandEntity)) {
if (armorStandEntity.isDead()) {
SlayerEntitiesGlow.cleanupArmorstand(armorStandEntity);
} else {
SlayerEntitiesGlow.setSlayerMobGlow(armorStandEntity);
}
}

if (SkyblockerConfigManager.get().slayers.blazeSlayer.firePillarCountdown != SlayersConfig.BlazeSlayer.FirePillar.OFF) FirePillarAnnouncer.checkFirePillar(entity);

EggFinder.checkIfEgg(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
} catch (Exception e) {
LOGGER.error("[Skyblocker Compact Damage] Failed to compact damage number", e);
}
}

@Inject(method = "onEntityEquipmentUpdate", at = @At(value = "TAIL"))
private void skyblocker$onEntityEquip(EntityEquipmentUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
EggFinder.checkIfEgg(entity);
}
@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);
return itemEntity;
}

@WrapWithCondition(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V", remap = false))
private boolean skyblocker$cancelEntityPassengersWarning(Logger instance, String msg) {
return !Utils.isOnHypixel();
}

@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelPlayerListWarning(Logger instance, String format, Object arg1, Object arg2) {
return !Utils.isOnHypixel();
}

@Inject(method = "onPlaySound", at = @At("RETURN"))
private void skyblocker$onPlaySound(PlaySoundS2CPacket packet, CallbackInfo ci) {
FishingHelper.onSound(packet);
CrystalsChestHighlighter.onSound(packet);
}

@WrapWithCondition(method = "warnOnUnknownPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$dropBadlionPacketWarnings(Logger instance, String message, Object identifier) {
return !(Utils.isOnHypixel() && ((Identifier) identifier).getNamespace().equals("badlion"));
}

@WrapWithCondition(method = {"onScoreboardScoreUpdate", "onScoreboardScoreReset"}, at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelUnknownScoreboardObjectiveWarnings(Logger instance, String message, Object objectiveName) {
return !Utils.isOnHypixel();
}

@WrapWithCondition(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelTeamWarning(Logger instance, String format, Object... arg) {
return !Utils.isOnHypixel();
}

@Inject(method = "onParticle", at = @At("RETURN"))
private void skyblocker$onParticle(ParticleS2CPacket packet, CallbackInfo ci) {
MythologicalRitual.onParticle(packet);
DojoManager.onParticle(packet);
CrystalsChestHighlighter.onParticle(packet);
EnderNodes.onParticle(packet);
WishingCompassSolver.onParticle(packet);
}

@ModifyExpressionValue(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/EntityStatusS2CPacket;getEntity(Lnet/minecraft/world/World;)Lnet/minecraft/entity/Entity;"))
private Entity skyblocker$onEntityDeath(Entity entity, @Local(argsOnly = true) EntityStatusS2CPacket packet) {
if (packet.getStatus() == EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES) {
DungeonScore.handleEntityDeath(entity);
TheEnd.onEntityDeath(entity);
SlayerEntitiesGlow.onEntityDeath(entity);
}
return entity;
}

@Inject(method = "onEntityTrackerUpdate", at = @At("TAIL"))
private void skyblocker$onEntityTrackerUpdate(EntityTrackerUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
if (!(entity instanceof ArmorStandEntity armorStandEntity)) return;

if (SkyblockerConfigManager.get().slayers.highlightMinis == SlayersConfig.HighlightSlayerEntities.GLOW && SlayerEntitiesGlow.isSlayerMiniMob(armorStandEntity)
|| SkyblockerConfigManager.get().slayers.highlightBosses == SlayersConfig.HighlightSlayerEntities.GLOW && SlayerEntitiesGlow.isSlayer(armorStandEntity)) {
if (armorStandEntity.isDead()) {
SlayerEntitiesGlow.cleanupArmorstand(armorStandEntity);
} else {
SlayerEntitiesGlow.setSlayerMobGlow(armorStandEntity);
}
}

if (SkyblockerConfigManager.get().slayers.blazeSlayer.firePillarCountdown != SlayersConfig.BlazeSlayer.FirePillar.OFF)
FirePillarAnnouncer.checkFirePillar(entity);

EggFinder.checkIfEgg(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
} catch (Exception e) {
LOGGER.error("[Skyblocker Compact Damage] Failed to compact damage number", e);
}
}

@Inject(method = "onEntityEquipmentUpdate", at = @At(value = "TAIL"))
private void skyblocker$onEntityEquip(EntityEquipmentUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
EggFinder.checkIfEgg(entity);
}

@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();
}

@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