diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java index e5ed0f3e..b91a8c29 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java @@ -60,8 +60,9 @@ public abstract class MixinPlayerEntity extends LivingEntity { @Shadow @Final private PlayerInventory inventory; + @Unique - private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6f, 1.65f); + private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F); @Unique private static final SoundEvent viaFabricPlus$oof_hurt = SoundEvent.of(new Identifier("viafabricplus", "oof.hurt")); diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/base/PerServerVersionScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/base/PerServerVersionScreen.java index 5d6972fc..a3d4d898 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/base/PerServerVersionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/base/PerServerVersionScreen.java @@ -60,33 +60,37 @@ public class PerServerVersionScreen extends VFPScreen { this.renderTitle(context); } - public class SlotList extends AlwaysSelectedEntryListWidget { + public class SlotList extends AlwaysSelectedEntryListWidget { public SlotList(MinecraftClient minecraftClient, int width, int height, int top, int bottom, int entryHeight) { super(minecraftClient, width, height - top - bottom, top, entryHeight); - this.addEntry(new ResetProtocolSlot()); - VersionEnum.SORTED_VERSIONS.stream().map(ViaProtocolSlot::new).forEach(this::addEntry); + this.addEntry(new ResetSlot()); + VersionEnum.SORTED_VERSIONS.stream().map(ProtocolSlot::new).forEach(this::addEntry); } } + // Dummy class files used to have a shared superclass for ResetSlot and ProtocolSlot + public abstract class SharedSlot extends AlwaysSelectedEntryListWidget.Entry { - public abstract static class DummyProtocolSlot extends AlwaysSelectedEntryListWidget.Entry { + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + playClickSound(); + close(); + return super.mouseClicked(mouseX, mouseY, button); + } } - public class ResetProtocolSlot extends DummyProtocolSlot { + public class ResetSlot extends SharedSlot { @Override public Text getNarration() { return Text.translatable("base.viafabricplus.cancel_and_reset"); } - @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { selectionConsumer.accept(null); - playClickSound(); - close(); return super.mouseClicked(mouseX, mouseY, button); } @@ -98,10 +102,11 @@ public class PerServerVersionScreen extends VFPScreen { } } - public class ViaProtocolSlot extends DummyProtocolSlot { + public class ProtocolSlot extends SharedSlot { + private final VersionEnum versionEnum; - public ViaProtocolSlot(final VersionEnum versionEnum) { + public ProtocolSlot(final VersionEnum versionEnum) { this.versionEnum = versionEnum; } @@ -113,8 +118,6 @@ public class PerServerVersionScreen extends VFPScreen { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { selectionConsumer.accept(versionEnum); - playClickSound(); - close(); return super.mouseClicked(mouseX, mouseY, button); } diff --git a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java index 866564c9..38a583ea 100644 --- a/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java +++ b/src/main/java/de/florianmichael/viafabricplus/screen/base/ProtocolSelectionScreen.java @@ -117,6 +117,7 @@ public class ProtocolSelectionScreen extends VFPScreen { } public static class ProtocolSlot extends AlwaysSelectedEntryListWidget.Entry { + private final VersionEnum versionEnum; public ProtocolSlot(final VersionEnum versionEnum) {