From 6416c4ce61596c7f97ed7b72a8ebf2b6ab7d2572 Mon Sep 17 00:00:00 2001 From: udu3324 Date: Thu, 20 Jun 2024 19:15:06 -0500 Subject: [PATCH] downgrade --- src/main/java/com/udu3324/poinpow/mixin/ChatMixin.java | 4 ++-- src/main/java/com/udu3324/poinpow/utils/BlockChestAds.java | 6 ++---- .../java/com/udu3324/poinpow/utils/BlockLobbyMapAds.java | 6 ++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/udu3324/poinpow/mixin/ChatMixin.java b/src/main/java/com/udu3324/poinpow/mixin/ChatMixin.java index a9f5e13..d07aca0 100644 --- a/src/main/java/com/udu3324/poinpow/mixin/ChatMixin.java +++ b/src/main/java/com/udu3324/poinpow/mixin/ChatMixin.java @@ -45,8 +45,8 @@ private void onMessage(Text message, MessageSignatureData signature, MessageIndi ChatPhraseFilter.check(chat, ci); } - @Inject(method = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/gui/DrawContext;IIIZ)V", at = @At("RETURN"), cancellable = true) - private void onRender(DrawContext context, int currentTick, int mouseX, int mouseY, boolean focused, CallbackInfo ci) { + @Inject(method = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/gui/DrawContext;III)V", at = @At("RETURN"), cancellable = true) + private void onRender(DrawContext context, int currentTick, int mouseX, int mouseY, CallbackInfo ci) { MuteLobbyChat.check(); } } diff --git a/src/main/java/com/udu3324/poinpow/utils/BlockChestAds.java b/src/main/java/com/udu3324/poinpow/utils/BlockChestAds.java index ff0b21e..73fd72c 100644 --- a/src/main/java/com/udu3324/poinpow/utils/BlockChestAds.java +++ b/src/main/java/com/udu3324/poinpow/utils/BlockChestAds.java @@ -1,7 +1,6 @@ package com.udu3324.poinpow.utils; import com.udu3324.poinpow.Poinpow; -import net.minecraft.component.DataComponentTypes; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.screen.slot.Slot; @@ -14,6 +13,8 @@ public class BlockChestAds { public static String description = "This removes the ads in the compass server listing."; public static AtomicBoolean toggled = new AtomicBoolean(true); + private static final ItemStack item = Items.BLACK_STAINED_GLASS_PANE.getDefaultStack().setCustomName(Text.literal("")); + public static void check(Slot slot) { // return false if toggled off if (!toggled.get()) return; @@ -26,9 +27,6 @@ public static void check(Slot slot) { if (name.equals("Air")) return; if (name.contains("[AD]")) { - ItemStack item = Items.BLACK_STAINED_GLASS_PANE.getDefaultStack(); - item.set(DataComponentTypes.CUSTOM_NAME, Text.literal("")); - slot.setStack(item); } } diff --git a/src/main/java/com/udu3324/poinpow/utils/BlockLobbyMapAds.java b/src/main/java/com/udu3324/poinpow/utils/BlockLobbyMapAds.java index 3f80281..24a7464 100644 --- a/src/main/java/com/udu3324/poinpow/utils/BlockLobbyMapAds.java +++ b/src/main/java/com/udu3324/poinpow/utils/BlockLobbyMapAds.java @@ -3,7 +3,6 @@ import com.udu3324.poinpow.Poinpow; import com.udu3324.poinpow.api.Minehut; import net.minecraft.client.gui.hud.ClientBossBar; -import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.Entity; import net.minecraft.entity.decoration.ItemFrameEntity; import net.minecraft.item.ItemStack; @@ -21,6 +20,8 @@ public class BlockLobbyMapAds { public static AtomicBoolean toggled = new AtomicBoolean(true); + private static final ItemStack item = new ItemStack(Items.DIAMOND, 1).setCustomName(Text.of("Poinpow by udu3324")); + public static void block(Entity entity) { // return if toggled off (no need for bool) if (!toggled.get()) return; @@ -38,9 +39,6 @@ public static void block(Entity entity) { //Poinpow.log.info("Blocked: Lobby Map Ad (" + itemFrame.getBlockX() + ", " + itemFrame.getBlockY() + ", " + itemFrame.getBlockZ() + ")"); - ItemStack item = Items.DIAMOND.getDefaultStack(); - item.set(DataComponentTypes.CUSTOM_NAME, Text.literal("Poinpow by udu3324")); - itemFrame.setHeldItemStack(item); itemFrame.setRotation(1); }