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

Slayer System rework #1040

Merged
merged 53 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
8d04e75
Added Slayer HUD
7azeemm Nov 1, 2024
f6bae9a
Narrowen the startRiding method injection because it was failing
Emirlol Nov 1, 2024
6e5566c
Change instanceof checks to type equality check for better intellisense
Emirlol Nov 1, 2024
b43c951
Fix TITLE related crash
Emirlol Nov 1, 2024
c193e57
Fix filled outline glow
Emirlol Nov 1, 2024
aaff5d1
pattern changes
7azeemm Nov 4, 2024
3e616a2
Translation keys sorting
7azeemm Nov 4, 2024
f8c6aba
mixins
7azeemm Nov 6, 2024
a675a49
more mixins changes
7azeemm Nov 6, 2024
d8ca611
..
7azeemm Nov 6, 2024
4f4a15b
more translatable text
7azeemm Nov 6, 2024
f20de3f
compatible with Slayer XP Buff (Aatrox perk)
7azeemm Nov 8, 2024
3e7c0cb
fixed title spam
7azeemm Nov 8, 2024
56153e5
imporved logic
7azeemm Nov 8, 2024
9c2f335
Fixed BossBar bug
7azeemm Nov 9, 2024
db40df5
Fixed Vampire slayer entity not being highlighted
7azeemm Nov 9, 2024
ac49b76
HUD improvements
7azeemm Nov 9, 2024
9738100
..
7azeemm Nov 9, 2024
b1d3bcc
...
7azeemm Nov 9, 2024
043b4d2
Merge remote-tracking branch 'origin/master' into SlayerSystem
7azeemm Nov 28, 2024
b065811
resolved conflicts
7azeemm Nov 28, 2024
259af0a
Refactor slayer code
kevinthegreat1 Nov 28, 2024
f6b0b9a
Fix internationalization
kevinthegreat1 Nov 28, 2024
45090dd
Refactor slayer glow
kevinthegreat1 Nov 28, 2024
30fa725
Rewrite slayer detection
kevinthegreat1 Nov 29, 2024
4590250
Clean up
kevinthegreat1 Nov 29, 2024
d4f70f4
fixed some crashes so i could test it
7azeemm Nov 29, 2024
a640e0e
fixed mob detection
7azeemm Nov 29, 2024
9513bd9
refactor
7azeemm Nov 30, 2024
b13124d
fixed sound checks
7azeemm Nov 30, 2024
e83394c
LazerTimer rewrite
7azeemm Nov 30, 2024
859b6f1
..
7azeemm Nov 30, 2024
598fb46
more improvements
7azeemm Nov 30, 2024
6a4f8f7
Refactor guard clauses
kevinthegreat1 Dec 2, 2024
1773b4e
Refactor SlayerManager
kevinthegreat1 Dec 2, 2024
5ac7625
Merge branch 'master' into fork/7azeemm/SlayerSystem
kevinthegreat1 Dec 20, 2024
96df676
Clean up ClientPlayNetworkHandlerMixin
kevinthegreat1 Dec 20, 2024
27b38da
Update slayer hud
kevinthegreat1 Dec 20, 2024
e3af8ef
Make it actually compile...
kevinthegreat1 Dec 20, 2024
1b3c546
some changes
7azeemm Dec 20, 2024
f984ed1
locations
7azeemm Dec 20, 2024
659220c
fixed locations
7azeemm Dec 20, 2024
8af8d4c
changes
7azeemm Dec 20, 2024
ea9daf5
removed extended class
7azeemm Dec 20, 2024
de43bea
Inject after forceMainThread
kevinthegreat1 Dec 20, 2024
3a5af65
..
7azeemm Dec 20, 2024
7f0c1ee
small change
7azeemm Dec 21, 2024
3359ab6
bug fixes
7azeemm Dec 22, 2024
700b6f8
null check
7azeemm Dec 22, 2024
699d166
Fix slayer hud config screen
kevinthegreat1 Dec 23, 2024
8caf78c
tabs
kevinthegreat1 Dec 23, 2024
70f4ab1
Fix slayer hud enabled
kevinthegreat1 Dec 23, 2024
64ee6e1
Don't render everywhere
kevinthegreat1 Dec 23, 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 @@ -140,6 +140,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
TheEnd.eyes = 0;
})
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.otherLocations.end.muteEndermanSounds"))
.binding(defaults.otherLocations.end.muteEndermanSounds,
() -> config.otherLocations.end.muteEndermanSounds,
newValue -> config.otherLocations.end.muteEndermanSounds = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//Spider's Den
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import de.hysky.skyblocker.config.ConfigUtils;
import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.SlayersConfig;
import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import de.hysky.skyblocker.skyblock.slayers.hud.SlayerHudConfigScreen;
import dev.isxander.yacl3.api.*;
import dev.isxander.yacl3.api.controller.FloatFieldControllerBuilder;
import dev.isxander.yacl3.api.controller.IntegerFieldControllerBuilder;
import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;

public class SlayersCategory {
Expand Down Expand Up @@ -51,6 +50,47 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.slayers.displayBossbar = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.slayer.bossSpawnAlert"))
.description(OptionDescription.of(
Text.translatable("skyblocker.config.slayer.bossSpawnAlert.@Tooltip")))
.binding(defaults.slayers.bossSpawnAlert,
() -> config.slayers.bossSpawnAlert,
newValue -> config.slayers.bossSpawnAlert = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.slayer.minibossSpawnAlert"))
.description(OptionDescription.of(
Text.translatable("skyblocker.config.slayer.minibossSpawnAlert.@Tooltip")))
.binding(defaults.slayers.miniBossSpawnAlert,
() -> config.slayers.miniBossSpawnAlert,
newValue -> config.slayers.miniBossSpawnAlert = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.slayer.slainTime"))
.description(OptionDescription.of(
Text.translatable("skyblocker.config.slayer.slainTime.@Tooltip")))
.binding(defaults.slayers.slainTime,
() -> config.slayers.slainTime,
newValue -> config.slayers.slainTime = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.slayer.enableHud"))
.description(OptionDescription.of(
Text.translatable("skyblocker.config.slayer.enableHud.@Tooltip")))
.binding(defaults.slayers.slayerHud.enableHud,
() -> config.slayers.slayerHud.enableHud,
newValue -> config.slayers.slayerHud.enableHud = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(ButtonOption.createBuilder()
.name(Text.translatable("skyblocker.config.slayer.slayerHud"))
.text(Text.translatable("text.skyblocker.open"))
.action((screen, opt) -> MinecraftClient.getInstance().setScreen(new SlayerHudConfigScreen(screen)))
.build())

//Enderman Slayer
.group(OptionGroup.createBuilder()
Expand All @@ -77,6 +117,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.slayers.endermanSlayer.highlightNukekubiHeads = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.slayer.endermanSlayer.lazerTimer"))
.binding(defaults.slayers.endermanSlayer.lazerTimer,
() -> config.slayers.endermanSlayer.lazerTimer,
newValue -> config.slayers.endermanSlayer.lazerTimer = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//Vampire Slayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public static class TheEnd {
@SerialEntry
public boolean waypoint = true;

@SerialEntry
public boolean muteEndermanSounds = false;

@SerialEntry
public int x = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

public class SlayersConfig {
@SerialEntry
public HighlightSlayerEntities highlightMinis = HighlightSlayerEntities.OFF;
public HighlightSlayerEntities highlightMinis = HighlightSlayerEntities.GLOW;

@SerialEntry
public HighlightSlayerEntities highlightBosses = HighlightSlayerEntities.OFF;
public HighlightSlayerEntities highlightBosses = HighlightSlayerEntities.GLOW;

@SerialEntry
public boolean displayBossbar = true;
Expand All @@ -22,6 +22,18 @@ public String toString() {
}
}

@SerialEntry
public boolean bossSpawnAlert = true;

@SerialEntry
public boolean miniBossSpawnAlert = true;

@SerialEntry
public boolean slainTime = true;

@SerialEntry
public SlayerHud slayerHud = new SlayerHud();

@SerialEntry
public EndermanSlayer endermanSlayer = new EndermanSlayer();

Expand All @@ -31,6 +43,17 @@ public String toString() {
@SerialEntry
public BlazeSlayer blazeSlayer = new BlazeSlayer();

public static class SlayerHud {
@SerialEntry
public boolean enableHud = true;

@SerialEntry
public int x;

@SerialEntry
public int y;
}

public static class EndermanSlayer {
@SerialEntry
public boolean enableYangGlyphsNotification = true;
Expand All @@ -40,6 +63,9 @@ public static class EndermanSlayer {

@SerialEntry
public boolean highlightNukekubiHeads = true;

@SerialEntry
public boolean lazerTimer = true;
}

public static class VampireSlayer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import de.hysky.skyblocker.skyblock.FishingHelper;
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;
import de.hysky.skyblocker.skyblock.slayers.SlayerManager;
import de.hysky.skyblocker.skyblock.slayers.boss.demonlord.FirePillarAnnouncer;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.skyblock.waypoint.MythologicalRitual;
import de.hysky.skyblocker.utils.Utils;
Expand All @@ -27,6 +27,8 @@
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -42,22 +44,15 @@ public abstract class ClientPlayNetworkHandlerMixin {
@Shadow
private ClientWorld world;

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

@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);
}
}
SlayerManager.checkSlayerBoss(armorStandEntity);

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

Expand All @@ -70,29 +65,28 @@ public abstract class ClientPlayNetworkHandlerMixin {
}

@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) {
if (world.getEntityById(entityId) instanceof ItemEntity itemEntity) {
DungeonManager.onItemPickup(itemEntity);
}
}

@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();
}
private void skyblocker$onItemDestroy(int entityId, CallbackInfo ci) {
if (world.getEntityById(entityId) instanceof ItemEntity itemEntity) {
DungeonManager.onItemPickup(itemEntity);
}
}

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

@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;
}
Expand All @@ -107,38 +101,50 @@ public abstract class ClientPlayNetworkHandlerMixin {
PlayerListMgr.updateFooter(packet.footer());
}

@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);
}
@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(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER), cancellable = true)
private void skyblocker$onPlaySound(PlaySoundS2CPacket packet, CallbackInfo ci) {
FishingHelper.onSound(packet);
CrystalsChestHighlighter.onSound(packet);
SoundEvent sound = packet.getSound().value();

// Mute Enderman sounds in the End
if (Utils.isInTheEnd() && SkyblockerConfigManager.get().otherLocations.end.muteEndermanSounds) {
if (sound.id().equals(SoundEvents.ENTITY_ENDERMAN_AMBIENT.id()) ||
sound.id().equals(SoundEvents.ENTITY_ENDERMAN_DEATH.id()) ||
sound.id().equals(SoundEvents.ENTITY_ENDERMAN_HURT.id()) ||
sound.id().equals(SoundEvents.ENTITY_ENDERMAN_SCREAM.id()) ||
sound.id().equals(SoundEvents.ENTITY_ENDERMAN_STARE.id())) {
ci.cancel();
}
}
}

@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import de.hysky.skyblocker.skyblock.crimson.dojo.DojoManager;
import de.hysky.skyblocker.skyblock.dungeon.device.SimonSays;
import de.hysky.skyblocker.skyblock.dwarven.CrystalsChestHighlighter;
import de.hysky.skyblocker.skyblock.end.BeaconHighlighter;
import de.hysky.skyblocker.utils.SlayerUtils;
import de.hysky.skyblocker.skyblock.slayers.SlayerManager;
import de.hysky.skyblocker.skyblock.slayers.boss.voidgloom.BeaconHighlighter;
import de.hysky.skyblocker.utils.Utils;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
Expand All @@ -31,7 +31,7 @@ public class ClientWorldMixin {
DojoManager.onBlockUpdate(pos.toImmutable(), state);
} else if (Utils.isInCrystalHollows()) {
CrystalsChestHighlighter.onBlockUpdate(pos.toImmutable(), state);
} else if (Utils.isInTheEnd() && SlayerUtils.isInSlayer()) {
} else if (Utils.isInTheEnd() && SlayerManager.isBossSpawned()) {
BeaconHighlighter.beaconPositions.remove(pos);

if (state.isOf(Blocks.BEACON)) BeaconHighlighter.beaconPositions.add(pos.toImmutable());
Expand Down
Loading
Loading