diff --git a/src/main/java/xyz/nucleoid/extras/mixin/lobby/ItemStackComponentizationFixMixin.java b/src/main/java/xyz/nucleoid/extras/mixin/datafixer/ItemStackComponentizationFixMixin.java similarity index 98% rename from src/main/java/xyz/nucleoid/extras/mixin/lobby/ItemStackComponentizationFixMixin.java rename to src/main/java/xyz/nucleoid/extras/mixin/datafixer/ItemStackComponentizationFixMixin.java index 5895a54..3ddb75c 100644 --- a/src/main/java/xyz/nucleoid/extras/mixin/lobby/ItemStackComponentizationFixMixin.java +++ b/src/main/java/xyz/nucleoid/extras/mixin/datafixer/ItemStackComponentizationFixMixin.java @@ -1,4 +1,4 @@ -package xyz.nucleoid.extras.mixin.lobby; +package xyz.nucleoid.extras.mixin.datafixer; import com.mojang.serialization.Dynamic; import net.minecraft.datafixer.fix.ItemStackComponentizationFix; diff --git a/src/main/java/xyz/nucleoid/extras/mixin/datafixer/Schema1460Mixin.java b/src/main/java/xyz/nucleoid/extras/mixin/datafixer/Schema1460Mixin.java new file mode 100644 index 0000000..6dad215 --- /dev/null +++ b/src/main/java/xyz/nucleoid/extras/mixin/datafixer/Schema1460Mixin.java @@ -0,0 +1,38 @@ +package xyz.nucleoid.extras.mixin.datafixer; + +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.datafixers.types.templates.TypeTemplate; +import net.minecraft.datafixer.TypeReferences; +import net.minecraft.datafixer.schema.Schema1460; +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; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.Map; +import java.util.function.Supplier; + +@Mixin(Schema1460.class) +public abstract class Schema1460Mixin extends Schema { + public Schema1460Mixin(int versionKey, Schema parent) { + super(versionKey, parent); + } + + @Shadow protected static void targetEntityItems(Schema schema, Map> map, String entityId) {}; + + @Inject(method = "registerEntities", at = @At("RETURN")) + private void registerCustomEntities(Schema schema, CallbackInfoReturnable>> cir) { + var map = cir.getReturnValue(); + + targetEntityItems(schema, map, mod("quick_armor_stand")); + registerSimple(map, mod("leaderboard_display")); + } + + @Unique + private static String mod(String path) { + return "nucleoid_extras:" + path; + } +} diff --git a/src/main/resources/extras.mixins.json b/src/main/resources/extras.mixins.json index 43aa981..616fdf0 100644 --- a/src/main/resources/extras.mixins.json +++ b/src/main/resources/extras.mixins.json @@ -9,9 +9,10 @@ "ServerEntityManagerAccessor", "ServerWorldAccessor", "TextCodecMixin", + "datafixer.ItemStackComponentizationFixMixin", + "datafixer.Schema1460Mixin", "debug.EntityMixin", "lobby.ArmorStandEntityAccessor", - "lobby.ItemStackComponentizationFixMixin", "lobby.LivingEntityAccessor", "lobby.ServerChunkLoadingManagerAccessor", "lobby.ServerPlayerEntityMixin",