Skip to content

Commit 6c9cdc0

Browse files
authored
Merge pull request #79 from moehreag/feat/sol/darkkronicle-bedwars-display
Port DarkKronicle's bedwars display
2 parents 7a9be2e + c1ab549 commit 6c9cdc0

File tree

343 files changed

+14690
-1659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

343 files changed

+14690
-1659
lines changed

1.16.5/src/main/java/io/github/axolotlclient/config/AxolotlClientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public class AxolotlClientConfig extends ConfigHolder {
6060
public final BooleanOption timeChangerEnabled = new BooleanOption("enabled", false);
6161
public final IntegerOption customTime = new IntegerOption("time", 0, 0, 24000);
6262
public final BooleanOption customSky = new BooleanOption("customSky", true);
63-
public final BooleanOption showSunMoon = new BooleanOption("showSunMoon", true);
6463
public final BooleanOption dynamicFOV = new BooleanOption("dynamicFov", true);
6564
public final BooleanOption fullBright = new BooleanOption("fullBright", false);
65+
public final BooleanOption removeVignette = new BooleanOption("removeVignette", false);
6666
public final BooleanOption lowFire = new BooleanOption("lowFire", false);
6767
public final BooleanOption lowShield = new BooleanOption("lowShield", false);
6868
public final ColorOption hitColor = new ColorOption("hitColor",
@@ -176,10 +176,10 @@ public void init() {
176176
general.addSubCategory(searchFilters);
177177

178178
rendering.add(customSky,
179-
showSunMoon,
180179
AxolotlClientConfigConfig.chromaSpeed,
181180
dynamicFOV,
182181
fullBright,
182+
removeVignette,
183183
lowFire,
184184
lowShield,
185185
hitColor,

1.16.5/src/main/java/io/github/axolotlclient/config/screen/CreditsScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ private void initCredits() {
167167
credits.add(new Credit("YakisikliBaran", "Turkish Translation"));
168168
credits.add(new Credit("TheKodeToad", "Contributor", "Motion Blur", "Freelook", "Zoom"));
169169
credits.add(new Credit("DragonEggBedrockBreaking", "Bugfixing", "Inspiration of new Features"));
170+
credits.add(new Credit("DarkKronicle", "Bedwars Overlay", "Author of KronHUD, the best HUD mod!"));
170171

171172
credits.add(new SpacerTitle("- - - - - - " + I18n.translate("other_people") + " - - - - - -"));
172173

173174
credits.add(new Credit("gart", "gartbin dev and host", "Image sharing help", "https://gart.sh"));
174-
credits.add(new Credit("DarkKronicle", "Author of KronHUD, the best HUD mod!"));
175175
credits.add(new Credit("AMereBagatelle", "Author of the excellent FabricSkyBoxes Mod"));
176176

177177
if (!externalModuleCredits.isEmpty()) {

1.16.5/src/main/java/io/github/axolotlclient/mixin/ChatHudMixin.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,40 @@
2222

2323
package io.github.axolotlclient.mixin;
2424

25-
import io.github.axolotlclient.modules.hypixel.autoboop.AutoBoop;
26-
import io.github.axolotlclient.modules.hypixel.autogg.AutoGG;
27-
import io.github.axolotlclient.modules.hypixel.autotip.AutoTip;
2825
import io.github.axolotlclient.modules.hypixel.nickhider.NickHider;
26+
import io.github.axolotlclient.util.events.Events;
27+
import io.github.axolotlclient.util.events.impl.ReceiveChatMessageEvent;
2928
import net.minecraft.client.gui.hud.ChatHud;
3029
import net.minecraft.text.Text;
3130
import org.spongepowered.asm.mixin.Mixin;
3231
import org.spongepowered.asm.mixin.injection.At;
3332
import org.spongepowered.asm.mixin.injection.Inject;
3433
import org.spongepowered.asm.mixin.injection.ModifyArg;
34+
import org.spongepowered.asm.mixin.injection.ModifyVariable;
3535
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3636

3737
@Mixin(ChatHud.class)
3838
public abstract class ChatHudMixin {
3939

40-
@Inject(method = "addMessage(Lnet/minecraft/text/Text;)V", at = @At("HEAD"), cancellable = true)
41-
public void axolotlclient$autoThings(Text message, CallbackInfo ci) {
42-
AutoGG.getInstance().onMessage(message);
43-
AutoBoop.getInstance().onMessage(message);
44-
45-
if (AutoTip.getInstance().onChatMessage(message)) {
40+
@Inject(method = "addMessage(Lnet/minecraft/text/Text;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;IIZ)V"), cancellable = true)
41+
public void axolotlclient$autoThings(Text message, int messageId, CallbackInfo ci) {
42+
if (message == null) {
4643
ci.cancel();
4744
}
4845
}
4946

47+
@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;I)V", at = @At("HEAD"), argsOnly = true)
48+
private Text axolotlclient$onChatMessage(Text message) {
49+
ReceiveChatMessageEvent event = new ReceiveChatMessageEvent(false, message.getString(), message);
50+
Events.RECEIVE_CHAT_MESSAGE_EVENT.invoker().invoke(event);
51+
if (event.isCancelled()) {
52+
return null;
53+
} else if (event.getNewMessage() != null) {
54+
return event.getNewMessage();
55+
}
56+
return message;
57+
}
58+
5059
@ModifyArg(method = "addMessage(Lnet/minecraft/text/Text;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;I)V"), index = 0)
5160
public Text axolotlclient$editChat(Text message) {
5261
return NickHider.getInstance().editMessage(message);

1.16.5/src/main/java/io/github/axolotlclient/mixin/EntityMixin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
import io.github.axolotlclient.modules.freelook.Freelook;
2626
import io.github.axolotlclient.modules.hypixel.skyblock.Skyblock;
27-
import io.github.axolotlclient.util.Hooks;
27+
import io.github.axolotlclient.util.events.Events;
28+
import io.github.axolotlclient.util.events.impl.PlayerDirectionChangeEvent;
2829
import net.minecraft.entity.Entity;
2930
import net.minecraft.util.math.MathHelper;
3031
import org.spongepowered.asm.mixin.Mixin;
@@ -54,7 +55,7 @@ public abstract class EntityMixin {
5455
float pitch = prevPitch + (float) (mouseDeltaY * .15);
5556
float yaw = prevYaw + (float) (mouseDeltaX * .15);
5657
pitch = MathHelper.clamp(pitch, -90.0F, 90.0F);
57-
Hooks.PLAYER_DIRECTION_CHANGE.invoker().onChange(prevPitch, prevYaw, pitch, yaw);
58+
Events.PLAYER_DIRECTION_CHANGE.invoker().invoke(new PlayerDirectionChangeEvent(prevPitch, prevYaw, pitch, yaw));
5859
}
5960

6061
@Shadow

1.16.5/src/main/java/io/github/axolotlclient/mixin/EntityRendererMixin.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import io.github.axolotlclient.AxolotlClient;
2626
import io.github.axolotlclient.modules.hypixel.HypixelAbstractionLayer;
27+
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
2728
import io.github.axolotlclient.modules.hypixel.levelhead.LevelHead;
2829
import net.minecraft.client.MinecraftClient;
2930
import net.minecraft.client.font.TextRenderer;
@@ -69,10 +70,24 @@ public abstract class EntityRendererMixin<T extends Entity> {
6970
CallbackInfo ci) {
7071
if (entity instanceof AbstractClientPlayerEntity) {
7172
if (MinecraftClient.getInstance().getCurrentServerEntry() != null
72-
&& MinecraftClient.getInstance().getCurrentServerEntry().address.contains("hypixel.net")) {
73-
if (HypixelAbstractionLayer.hasValidAPIKey() && LevelHead.getInstance().enabled.get()
74-
&& string.getString().contains(entity.getName().getString())) {
75-
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
73+
&& MinecraftClient.getInstance().getCurrentServerEntry().address.contains("hypixel.net")
74+
&& string.getString().contains(entity.getName().getString())) {
75+
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
76+
if (BedwarsMod.getInstance().isEnabled() &&
77+
BedwarsMod.getInstance().inGame() &&
78+
BedwarsMod.getInstance().bedwarsLevelHead.get()) {
79+
String text = BedwarsMod.getInstance().getGame().get().getLevelHead((AbstractClientPlayerEntity) entity);
80+
if (text != null) {
81+
float x = -textRenderer.getWidth(text) / 2F;
82+
float y = string.getString().contains("deadmau5") ? -20 : -10;
83+
84+
Matrix4f matrix4f = matrices.peek().getModel();
85+
MinecraftClient.getInstance().textRenderer.draw(text, x, y,
86+
LevelHead.getInstance().textColor.get().getAsInt(), AxolotlClient.CONFIG.useShadows.get(),
87+
matrix4f, vertexConsumers, false, LevelHead.getInstance().background.get() ? 127 : 0,
88+
light);
89+
}
90+
} else if (HypixelAbstractionLayer.hasValidAPIKey() && LevelHead.getInstance().enabled.get()) {
7691
String text = "Level: " + HypixelAbstractionLayer.getPlayerLevel(String.valueOf(entity.getUuid()), LevelHead.getInstance().mode.get());
7792

7893
float x = -textRenderer.getWidth(text) / 2F;

1.16.5/src/main/java/io/github/axolotlclient/mixin/InGameHudMixin.java

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,28 @@
2222

2323
package io.github.axolotlclient.mixin;
2424

25+
import io.github.axolotlclient.AxolotlClient;
2526
import io.github.axolotlclient.modules.hud.HudManager;
2627
import io.github.axolotlclient.modules.hud.gui.hud.PotionsHud;
2728
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.ActionBarHud;
2829
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.CrosshairHud;
2930
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.HotbarHUD;
3031
import io.github.axolotlclient.modules.hud.gui.hud.vanilla.ScoreboardHud;
32+
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
33+
import io.github.axolotlclient.util.events.Events;
34+
import io.github.axolotlclient.util.events.impl.ScoreboardRenderEvent;
3135
import net.minecraft.client.MinecraftClient;
3236
import net.minecraft.client.font.TextRenderer;
3337
import net.minecraft.client.gui.hud.InGameHud;
3438
import net.minecraft.client.util.math.MatrixStack;
39+
import net.minecraft.entity.Entity;
3540
import net.minecraft.scoreboard.ScoreboardObjective;
3641
import net.minecraft.text.StringVisitable;
3742
import net.minecraft.text.Text;
3843
import org.jetbrains.annotations.Nullable;
3944
import org.spongepowered.asm.mixin.Mixin;
4045
import org.spongepowered.asm.mixin.Shadow;
41-
import org.spongepowered.asm.mixin.injection.At;
42-
import org.spongepowered.asm.mixin.injection.Inject;
43-
import org.spongepowered.asm.mixin.injection.ModifyArgs;
44-
import org.spongepowered.asm.mixin.injection.Redirect;
46+
import org.spongepowered.asm.mixin.injection.*;
4547
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
4648
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
4749

@@ -89,7 +91,9 @@ public abstract class InGameHudMixin {
8991
@Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
9092
public void axolotlclient$renderScoreboard(MatrixStack matrices, ScoreboardObjective objective, CallbackInfo ci) {
9193
ScoreboardHud hud = (ScoreboardHud) HudManager.getInstance().get(ScoreboardHud.ID);
92-
if (hud != null && hud.isEnabled()) {
94+
ScoreboardRenderEvent event = new ScoreboardRenderEvent(objective);
95+
Events.SCOREBOARD_RENDER_EVENT.invoker().invoke(event);
96+
if (event.isCancelled() || hud.isEnabled()) {
9397
ci.cancel();
9498
}
9599
}
@@ -187,4 +191,40 @@ public abstract class InGameHudMixin {
187191
}
188192
return scaledWidth;
189193
}
194+
195+
@ModifyVariable(
196+
method = "renderStatusBars",
197+
at = @At(
198+
value = "STORE"
199+
),
200+
ordinal = 18
201+
)
202+
public int axolotlclient$displayHardcoreHearts(int offset) {
203+
boolean hardcore = BedwarsMod.getInstance().isEnabled() &&
204+
BedwarsMod.getInstance().inGame() && BedwarsMod.getInstance().hardcoreHearts.get() &&
205+
!BedwarsMod.getInstance().getGame().get().getSelf().isBed();
206+
return hardcore ? 5 : offset;
207+
}
208+
209+
@ModifyVariable(
210+
method = "renderStatusBars",
211+
at = @At(
212+
value = "STORE"
213+
), ordinal = 20
214+
)
215+
public int axolotlclient$dontHunger(int heartCount) {
216+
if (heartCount == 0 && BedwarsMod.getInstance().isEnabled() &&
217+
BedwarsMod.getInstance().inGame() &&
218+
!BedwarsMod.getInstance().showHunger.get()) {
219+
return 3;
220+
}
221+
return heartCount;
222+
}
223+
224+
@Inject(method = "renderVignetteOverlay", at = @At("HEAD"), cancellable = true)
225+
private void axolotlclient$removeVignette(Entity entity, CallbackInfo ci){
226+
if(AxolotlClient.CONFIG.removeVignette.get()){
227+
ci.cancel();
228+
}
229+
}
190230
}

1.16.5/src/main/java/io/github/axolotlclient/mixin/KeyBindMixin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
package io.github.axolotlclient.mixin;
2424

25-
import io.github.axolotlclient.util.Hooks;
25+
import io.github.axolotlclient.util.events.Events;
26+
import io.github.axolotlclient.util.events.impl.KeyBindChangeEvent;
27+
import io.github.axolotlclient.util.events.impl.KeyPressEvent;
2628
import net.minecraft.client.option.KeyBinding;
2729
import net.minecraft.client.util.InputUtil;
2830
import org.spongepowered.asm.mixin.Mixin;
@@ -35,13 +37,13 @@ public abstract class KeyBindMixin {
3537

3638
@Inject(method = "setBoundKey", at = @At("RETURN"))
3739
public void axolotlclient$boundKeySet(InputUtil.Key key, CallbackInfo ci) {
38-
Hooks.KEYBIND_CHANGE.invoker().setBoundKey(key);
40+
Events.KEYBIND_CHANGE.invoker().invoke(new KeyBindChangeEvent(key));
3941
}
4042

4143
@Inject(method = "setPressed", at = @At("RETURN"))
4244
public void axolotlclient$onPress(boolean pressed, CallbackInfo ci) {
4345
if (pressed) {
44-
Hooks.KEYBIND_PRESS.invoker().onPress((KeyBinding) ((Object) this));
46+
Events.KEY_PRESS.invoker().invoke(new KeyPressEvent((KeyBinding) ((Object) this)));
4547
}
4648
}
4749
}

1.16.5/src/main/java/io/github/axolotlclient/mixin/MinecraftClientMixin.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
import io.github.axolotlclient.modules.blur.MenuBlur;
2727
import io.github.axolotlclient.modules.rpc.DiscordRPC;
2828
import io.github.axolotlclient.util.NetworkHelper;
29+
import io.github.axolotlclient.util.events.Events;
30+
import io.github.axolotlclient.util.events.impl.WorldLoadEvent;
2931
import net.fabricmc.loader.api.FabricLoader;
3032
import net.minecraft.SharedConstants;
3133
import net.minecraft.client.MinecraftClient;
3234
import net.minecraft.client.RunArgs;
3335
import net.minecraft.client.gui.screen.Screen;
36+
import net.minecraft.client.world.ClientWorld;
3437
import org.spongepowered.asm.mixin.Mixin;
3538
import org.spongepowered.asm.mixin.injection.At;
3639
import org.spongepowered.asm.mixin.injection.Inject;
@@ -83,4 +86,9 @@ public abstract class MinecraftClientMixin {
8386
private void axolotlclient$noModdedSigns(CallbackInfoReturnable<Boolean> cir) {
8487
cir.setReturnValue(false);
8588
}
89+
90+
@Inject(method = "joinWorld", at = @At("HEAD"))
91+
private void axolotlclient$onWorldLoad(ClientWorld world, CallbackInfo ci) {
92+
Events.WORLD_LOAD_EVENT.invoker().invoke(new WorldLoadEvent(world));
93+
}
8694
}

1.16.5/src/main/java/io/github/axolotlclient/mixin/MouseMixin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import io.github.axolotlclient.modules.hud.HudManager;
2626
import io.github.axolotlclient.modules.scrollableTooltips.ScrollableTooltips;
2727
import io.github.axolotlclient.modules.zoom.Zoom;
28-
import io.github.axolotlclient.util.Hooks;
28+
import io.github.axolotlclient.util.events.Events;
29+
import io.github.axolotlclient.util.events.impl.MouseInputEvent;
2930
import net.minecraft.client.Mouse;
3031
import org.spongepowered.asm.mixin.Mixin;
3132
import org.spongepowered.asm.mixin.injection.At;
@@ -39,7 +40,7 @@ public abstract class MouseMixin {
3940
@Inject(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;setKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;Z)V"))
4041
private void axolotlclient$onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
4142
if (action == 1) {
42-
Hooks.MOUSE_INPUT.invoker().onMouseButton(window, button, action, mods);
43+
Events.MOUSE_INPUT.invoker().invoke(new MouseInputEvent(window, button, action, mods));
4344
}
4445
}
4546

1.16.5/src/main/java/io/github/axolotlclient/mixin/PlayerEntityMixin.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
import io.github.axolotlclient.modules.hud.HudManager;
2626
import io.github.axolotlclient.modules.hud.gui.hud.simple.ComboHud;
2727
import io.github.axolotlclient.modules.hud.gui.hud.simple.ReachHud;
28+
import io.github.axolotlclient.modules.hypixel.bedwars.BedwarsMod;
2829
import io.github.axolotlclient.modules.particles.Particles;
2930
import net.minecraft.client.MinecraftClient;
3031
import net.minecraft.entity.Entity;
3132
import net.minecraft.entity.EntityType;
33+
import net.minecraft.entity.LivingEntity;
3234
import net.minecraft.entity.damage.DamageSource;
3335
import net.minecraft.entity.player.PlayerEntity;
3436
import net.minecraft.particle.ParticleTypes;
@@ -40,9 +42,9 @@
4042
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
4143

4244
@Mixin(PlayerEntity.class)
43-
public abstract class PlayerEntityMixin extends Entity {
45+
public abstract class PlayerEntityMixin extends LivingEntity {
4446

45-
public PlayerEntityMixin(EntityType<?> entityType, World world) {
47+
protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World world) {
4648
super(entityType, world);
4749
}
4850

@@ -84,4 +86,12 @@ public PlayerEntityMixin(EntityType<?> entityType, World world) {
8486
comboHud.onEntityDamage(this);
8587
}
8688
}
89+
90+
@Override
91+
public int getArmor() {
92+
if (BedwarsMod.getInstance().isEnabled() && BedwarsMod.getInstance().inGame() && !BedwarsMod.getInstance().displayArmor.get()) {
93+
return 0;
94+
}
95+
return super.getArmor();
96+
}
8797
}

0 commit comments

Comments
 (0)