From 4e4b514f801dc228618893e9b04e0cb6138c88a5 Mon Sep 17 00:00:00 2001 From: samolego <34912839+samolego@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:05:17 +0200 Subject: [PATCH] 1.20.2 Still haven't fixed storage presets --- build.gradle | 2 +- .../storage_memory/StorageMemoryPreset.java | 2 +- .../ACreativeModeInventoryScreen.java | 14 --------- ...monPacketListenerImpl_BrandRecognizer.java | 27 +++++++++++++++++ .../mixin/network/MClientPacketListener.java | 30 ++++--------------- .../mixin/screen/MCraftingScreen.java | 24 +++++---------- ... MAbstractContainerScreen_ArmorSlots.java} | 6 ++-- .../MAbstractContainerScreen.java | 15 +++++++--- .../fabric_client/network/PacketLimiter.java | 4 +-- .../fabric_client/render/ESPRender.java | 5 +--- .../render/TransparencyBuffer.java | 11 +++---- .../assets/clientstorage/lang/sl_si.json | 8 ++++- .../resources/clientstorage.accesswidener | 4 ++- .../main/resources/clientstorage.mixins.json | 4 +-- .../fabric_server/ServerStorageFabric.java | 8 +++-- gradle.properties | 8 ++--- gradle/wrapper/gradle-wrapper.properties | 4 ++- 17 files changed, 87 insertions(+), 89 deletions(-) delete mode 100644 fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/accessor/ACreativeModeInventoryScreen.java create mode 100644 fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientCommonPacketListenerImpl_BrandRecognizer.java rename fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/{MAbstractContainerScreen.java => MAbstractContainerScreen_ArmorSlots.java} (97%) diff --git a/build.gradle b/build.gradle index e9f6474..a32bcbd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' apply false + id 'fabric-loom' version '1.3-SNAPSHOT' apply false id 'org.quiltmc.quilt-mappings-on-loom' version '4.2.0' apply false id "com.modrinth.minotaur" version "2.+" apply false } diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/storage_memory/StorageMemoryPreset.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/storage_memory/StorageMemoryPreset.java index 91924dd..6f089aa 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/storage_memory/StorageMemoryPreset.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/config/storage_memory/StorageMemoryPreset.java @@ -72,7 +72,7 @@ public int hashCode() { @Override public String toString() { - return String.format("%s@%%s_%s", this.blockName, this.pos.toShortString(), BuiltInRegistries.BLOCK.getKey(this.block)); + return String.format("%s@%s_%s", this.blockName, this.pos.toShortString(), BuiltInRegistries.BLOCK.getKey(this.block)); } public String containerName() { diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/accessor/ACreativeModeInventoryScreen.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/accessor/ACreativeModeInventoryScreen.java deleted file mode 100644 index 0f5dd4e..0000000 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/accessor/ACreativeModeInventoryScreen.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.samo_lego.clientstorage.fabric_client.mixin.accessor; - -import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; -import net.minecraft.resources.ResourceLocation; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(CreativeModeInventoryScreen.class) -public interface ACreativeModeInventoryScreen { - @Accessor("CREATIVE_TABS_LOCATION") - static ResourceLocation CREATIVE_TABS_LOCATION() { - throw new AssertionError(); - } -} diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientCommonPacketListenerImpl_BrandRecognizer.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientCommonPacketListenerImpl_BrandRecognizer.java new file mode 100644 index 0000000..6ce653f --- /dev/null +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientCommonPacketListenerImpl_BrandRecognizer.java @@ -0,0 +1,27 @@ +package org.samo_lego.clientstorage.fabric_client.mixin.network; + +import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; +import org.samo_lego.clientstorage.fabric_client.network.PacketLimiter; +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(ClientCommonPacketListenerImpl.class) +public class MClientCommonPacketListenerImpl_BrandRecognizer { + + /** + * Tries to recognize server type from server brand packet. + * + * @param packet + * @param ci + */ + @Inject(method = "handleCustomPayload", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/telemetry/WorldSessionTelemetryManager;onServerBrandReceived(Ljava/lang/String;)V", + shift = At.Shift.BEFORE)) + private void onServerBrand(ClientboundCustomPayloadPacket packet, CallbackInfo ci) { + PacketLimiter.tryRecognizeServer(); + } +} diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientPacketListener.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientPacketListener.java index 5df9c80..5f1fd06 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientPacketListener.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/network/MClientPacketListener.java @@ -3,16 +3,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket; -import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket; import net.minecraft.network.protocol.game.ClientboundSoundPacket; import net.minecraft.world.inventory.MenuType; import org.samo_lego.clientstorage.fabric_client.casts.ICSPlayer; import org.samo_lego.clientstorage.fabric_client.event.ContainerDiscovery; -import org.samo_lego.clientstorage.fabric_client.network.PacketLimiter; -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; @@ -24,9 +20,6 @@ @Mixin(ClientPacketListener.class) public class MClientPacketListener { - @Shadow - @Final - private Minecraft minecraft; @Unique private boolean craftingScreen; @Unique @@ -44,7 +37,7 @@ public class MClientPacketListener { target = "Lnet/minecraft/network/protocol/game/ClientboundContainerSetContentPacket;getContainerId()I"), cancellable = true) private void onInventoryPacket(ClientboundContainerSetContentPacket packet, CallbackInfo ci) { - if (((ICSPlayer) this.minecraft.player).cs_isAccessingItem()) { + if (((ICSPlayer) Minecraft.getInstance().player).cs_isAccessingItem()) { ci.cancel(); return; } @@ -77,8 +70,9 @@ private void onOpenScreen(ClientboundOpenScreenPacket packet, CallbackInfo ci) { this.containerId = packet.getContainerId(); if (this.craftingScreen) { - ((ICSPlayer) this.minecraft.player).cs_setAccessingItem(false); - } else if (((ICSPlayer) this.minecraft.player).cs_isAccessingItem() || ContainerDiscovery.fakePacketsActive()) { + ((ICSPlayer) Minecraft.getInstance().player).cs_setAccessingItem(false); + } else if (((ICSPlayer) Minecraft.getInstance().player).cs_isAccessingItem() || ContainerDiscovery.fakePacketsActive()) { + ci.cancel(); } } @@ -97,23 +91,9 @@ private void onOpenScreen(ClientboundOpenScreenPacket packet, CallbackInfo ci) { cancellable = true) private void onSoundEvent(ClientboundSoundPacket packet, CallbackInfo ci) { // Cancel sounds if item search is active - if (packet.getSource().equals(BLOCKS) && (((ICSPlayer) this.minecraft.player).cs_isAccessingItem() || ContainerDiscovery.fakePacketsActive())) { + if (packet.getSource().equals(BLOCKS) && (((ICSPlayer) Minecraft.getInstance().player).cs_isAccessingItem() || ContainerDiscovery.fakePacketsActive())) { ci.cancel(); } } - - /** - * Tries to recognize server type from server brand packet. - * - * @param packet - * @param ci - */ - @Inject(method = "handleCustomPayload", - at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/player/LocalPlayer;setServerBrand(Ljava/lang/String;)V", - shift = At.Shift.AFTER)) - private void onServerBrand(ClientboundCustomPayloadPacket packet, CallbackInfo ci) { - PacketLimiter.tryRecognizeServer(); - } } diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/MCraftingScreen.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/MCraftingScreen.java index bdb0681..9085577 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/MCraftingScreen.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/MCraftingScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.CraftingScreen; +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -33,7 +34,6 @@ import java.util.List; import static org.samo_lego.clientstorage.fabric_client.ClientStorageFabric.config; -import static org.samo_lego.clientstorage.fabric_client.mixin.accessor.ACreativeModeInventoryScreen.CREATIVE_TABS_LOCATION; @Environment(EnvType.CLIENT) @Mixin(CraftingScreen.class) @@ -95,7 +95,8 @@ private void addBackground(GuiGraphics graphics, float delta, int mouseX, int mo // Scrollbar boolean canScroll = RemoteInventory.getInstance().getRows() > 3; - graphics.blit(CREATIVE_TABS_LOCATION(), topX, topY + (int) ((float) (k - topY - 17) * RemoteInventory.getInstance().scrollOffset()), 232 + (canScroll ? 0 : 12), 0, 12, 15); + final var sprite = canScroll ? CreativeModeInventoryScreen.SCROLLER_SPRITE : CreativeModeInventoryScreen.SCROLLER_DISABLED_SPRITE; + graphics.blitSprite(sprite, topX, topY + (int) ((float) (k - topY - 17) * RemoteInventory.getInstance().scrollOffset()), 232 + (canScroll ? 0 : 12), 0); } @Inject(method = "", at = @At("TAIL")) @@ -104,10 +105,6 @@ private void constructor(CallbackInfo ci) { this.titleLabelY += Y_MOVE; this.inventoryLabelY += Y_MOVE; - - if (this.searchBox != null) { - this.searchBox.tick(); - } } @Inject(method = "init", at = @At("TAIL")) @@ -129,12 +126,6 @@ private void init(CallbackInfo ci) { this.addWidget(this.searchBox); } - @Inject(method = "containerTick", at = @At("TAIL")) - private void containerTick(CallbackInfo ci) { - if (this.searchBox != null && config.enabled) { - this.searchBox.tick(); - } - } @Override public boolean charTyped(char chr, int modifiers) { @@ -143,7 +134,7 @@ public boolean charTyped(char chr, int modifiers) { if (this.searchBox.charTyped(chr, modifiers)) { if (!string.equals(this.searchBox.getValue())) { - this.refreshSearchResults(); + this.clienstorage$refreshSearchResults(); } return true; } @@ -158,7 +149,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { String string = this.searchBox.getValue(); if (this.searchBox.keyPressed(keyCode, scanCode, modifiers)) { if (!string.equals(this.searchBox.getValue())) { - this.refreshSearchResults(); + this.clienstorage$refreshSearchResults(); } return true; } @@ -171,12 +162,13 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { return super.keyPressed(keyCode, scanCode, modifiers); } - private void refreshSearchResults() { + @Unique + private void clienstorage$refreshSearchResults() { RemoteInventory.getInstance().refreshSearchResults(this.searchBox.getValue()); } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) { + public boolean mouseScrolled(double mouseX, double mouseY, double amount, double _a) { int rows = RemoteInventory.getInstance().getRows(); if (rows < 4) { return false; diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen_ArmorSlots.java similarity index 97% rename from fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java rename to fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen_ArmorSlots.java index 7028bee..fdb93e6 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/gui_armour/MAbstractContainerScreen_ArmorSlots.java @@ -21,7 +21,7 @@ import static org.samo_lego.clientstorage.fabric_client.ClientStorageFabric.config; @Mixin(AbstractContainerScreen.class) -public abstract class MAbstractContainerScreen { +public abstract class MAbstractContainerScreen_ArmorSlots { private final AbstractContainerScreen self = (AbstractContainerScreen) (Object) this; @Shadow @@ -34,7 +34,7 @@ public abstract class MAbstractContainerScreen { @Shadow protected abstract void renderSlot(GuiGraphics guiGraphics, Slot slot); - @Inject(method = "render", + /*@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderBg(Lnet/minecraft/client/gui/GuiGraphics;FII)V", shift = At.Shift.AFTER)) @@ -42,7 +42,7 @@ private void addArmorSlotBg(GuiGraphics graphics, int x, int y, float f, Callbac if (!config.enabled || self instanceof InventoryScreen || !config.armorAccess) return; // Draw background - } + }*/ @Inject(method = "render", at = @At(value = "INVOKE", diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/storage_memory/MAbstractContainerScreen.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/storage_memory/MAbstractContainerScreen.java index cec3d43..d2c79e0 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/storage_memory/MAbstractContainerScreen.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/mixin/screen/storage_memory/MAbstractContainerScreen.java @@ -96,7 +96,8 @@ private void constructor(AbstractContainerMenu abstractContainerMenu, Inventory cancellable = true) private static void renderSlotHighlight(GuiGraphics graphics, int x, int y, int blitOffset, CallbackInfo ci) { if (usingFakeSlot) { - final int color = 0x7F_FF_F7_00; + //final int color = 0x7F_FF_F7_00; + final int color = 0x7F_00_00_00; graphics.fillGradient(x, y, x + 16, y + 16, color, color, blitOffset); RenderSystem.colorMask(true, true, true, true); @@ -133,14 +134,20 @@ private void postRenderItem(GuiGraphics guiGraphics, Slot slot, CallbackInfo ci) TransparencyBuffer.preInject(); // Align the matrix stack - //poseStack.pushPose(); - //poseStack.translate(-this.leftPos, -this.topPos, 0.0f); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(-this.leftPos, -this.topPos, 0.0f); // Draw the framebuffer texture TransparencyBuffer.drawExtraFramebuffer(guiGraphics); - //poseStack.popPose(); + var itemStack = slot.getItem(); + guiGraphics.renderItem(itemStack, slot.x, slot.y, slot.x + slot.y * this.imageWidth); + guiGraphics.renderItemDecorations(this.font, itemStack, slot.x, slot.y, "0"); + + + guiGraphics.pose().popPose(); TransparencyBuffer.postInject(); + } } diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/network/PacketLimiter.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/network/PacketLimiter.java index 9edc619..92969ad 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/network/PacketLimiter.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/network/PacketLimiter.java @@ -34,7 +34,7 @@ public static void tryRecognizeServer() { FabricConfig.limiter = getServerLimiter(); Minecraft client = Minecraft.getInstance(); - var brand = client.player.getServerBrand().toLowerCase(Locale.ROOT); + var brand = client.getConnection().serverBrand().toLowerCase(Locale.ROOT); if (FabricConfig.limiter != CUSTOM) { if (config.informServerType && !client.hasSingleplayerServer()) { @@ -57,7 +57,7 @@ public static PacketLimiter getServerLimiter() { return CUSTOM; } - var brand = player.getServerBrand().toLowerCase(Locale.ROOT); + var brand = client.getConnection().serverBrand().toLowerCase(Locale.ROOT); // If server brand is vanilla, fabric, forge, quilt or craftbukkit, use vanilla limiter // We use .contains as server might be behind a proxy diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/ESPRender.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/ESPRender.java index d85659f..ab4923c 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/ESPRender.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/ESPRender.java @@ -16,9 +16,6 @@ import org.samo_lego.clientstorage.fabric_client.mixin.accessor.AEntity; import org.samo_lego.clientstorage.fabric_client.mixin.accessor.ALevelRenderer; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -31,7 +28,7 @@ */ public class ESPRender { - private static final ModelPart.Cube CUBE = new ModelPart.Cube(0, 0, 0, 0, 0, 16, 16, 16, 0, 0, 0, false, 0, 0, new HashSet<>(List.of(Direction.values()))); + private static final ModelPart.Cube CUBE = new ModelPart.Cube(0, 0, 0, 0, 0, 16, 16, 16, 0, 0, 0, false, 0, 0, Set.of(Direction.values())); private static final RenderType RENDER_TYPE = RenderType.outline(new ResourceLocation("textures/misc/white.png")); /** diff --git a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java index 7efa258..a1d65fd 100644 --- a/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java +++ b/fabric-client/src/main/java/org/samo_lego/clientstorage/fabric_client/render/TransparencyBuffer.java @@ -38,15 +38,14 @@ public static void preInject() { RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.5f); } - public static void drawExtraFramebuffer(GuiGraphics matrices) { + public static void drawExtraFramebuffer(GuiGraphics graphics) { // Restore the original framebuffer GlStateManager._glBindFramebuffer(GL30.GL_FRAMEBUFFER, previousFramebuffer); // Render the custom framebuffer's contents with transparency into the main buffer RenderSystem.setShaderTexture(0, framebuffer.getColorTextureId()); - Window window = Minecraft.getInstance().getWindow(); - // Create new matrix stack to prevent the transparency from affecting the rest of the GUI - /*matrices.blit( + /*Window window = Minecraft.getInstance().getWindow(); + graphics.blit( framebuffer.getColorTextureId(), 0, // x 0, // y @@ -55,9 +54,7 @@ public static void drawExtraFramebuffer(GuiGraphics matrices) { 0, // left-most coordinate of the texture region framebuffer.height, // top-most coordinate of the texture region framebuffer.width, // width of the texture region - -framebuffer.height, // height of the texture region - framebuffer.width, // width of the entire texture - framebuffer.height // height of the entire texture + -framebuffer.height // height of the texture region );*/ } diff --git a/fabric-client/src/main/resources/assets/clientstorage/lang/sl_si.json b/fabric-client/src/main/resources/assets/clientstorage/lang/sl_si.json index f78c80d..ea739c0 100644 --- a/fabric-client/src/main/resources/assets/clientstorage/lang/sl_si.json +++ b/fabric-client/src/main/resources/assets/clientstorage/lang/sl_si.json @@ -46,5 +46,11 @@ "tooltip.clientstorage.enable_block_search": "Omogoči preiskovanje shramb v kockah (npr. skrinjah, sodih, pečeh itd.)", "tooltip.clientstorage.enable_entity_search": "Omogoči preiskovanje shramb bitij (npr. vozičkov ali čolnov s skrinjami) (experimentalno tudi oslov, mul in lam)", "tooltip.clientstorage.save_preset": "Shrani trenutno postavitev stvari.", - "tooltip.clientstorage.remove_preset": "Pozabi trenutno postavitev stvari." + "tooltip.clientstorage.remove_preset": "Pozabi trenutno postavitev stvari.", + "settings.clientstorage.enable_presets": "Omogoči pomnenje shramb", + "settings.clientstorage.delete_preset": "Delete presets for this world", + "settings.clientstorage.delete_presets": "Delete all presets", + "tooltip.clientstorage.enable_presets": "Enables saving layout for containers. You won't be able to put any other items in the container via shift-clicking.", + "tooltip.clientstorage.delete_preset": "Deletes all storage presets saved for this world.", + "tooltip.clientstorage.delete_presets": "Deletes all saved presets." } \ No newline at end of file diff --git a/fabric-client/src/main/resources/clientstorage.accesswidener b/fabric-client/src/main/resources/clientstorage.accesswidener index 28db84e..91e4b09 100644 --- a/fabric-client/src/main/resources/clientstorage.accesswidener +++ b/fabric-client/src/main/resources/clientstorage.accesswidener @@ -1,2 +1,4 @@ accessWidener v1 named -extendable class net/minecraft/world/item/ItemStack \ No newline at end of file +extendable class net/minecraft/world/item/ItemStack +accessible field net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen SCROLLER_SPRITE Lnet/minecraft/resources/ResourceLocation; +accessible field net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen SCROLLER_DISABLED_SPRITE Lnet/minecraft/resources/ResourceLocation; \ No newline at end of file diff --git a/fabric-client/src/main/resources/clientstorage.mixins.json b/fabric-client/src/main/resources/clientstorage.mixins.json index 3603a87..23d9dbf 100644 --- a/fabric-client/src/main/resources/clientstorage.mixins.json +++ b/fabric-client/src/main/resources/clientstorage.mixins.json @@ -7,19 +7,19 @@ "MItemStack", "MPlayer_ICSPlayer", "accessor.ACompoundContainer", - "accessor.ACreativeModeInventoryScreen", "accessor.AEntity", "accessor.ALevelRenderer", "accessor.AMultiPlayerGamemode", "accessor.AScreen", "accessor.AScreenHandler", "accessor.ASlot", + "network.MClientCommonPacketListenerImpl_BrandRecognizer", "network.MClientPacketListener", "network.MServerboundContainerClosePacket", "screen.MAbstractContainerScreen", "screen.MCraftingMenu", "screen.MCraftingScreen", - "screen.gui_armour.MAbstractContainerScreen", + "screen.gui_armour.MAbstractContainerScreen_ArmorSlots", "screen.storage_memory.MAbstractContainerScreen", "screen.storage_memory.MMinecraft", "storage.MAbstractChestedHorse", diff --git a/fabric-server/src/main/java/org/samo_lego/clientstorage/fabric_server/ServerStorageFabric.java b/fabric-server/src/main/java/org/samo_lego/clientstorage/fabric_server/ServerStorageFabric.java index 78f9846..2bc11f0 100644 --- a/fabric-server/src/main/java/org/samo_lego/clientstorage/fabric_server/ServerStorageFabric.java +++ b/fabric-server/src/main/java/org/samo_lego/clientstorage/fabric_server/ServerStorageFabric.java @@ -8,7 +8,7 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.resources.ResourceLocation; import org.samo_lego.clientstorage.common.ClientStorage; import org.samo_lego.clientstorage.common.Config; @@ -36,9 +36,10 @@ public void onInitializeServer() { } var byteBuf = new FriendlyByteBuf(Unpooled.buffer()); + byteBuf.writeResourceLocation(channelId); byteBuf.writeBytes(config.get().pack()); - handler.send(new ClientboundCustomPayloadPacket(channelId, byteBuf)); + handler.send(new ClientboundCustomPayloadPacket(byteBuf)); }); @@ -47,9 +48,10 @@ public void onInitializeServer() { config.set(Config.load(Config.class, config::get)); var byteBuf = new FriendlyByteBuf(Unpooled.buffer()); + byteBuf.writeResourceLocation(channelId); byteBuf.writeBytes(config.get().pack()); - server.getPlayerList().broadcastAll(new ClientboundCustomPayloadPacket(channelId, byteBuf)); + server.getPlayerList().broadcastAll(new ClientboundCustomPayloadPacket(byteBuf)); }); } } diff --git a/gradle.properties b/gradle.properties index 62c78bf..2e05e80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G # Fabric Properties -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.9 -loader_version=0.14.21 +minecraft_version=1.20.2 +yarn_mappings=1.20.2+build.4 +loader_version=0.14.22 #Fabric api -fabric_version=0.85.0+1.20.1 +fabric_version=0.89.3+1.20.2 # Mod Properties mod_version=2.2.2 maven_group=org.samo_lego diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..ac72c34 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists