diff --git a/README.md b/README.md index 248dad7..ec57450 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ library is distributed via [jitpack.io](https://jitpack.io/#CrimsonDawn45/Fabric #### put this in gradle.properties ```properties -fabric_shield_lib_version=1.7.2-1.21.1 +fabric_shield_lib_version=1.8.0-1.21.4 ``` #### build.gradle under repositories just above dependencies diff --git a/build.gradle b/build.gradle index f1555bd..46edd04 100644 --- a/build.gradle +++ b/build.gradle @@ -24,11 +24,13 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + //Mod Menu modCompileOnly modRuntimeOnly ("com.terraformersmc:modmenu:${project.mod_menu_version}"), { exclude(group: "net.fabricmc.fabric-api") } - + //Fabric ASM modImplementation("com.github.Chocohead:Fabric-ASM:v2.3") { exclude (group: "net.fabricmc.fabric-api") @@ -38,8 +40,6 @@ dependencies { modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" include "maven.modrinth:midnightlib:${project.midnightlib_version}" - // Mixin Extras - include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${mixinextras_version}"))) } processResources { diff --git a/gradle.properties b/gradle.properties index e419cb9..d482ace 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,17 +4,16 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop/ -minecraft_version=1.21.3 -yarn_mappings=1.21.3+build.2 +minecraft_version=1.21.4 +yarn_mappings=1.21.4+build.4 loader_version=0.16.9 # Mod Properties -mod_version=1.8.0-1.21.3 +mod_version=1.8.0-1.21.4 maven_group=com.github.crimsondawn45 archives_base_name=FabricShieldLib # Dependencies -fabric_version=0.106.1+1.21.3 -mod_menu_version=12.0.0-beta.1 -midnightlib_version=1.5.8-fabric -mixinextras_version=0.4.1 +fabric_version=0.114.3+1.21.4 +mod_menu_version=13.0.0 +midnightlib_version=1.6.6-fabric \ No newline at end of file diff --git a/src/main/generated/.cache/50f19fade4190ed6a5a4f9c733c6c9946b1cb334 b/src/main/generated/.cache/50f19fade4190ed6a5a4f9c733c6c9946b1cb334 index 4508d8a..e5faaa5 100644 --- a/src/main/generated/.cache/50f19fade4190ed6a5a4f9c733c6c9946b1cb334 +++ b/src/main/generated/.cache/50f19fade4190ed6a5a4f9c733c6c9946b1cb334 @@ -1,2 +1,2 @@ -// 1.21 2024-08-17T22:36:15.9204123 Fabric Shield Lib/FabricShieldLibEnchantmentGenerator +// 1.21.3 2024-12-31T11:01:40.5595807 Fabric Shield Lib/FabricShieldLibEnchantmentGenerator a315763c245701a58241df5b075f5208c35d3829 data\fabricshieldlib\enchantment\reflect.json diff --git a/src/main/generated/data/fabricshieldlib/enchantment/reflect.json b/src/main/generated/data/fabricshieldlib/enchantment/reflect.json deleted file mode 100644 index a29b627..0000000 --- a/src/main/generated/data/fabricshieldlib/enchantment/reflect.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "anvil_cost": 5, - "description": { - "translate": "enchantment.fabricshieldlib.reflect" - }, - "max_cost": { - "base": 15, - "per_level_above_first": 0 - }, - "max_level": 1, - "min_cost": { - "base": 10, - "per_level_above_first": 0 - }, - "slots": [ - "hand" - ], - "supported_items": "#c:tools/shield", - "weight": 10 -} \ No newline at end of file diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLib.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLib.java index 348f5ee..afe0a2a 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLib.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLib.java @@ -1,22 +1,16 @@ package com.github.crimsondawn45.fabricshieldlib.initializers; import com.github.crimsondawn45.fabricshieldlib.lib.config.FabricShieldLibConfig; -import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldBlockCallback; -import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldDisabledCallback; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricBannerShieldItem; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldDecoratorRecipe; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldItem; -import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldLibDataGenerator; +//import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldLibDataGenerator; +import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldModelComponent; import eu.midnightdust.lib.config.MidnightConfig; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.component.ComponentType; import net.minecraft.item.Item; import net.minecraft.item.ItemGroups; import net.minecraft.item.Items; @@ -27,16 +21,12 @@ import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.ActionResult; import net.minecraft.util.Identifier; -import net.minecraft.world.World; - -import java.util.function.Function; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.function.Function; + /** * Main class for Fabric Shield Lib. */ @@ -63,6 +53,9 @@ public class FabricShieldLib implements ModInitializer { */ public static FabricShieldItem fabric_shield; + public static ComponentType MODEL_COMPONENT; + + /** * Recipe type and serializer for banner decoration recipe. @@ -87,6 +80,8 @@ public void onInitialize() { //Register Config MidnightConfig.init(MOD_ID, FabricShieldLibConfig.class); + MODEL_COMPONENT = Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MOD_ID, "shieldlibmodelcomponent"), ComponentType.builder().codec(FabricShieldModelComponent.CODEC).build()); + //Dev environment code. if(FabricLoader.getInstance().isDevelopmentEnvironment()) { @@ -94,7 +89,7 @@ public void onInitialize() { logger.warn("FABRIC SHIELD LIB DEVELOPMENT CODE RAN!!!, if you are not in a development environment this is very bad! Test items and test enchantments will be ingame!"); //Register Custom Shield - fabric_banner_shield = registerItem("fabric_banner_shield", (props) -> new FabricBannerShieldItem(props.maxDamage(336), 85, 9, Items.OAK_PLANKS, Items.SPRUCE_PLANKS)); + fabric_banner_shield = registerItem("fabric_banner_shield", (props) -> new FabricBannerShieldItem(props.maxDamage(336).component(MODEL_COMPONENT, new FabricShieldModelComponent(FabricShieldLibClient.FABRIC_BANNER_SHIELD_BASE.getTextureId(), FabricShieldLibClient.FABRIC_BANNER_SHIELD_BASE_NO_PATTERN.getTextureId(), FabricShieldLibClient.fabric_banner_shield_model_layer.toString())), 85, 9, Items.OAK_PLANKS, Items.SPRUCE_PLANKS)); fabric_shield = registerItem("fabric_shield", (props) -> new FabricShieldItem(props.maxDamage(336), 100, 9, Items.OAK_PLANKS, Items.SPRUCE_PLANKS)); @@ -103,37 +98,40 @@ public void onInitialize() { entries.addAfter(fabric_banner_shield,fabric_shield); }); + + + //Test event: makes any shield with new enchantment reflect a 1/3rd of damage back to attacker - ShieldBlockCallback.EVENT.register((defender, source, amount, hand, shield) -> { - - RegistryKey key = FabricShieldLibDataGenerator.EnchantmentGenerator.REFLECTION; - RegistryEntry entry = defender.getWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getEntry(key.getValue()).get(); - int reflectNumber = EnchantmentHelper.getLevel(entry, shield); - - if(reflectNumber > 0) { - Entity attacker = source.getAttacker(); - - if(attacker.equals(null)) { - return ActionResult.CONSUME; - } - if(defender.blockedByShield(source)){ - World world = attacker.getWorld(); - if(defender instanceof PlayerEntity) { //Defender should always be a player, but check anyway - attacker.sidedDamage(world.getDamageSources().playerAttack((PlayerEntity) defender), Math.round(amount * 0.33F)); - } else { - attacker.sidedDamage(world.getDamageSources().mobAttack(defender), Math.round(amount * 0.33F)); - } - } - } - - return ActionResult.PASS; - }); +// ShieldBlockCallback.EVENT.register((defender, source, amount, hand, shield) -> { +// +// RegistryKey key = FabricShieldLibDataGenerator.EnchantmentGenerator.REFLECTION; +// RegistryEntry entry = defender.getWorld().getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getEntry(key.getValue()).get(); +// int reflectNumber = EnchantmentHelper.getLevel(entry, shield); +// +// if(reflectNumber > 0) { +// Entity attacker = source.getAttacker(); +// +// if(attacker.equals(null)) { +// return ActionResult.CONSUME; +// } +// if(defender.blockedByShield(source)){ +// World world = attacker.getWorld(); +// if(defender instanceof PlayerEntity) { //Defender should always be a player, but check anyway +// attacker.sidedDamage(world.getDamageSources().playerAttack((PlayerEntity) defender), Math.round(amount * 0.33F)); +// } else { +// attacker.sidedDamage(world.getDamageSources().mobAttack(defender), Math.round(amount * 0.33F)); +// } +// } +// } +// +// return ActionResult.PASS; +// }); //Test Event: if your shield gets disabled, give player speed - ShieldDisabledCallback.EVENT.register((defender, hand, shield) -> { - defender.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 10, 1, true, false)); - return ActionResult.PASS; - }); +// ShieldDisabledCallback.EVENT.register((defender, hand, shield) -> { +// defender.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 10, 1, true, false)); +// return ActionResult.PASS; +// }); } //Announce having finished starting up logger.info("Fabric Shield Lib Initialized!"); diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLibClient.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLibClient.java index 8fad72b..77c9f5d 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLibClient.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/initializers/FabricShieldLibClient.java @@ -3,34 +3,26 @@ import com.github.crimsondawn45.fabricshieldlib.lib.config.FabricShieldLibConfig; import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldSetModelCallback; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShield; +import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldModelRenderer; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; -import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; import net.minecraft.client.render.entity.model.EntityModelLayer; import net.minecraft.client.render.entity.model.ShieldEntityModel; -import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.item.model.special.SpecialModelTypes; import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; -import net.minecraft.util.DyeColor; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import java.util.ArrayList; import java.util.List; -import java.util.Objects; public class FabricShieldLibClient implements ClientModInitializer { @@ -48,6 +40,8 @@ public class FabricShieldLibClient implements ClientModInitializer { @Override public void onInitializeClient() { + SpecialModelTypes.ID_MAPPER.put(Identifier.of("fabricshieldlib", "fabric_banner_shield"), FabricShieldModelRenderer.Unbaked.CODEC); + /* * Register tooltip callback this is the same as mixing into the end of: * ItemStack.getTooltip() @@ -65,7 +59,7 @@ public void onInitializeClient() { //Add cooldown tooltip if(shield.displayTooltip()) { - getCooldownTooltip(stack, type ,tooltip, shield.getCoolDownTicks()); + getCooldownTooltip(stack, type ,tooltip, shield.getCoolDownTicks(stack)); } } @@ -90,34 +84,7 @@ public void onInitializeClient() { return ActionResult.PASS; }); - //Register renderer - BuiltinItemRendererRegistry.INSTANCE.register(FabricShieldLib.fabric_banner_shield, (stack, mode, matrices, vertexConsumers, light, overlay) -> { - renderBanner(stack, matrices, vertexConsumers, light, overlay, modelFabricShield, FABRIC_BANNER_SHIELD_BASE, FABRIC_BANNER_SHIELD_BASE_NO_PATTERN); - }); - } - } - - /** - * Used to simplify the mixin on the user end to make their shield render banner. - * - * Uses params from the mixin method, and the model and sprite identifiers made by the player. - */ - public static void renderBanner(ItemStack stack, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ShieldEntityModel model, SpriteIdentifier base, SpriteIdentifier base_nopattern){ - BannerPatternsComponent bannerPatternsComponent = (BannerPatternsComponent)stack.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT); - DyeColor dyeColor2 = (DyeColor)stack.get(DataComponentTypes.BASE_COLOR); - boolean bl = !bannerPatternsComponent.layers().isEmpty() || dyeColor2 != null; - matrices.push(); - matrices.scale(1.0F, -1.0F, -1.0F); - SpriteIdentifier spriteIdentifier = bl ? base : base_nopattern; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, model.getLayer(spriteIdentifier.getAtlasId()), true, stack.hasGlint())); - model.getHandle().render(matrices, vertexConsumer, light, overlay); - if (bl) { - BannerBlockEntityRenderer.renderCanvas(matrices, vertexConsumers, light, overlay, model.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasGlint(), true); - } else { - model.getPlate().render(matrices, vertexConsumer, light, overlay); } - - matrices.pop(); } /** diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/event/ShieldSetModelCallback.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/event/ShieldSetModelCallback.java index 3b81262..3d5d93d 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/event/ShieldSetModelCallback.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/event/ShieldSetModelCallback.java @@ -2,7 +2,7 @@ import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; -import net.minecraft.client.render.entity.model.EntityModelLoader; +import net.minecraft.client.render.entity.model.LoadedEntityModels; import net.minecraft.util.ActionResult; public interface ShieldSetModelCallback { @@ -23,5 +23,5 @@ public interface ShieldSetModelCallback { return ActionResult.PASS; }); - ActionResult setModel(EntityModelLoader loader); + ActionResult setModel(LoadedEntityModels loader); } diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricBannerShieldItem.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricBannerShieldItem.java index e54ff5e..b4d66d5 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricBannerShieldItem.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricBannerShieldItem.java @@ -1,11 +1,14 @@ package com.github.crimsondawn45.fabricshieldlib.lib.object; import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.*; +import net.minecraft.item.BannerItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; import net.minecraft.item.tooltip.TooltipType; import net.minecraft.registry.tag.TagKey; import net.minecraft.text.Text; -import net.minecraft.util.*; +import net.minecraft.util.DyeColor; import java.util.List; diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShield.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShield.java index 0316e07..6de5a4d 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShield.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShield.java @@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Text; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -17,7 +18,7 @@ public interface FabricShield { * * @return how many ticks shield will be disabled for when it with axe. */ - default int getCoolDownTicks() { + default int getCoolDownTicks(@Nullable ItemStack itemStack) { return 100; } diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldItem.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldItem.java index b6c1010..8d1ffba 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldItem.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldItem.java @@ -4,7 +4,6 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.DispenserBlock; import net.minecraft.block.dispenser.EquippableDispenserBehavior; -import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.RepairableComponent; import net.minecraft.entity.EquipmentSlot; @@ -21,15 +20,13 @@ import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.jetbrains.annotations.Nullable; - /** * Pre-made class for quickly making custom shields. */ @@ -89,9 +86,9 @@ public FabricShieldItem(Settings settings, int coolDownTicks, int enchantability } private void RegisterModelPredicate() { - ModelPredicateProviderRegistry.register(Identifier.of("blocking"), (itemStack, clientWorld, livingEntity, i) -> { - return livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F; - }); +// ModelPredicateProviderRegistry.register(Identifier.of("blocking"), (itemStack, clientWorld, livingEntity, i) -> { +// return livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F; +// }); } @Override @@ -99,7 +96,7 @@ public void appendTooltip(ItemStack stack, Item.TooltipContext context, List REFLECTION = EnchantmentGenerator.of("reflect"); - - public EnchantmentGenerator(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - System.out.println("REGISTERING ENCHANTS"); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - register(entries, REFLECTION, Enchantment.builder(Enchantment.definition(registries.getOrThrow(RegistryKeys.ITEM).getOrThrow(ConventionalItemTags.SHIELD_TOOLS), - // this is the "weight" or probability of our enchantment showing up in the table - 10, - // the maximum level of the enchantment - 1, - // base cost for level 1 of the enchantment, and min levels required for something higher - Enchantment.constantCost( 10), - // same fields as above but for max cost - Enchantment.constantCost(15), - // anvil cost - 5, - // valid slots - AttributeModifierSlot.HAND))); - } - - private void register(Entries entries, RegistryKey key, Enchantment.Builder builder, ResourceCondition... resourceConditions) { - entries.add(key, builder.build(key.getValue()), resourceConditions); - } - - private static RegistryKey of(String path) { - Identifier id = Identifier.of(FabricShieldLib.MOD_ID, path); - return RegistryKey.of(RegistryKeys.ENCHANTMENT, id); - } - - @Override - public String getName() { - return "FabricShieldLibEnchantmentGenerator"; - } - } -} \ No newline at end of file +//package com.github.crimsondawn45.fabricshieldlib.lib.object; +// +//import com.github.crimsondawn45.fabricshieldlib.initializers.FabricShieldLib; +//import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; +//import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +//import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +//import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; +//import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; +//import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags; +//import net.minecraft.component.type.AttributeModifierSlot; +//import net.minecraft.enchantment.Enchantment; +//import net.minecraft.registry.RegistryKey; +//import net.minecraft.registry.RegistryKeys; +//import net.minecraft.registry.RegistryWrapper; +//import net.minecraft.util.Identifier; +// +//import java.util.concurrent.CompletableFuture; +// +//public class FabricShieldLibDataGenerator implements DataGeneratorEntrypoint { +// +// @Override +// public void onInitializeDataGenerator(FabricDataGenerator generator) { +// FabricDataGenerator.Pack pack = generator.createPack(); +// pack.addProvider(EnchantmentGenerator::new); +// } +// +// +// public static class EnchantmentGenerator extends FabricDynamicRegistryProvider { +// public static final RegistryKey REFLECTION = EnchantmentGenerator.of("reflect"); +// +// public EnchantmentGenerator(FabricDataOutput output, CompletableFuture registriesFuture) { +// super(output, registriesFuture); +// System.out.println("REGISTERING ENCHANTS"); +// } +// +// @Override +// protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { +// register(entries, REFLECTION, Enchantment.builder(Enchantment.definition(registries.getOrThrow(RegistryKeys.ITEM).getOrThrow(ConventionalItemTags.SHIELD_TOOLS), +// // this is the "weight" or probability of our enchantment showing up in the table +// 10, +// // the maximum level of the enchantment +// 1, +// // base cost for level 1 of the enchantment, and min levels required for something higher +// Enchantment.constantCost( 10), +// // same fields as above but for max cost +// Enchantment.constantCost(15), +// // anvil cost +// 5, +// // valid slots +// AttributeModifierSlot.HAND))); +// } +// +// private void register(Entries entries, RegistryKey key, Enchantment.Builder builder, ResourceCondition... resourceConditions) { +// entries.add(key, builder.build(key.getValue()), resourceConditions); +// } +// +// private static RegistryKey of(String path) { +// Identifier id = Identifier.of(FabricShieldLib.MOD_ID, path); +// return RegistryKey.of(RegistryKeys.ENCHANTMENT, id); +// } +// +// @Override +// public String getName() { +// return "FabricShieldLibEnchantmentGenerator"; +// } +// } +//} \ No newline at end of file diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelComponent.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelComponent.java new file mode 100644 index 0000000..96b4afe --- /dev/null +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelComponent.java @@ -0,0 +1,18 @@ +package com.github.crimsondawn45.fabricshieldlib.lib.object; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.util.Identifier; + +public record FabricShieldModelComponent(Identifier baseModel, Identifier baseModelNoPat, String layer) { + + public static final Codec CODEC = RecordCodecBuilder.create(builder -> { + return builder.group( + Identifier.CODEC.fieldOf("baseModel").forGetter(FabricShieldModelComponent::baseModel), + Identifier.CODEC.fieldOf("baseModelNoPat").forGetter(FabricShieldModelComponent::baseModelNoPat), + Codec.STRING.fieldOf("EML").forGetter(FabricShieldModelComponent::layer) + ).apply(builder, FabricShieldModelComponent::new); + }); + +} diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelRenderer.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelRenderer.java new file mode 100644 index 0000000..3ba3129 --- /dev/null +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/lib/object/FabricShieldModelRenderer.java @@ -0,0 +1,88 @@ +package com.github.crimsondawn45.fabricshieldlib.lib.object; + +import com.github.crimsondawn45.fabricshieldlib.initializers.FabricShieldLib; +import com.mojang.serialization.MapCodec; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.client.render.entity.model.LoadedEntityModels; +import net.minecraft.client.render.entity.model.ShieldEntityModel; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.item.model.special.SpecialModelRenderer; +import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.BannerPatternsComponent; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; +import net.minecraft.util.DyeColor; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; + +import java.util.Objects; + +@Environment(EnvType.CLIENT) +public class FabricShieldModelRenderer implements SpecialModelRenderer { + private final LoadedEntityModels loadedEntityModels; + + public FabricShieldModelRenderer(LoadedEntityModels loadedEntityModels) { + this.loadedEntityModels = loadedEntityModels; + } + + @Nullable + public ComponentMap getData(ItemStack itemStack) { + return itemStack.getImmutableComponents(); + } + + public void render(@Nullable ComponentMap componentMap, ModelTransformationMode modelTransformationMode, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, boolean bl) { + BannerPatternsComponent bannerPatternsComponent = componentMap != null ? (BannerPatternsComponent)componentMap.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT) : BannerPatternsComponent.DEFAULT; + DyeColor dyeColor = componentMap != null ? (DyeColor)componentMap.get(DataComponentTypes.BASE_COLOR) : null; + boolean bl2 = !bannerPatternsComponent.layers().isEmpty() || dyeColor != null; + matrixStack.push(); + matrixStack.scale(1.0F, -1.0F, -1.0F); + FabricShieldModelComponent modelComponent = componentMap.get(FabricShieldLib.MODEL_COMPONENT); + EntityModelLayer EML = new EntityModelLayer(getEMLID(modelComponent.layer()), "main"); + ShieldEntityModel model = new ShieldEntityModel(loadedEntityModels.getModelPart(EML)); + @SuppressWarnings("deprecation") + SpriteIdentifier spriteIdentifier = bl2 ? new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, modelComponent.baseModel()) : new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, modelComponent.baseModelNoPat()); + VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumerProvider, model.getLayer(spriteIdentifier.getAtlasId()), modelTransformationMode == ModelTransformationMode.GUI, bl)); + model.getHandle().render(matrixStack, vertexConsumer, i, j); + if (bl2) { + BannerBlockEntityRenderer.renderCanvas(matrixStack, vertexConsumerProvider, i, j, model.getPlate(), spriteIdentifier, false, (DyeColor)Objects.requireNonNullElse(dyeColor, DyeColor.WHITE), bannerPatternsComponent, bl, false); + } else { + model.getPlate().render(matrixStack, vertexConsumer, i, j); + } + + matrixStack.pop(); + } + + @Environment(EnvType.CLIENT) + public record Unbaked() implements SpecialModelRenderer.Unbaked { + public static final FabricShieldModelRenderer.Unbaked INSTANCE = new FabricShieldModelRenderer.Unbaked(); + public static final MapCodec CODEC; + + public MapCodec getCodec() { + return CODEC; + } + + + public SpecialModelRenderer bake(LoadedEntityModels entityModels) { + return new FabricShieldModelRenderer(entityModels); + } + + static { + CODEC = MapCodec.unit(INSTANCE); + } + } + + @Nullable + public static Identifier getEMLID(String IdWithVariant) { + return Identifier.tryParse(IdWithVariant.split("#")[0]); + } +} + diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/HeldItemRendererMixin.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/HeldItemRendererMixin.java new file mode 100644 index 0000000..52d5f4e --- /dev/null +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/HeldItemRendererMixin.java @@ -0,0 +1,22 @@ +package com.github.crimsondawn45.fabricshieldlib.mixin; + + +import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShield; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import net.minecraft.client.render.item.HeldItemRenderer; +import net.minecraft.item.ShieldItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; + +@Mixin(HeldItemRenderer.class) +public class HeldItemRendererMixin { + //thanks Starexify (Nova on disc) for this mixin! + @WrapOperation( + method = "renderFirstPersonItem", + constant = @Constant(classValue = ShieldItem.class) + ) + private boolean wrapInstanceCheck(Object instance, Operation original) { + return original.call(instance) || instance instanceof FabricShield; + } +} diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/ItemsMixin.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/ItemsMixin.java index 261a35f..04f3ace 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/ItemsMixin.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/ItemsMixin.java @@ -1,16 +1,14 @@ package com.github.crimsondawn45.fabricshieldlib.mixin; +import com.github.crimsondawn45.fabricshieldlib.lib.config.FabricShieldLibConfig; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import net.minecraft.item.Item; import net.minecraft.item.Items; - import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Slice; -import com.github.crimsondawn45.fabricshieldlib.lib.config.FabricShieldLibConfig; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - /** * Makes vanilla shield enchantable with an enchantability of 14. */ diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/LivingEntityMixin.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/LivingEntityMixin.java index 140ce3c..253b33e 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/LivingEntityMixin.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/LivingEntityMixin.java @@ -3,14 +3,12 @@ import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldBlockCallback; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldUtils; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.server.world.ServerWorld; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -77,7 +75,7 @@ private boolean instanceOfShieldItem(boolean isVanillaShieldClass) { @ModifyExpressionValue( allow = 1, require = 1, - method = "blockedByShield(Lnet/minecraft/entity/damage/DamageSource;)V", + method = "blockedByShield(Lnet/minecraft/entity/damage/DamageSource;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;") ) private Item instanceOfShieldItem(Item item) { diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/PlayerEntityMixin.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/PlayerEntityMixin.java index 617f76c..e105e96 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/PlayerEntityMixin.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/PlayerEntityMixin.java @@ -4,9 +4,7 @@ import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldDisabledCallback; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShield; import com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldUtils; - import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; @@ -16,7 +14,6 @@ import net.minecraft.registry.Registries; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntryList; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -69,7 +66,7 @@ private void disableShieldHead(ItemStack itemStack, CallbackInfo callbackInfo) { if (itemStack.getItem() instanceof FabricShield shield) { if (!FabricShieldLibConfig.universal_disable) { - player.getItemCooldownManager().set(itemStack, shield.getCoolDownTicks()); + player.getItemCooldownManager().set(itemStack, shield.getCoolDownTicks(itemStack)); player.clearActiveItem(); player.getWorld().sendEntityStatus(player, (byte) 30); callbackInfo.cancel(); @@ -96,7 +93,7 @@ private void getEntryList(PlayerEntity player) { if (list.get(amountOfShields - 1) instanceof ShieldItem) { player.getItemCooldownManager().set(Items.SHIELD.getDefaultStack(), 100); } else if (list.get(amountOfShields - 1) instanceof FabricShield) { - player.getItemCooldownManager().set(list.get(amountOfShields - 1).getDefaultStack(), ((FabricShield) list.get(amountOfShields - 1)).getCoolDownTicks()); + player.getItemCooldownManager().set(list.get(amountOfShields - 1).getDefaultStack(), ((FabricShield) list.get(amountOfShields - 1)).getCoolDownTicks(list.get(amountOfShields - 1).getDefaultStack())); } player.clearActiveItem(); player.getWorld().sendEntityStatus(player, (byte) 30); diff --git a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/RendererMixin.java b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/RendererMixin.java index 53126b3..b1f10f6 100644 --- a/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/RendererMixin.java +++ b/src/main/java/com/github/crimsondawn45/fabricshieldlib/mixin/RendererMixin.java @@ -2,31 +2,26 @@ import com.github.crimsondawn45.fabricshieldlib.lib.event.ShieldSetModelCallback; -import net.minecraft.client.render.entity.model.EntityModelLoader; -import net.minecraft.client.render.item.BuiltinModelItemRenderer; -import org.spongepowered.asm.mixin.Final; +import net.minecraft.client.render.entity.model.LoadedEntityModels; +import net.minecraft.client.render.item.model.special.ShieldModelRenderer; +import net.minecraft.client.render.item.model.special.SpecialModelRenderer; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * Handles rendering of shields with banners. */ -@Mixin(BuiltinModelItemRenderer.class) +@Mixin(ShieldModelRenderer.Unbaked.class) public class RendererMixin { /** * This is now lib code and the player will not have to make this! */ - @Final - @Shadow - public EntityModelLoader entityModelLoader; - - @Inject(method = "reload", at = @At("HEAD")) - private void setModelFabricShield(CallbackInfo ci){ - ShieldSetModelCallback.EVENT.invoker().setModel(this.entityModelLoader); + @Inject(method = "bake", at = @At("HEAD")) + private void setModelFabricShield(LoadedEntityModels entityModels, CallbackInfoReturnable> cir){ + ShieldSetModelCallback.EVENT.invoker().setModel(entityModels); } } \ No newline at end of file diff --git a/src/main/resources/assets/fabricshieldlib/items/fabric_banner_shield.json b/src/main/resources/assets/fabricshieldlib/items/fabric_banner_shield.json new file mode 100644 index 0000000..4913ba4 --- /dev/null +++ b/src/main/resources/assets/fabricshieldlib/items/fabric_banner_shield.json @@ -0,0 +1,20 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:using_item", + "on_false": { + "type": "minecraft:special", + "base": "fabricshieldlib:item/fabric_banner_shield", + "model": { + "type": "fabricshieldlib:fabric_banner_shield" + } + }, + "on_true": { + "type": "minecraft:special", + "base": "fabricshieldlib:item/fabric_banner_shield_blocking", + "model": { + "type": "fabricshieldlib:fabric_banner_shield" + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/fabricshieldlib/items/fabric_shield.json b/src/main/resources/assets/fabricshieldlib/items/fabric_shield.json new file mode 100644 index 0000000..3f65e3b --- /dev/null +++ b/src/main/resources/assets/fabricshieldlib/items/fabric_shield.json @@ -0,0 +1,14 @@ +{ + "model": { + "type": "minecraft:condition", + "property": "minecraft:using_item", + "on_false": { + "type": "minecraft:model", + "model": "fabricshieldlib:item/fabric_shield" + }, + "on_true": { + "type": "minecraft:model", + "model": "fabricshieldlib:item/fabric_shield_blocking" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield.json b/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield.json index b931bcc..5082ac9 100644 --- a/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield.json +++ b/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield.json @@ -1,5 +1,4 @@ { - "parent": "builtin/entity", "gui_light": "front", "textures": { "particle": "fabricshieldlib:entity/fabric_banner_shield_base_nopattern" @@ -32,21 +31,13 @@ }, "fixed": { "rotation": [ 0, 180, 0 ], - "translation": [ -2, 4, -5], - "scale":[ 0.5, 0.5, 0.5] + "translation": [ -4.5, 4.5, -5], + "scale":[ 0.55, 0.55, 0.55] }, "ground": { "rotation": [ 0, 0, 0 ], - "translation": [ 4, 4, 2], + "translation": [ 2, 4, 2], "scale":[ 0.25, 0.25, 0.25] } - }, - "overrides": [ - { - "predicate": { - "blocking": 1 - }, - "model": "fabricshieldlib:item/fabric_banner_shield_blocking" - } - ] + } } diff --git a/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield_blocking.json b/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield_blocking.json index fd99a6b..836c185 100644 --- a/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield_blocking.json +++ b/src/main/resources/assets/fabricshieldlib/models/item/fabric_banner_shield_blocking.json @@ -1,18 +1,17 @@ { - "parent": "builtin/entity", "gui_light": "front", "textures": { "particle": "fabricshieldlib:entity/fabric_banner_shield_base_nopattern" }, "display": { "thirdperson_righthand": { - "rotation": [ 45, 135, 0 ], - "translation": [ 3.51, 11, -2 ], + "rotation": [ 45, 155, 0 ], + "translation": [ -3.49, 11, -2 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { - "rotation": [ 45, 135, 0 ], - "translation": [ 13.51, 3, 5 ], + "rotation": [ 45, 155, 0 ], + "translation": [ 11.51, 7, 2.5 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { diff --git a/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield.json b/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield.json index e99c75c..b5422c3 100644 --- a/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield.json +++ b/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield.json @@ -64,12 +64,12 @@ "display": { "thirdperson_righthand": { "rotation": [0, 90, 0], - "translation": [0.5, -5.0, 2], + "translation": [0, -5.0, 2], "scale": [1.00, 1.00, 1.00] }, "thirdperson_lefthand": { "rotation": [0, 90, 0], - "translation": [0.50, -5, 6], + "translation": [0, -5, 6], "scale": [1.00, 1.00, 1.00] }, "firstperson_righthand": { @@ -87,11 +87,6 @@ "translation": [2, -2, 0], "scale": [0.65, 0.65, 0.65] }, - "head": { - "rotation": [0, 0, 0], - "translation": [0.00, 0.00, 0.00], - "scale": [1.00, 1.00, 1.00] - }, "fixed": { "rotation": [0, 180, 0], "translation": [1, -1.5, 0], @@ -102,13 +97,5 @@ "translation": [0.00, 3.00, 0.00], "scale": [0.25, 0.25, 0.25] } - }, - "overrides": [ - { - "predicate": { - "blocking": 1 - }, - "model": "fabricshieldlib:item/fabric_shield_blocking" - } - ] + } } \ No newline at end of file diff --git a/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield_blocking.json b/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield_blocking.json index 7a05a4d..0862e93 100644 --- a/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield_blocking.json +++ b/src/main/resources/assets/fabricshieldlib/models/item/fabric_shield_blocking.json @@ -14,12 +14,12 @@ }, "firstperson_righthand": { "rotation": [0, 180, -5], - "translation": [-6, -14, 0], + "translation": [-5.4, -13.35, -2], "scale": [1.65, 1.65, 1.65] }, "firstperson_lefthand": { "rotation": [0, 180, -5], - "translation": [4, -14, 0], + "translation": [4, -13.25, -2], "scale": [1.65, 1.65, 1.65] } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 13ba076..e0119da 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -9,9 +9,9 @@ "CrimsonDawn45" ], "contributors":[ - "Rikka0w0", "LegibleSleet827", "CringeStar", + "Rikka0w0", "RDKRACZ", "Jamalam360", "NLxDodge", @@ -26,7 +26,8 @@ "muhammedesadcomert", "timoreo22", "OverLordsIII", - "SKZGx" + "SKZGx", + "Starexify" ], "contact": { "homepage": "https://www.curseforge.com/minecraft/mc-mods/fabric-shield-lib", @@ -39,15 +40,11 @@ "environment": "*", "entrypoints": { - "fabric-datagen": [ - "com.github.crimsondawn45.fabricshieldlib.lib.object.FabricShieldLibDataGenerator" - ], "main": [ "com.github.crimsondawn45.fabricshieldlib.initializers.FabricShieldLib" ], "client": [ "com.github.crimsondawn45.fabricshieldlib.initializers.FabricShieldLibClient" - ], "modmenu":[ "com.github.crimsondawn45.fabricshieldlib.lib.config.FabricShieldLibModMenuIntegration" @@ -58,8 +55,8 @@ ], "depends": { "fabricloader": ">=0.14.8", - "fabric": "*", - "minecraft": ">=1.20.5", + "fabric-api": "*", + "minecraft": ">=1.21.4", "java": ">=17", "mm":">=2.3" } diff --git a/src/main/resources/fabricshieldlib.mixins.json b/src/main/resources/fabricshieldlib.mixins.json index 76456c1..a0010cb 100644 --- a/src/main/resources/fabricshieldlib.mixins.json +++ b/src/main/resources/fabricshieldlib.mixins.json @@ -4,12 +4,13 @@ "package": "com.github.crimsondawn45.fabricshieldlib.mixin", "compatibilityLevel": "JAVA_21", "mixins": [ + "ItemsMixin", "LivingEntityMixin", - "PlayerEntityMixin", - "ItemsMixin" + "PlayerEntityMixin" ], "client": [ - "RendererMixin" + "RendererMixin", + "HeldItemRendererMixin" ], "injectors": { "defaultRequire": 1