aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java3
-rw-r--r--src/main/java/com/dulkirfabric/mixin/io/KeyboardMixin.java (renamed from src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java)2
-rw-r--r--src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java (renamed from src/main/java/com/dulkirfabric/mixin/MouseMixin.java)2
-rw-r--r--src/main/java/com/dulkirfabric/mixin/io/SoundSystemMixin.java (renamed from src/main/java/com/dulkirfabric/mixin/SoundSystemMixin.java)2
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java2
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java (renamed from src/main/java/com/dulkirfabric/mixin/io/HandledScreenMixin.java)2
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java13
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java3
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java62
-rw-r--r--src/main/kotlin/com/dulkirfabric/Registrations.kt6
-rw-r--r--src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt5
-rw-r--r--src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt24
-rw-r--r--src/main/kotlin/com/dulkirfabric/events/HudRenderEvent.kt9
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/ArachneFeatures.kt2
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/CustomBlockOutline.kt2
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt2
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/RenderTest.kt8
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/chat/BridgeBotFormatter.kt35
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/render/AnimationPreset.kt (renamed from src/main/kotlin/com/dulkirfabric/util/AnimationPreset.kt)2
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/render/GlowingEntityInterface.kt (renamed from src/main/kotlin/com/dulkirfabric/util/GlowingEntityInterface.kt)6
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/render/HudRenderUtil.kt41
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/render/ItemChangeHandler.kt (renamed from src/main/kotlin/com/dulkirfabric/util/ItemChangeHandler.kt)2
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt (renamed from src/main/kotlin/com/dulkirfabric/util/WorldRenderUtils.kt)2
-rw-r--r--src/main/resources/dulkirmod-fabric.mixins.json8
-rw-r--r--src/main/resources/fabric.mod.json5
25 files changed, 142 insertions, 108 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java b/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java
index 5fdd7f5..7820bf3 100644
--- a/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/ItemStackMixin.java
@@ -1,6 +1,6 @@
package com.dulkirfabric.mixin;
-import com.dulkirfabric.util.ItemChangeHandler;
+import com.dulkirfabric.util.render.ItemChangeHandler;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
@@ -11,7 +11,6 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
diff --git a/src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java b/src/main/java/com/dulkirfabric/mixin/io/KeyboardMixin.java
index c2c5a45..47decc6 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/KeyboardMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/io/KeyboardMixin.java
@@ -1,4 +1,4 @@
-package com.dulkirfabric.mixin.render;
+package com.dulkirfabric.mixin.io;
import com.dulkirfabric.events.WorldKeyPressEvent;
import net.minecraft.client.Keyboard;
diff --git a/src/main/java/com/dulkirfabric/mixin/MouseMixin.java b/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java
index d86985d..76dd828 100644
--- a/src/main/java/com/dulkirfabric/mixin/MouseMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/io/MouseMixin.java
@@ -1,4 +1,4 @@
-package com.dulkirfabric.mixin;
+package com.dulkirfabric.mixin.io;
import com.dulkirfabric.features.InventoryScale;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
diff --git a/src/main/java/com/dulkirfabric/mixin/SoundSystemMixin.java b/src/main/java/com/dulkirfabric/mixin/io/SoundSystemMixin.java
index 3f4c0af..e28d133 100644
--- a/src/main/java/com/dulkirfabric/mixin/SoundSystemMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/io/SoundSystemMixin.java
@@ -1,4 +1,4 @@
-package com.dulkirfabric.mixin;
+package com.dulkirfabric.mixin.io;
import com.dulkirfabric.events.PlaySoundEvent;
import net.minecraft.client.sound.SoundInstance;
diff --git a/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java
index 79a71b2..958a1bf 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java
@@ -1,10 +1,8 @@
package com.dulkirfabric.mixin.render;
import com.dulkirfabric.config.DulkirConfig;
-import com.dulkirfabric.events.TooltipRenderChangeEvent;
import com.dulkirfabric.features.InventoryScale;
import com.dulkirfabric.features.TooltipImpl;
-import com.dulkirfabric.util.ItemChangeHandler;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.MinecraftClient;
diff --git a/src/main/java/com/dulkirfabric/mixin/io/HandledScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java
index dbf8dbd..97d9552 100644
--- a/src/main/java/com/dulkirfabric/mixin/io/HandledScreenMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java
@@ -1,4 +1,4 @@
-package com.dulkirfabric.mixin.io;
+package com.dulkirfabric.mixin.render;
import com.dulkirfabric.events.InventoryKeyPressEvent;
import com.dulkirfabric.events.SlotRenderEvent;
diff --git a/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java b/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java
index b615136..d375709 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/LivingEntityMixin.java
@@ -1,11 +1,8 @@
package com.dulkirfabric.mixin.render;
import com.dulkirfabric.config.DulkirConfig;
-import com.dulkirfabric.util.GlowingEntityInterface;
-import net.minecraft.client.MinecraftClient;
+import com.dulkirfabric.util.render.GlowingEntityInterface;
import net.minecraft.entity.LivingEntity;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -34,10 +31,9 @@ public class LivingEntityMixin implements GlowingEntityInterface {
private boolean shouldESP_DulkirMod;
@Override
- public void setDulkirEntityGlow(boolean shouldGlow, @NotNull Color glowColor, boolean shouldESP) {
+ public void setDulkirEntityGlow(boolean shouldGlow, @NotNull Color glowColor) {
this.shouldGlow_DulkirMod = shouldGlow;
this.glowColor_DulkirMod = glowColor;
- this.shouldESP_DulkirMod = shouldESP;
}
@Override
@@ -51,11 +47,6 @@ public class LivingEntityMixin implements GlowingEntityInterface {
return glowColor_DulkirMod;
}
- @Override
- public boolean shouldDulkirEntityESP() {
- return shouldESP_DulkirMod;
- }
-
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;tickNewAi()V",
shift = At.Shift.AFTER))
public void onWhatever(CallbackInfo ci) {
diff --git a/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java b/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java
index 13285e3..7535b67 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/MinecraftClientMixin.java
@@ -1,10 +1,9 @@
package com.dulkirfabric.mixin.render;
-import com.dulkirfabric.util.GlowingEntityInterface;
+import com.dulkirfabric.util.render.GlowingEntityInterface;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
diff --git a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java
index 03ffbd0..58558e0 100644
--- a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java
+++ b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java
@@ -1,42 +1,16 @@
package com.dulkirfabric.mixin.render;
-import com.dulkirfabric.util.GlowingEntityInterface;
+import com.dulkirfabric.util.render.GlowingEntityInterface;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gl.Framebuffer;
-import net.minecraft.client.gl.SimpleFramebuffer;
-import net.minecraft.client.render.*;
-import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.client.render.WorldRenderer;
import net.minecraft.entity.Entity;
-import org.jetbrains.annotations.Nullable;
-import org.joml.Matrix4f;
-import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-import static com.dulkirfabric.DulkirModFabric.mc;
@Mixin(WorldRenderer.class)
public class WorldRendererMixin {
- @Shadow
- private @Nullable Framebuffer entityOutlinesFramebuffer;
- @Shadow
- @Final
- public BufferBuilderStorage bufferBuilders;
- @Shadow @Final private MinecraftClient client;
- @Unique
- boolean shouldRenderOutlinesDirect = false;
-
- @Unique
- Framebuffer defaultEntityOutlineBuffer;
-
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lorg/joml/Matrix4f;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getTeamColorValue()I"))
public int getGlowColor(int existing, @Local Entity entity) {
@@ -48,36 +22,4 @@ public class WorldRendererMixin {
return existing;
}
- @Inject(method = "onResized", at = @At("HEAD"))
- public void onResized(int width, int height, CallbackInfo ci) {
- if (defaultEntityOutlineBuffer == null) {
- defaultEntityOutlineBuffer = new SimpleFramebuffer(width, height, true, false);
- defaultEntityOutlineBuffer.setClearColor(0, 0, 0, 0);
- } else {
- defaultEntityOutlineBuffer.resize(width, height, false);
- }
- }
-
- @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lorg/joml/Matrix4f;)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferBuilderStorage;getEntityVertexConsumers()Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;", shift = At.Shift.AFTER))
- public void saveDefaultBufferESP(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
- if (defaultEntityOutlineBuffer != null) {
- defaultEntityOutlineBuffer.copyDepthFrom(this.entityOutlinesFramebuffer);
- }
- }
-
- @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lorg/joml/Matrix4f;)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRenderDispatcher;shouldRender(Lnet/minecraft/entity/Entity;Lnet/minecraft/client/render/Frustum;DDD)Z"))
- public void setOutlineESP(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci, @Local Entity entity) {
- this.bufferBuilders.getEntityVertexConsumers().drawCurrentLayer();
- if (entity instanceof GlowingEntityInterface dEntity && dEntity.shouldDulkirEntityGlow() && !dEntity.shouldDulkirEntityESP()) {
- if (this.entityOutlinesFramebuffer != null)
- this.entityOutlinesFramebuffer.copyDepthFrom(mc.getFramebuffer());
- } else {
- // give esp back here
- if (this.entityOutlinesFramebuffer != null)
- this.entityOutlinesFramebuffer.copyDepthFrom(defaultEntityOutlineBuffer);
- }
- this.client.getFramebuffer().beginWrite(false);
- }
}
diff --git a/src/main/kotlin/com/dulkirfabric/Registrations.kt b/src/main/kotlin/com/dulkirfabric/Registrations.kt
index ffcf85f..04eb9d8 100644
--- a/src/main/kotlin/com/dulkirfabric/Registrations.kt
+++ b/src/main/kotlin/com/dulkirfabric/Registrations.kt
@@ -8,12 +8,14 @@ import com.dulkirfabric.events.chat.ModifyCommandEvent
import com.dulkirfabric.events.chat.OverlayReceivedEvent
import com.dulkirfabric.features.*
import com.dulkirfabric.features.chat.AbiPhoneDND
+import com.dulkirfabric.features.chat.BridgeBotFormatter
import com.dulkirfabric.util.TablistUtils
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents
import net.fabricmc.fabric.api.client.message.v1.ClientSendMessageEvents
+import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents
import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents
@@ -66,6 +68,7 @@ object Registrations {
EVENT_BUS.subscribe(CullExplosionParticles)
EVENT_BUS.subscribe(CooldownDisplays)
EVENT_BUS.subscribe(ArachneFeatures)
+ EVENT_BUS.subscribe(BridgeBotFormatter)
}
fun registerEvents() {
@@ -104,5 +107,8 @@ object Registrations {
ServerWorldEvents.LOAD.register { server, world ->
WorldLoadEvent(server, world).post()
}
+ HudRenderCallback.EVENT.register { context, delta ->
+ HudRenderEvent(context, delta).post()
+ }
}
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
index 34da0cb..39a9f11 100644
--- a/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
+++ b/src/main/kotlin/com/dulkirfabric/commands/AnimationCommand.kt
@@ -1,14 +1,11 @@
package com.dulkirfabric.commands
import com.dulkirfabric.config.DulkirConfig
-import com.dulkirfabric.util.AnimationPreset
+import com.dulkirfabric.util.render.AnimationPreset
import com.dulkirfabric.util.TextUtils
import com.google.gson.Gson
import com.mojang.brigadier.CommandDispatcher
-import com.mojang.brigadier.arguments.StringArgumentType
import com.mojang.brigadier.builder.LiteralArgumentBuilder
-import com.mojang.brigadier.builder.RequiredArgumentBuilder
-import me.shedaniel.autoconfig.ConfigData
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
import net.minecraft.command.CommandRegistryAccess
import java.awt.Toolkit
diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
index 2795668..06b19ad 100644
--- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
+++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
@@ -17,7 +17,7 @@ import com.dulkirfabric.DulkirModFabric.mc
import com.dulkirfabric.config.ConfigHelper.mkKeyField
import com.dulkirfabric.config.ConfigHelper.mkStringField
import com.dulkirfabric.config.ConfigHelper.mkToggle
-import com.dulkirfabric.util.AnimationPreset
+import com.dulkirfabric.util.render.AnimationPreset
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
import kotlinx.serialization.decodeFromString
@@ -169,7 +169,7 @@ class DulkirConfig {
)
animations.addEntry(
entryBuilder.startIntSlider(Text.literal("posY"), configOptions.animationPreset.posY, -150, 150)
- .setSaveConsumer { newValue -> configOptions.animationPreset.posZ = newValue }
+ .setSaveConsumer { newValue -> configOptions.animationPreset.posY = newValue }
.setDefaultValue(0)
.build()
)
@@ -219,6 +219,21 @@ class DulkirConfig {
.build()
)
+ val bridge = builder.getOrCreateCategory(Text.literal("Bridge Features"))
+
+ bridge.addEntry(
+ entryBuilder.mkToggle(Text.literal("Format Bridge Messages"), configOptions::bridgeFormatter)
+ )
+ bridge.addEntry(
+ entryBuilder.mkStringField(Text.literal("Bridge Bot IGN"), configOptions::bridgeBotName)
+ )
+ bridge.addEntry(
+ entryBuilder.startColorField(Text.literal("Bridge User Color"), configOptions.bridgeNameColor)
+ .setDefaultValue(Formatting.GOLD.colorValue!!)
+ .setSaveConsumer { newValue -> configOptions.bridgeNameColor = newValue }
+ .build()
+ )
+
builder.transparentBackground()
screen = builder.build()
}
@@ -246,7 +261,10 @@ class DulkirConfig {
var duraCooldown: Boolean = false,
var alarmTimeout: Int = 300,
var arachneKeeperWaypoints: Boolean = false,
- var arachneSpawnTimer: Boolean = false
+ var arachneSpawnTimer: Boolean = false,
+ var bridgeFormatter: Boolean = false,
+ var bridgeBotName: String = "Dilkur",
+ var bridgeNameColor: Int = Formatting.GOLD.colorValue!!
)
@Serializable
diff --git a/src/main/kotlin/com/dulkirfabric/events/HudRenderEvent.kt b/src/main/kotlin/com/dulkirfabric/events/HudRenderEvent.kt
new file mode 100644
index 0000000..51895ee
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/events/HudRenderEvent.kt
@@ -0,0 +1,9 @@
+package com.dulkirfabric.events
+
+import com.dulkirfabric.events.base.Event
+import net.minecraft.client.gui.DrawContext
+
+data class HudRenderEvent(
+ val context: DrawContext,
+ val delta: Float
+): Event()
diff --git a/src/main/kotlin/com/dulkirfabric/features/ArachneFeatures.kt b/src/main/kotlin/com/dulkirfabric/features/ArachneFeatures.kt
index be8ad51..695e610 100644
--- a/src/main/kotlin/com/dulkirfabric/features/ArachneFeatures.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/ArachneFeatures.kt
@@ -6,7 +6,7 @@ import com.dulkirfabric.events.chat.ChatReceivedEvent
import com.dulkirfabric.util.TablistUtils
import com.dulkirfabric.util.TextUtils
import com.dulkirfabric.util.TextUtils.unformattedString
-import com.dulkirfabric.util.WorldRenderUtils
+import com.dulkirfabric.util.render.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.text.Style
import net.minecraft.text.Text
diff --git a/src/main/kotlin/com/dulkirfabric/features/CustomBlockOutline.kt b/src/main/kotlin/com/dulkirfabric/features/CustomBlockOutline.kt
index df306e1..3aa3121 100644
--- a/src/main/kotlin/com/dulkirfabric/features/CustomBlockOutline.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/CustomBlockOutline.kt
@@ -3,7 +3,7 @@ package com.dulkirfabric.features
import com.dulkirfabric.config.DulkirConfig
import com.dulkirfabric.events.BlockOutlineEvent
import com.dulkirfabric.util.ColorUtil
-import com.dulkirfabric.util.WorldRenderUtils
+import com.dulkirfabric.util.render.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.util.math.Box
diff --git a/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt b/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt
index 9e8c75f..257a200 100644
--- a/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt
@@ -6,7 +6,7 @@ import com.dulkirfabric.events.WorldRenderLastEvent
import com.dulkirfabric.util.ScoreBoardUtils
import com.dulkirfabric.util.TablistUtils
import com.dulkirfabric.util.Utils
-import com.dulkirfabric.util.WorldRenderUtils
+import com.dulkirfabric.util.render.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.text.Style
import net.minecraft.text.Text
diff --git a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
index 4799e0c..3cc489d 100644
--- a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
@@ -2,8 +2,7 @@ package com.dulkirfabric.features
import com.dulkirfabric.events.EntityLoadEvent
import com.dulkirfabric.events.WorldRenderLastEvent
-import com.dulkirfabric.util.GlowingEntityInterface
-import com.dulkirfabric.util.WorldRenderUtils
+import com.dulkirfabric.util.render.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.text.Style
import net.minecraft.text.Text
@@ -23,11 +22,12 @@ object RenderTest {
// if (it is GlowingEntityInterface)
// it.setDulkirEntityGlow(true, Color(255, 255, 255, 255), Random(it.id).nextBoolean())
// }
+ //HudRenderUtil.drawTitle(event.context, Text.literal("Hello World!"))
}
@EventHandler
fun onLoadEnt(event: EntityLoadEvent) {
- if (event.entity !is GlowingEntityInterface) return
- event.entity.setDulkirEntityGlow(true, Color(0, 0, 255, 255),false)
+ //if (event.entity !is GlowingEntityInterface) return
+ //event.entity.setDulkirEntityGlow(true, Color(0, 0, 255, 255),false)
}
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/features/chat/BridgeBotFormatter.kt b/src/main/kotlin/com/dulkirfabric/features/chat/BridgeBotFormatter.kt
new file mode 100644
index 0000000..f956791
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/features/chat/BridgeBotFormatter.kt
@@ -0,0 +1,35 @@
+package com.dulkirfabric.features.chat
+
+import com.dulkirfabric.config.DulkirConfig
+import com.dulkirfabric.events.chat.ChatReceivedEvent
+import com.dulkirfabric.util.TextUtils
+import com.dulkirfabric.util.Utils
+import meteordevelopment.orbit.EventHandler
+import net.minecraft.text.Style
+import net.minecraft.text.Text
+import net.minecraft.util.Formatting
+
+object BridgeBotFormatter {
+ private val bridgeRegex: Regex = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9][[A-Z]+])?§f: ([^>]+)(?: >| »|:) (.+)".toRegex()
+
+ @EventHandler
+ fun onChat(event: ChatReceivedEvent) {
+ if (!DulkirConfig.configOptions.bridgeFormatter) return
+
+ val message = event.message.string
+ if (bridgeRegex matches message) {
+ val matchResult = bridgeRegex.find(message)
+ val (prefix, name, playerName) = matchResult!!.destructured
+ if (TextUtils.stripColorCodes(name).equals(DulkirConfig.configOptions.bridgeBotName, ignoreCase = true)) {
+ val newPrefix = if (prefix == "§2Guild") "§2Bridge" else "§3Bridge"
+ event.message.siblings[0] = Text.literal(
+ "$newPrefix > "
+ ).append(Text.literal(playerName).setStyle(Style.EMPTY.withColor(DulkirConfig.configOptions.bridgeNameColor)))
+ .append(": ")
+ event.message.siblings[1] = Text.literal(
+ event.message.siblings[1].string.replace("$playerName > ", "")
+ ).setStyle(event.message.siblings[1].style)
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/util/AnimationPreset.kt b/src/main/kotlin/com/dulkirfabric/util/render/AnimationPreset.kt
index 67f5b00..af4388b 100644
--- a/src/main/kotlin/com/dulkirfabric/util/AnimationPreset.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/render/AnimationPreset.kt
@@ -1,4 +1,4 @@
-package com.dulkirfabric.util
+package com.dulkirfabric.util.render
import kotlinx.serialization.Serializable
diff --git a/src/main/kotlin/com/dulkirfabric/util/GlowingEntityInterface.kt b/src/main/kotlin/com/dulkirfabric/util/render/GlowingEntityInterface.kt
index 9b129fd..3033d19 100644
--- a/src/main/kotlin/com/dulkirfabric/util/GlowingEntityInterface.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/render/GlowingEntityInterface.kt
@@ -1,13 +1,11 @@
-package com.dulkirfabric.util
+package com.dulkirfabric.util.render
import java.awt.Color
interface GlowingEntityInterface {
- fun setDulkirEntityGlow(shouldGlow: Boolean = false, glowColor: Color, shouldESP: Boolean = false)
+ fun setDulkirEntityGlow(shouldGlow: Boolean = false, glowColor: Color)
fun shouldDulkirEntityGlow() : Boolean
fun getDulkirEntityGlowColor() : Color?
-
- fun shouldDulkirEntityESP() : Boolean
} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/util/render/HudRenderUtil.kt b/src/main/kotlin/com/dulkirfabric/util/render/HudRenderUtil.kt
new file mode 100644
index 0000000..e055b60
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/util/render/HudRenderUtil.kt
@@ -0,0 +1,41 @@
+package com.dulkirfabric.util.render
+
+import com.dulkirfabric.DulkirModFabric.mc
+import com.dulkirfabric.events.HudRenderEvent
+import meteordevelopment.orbit.EventHandler
+import net.minecraft.client.gui.DrawContext
+import net.minecraft.text.Text
+import java.time.Duration
+
+object HudRenderUtil {
+
+ private var curTitle: Text? = null
+ private var clearTime: Long = -1
+
+ private fun drawTitle(context: DrawContext, content: Text) {
+ val matrices = context.matrices
+ val tr = mc.textRenderer
+ val w = tr.getWidth(content)
+ val sf: Float = mc.window.scaledWidth / w.toFloat() / 3
+ matrices.push()
+ matrices.translate(mc.window.scaledWidth / 3f, mc.window.scaledHeight / 2f, 0f)
+ matrices.scale(sf, sf, 1f)
+ context.drawText(tr, content, 0, -tr.fontHeight / 2, -1, true)
+ matrices.pop()
+ }
+
+ fun drawTitle(content: Text, duration: Duration) {
+ curTitle = content
+ clearTime = System.currentTimeMillis() + duration.toMillis()
+ }
+
+ @EventHandler
+ fun onHudRender(event: HudRenderEvent) {
+ val content = curTitle ?: return
+ if (System.currentTimeMillis() >= clearTime) {
+ curTitle = null
+ return
+ }
+ drawTitle(event.context, content)
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/util/ItemChangeHandler.kt b/src/main/kotlin/com/dulkirfabric/util/render/ItemChangeHandler.kt
index 7a98f7f..7f6193e 100644
--- a/src/main/kotlin/com/dulkirfabric/util/ItemChangeHandler.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/render/ItemChangeHandler.kt
@@ -1,4 +1,4 @@
-package com.dulkirfabric.util
+package com.dulkirfabric.util.render
import com.dulkirfabric.events.TooltipRenderChangeEvent
diff --git a/src/main/kotlin/com/dulkirfabric/util/WorldRenderUtils.kt b/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt
index c8ec492..ceb631d 100644
--- a/src/main/kotlin/com/dulkirfabric/util/WorldRenderUtils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt
@@ -1,4 +1,4 @@
-package com.dulkirfabric.util
+package com.dulkirfabric.util.render
import com.mojang.blaze3d.systems.RenderSystem
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext
diff --git a/src/main/resources/dulkirmod-fabric.mixins.json b/src/main/resources/dulkirmod-fabric.mixins.json
index dff1de2..1a8b3ff 100644
--- a/src/main/resources/dulkirmod-fabric.mixins.json
+++ b/src/main/resources/dulkirmod-fabric.mixins.json
@@ -6,16 +6,16 @@
"defaultRequire": 1
},
"client": [
- "MouseMixin",
- "SoundSystemMixin",
- "io.HandledScreenMixin",
+ "io.MouseMixin",
+ "io.SoundSystemMixin",
+ "render.HandledScreenMixin",
"render.AbstractInventoryScreenMixin",
"render.DrawContextMixin",
"render.GameMenuScreenMixin",
"render.GameRendererMixin",
"render.HeldItemRendererMixin",
"render.InGameHudMixin",
- "render.KeyboardMixin",
+ "io.KeyboardMixin",
"render.LoomScreenMixin",
"render.MinecraftClientMixin",
"render.ParticleManagerMixin",
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 3f6321d..c045783 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -16,7 +16,7 @@
},
"license": "MPL-2.0",
"icon": "assets/dulkirmod-fabric/icon.png",
- "environment": "*",
+ "environment": "client",
"entrypoints": {
"main": [
{
@@ -47,5 +47,6 @@
"Mod Menu": "https://modrinth.com/mod/modmenu",
"Puzzle": "https://www.midnightdust.eu/",
"Starlight": "https://www.curseforge.com/minecraft/mc-mods/starlight"
- }
+ },
+ "accessWidener" : "dulkirmod.accesswidener"
} \ No newline at end of file