From c568aa5024813b94049cef9fcbd6954d6e1a4bb0 Mon Sep 17 00:00:00 2001 From: Cat Core Date: Sat, 7 Dec 2024 14:26:54 +0100 Subject: [PATCH] Small mixins clean-up --- .../sync/versioned/BiDefaultedRegistryMixin.java | 2 +- .../registry/sync/versioned/SimpleRegistryMixin.java | 9 ++------- ...leRegistryMixinV2.java => SimpleRegistryMixin.java} | 9 +++------ .../legacy-fabric-registry-sync-api-v2.mixins.json | 2 +- .../sync/versioned/BiDefaultedRegistryMixin.java | 2 +- ...leRegistryMixinV2.java => SimpleRegistryMixin.java} | 10 +++------- .../legacy-fabric-registry-sync-api-v2.mixins.json | 2 +- .../registrable/DesynchronizeableRegistrable.java | 4 ++-- .../impl/registry/RegistryHelperImplementation.java | 4 ++-- .../sync/{IdListMixinV2.java => IdListMixin.java} | 2 +- ...eRegistryMixinV2.java => MutableRegistryMixin.java} | 2 +- ...leRegistryMixinV2.java => SimpleRegistryMixin.java} | 2 +- ...gacy-fabric-registry-sync-api-v2-common.mixins.json | 6 +++--- 13 files changed, 22 insertions(+), 34 deletions(-) rename legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/{SimpleRegistryMixinV2.java => SimpleRegistryMixin.java} (93%) rename legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/{SimpleRegistryMixinV2.java => SimpleRegistryMixin.java} (93%) rename legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/{IdListMixinV2.java => IdListMixin.java} (96%) rename legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/{MutableRegistryMixinV2.java => MutableRegistryMixin.java} (97%) rename legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/{SimpleRegistryMixinV2.java => SimpleRegistryMixin.java} (88%) diff --git a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/BiDefaultedRegistryMixin.java b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/BiDefaultedRegistryMixin.java index 432bae577..b06243e47 100644 --- a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/BiDefaultedRegistryMixin.java +++ b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/BiDefaultedRegistryMixin.java @@ -41,7 +41,7 @@ public abstract class BiDefaultedRegistryMixin implements SyncedFabricRegi @Override public V fabric$getValue(Identifier id) { - K key = (K) fabric$toKeyType(id); + K key = fabric$toKeyType(id); V value = ((BiDefaultedRegistry) (Object) this).get(key); if (value == this.defaultValue && !Objects.equals(this.defaultKey.toString(), key.toString())) return null; diff --git a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java index 69736d41d..b80f7f551 100644 --- a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java +++ b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java @@ -38,25 +38,20 @@ @Mixin(SimpleRegistry.class) public abstract class SimpleRegistryMixin implements SyncedFabricRegistry, SyncedRegistrable, DesynchronizeableRegistrable { - // 1.8+ @Shadow public abstract void add(int id, K identifier, V object); - // 1.9+ @Mutable @Shadow @Final protected class_2929 field_13718; - // 1.8+ @Shadow public abstract K getIdentifier(Object par1); - // 1.9+ @Shadow public abstract int getRawId(Object object); - // 1.7+ @Shadow public abstract Object getByRawId(int index); @@ -64,12 +59,12 @@ public abstract class SimpleRegistryMixin implements SyncedFabricRegistry< private boolean synchronize = true; @Override - public void setSynchronize(boolean isSynchronize) { + public void fabric$setSynchronize(boolean isSynchronize) { this.synchronize = isSynchronize; } @Override - public boolean canSynchronize() { + public boolean fabric$canSynchronize() { return this.synchronize; } diff --git a/legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java b/legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java similarity index 93% rename from legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java rename to legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java index 8df993542..0b9b12580 100644 --- a/legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java +++ b/legacy-fabric-registry-sync-api-v2/1.7.10/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java @@ -37,16 +37,13 @@ import net.legacyfabric.fabric.api.util.Identifier; @Mixin(SimpleRegistry.class) -public abstract class SimpleRegistryMixinV2 implements SyncedFabricRegistry, SyncedRegistrable, DesynchronizeableRegistrable { - // 1.8+ +public abstract class SimpleRegistryMixin implements SyncedFabricRegistry, SyncedRegistrable, DesynchronizeableRegistrable { @Shadow public abstract void add(int id, String identifier, Object object); - // 1.9+ @Shadow public abstract int getRawId(Object object); - // 1.7+ @Shadow public abstract Object getByRawId(int index); @@ -62,12 +59,12 @@ public abstract class SimpleRegistryMixinV2 implements SyncedFabricRegistry implements SyncedFabricRegi @Override public V fabric$getValue(Identifier id) { - K key = (K) fabric$toKeyType(id); + K key = fabric$toKeyType(id); V value = ((BiDefaultedRegistry) (Object) this).get(key); if (value == this.defaultValue && !Objects.equals(this.defaultKey.toString(), key.toString())) return null; diff --git a/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java b/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java similarity index 93% rename from legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java rename to legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java index 778e01c90..6c07f02a3 100644 --- a/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixinV2.java +++ b/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java @@ -37,20 +37,16 @@ import net.legacyfabric.fabric.api.util.Identifier; @Mixin(SimpleRegistry.class) -public abstract class SimpleRegistryMixinV2 implements SyncedFabricRegistry, SyncedRegistrable, DesynchronizeableRegistrable { - // 1.8+ +public abstract class SimpleRegistryMixin implements SyncedFabricRegistry, SyncedRegistrable, DesynchronizeableRegistrable { @Shadow public abstract void add(int id, K identifier, V object); - // 1.8+ @Shadow public abstract K getIdentifier(Object par1); - // 1.9+ @Shadow public abstract int getRawId(Object object); - // 1.7+ @Shadow public abstract Object getByRawId(int index); @@ -63,12 +59,12 @@ public abstract class SimpleRegistryMixinV2 implements SyncedFabricRegistr private boolean synchronize = true; @Override - public void setSynchronize(boolean isSynchronize) { + public void fabric$setSynchronize(boolean isSynchronize) { this.synchronize = isSynchronize; } @Override - public boolean canSynchronize() { + public boolean fabric$canSynchronize() { return this.synchronize; } diff --git a/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/resources/legacy-fabric-registry-sync-api-v2.mixins.json b/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/resources/legacy-fabric-registry-sync-api-v2.mixins.json index b120e9059..df7775833 100644 --- a/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/resources/legacy-fabric-registry-sync-api-v2.mixins.json +++ b/legacy-fabric-registry-sync-api-v2/1.8.9/src/main/resources/legacy-fabric-registry-sync-api-v2.mixins.json @@ -8,7 +8,7 @@ "mixins": [ "versioned.BiDefaultedRegistryMixin", "versioned.PlayerManagerMixin", - "versioned.SimpleRegistryMixinV2" + "versioned.SimpleRegistryMixin" ], "client": [ ] diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/registrable/DesynchronizeableRegistrable.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/registrable/DesynchronizeableRegistrable.java index 9194d63fc..bef40cb28 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/registrable/DesynchronizeableRegistrable.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/registrable/DesynchronizeableRegistrable.java @@ -18,9 +18,9 @@ package net.legacyfabric.fabric.api.registry.v2.registry.registrable; public interface DesynchronizeableRegistrable { - default boolean canSynchronize() { + default boolean fabric$canSynchronize() { return true; } - void setSynchronize(boolean synchronize); + void fabric$setSynchronize(boolean synchronize); } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java index 02b8f7853..6d6a205a6 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java @@ -95,7 +95,7 @@ public static void registerRegistry(Identifier identifier, FabricRegistry boolean remappable = true; if (holder instanceof DesynchronizeableRegistrable) { - remappable = ((DesynchronizeableRegistrable) holder).canSynchronize(); + remappable = ((DesynchronizeableRegistrable) holder).fabric$canSynchronize(); } if (holder instanceof SyncedRegistrableFabricRegistry && remappable) { @@ -137,7 +137,7 @@ public static void register(FabricRegistry registry, Identifier identifie boolean remappable = true; if (registry instanceof DesynchronizeableRegistrable) { - remappable = ((DesynchronizeableRegistrable) registry).canSynchronize(); + remappable = ((DesynchronizeableRegistrable) registry).fabric$canSynchronize(); } if (registry instanceof SyncedRegistrable && remappable) { diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixinV2.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixin.java similarity index 96% rename from legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixinV2.java rename to legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixin.java index 35170c1a1..140c89282 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixinV2.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/IdListMixin.java @@ -28,7 +28,7 @@ import net.legacyfabric.fabric.api.registry.v2.registry.registrable.IdsHolder; @Mixin(IdList.class) -public abstract class IdListMixinV2 implements IdsHolder { +public abstract class IdListMixin implements IdsHolder { @Shadow public abstract T fromId(int index); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixinV2.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java similarity index 97% rename from legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixinV2.java rename to legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java index 20993e526..c920425f2 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixinV2.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java @@ -37,7 +37,7 @@ import net.legacyfabric.fabric.impl.registry.accessor.RegistryIdSetter; @Mixin(MutableRegistry.class) -public abstract class MutableRegistryMixinV2 implements FabricRegistry, RegistryIdSetter, Registrable { +public abstract class MutableRegistryMixin implements FabricRegistry, RegistryIdSetter, Registrable { @Shadow public abstract void put(Object key, Object value); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixinV2.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixin.java similarity index 88% rename from legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixinV2.java rename to legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixin.java index 17a2e199d..d0efa3d73 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixinV2.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/SimpleRegistryMixin.java @@ -25,5 +25,5 @@ import net.legacyfabric.fabric.api.registry.v2.registry.registrable.DesynchronizeableRegistrable; @Mixin(SimpleRegistry.class) -public abstract class SimpleRegistryMixinV2 implements SyncedRegistrableFabricRegistry, DesynchronizeableRegistrable { +public abstract class SimpleRegistryMixin implements SyncedRegistrableFabricRegistry, DesynchronizeableRegistrable { } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/resources/legacy-fabric-registry-sync-api-v2-common.mixins.json b/legacy-fabric-registry-sync-api-v2/common/src/main/resources/legacy-fabric-registry-sync-api-v2-common.mixins.json index f0cedd1d4..c26a57d04 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/resources/legacy-fabric-registry-sync-api-v2-common.mixins.json +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/resources/legacy-fabric-registry-sync-api-v2-common.mixins.json @@ -6,9 +6,9 @@ "defaultRequire": 1 }, "mixins": [ - "IdListMixinV2", - "MutableRegistryMixinV2", - "SimpleRegistryMixinV2", + "IdListMixin", + "MutableRegistryMixin", + "SimpleRegistryMixin", "WorldSaveHandlerMixin" ], "client": [