diff --git a/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java index 5a8c6ac..1ab6c36 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/AbstractInventoryScreenMixin.java @@ -2,17 +2,17 @@ import com.dulkirfabric.config.DulkirConfig; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; +import net.minecraft.client.gui.screen.ingame.StatusEffectsDisplay; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(AbstractInventoryScreen.class) +@Mixin(StatusEffectsDisplay.class) public class AbstractInventoryScreenMixin { @Inject( - method = "drawStatusEffects", + method = "drawStatusEffects(Lnet/minecraft/client/gui/DrawContext;II)V", at = @At("HEAD"), cancellable = true ) diff --git a/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java index 48156bd..4188d9a 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java @@ -13,6 +13,7 @@ import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.client.gui.tooltip.TooltipPositioner; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.Identifier; import org.joml.Vector2ic; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -28,14 +29,15 @@ public class DrawContextMixin { @Shadow @Final private MatrixStack matrices; @WrapOperation( - method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/" + - "client/gui/tooltip/TooltipPositioner;)V", + method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;" + + "IILnet/minecraft/client/gui/tooltip/TooltipPositioner;Lnet/minecraft/util/Identifier;)V", at = @At( target = "Lnet/minecraft/client/gui/tooltip/TooltipPositioner;getPosition(IIIIII)Lorg/joml/Vector2ic;", value = "INVOKE" ) ) - public Vector2ic drawTooltip(TooltipPositioner positionerInstance, int sw, int sh, int mx, int my, int tw, int th, Operation operation) { + public Vector2ic drawTooltip(TooltipPositioner positionerInstance, int sw, int sh, int mx, int my, int tw, + int th, Operation operation) { Screen screen = MinecraftClient.getInstance().currentScreen; if (!(screen instanceof HandledScreen)) { return operation.call(positionerInstance, sw, sh, mx, my, tw, th); @@ -49,15 +51,16 @@ public Vector2ic drawTooltip(TooltipPositioner positionerInstance, int sw, int s } @Inject( - method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/" + - "minecraft/client/gui/tooltip/TooltipPositioner;)V", + method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;II" + + "Lnet/minecraft/client/gui/tooltip/TooltipPositioner;Lnet/minecraft/util/Identifier;)V", at = @At( target = "Lnet/minecraft/client/util/math/MatrixStack;push()V", value = "INVOKE", shift = At.Shift.AFTER ) ) - public void onPush(TextRenderer textRenderer, List components, int x, int y, TooltipPositioner positioner, CallbackInfo ci) { + public void onPush(TextRenderer textRenderer, List components, int x, int y, + TooltipPositioner positioner, Identifier texture, CallbackInfo ci) { if (MinecraftClient.getInstance().currentScreen instanceof HandledScreen) { TooltipImpl.INSTANCE.applyScale(matrices); } diff --git a/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java b/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java index 0bb3966..09b0a20 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/HandledScreenMixin.java @@ -1,16 +1,11 @@ package com.dulkirfabric.mixin.render; import com.dulkirfabric.events.InventoryKeyPressEvent; -import com.dulkirfabric.events.SlotRenderEvent; -import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.screen.slot.Slot; import org.spongepowered.asm.mixin.Mixin; 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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(HandledScreen.class) public class HandledScreenMixin { @@ -30,35 +25,4 @@ public void onKeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoR } } - /**@Inject(method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V", - at = @At("HEAD"), cancellable = true) - public void onMouseClickedSlot(Slot slot, int slotId, int button, SlotActionType actionType, CallbackInfo ci) { - if (IsSlotProtectedEvent.shouldBlockInteraction(slot)) { - ci.cancel(); - } - }*/ - - @Inject( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V", - shift = At.Shift.AFTER - ), - locals = LocalCapture.CAPTURE_FAILHARD - ) - public void onAfterDrawSlot(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci, - int i, int j, int k, Slot slot) { - SlotRenderEvent.After event = new SlotRenderEvent.After(context, slot, mouseX, mouseY, delta); - event.post(); - } - - @Inject( - method = "render", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - public void onBeforeDrawSlot(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci, int i, int j, int k, Slot slot) { - SlotRenderEvent.Before event = new SlotRenderEvent.Before(context, slot, mouseX, mouseY, delta); - event.post(); - } } diff --git a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java index ba7799f..301b316 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/HeldItemRendererMixin.java @@ -2,7 +2,6 @@ import com.dulkirfabric.config.DulkirConfig; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.ModifyReturnValue; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; @@ -12,7 +11,6 @@ import net.minecraft.util.Arm; import net.minecraft.util.Hand; import net.minecraft.util.math.RotationAxis; -import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -23,6 +21,7 @@ // SOURCE FOR A LOT OF THIS: https://github.com/cosrnic/smallviewmodel/blob/main/src/main/java/uk/cosrnic/smallviewmodel/mixin/MixinHeldItemRenderer.java @Mixin(HeldItemRenderer.class) public abstract class HeldItemRendererMixin { + @Shadow public abstract void resetEquipProgress(Hand hand); @Shadow private float equipProgressMainHand; @@ -35,10 +34,10 @@ public abstract class HeldItemRendererMixin { "MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At( value = "INVOKE", - target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft" + - "/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render" + - "/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack" + - ";Lnet/minecraft/client/render/VertexConsumerProvider;I)V" + target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(" + + "Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;" + + "Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;" + + "Lnet/minecraft/client/render/VertexConsumerProvider;I)V" ) ) public void onRenderHeldItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java index 54e5756..fcc8dc5 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/InGameHudMixin.java @@ -4,20 +4,15 @@ import com.dulkirfabric.util.Utils; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.LayeredDrawer; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.render.RenderTickCounter; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Final; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(InGameHud.class) @@ -35,7 +30,8 @@ public void onRenderStatusEffectOverlay(DrawContext context, RenderTickCounter t } @WrapWithCondition( - method = "method_55440", + method = "renderScoreboardSidebar(Lnet/minecraft/client/gui/DrawContext;" + + "Lnet/minecraft/scoreboard/ScoreboardObjective;)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;" + diff --git a/src/main/java/com/dulkirfabric/mixin/render/InGameOverlayRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/InGameOverlayRendererMixin.java index 8de24e6..0c0de48 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/InGameOverlayRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/InGameOverlayRendererMixin.java @@ -1,8 +1,8 @@ package com.dulkirfabric.mixin.render; import com.dulkirfabric.config.DulkirConfig; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.InGameOverlayRenderer; +import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.util.math.MatrixStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -17,7 +17,7 @@ public class InGameOverlayRendererMixin { at = @At("HEAD"), cancellable = true ) - private static void onFireOverlay(MinecraftClient client, MatrixStack matrices, CallbackInfo ci) { + private static void onFireOverlay(MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) { if (DulkirConfig.ConfigVars.getConfigOptions().getHideFireOverlay()) ci.cancel(); } diff --git a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java index 5926029..7c60e02 100644 --- a/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java +++ b/src/main/java/com/dulkirfabric/mixin/render/WorldRendererMixin.java @@ -12,7 +12,7 @@ public class WorldRendererMixin { @ModifyExpressionValue( - method = "render", + method = "renderEntities", at = @At( value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getTeamColorValue()I" diff --git a/src/main/kotlin/com/dulkirfabric/events/SlotRenderEvent.kt b/src/main/kotlin/com/dulkirfabric/events/SlotRenderEvent.kt deleted file mode 100644 index 3670998..0000000 --- a/src/main/kotlin/com/dulkirfabric/events/SlotRenderEvent.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.dulkirfabric.events - -import com.dulkirfabric.events.base.CancellableEvent -import net.minecraft.client.gui.DrawContext -import net.minecraft.screen.slot.Slot - -interface SlotRenderEvent { - val context: DrawContext - val slot: Slot - val mouseX: Int - val mouseY: Int - val delta: Float - - data class Before( - override val context: DrawContext, override val slot: Slot, - override val mouseX: Int, - override val mouseY: Int, - override val delta: Float - ) : CancellableEvent(), - SlotRenderEvent - - data class After( - override val context: DrawContext, override val slot: Slot, - override val mouseX: Int, - override val mouseY: Int, - override val delta: Float - ) : CancellableEvent(), - SlotRenderEvent -} \ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt b/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt index 3c3339a..8dced31 100644 --- a/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt +++ b/src/main/kotlin/com/dulkirfabric/features/filters/Lightning.kt @@ -1,11 +1,12 @@ package com.dulkirfabric.features.filters import com.dulkirfabric.config.DulkirConfig -import com.dulkirfabric.events.AddParticleEvent import com.dulkirfabric.events.EntityLoadEvent import com.dulkirfabric.util.Utils import meteordevelopment.orbit.EventHandler +import net.minecraft.entity.Entity import net.minecraft.entity.LightningEntity +import net.minecraft.world.event.GameEvent object Lightning { @EventHandler @@ -13,7 +14,8 @@ object Lightning { if (!DulkirConfig.configOptions.hideLightning) return if (!Utils.isInSkyblock()) return if (event.entity is LightningEntity) { - event.entity.kill() + event.entity.remove(Entity.RemovalReason.KILLED) + event.entity.emitGameEvent(GameEvent.ENTITY_DIE) } } } \ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt index 209bb59..6672c76 100644 --- a/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt +++ b/src/main/kotlin/com/dulkirfabric/features/slayer/Demonlord.kt @@ -11,9 +11,11 @@ import com.dulkirfabric.util.TextUtils import com.dulkirfabric.util.Utils.getInterpolatedPos import com.dulkirfabric.util.render.WorldRenderUtils import meteordevelopment.orbit.EventHandler +import net.minecraft.entity.Entity import net.minecraft.entity.decoration.ArmorStandEntity import net.minecraft.entity.projectile.SmallFireballEntity import net.minecraft.util.math.Box +import net.minecraft.world.event.GameEvent import java.awt.Color object Demonlord { @@ -75,7 +77,9 @@ object Demonlord { fun onEntityLoad(event: EntityLoadEvent) { if (!DulkirConfig.configOptions.cleanBlaze) return if (!inBoss) return - if (event.entity is SmallFireballEntity) - event.entity.kill() + if (event.entity is SmallFireballEntity) { + event.entity.remove(Entity.RemovalReason.KILLED) + event.entity.emitGameEvent(GameEvent.ENTITY_DIE) + } } } \ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt b/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt index 97432e1..d931f69 100644 --- a/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt +++ b/src/main/kotlin/com/dulkirfabric/util/render/WorldRenderUtils.kt @@ -1,10 +1,10 @@ package com.dulkirfabric.util.render -import com.dulkirfabric.DulkirModFabric.mc import com.mojang.blaze3d.systems.RenderSystem import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext import net.minecraft.client.MinecraftClient import net.minecraft.client.font.TextRenderer +import net.minecraft.client.gl.ShaderProgramKeys import net.minecraft.client.render.* import net.minecraft.client.util.math.MatrixStack import net.minecraft.text.Style @@ -63,7 +63,7 @@ object WorldRenderUtils { val matrices = context.matrixStack() ?: return matrices.push() val prevShader = RenderSystem.getShader() - RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram) + RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES) RenderSystem.disableBlend() RenderSystem.disableCull() // RenderSystem.defaultBlendFunc() @@ -107,7 +107,7 @@ object WorldRenderUtils { RenderSystem.setShaderColor( 1f, 1f, 1f, 1f ) - RenderSystem.setShader { prevShader } + RenderSystem.setShader(prevShader) RenderSystem.enableCull() matrices.pop() } @@ -120,7 +120,7 @@ object WorldRenderUtils { val matrices = context.matrixStack() ?: return matrices.push() val prevShader = RenderSystem.getShader() - RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram) + RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES) RenderSystem.disableBlend() RenderSystem.disableCull() // RenderSystem.defaultBlendFunc() @@ -148,7 +148,7 @@ object WorldRenderUtils { RenderSystem.setShaderColor( 1f, 1f, 1f, 1f ) - RenderSystem.setShader { prevShader } + RenderSystem.setShader(prevShader) RenderSystem.enableCull() matrices.pop() } @@ -161,7 +161,7 @@ object WorldRenderUtils { val matrices = context.matrixStack() ?: return matrices.push() val prevShader = RenderSystem.getShader() - RenderSystem.setShader(GameRenderer::getRenderTypeLinesProgram) + RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES) RenderSystem.disableBlend() RenderSystem.disableCull() // RenderSystem.defaultBlendFunc() @@ -193,7 +193,7 @@ object WorldRenderUtils { RenderSystem.setShaderColor( 1f, 1f, 1f, 1f ) - RenderSystem.setShader { prevShader } + RenderSystem.setShader(prevShader) RenderSystem.enableCull() matrices.pop() } @@ -357,7 +357,7 @@ object WorldRenderUtils { } else { RenderSystem.enableDepthTest() } - RenderSystem.setShader(GameRenderer::getPositionColorProgram) + RenderSystem.setShader(ShaderProgramKeys.POSITION_COLOR) RenderSystem.enableBlend() RenderSystem.defaultBlendFunc() @@ -366,7 +366,7 @@ object WorldRenderUtils { val buf = tes.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR) matrices.push() matrices.translate(x - context.camera().pos.x, y - context.camera().pos.y, z - context.camera().pos.z) - WorldRenderer.renderFilledBox(matrices, buf, 0.0, 0.0, 0.0, width, height, depth, + VertexRendering.drawFilledBox(matrices, buf, 0.0, 0.0, 0.0, width, height, depth, color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f) BufferRenderer.drawWithGlobalProgram(buf.end()) RenderSystem.enableDepthTest()