diff --git a/CHANGELOG.md b/CHANGELOG.md index 538735bca..0c15150ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Fixed losing disk when using Wrench dismantling on the Portable Grid. - Fixed losing energy when using Wrench dismantling on the Portable Grid and the Controller. +- Fixed changing side buttons not working on Forge. ## [2.0.0-milestone.3.3] - 2024-02-17 diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java index f559f76f0..a22d53f7f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java @@ -26,10 +26,7 @@ public T getValue() { } public void setValue(final T newValue) { - Platform.INSTANCE.getClientToServerCommunications().sendPropertyChange( - type, - newValue - ); + Platform.INSTANCE.getClientToServerCommunications().sendPropertyChange(type, newValue); } @Override diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/packet/c2s/PropertyChangePacket.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/packet/c2s/PropertyChangePacket.java index 439a08233..c2beb3d1a 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/packet/c2s/PropertyChangePacket.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/support/packet/c2s/PropertyChangePacket.java @@ -1,13 +1,14 @@ package com.refinedmods.refinedstorage2.platform.forge.support.packet.c2s; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBaseContainerMenu; +import com.refinedmods.refinedstorage2.platform.common.support.packet.PacketIds; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.network.handling.PlayPayloadContext; -public record PropertyChangePacket(ResourceLocation id, int value) implements CustomPacketPayload { +public record PropertyChangePacket(ResourceLocation propertyId, int value) implements CustomPacketPayload { public static PropertyChangePacket decode(final FriendlyByteBuf buf) { return new PropertyChangePacket(buf.readResourceLocation(), buf.readInt()); } @@ -15,14 +16,19 @@ public static PropertyChangePacket decode(final FriendlyByteBuf buf) { public static void handle(final PropertyChangePacket packet, final PlayPayloadContext ctx) { ctx.player().ifPresent(player -> ctx.workHandler().submitAsync(() -> { if (player.containerMenu instanceof AbstractBaseContainerMenu menu) { - menu.receivePropertyChangeFromClient(packet.id, packet.value); + menu.receivePropertyChangeFromClient(packet.propertyId, packet.value); } })); } @Override public void write(final FriendlyByteBuf buf) { - buf.writeResourceLocation(id); + buf.writeResourceLocation(propertyId); buf.writeInt(value); } + + @Override + public ResourceLocation id() { + return PacketIds.PROPERTY_CHANGE; + } }