User Tools

Site Tools


tutorial:shield

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:shield [2023/09/26 00:09] – added warning cringestar_boitutorial:shield [2025/06/21 18:39] (current) – updated to 1.21.4 cringestar_boi
Line 1: Line 1:
-__**!!OUTDATED AND BEING WORKED ON !!**__+====== Making a Custom Shield in Minecraft [1.19-1.21.4] ====== 
 +:!: The tutorial depends on third-party libraries.
  
-====== Making a Custom Shield in Minecraft [1.19-1.14] ======+Congrats! You just learned how to create your custom tools in the last tutorial! Now imagine you want to shield yourself from that sword if your friend got itIf you made it too op, a regular shield won't do. So we will see how to make a custom shield.
  
-Congrats! You just learned how to create your custom sword in the last tutorial! Now imagine you want to shield yourself from that sword if your friend got it. If you made it too op, a regular shield won't do. So we will see how to make a custom shield.\\  +Luckily, StellarWind22 has already made a library to help with this! If she didn't, you probably would be sitting here for the next hour following this tutorial, so thanks, StellarWind22!
-Luckily, CrimsonDawn45 has already made a library to help with this! If he didn't, you probably would be sitting here for the next hour to follow this tutorial, so thanks CrimsonDawn45!+
  
-Library source is available at https://github.com/CrimsonDawn45/Fabric-Shield-Lib+The library source is available at https://github.com/StellarWind22/Fabric-Shield-Lib
  
 Library compiled as a jar is available at https://www.curseforge.com/minecraft/mc-mods/fabric-shield-lib Library compiled as a jar is available at https://www.curseforge.com/minecraft/mc-mods/fabric-shield-lib
Line 12: Line 12:
 ===== Adding the library to your project ===== ===== Adding the library to your project =====
  
-Add the following code to the files mentioned:\\ \\  +Add the following code to the files mentioned:
-**gradle.properties**\\  +
-<code java> +
-fabric_shield_lib_version=1.6.0-1.19 +
-</code>\\  +
-**build.gradle** (under dependencies)\\  +
-<code java> +
-modImplementation "com.github.CrimsonDawn45:Fabric-Shield-Lib:v${project.fabric_shield_lib_version}" +
-</code>\\  +
-At the time of writing, latest project.fabric_shield_lib_version should be 1.6.0-1.19. This page will be updated whenever a new update comes out.\\ \\  +
-**build.gradle** (under repositories, the one above dependencies)\\  +
-<code java> +
- maven { url = 'https://jitpack.io'+
-</code>\\ +
  
-__//**If you are doing this in Minecraft version 1.17 or higher or using FabricShieldLib version 1.5.0 or higher, add these things as well:**//__+**gradle.properties** 
 +<file properties gradle.properties> 
 +fabric_shield_lib_version=1.8.0-1.21.4 
 +mod_menu_version=13.0.0 
 +midnightlib_version=1.6.6-fabric 
 +fabricasm_version=2.3 
 +</file>
  
-**gradle.properties**\\  +**build.gradle** (under ''dependencies'' block)  
-<code java+<file groovy build.gradle
- fabric_asm_version=2.+ modImplementation "com.github.StellarWind:Fabric-Shield-Lib:v${project.fabric_shield_lib_version}" 
- cloth_version=8.1.77 + modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}" 
- mod_menu_version=4.0.6 + modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" 
- crowdlin_version=1.4+1.19 + modImplementation "com.github.Chocohead:Fabric-ASM:v${project.fabricasm_version}" 
-</code>\\ +</file>
  
-**(These versions will be updated in this wiki alongside the mod version)**+At the time of writing, these are the most up-to-date FabricShieldLib versions: 
 +  * **1.21.4** (''1.8.0-1.21.4'') 
 +  * **1.21.2** - **1.21.3** (''1.8.0-pre1-1.21.3''
 +  * **1.21** - **1.21.1** (''1.7.2-1.21.1''
 +  * **1.20.5** - **1.20.6** (''1.7.2-1.20.6''
 +  * **1.20.2** - **1.20.4** (''1.7.2-1.20.4''
 +  * **1.20** - **1.20.1** (''1.7.2-1.20.1''
 +  * **1.19.3** - **1.19.4** (''1.7.2-1.19.4''
 +  * **1.19** - **1.19.2** (''1.7.2-1.19.2''
 +  * **1.18.2** (''1.7.2-1.18.2''
 +  * **1.17.1** (''1.7.2-1.17.1'')\\  
 +**build.gradle** (inside ''repositories'' block) 
 +<file groovy build.gradle> 
 + maven {url = 'https://jitpack.io'
 + maven {url "https://maven.terraformersmc.com/releases/"
 + maven {url = "https://api.modrinth.com/maven"
 +</file>\\ 
  
-**build.gradle** (under dependencies)\\  +__//**Midnight Lib and FabricASM are included in the FabricShieldLib release (.jar on Curseforge/Modrinth) but need to be used as dependencies when developing**//__
-<code java>+
  
- modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}") { +===== Adding a custom shield ===== 
- exclude(group: "net.fabricmc.fabric-api"+**If you want your shield to support banner decoration on your shield, please skip to the next section**
-+
- include("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}")+
  
- modCompileOnly modRuntimeOnly ("com.terraformersmc:modmenu:${project.mod_menu_version}"),+On to the non-boring steps! We will now make a custom shield!
- exclude(group: "net.fabricmc.fabric-api"+
- }+
  
- modImplementation("com.github.Chocohead:Fabric-ASM:v${project.fabric_asm_version}") { +If you have followed the above steps correctly and refreshed the project, then you will have the FabricShieldLib installed.
- exclude (group: "net.fabricmc.fabric-api"+
-+
- include("com.github.Chocohead:Fabric-ASM:v${project.fabric_asm_version}")+
  
-</code>\\ +If so, the first step to do is create a new instance of an ''Item'' (see [[https://docs.fabricmc.net/develop/items/first-item|items]] tutorial), like: 
 +<code java TutorialItems> 
 +public final class TutorialItems { 
 +    // ... 
 +    public static final Item NETHERITE_SHIELD = register("netherite_shield", settings -> new FabricShieldItem(settings,10, 13, Items.NETHERITE_INGOT), new Item.Settings().maxDamage(2500)); 
 +    //The constructor for the item takes in the following values: FabricBannerShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItems) 
 +    // ... 
 +
 +</code>
  
-**build.gradle** (under repositories, the one above dependencies)\\  +If you want to add your shield to a [[itemgroup|item groups]], for example, the "Combatgroup, use:
-<code java> +
- maven { url "https://maven.shedaniel.me/+
- maven { url "https://maven.terraformersmc.com/releases/"+
-</code>\\ +
  
-===== Adding a custom shield ===== +<yarncode java ExampleMod> 
-**If you want your shield to support banner decoration, there are extra steps that will be covered after the main creation.**\\ +public class ExampleMod implements ModInitializer { 
-On to the non-boring steps! We will now make a custom shield!\\ \\  +    ..
-If you have followed the above steps correctly and refreshed the project, then you will have the fabric shield api installed.\\  +    @Override 
-If so, the first step to do is create a new instance of an Item like: +    public void onInitialize() 
-<code java> +        ..
-public static final Item NETHERITE_SHIELD = new FabricShieldItem(new FabricItemSettings().maxDamage(2500).group(ItemGroup.COMBAT), 10, 13, Items.NETHERITE_INGOT); // FabricShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItem+        ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> { 
-</code>+            entries.add(NETHERITE_SHIELD)
 +        })
 +        ... 
 +    } 
 +    ... 
 +} 
 +</yarncode>
  
-Then, we have to register it, like so: +And our shield is (code-wisedone!
-  +
-<code java> +
-Registry.register(Registries.ITEM, new Identifier("examplemod", "netherite_shield"), NETHERITE_SHIELD); +
-</code>+
  
-And our shield is done!\\  +Now, we have to create the textures and models of the shield. 
-Now, we have to create the textures and models of the shield.\\  + 
-For the texture, you can use anything. A good place to start is looking at mojang's shield image and changing it. Put it in ''resources/assets/examplemod/textures/item/<filename>.png''\\  +For the texture, you can use anything. A good place to start is to look at Mojang's shield texture and change it. Put it in ''resources/assets/tutorial/textures/item/netherite_shield.png'' 
-Now, for the models, we have to write a few .json files.\\  + 
-For the model file without blockingwe use\\  +Now, for the models, we have to write a few .json files. 
-<code javascript>+ 
 +Inside ''resources/assets/tutorial/models/item/''create a ''netherite_shield.json'' file and put this inside it: 
 + 
 +<file javascript resources/assets/tutorial/models/item/netherite_shield.json>
 { {
-    "parent":"fabricshieldlib:item/fabric_shield", +  "parent":"fabricshieldlib:item/fabric_shield", 
-    "textures":+  "textures":
-        "shield":"examplemod:item/netherite_shield" +    "shield":"tutorial:item/netherite_shield" 
-    }+  }
-    "overrides":+
-        { +
-            "predicate":+
-                "blocking":+
-            }, +
-            "model": "examplemod:item/netherite_shield_blocking" +
-        } +
-    ]+
 } }
-</code>\\  +</file>  
-Put it in ''resources/assets/examplemod/models/item/netherite_shield.json''\\  + 
-For the blocking model, use this: \\  +In the same folder, create another file, ''netherite_shield_blocking.json'', and put his inside it:  
-<code javascript>+<file javascript resources/assets/tutorial/models/item/netherite_shield_blocking.json>
 { {
-  "parent": "fabricshieldlib:item/fabric_shield_blocking"+  "parent": "fabricshieldlib:item/fabric_shield_blocking"
 +  "textures":
 +    "shield":"tutorial:item/netherite_shield" 
 +  }
 } }
-</code>\\  +</file
-Plop it in resources/models/item/netherite_shield_blocking.json\\ \\  + 
-Don't forget to add it to **en_us.json** in ''resources/assets/lang/en_us.json''\\  +Then, as a [[tags|conventional tag]], create a ''shield.json'' file in ''resources/data/c/tags/item/tools/shield.json'' and add your shield to it: 
-<code javascript>+<code javascript resources/data/c/tags/item/shields.json>
 { {
-  "item.examplemod.netherite_shield": "Netherite Shield"+  "replace": false, 
 +  "values":
 +    "tutorial:netherite_shield" 
 +  ]
 } }
-</code>\\  +</code>
-And with that, your shield is done!+
  
- +Lastly, to make it enchantable, create a ''durability.json'' file in ''resources/data/minecraft/tags/item/enchantable/durability.json'' and add your shield to it
-===== Adding banner support to your shield (1.17+) ===== +<code javascript resources/data/minecraft/tags/item/enchantable/durability.json
- +{ 
-If you are using 1.17/1.18 instead of 1.19, please change versions in **gradle.properties** to: +  "replace": false, 
-<code java> +  "values": [ 
- fabric_shield_lib_version=1.5.3-1.18 +    "tutorial:netherite_shield" 
- fabric_asm_version=2.3 +  ] 
- cloth_version=6.2.57 +}
- mod_menu_version=3.0.1 +
- crowdlin_version=1.4+1.18 +
-</code+
-or +
-<code java> +
- fabric_shield_lib_version=1.5.3-1.17 +
- fabric_asm_version=2.3 +
- cloth_version=5.3.63 +
- mod_menu_version=2.0.15 +
- crowdlin_version=1.3+1.17+
 </code> </code>
  
 +Don't forget to add it to **en_us.json** in ''resources/assets/tutorial/lang/en_us.json''
 +<code javascript resources/assets/tutorial/lang/en_us.json>
 +{
 +  "item.tutorial.netherite_shield": "Netherite Shield"
 +}
 +</code>\\ 
 +And with that, your non-decorateable shield is done!
  
-This is where mixins get involved.+===== Adding a custom shield with banner support ===== 
 +The process is slightly different if you want to make your shield accept banners and decorateable like a vanilla shield.
  
-First thing you will want to do is to change //FabricShieldItem// to //FabricBannerShieldItem// so that it will be able to be crafted with banners. +We still make the item in the same way, just make it a ''FabricBannerShieldItem'': 
- +<code java TutorialItems
-<code java> + public static final Item NETHERITE_BANNER_SHIELD register("netherite_banner_shield", settings -> new FabricBannerShieldItem(settings, 10, 13, Items.NETHERITE_INGOT), new Item.Settings().maxDamage(2500));
-public static final Item NETHERITE_SHIELD = new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500).group(ItemGroup.COMBAT), 10, 13, Items.NETHERITE_INGOT); // FabricBannerShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItem)+
 </code> </code>
 +If you want to add your shield to a [[itemgroup|item groups]], for example, the "Combat" group, use:  
 + 
 +<yarncode java ExampleMod>  
 +public class ExampleMod implements ModInitializer {  
 +    @Override  
 +    public void onInitialize() {  
 +        ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> {  
 +            // ...  
 +            entries.add(NETHERITE_BANNER_SHIELD);  
 +        });  
 +    }  
 +}  
 +</yarncode>
  
-Now, we have to register a few things in our ''ClientModInitalizer''. +Now the item is created, we need to set up its renderingFor these steps, we are going to be working in our client mod initializer, which should already be set up for you in the fabric example mod.
- +
-To create our ''ClientModInitalizer'', we will make a new class called ''ExampleModClient'' and implement ''ClientModInitializer''. We will also implement and override the method ''onInitializeClient'' **(If you already have a client initializer, you can skip these next 2 steps.)**+
  
 +First, we will need to create an ''EntityModelLayer'' to use later.
 <code java> <code java>
 +@Environment(EnvType.CLIENT)
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
 +    public static final EntityModelLayer NETHERITE_BANNER_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of("tutorial", "netherite_banner_shield"),"main");
 +
     @Override     @Override
     public void onInitializeClient() {     public void onInitializeClient() {
Line 158: Line 177:
 </code> </code>
  
-Before we do any work in our client mod initializer, we need to register its entrypoint in ''fabric.mod.json''.+Next, we will register out ''EntityModelLayer'' that we made previously
  
-<code javascript> 
-{ 
-  [...] 
-  "entrypoints": { 
-    "main": [ 
-      "net.fabricmc.ExampleMod" 
-    ], 
-    "client": [ 
-      "net.fabricmc.ExampleModClient" 
-    ] 
-  } 
-  [...] 
-} 
-</code> 
- 
-Ok, so now that is done, we can work in our client initializer. 
- 
-First, we will need to create an ''EntityModelLayer'' to use later. 
 <code java> <code java>
 +@Environment(EnvType.CLIENT)
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
  
-    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(new Identifier("examplemod", "netherite_shield"),"main");+    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of("tutorial", "netherite_shield"),"main");
  
     @Override     @Override
     public void onInitializeClient() {     public void onInitializeClient() {
-    + EntityModelLayerRegistry.registerModelLayer(NETHERITE_BANNER_SHILED_MODEL_LAYER, ShieldEntityModel::getTexturedModelData);
     }     }
 } }
 </code> </code>
  
-Next, we will register out ''EntityModelLayer'' that we made previously. +Then we will create our shield model,
  
 <code java> <code java>
 +@Environment(EnvType.CLIENT)
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
- +    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of("tutorial", "netherite_shield"), "main"); 
-    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(new Identifier("examplemod", "netherite_shield"),"main");+     
 +    public static ShieldEntityModel modelNetheriteShield;
  
     @Override     @Override
Line 204: Line 208:
 </code> </code>
  
-Then we will register our 2 ''SpriteIdentifier''s.+And then register that shield model,
  
 <code java> <code java>
 +@Environment(EnvType.CLIENT)
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
- +    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of("tutorial", "netherite_shield"),"main"); 
-    public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(new Identifier("examplemod", "netherite_shield"),"main");+     
 +    public static ShieldEntityModel modelNetheriteShield;
  
     @Override     @Override
     public void onInitializeClient() {     public void onInitializeClient() {
         EntityModelLayerRegistry.registerModelLayer(NETHERITE_SHIELD_MODEL_LAYER, ShieldEntityModel::getTexturedModelData);         EntityModelLayerRegistry.registerModelLayer(NETHERITE_SHIELD_MODEL_LAYER, ShieldEntityModel::getTexturedModelData);
-        ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register((atlasTexture, registry) -> { +         
-            registry.register(new Identifier("examplemod", "entity/netherite_shield_base")); +        ShieldSetModelCallback.EVENT.register((loader) -> { 
-            registry.register(new Identifier("examplemod", "entity/netherite_shield_base_nopattern"))+     modelNetheriteShield = new ShieldEntityModel(loader.getModelPart(netherite_banner_shield_model_layer)); 
-        });+     return ActionResult.PASS
 + });
     }     }
 } }
 </code> </code>
  
-And now we get to the mixin. Don't worryits an easy one.+Next, we have to create our two ''SpriteIdentifiers'', 
 +<code java> 
 +@Environment(EnvType.CLIENT) 
 +public class ExampleModClient implements ClientModInitializer {
  
-If this is your first time, [[tutorial:mixin_registration|here's how to register mixins on your fabric.mod.json]] //__(Make sure to make a **client** mixin)__//+ public static final EntityModelLayer netherite_banner_shield_model_layer = new EntityModelLayer(Identifier.of("tutorial", "netherite_banner_shield"), "main");
  
-We will make a class called ''RendererMixin'' and write: + public static ShieldEntityModel modelNetheriteShield;
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin {+
  
-} + public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.of("tutorial", "entity/netherite_banner_shield_base")); 
-</code>+ public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.of("tutorial", "entity/netherite_banner_shield_base_nopattern"));
  
-Then we will make the necessary ''Spriteidentifier''s and a ''ShieldEntityModel''. The ''Spriteidentifier''s will be the same as in your ''ClientModInitializer''. + @Override 
-<code java> + public void onInitializeClient() { 
-@Mixin (BuiltinModelItemRenderer.class) +            EntityModelLayerRegistry.registerModelLayer(NETHERITE_SHIELD_MODEL_LAYER, ShieldEntityModel::getTexturedModelData)
-public class RendererMixin +         
-    private ShieldEntityModel modelNetheriteShield+            ShieldSetModelCallback.EVENT.register((loader-> { 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); +         modelNetheriteShield = new ShieldEntityModel(loader.getModelPart(netherite_banner_shield_model_layer)); 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern"));+         return ActionResult.PASS; 
 +     }); 
 + }
 } }
 </code> </code>
  
-Next, we need to @Shadow the ''entityModelLoader'' so that we can use it to initialize our model.+Finally, we will want to go back to our item and add a component to it to store its model information like so: 
 <code java> <code java>
-@Mixin (BuiltinModelItemRenderer.class) + public static final Item NETHERITE_BANNER_SHIELD register("netherite_banner_shield", 
-public class RendererMixin { + settings -> new FabricBannerShieldItem(settings,10, 13, Items.NETHERITE_INGOT), // FabricBannerShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItem
-    private ShieldEntityModel modelNetheriteShield; + new Item.Settings().maxDamage(2500).component(FabricShieldLib.MODEL_COMPONENT, 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); + new FabricShieldModelComponent( 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern"));+ ExampleModClient.NETHERITE_BANNER_SHIELD_BASE.getTextureId(), //Your base texture, from the client initializer 
 + ExampleModClient.NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN.getTextureId(), //Your no-pattern texture, from the client initializer 
 + ExampleModClient.netherite_banner_shield_model_layer.toString() // Your model layer, from the client initializer 
 + )));
  
-    @Final 
-    @Shadow 
-    private EntityModelLoader entityModelLoader; 
-}     
 </code> </code>
  
-Now we will inject into the ''reload'' method to initialize our model. 
-<code java> 
-@Mixin (BuiltinModelItemRenderer.class) 
-public class RendererMixin { 
-   private ShieldEntityModel modelNetheriteShield; 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); 
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern")); 
  
-    @Final +That is all of our code done, we only have a few json files to make.
-    @Shadow +
-    private EntityModelLoader entityModelLoader;+
  
- +First, create a ''blocks.json'' file inside of ''resources/assets/minecraft/atlases/''. Inside of it, you will have to list your ''SpriteIdentifiers'' from your client mod initializer like this: 
-    @Inject(method = "reload", at = @At("HEAD")) +<code javascript resources/assets/minecraft/atlases/blocks.json> 
-    private void setModelNetheriteShield(CallbackInfo ci)+
-        modelNetheriteShield = new ShieldEntityModel(this.entityModelLoader.getModelPart(ExampleModClient.NETHERITE_SHIELD_MODEL_LAYER));+  "sources": [ 
 +    
 +      "type": "single", 
 +      "resource": "tutorial:entity/netherite_banner_shield_base
 +    }, 
 +    
 +      "type": "single", 
 +      "resource": "tutorial:entity/netherite_banner_shield_base_nopattern"
     }     }
 +  ]
 } }
-</code>     +</code>
-  +
-Now we get to the most important part of the mixin. We will inject a method to render a banner on our shield. +
-   +
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-   private ShieldEntityModel modelNetheriteShield; +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern"));+
  
-    @Final +Nextinside ''resources/assets/tutorial/models/item/'', create a ''netherite_banner_shield.json'' file and put this inside it: 
-    @Shadow +<code javascript resources/assets/tutorial/models/item/netherite_banner_shield.json>
-    private EntityModelLoader entityModelLoader; +
- +
- +
-    @Inject(method = "reload"at = @At("HEAD")) +
-    private void setModelNetheriteShield(CallbackInfo ci){ +
-        this.modelNetheriteShield = new ShieldEntityModel(this.entityModelLoader.getModelPart(ExampleModClient.NETHERITE_SHIELD_MODEL_LAYER)); +
-    } +
-     +
-    @Inject(method = "render", at = @At("HEAD")) +
-    private void mainRender(ItemStack stack, ModelTransformation.Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) { +
-        if (stack.isOf(ExampleMod.NETHERITE_SHIELD)) { +
-            FabricShieldLibClient.renderBanner(stack, matrices, vertexConsumers, light, overlay, modelNetheriteShield, NETHERITE_SHIELD_BASE, NETHERITE_SHIELD_BASE_NO_PATTERN);  +
-            //The first five parameters are taken from the method, while the last 3 you provide yourself. You will provide the model, and then your 2 sprite identifiers in the order of ''//SHIELD_NAME//_BASE'' and then ''//SHIELD_NAME//_BASE_NOPATTERN. +
-'' +
-        } +
-    } +
- +
-     +
-+
-</code>      +
- +
-That is now all of the complicated things done! We now only need to change our existing modeladd a ''nopattern'' texture, and move our textures to the locations we identified earlier. +
- +
-In your shield model, ''netherite_shield.json'' for us, we need to change the parent and remove the texture. +
-<code javascript>+
 { {
-  "parent":"fabricshieldlib:item/fabric_banner_shield"+  "parent":"fabricshieldlib:item/fabric_banner_shield"
-    "overrides":+
-        { +
-            "predicate":+
-                "blocking":+
-            }, +
-            "model": "examplemod:item/netherite_shield_blocking" +
-        } +
-    ]+
 } }
 </code> </code>
  
-You also have to change your blocking model for your shield, ''netherite_shield_blocking.json'' for usto: +In the same folder, create another file, ''netherite_banner_shield_blocking.json'', and put his inside it:  
- +<code javascript resources/assets/tutorial/models/item/netherite_banner_shield_blocking.json>
-<code javascript>+
 { {
   "parent":"fabricshieldlib:item/fabric_banner_shield_blocking"   "parent":"fabricshieldlib:item/fabric_banner_shield_blocking"
Line 335: Line 300:
 </code> </code>
  
-For this next step, you will add ''_base_nopattern'' to your current shield texture, so ''netherite_shield'' to ''netherite_shield_base_nopattern''. +For this next step, you will add ''netherite_shield_base_nopattern'' texture, which will be a standard shield texture. Then, you will need to make a ''base'' version for your shield texture, so ''netherite_shield_base''. I recommend looking at the vanilla shield's ''base'' texture.
-Then, you will need to make a ''base'' version for your shield texture, so ''netherite_shield_base''. I recommend looking at the vanilla shield's ''base'' texture.+
  
 Then, you will move both of these textures into ''resources/assets/<modid>/textures/entity''. Then, you will move both of these textures into ''resources/assets/<modid>/textures/entity''.
  
-For one last thingyou will need to add names for each of your shield color variants in ''en_us.json''+Nextcreate a ''shields.json'' file in ''resources/data/c/tags/items/shields.json'' and add your shield to it: 
-<code javascript>+<code javascript resources/data/c/tags/items/shields.json>
 { {
-    "item.examplemod.netherite_shield": "Netherite Shield"+  "replace": false
-    "item.examplemod.netherite_shield.red": "Red Netherite Shield", +  "values": [ 
-    "item.examplemod.netherite_shield.orange": "Orange Netherite Shield", +    "tutorial:netherite_banner_shield
-    "item.examplemod.netherite_shield.yellow": "Yellow Netherite Shield", +  ]
-    "item.examplemod.netherite_shield.lime": "Lime Netherite Shield", +
-    "item.examplemod.netherite_shield.green": "Green Netherite Shield", +
-    "item.examplemod.netherite_shield.light_blue": "Light Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.cyan": "Cyan Netherite Shield", +
-    "item.examplemod.netherite_shield.blue": "Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.purple": "Purple Netherite Shield", +
-    "item.examplemod.netherite_shield.magenta": "Magenta Netherite Shield", +
-    "item.examplemod.netherite_shield.pink": "Pink Netherite Shield", +
-    "item.examplemod.netherite_shield.brown": "Brown Netherite Shield", +
-    "item.examplemod.netherite_shield.white": "White Netherite Shield", +
-    "item.examplemod.netherite_shield.light_gray": "Light Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.gray": "Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.dark_gray": "Dark Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.black": "Black Netherite Shield"+
 } }
-</code>     
- 
-===== Adding banner support to your shield (1.16) ===== 
- 
-This is where mixins get involved. 
- 
-First, change the fabric_shield_lib in **gradle.properties** 
-\\  
-<code java> 
-fabric_shield_lib_version=1.4.5-1.16 
 </code> </code>
-\\  
  
-Next thing you will want to do is to change //FabricShieldItem// to //FabricBannerShieldItem// so that it will be able to be crafted with banners. +Finally create a ''durability.json'' file in ''resources/data/minecraft/tags/item/enchantable/durability.json'' and add your shield to it: 
- +<code javascript resources/data/minecraft/tags/item/enchantable/durability.json
-<code java> +
-public static final Item NETHERITE_SHIELD = new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500).group(ItemGroup.COMBAT), 10, 13, Items.NETHERITE_INGOT); // FabricBannerShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItem) +  "replace": false, 
-</code> +  "values": [ 
- +    "tutorial:netherite_banner_shield" 
-Now, we have to register a few things in our ''ClientModInitalizer''. +  ]
- +
-To create our ''ClientModInitalizer'', we will make a new class called ''ExampleModClient'' and implement ''ClientModInitializer''. We will also implement and override the method ''onInitializeClient'' **(If you already have a client initializer, you can skip these next 2 steps.)** +
- +
-<code java+
-public class ExampleModClient implements ClientModInitializer +
-    @Override +
-    public void onInitializeClient() { +
-     +
-    }+
 } }
 </code> </code>
  
-Before we do any work in our client mod initializer, we need to register its entrypoint in ''fabric.mod.json''+Don't forget to add it to **en_us.json** in ''resources/assets/lang/en_us.json'' along with the color variants,\\ 
 <code javascript> <code javascript>
 { {
-  [...] +  "item.tutorial.netherite_banner_shield": "Netherite Banner Shield", 
-  "entrypoints": { +  "item.tutorial.netherite_banner_shield.red": "Red Netherite Banner Shield", 
-    "main": [ +  "item.tutorial.netherite_banner_shield.orange": "Orange Netherite Banner Shield", 
-      "net.fabricmc.ExampleMod+  "item.tutorial.netherite_banner_shield.yellow": "Yellow Netherite Banner Shield", 
-    ]+  "item.tutorial.netherite_banner_shield.lime": "Lime Netherite Banner Shield", 
-    "client": [ +  "item.tutorial.netherite_banner_shield.green": "Green Netherite Banner Shield"
-      "net.fabricmc.ExampleModClient+  "item.tutorial.netherite_banner_shield.light_blue": "Light Blue Banner Netherite Shield", 
-    ] +  "item.tutorial.netherite_banner_shield.cyan": "Cyan Netherite Banner Shield", 
-  } +  "item.tutorial.netherite_banner_shield.blue": "Blue Netherite Banner Shield", 
-  [...]+  "item.tutorial.netherite_banner_shield.purple": "Purple Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.magenta": "Magenta Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.pink": "Pink Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.brown": "Brown Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.white": "White Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.light_gray": "Light Gray Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.gray": "Gray Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.dark_gray": "Dark Gray Netherite Banner Shield", 
 +  "item.tutorial.netherite_banner_shield.black": "Black Netherite Banner Shield"
 } }
 </code> </code>
  
-Ok, so now that is done, we can work in our client initializer.+And now your shield is fully completed and supports banner decoration! 
 +===== Changes for 1.21.3 ===== 
 +If you are working in 1.21.3, **follow the changes for all higher versions first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\ 
 + 
 +<file properties gradle.properties> 
 +mod_menu_version=12.0.0-beta.1 
 +midnightlib_version=1.6.4-fabric 
 +</file>
  
-The only thing that we will need to do is register our 2 ''SpriteIdentifier''s.+Next, remove the ''FabricShieldLib.MODEL_COMPONENT'' from your shields. Then, you will want to register your shield with the ''BuiltinItemRendererRegistry'':
  
 <code java> <code java>
 +...
 +import static com.github.crimsondawn45.fabricshieldlib.initializers.FabricShieldLibClient.renderBanner;
 +...
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
- + ... 
-    @Override + @Override 
-    public void onInitializeClient() { + public void onInitializeClient() { 
-        ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).register((atlasTextureregistry) -> { +                ..
-            registry.register(new Identifier("examplemod""entity/netherite_shield_base")); + BuiltinItemRendererRegistry.INSTANCE.register(ExampleMod.NETHERITE_BANNER_SHIELD, (stackmode, matrices, vertexConsumers, light, overlay) -> { 
-            registry.register(new Identifier("examplemod""entity/netherite_shield_base_nopattern")); + renderBanner(stackmatrices, vertexConsumers, light, overlay, modelNetheriteShield, NETHERITE_BANNER_SHIELD_BASE, NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN); 
-        }); + //The first five parameters are taken from the methodwhile the last 3 you provide yourself.  
-    }+ //You will provide the model, and then your 2 sprite identifiers in the order of SHIELD_NAME_BASE and then SHIELD_NAME_BASE_NOPATTERN. 
 + }); 
 + ... 
 + } 
 +        ...
 } }
 </code> </code>
  
-And now we get to the mixin. Don't worry, its an easy one.+Finally, change the following models to these formats: (netherite_shield_blocking.json will be unchanged)
  
-If this is your first time, [[tutorial:mixin_registration|here's how to register mixins on your fabric.mod.json]] //__(Make sure to make a **client** mixin)__// +<file javascript resources/assets/tutorial/models/item/netherite_shield.json>
- +
-We will make a class called ''RendererMixin'' and write: +
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
- +
-+
-</code> +
- +
-Then we will make the necessary ''Spriteidentifier''s and a ''ShieldEntityModel''. The ''Spriteidentifier''s will be the same as in your ''ClientModInitializer''+
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-    private ShieldEntityModel modelNetheriteShield = new ShieldEntityModel; +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern")); +
-+
-</code>  +
-  +
-Now we get to the most important part of the mixin. We will inject a method to render a banner on our shield. +
-   +
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-    private ShieldEntityModel modelNetheriteShield = new ShieldEntityModel; +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base")); +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("examplemod","entity/netherite_shield_base_nopattern")); +
-     +
-    @Inject(method = "render", at = @At("HEAD")) +
-    private void mainRender(ItemStack stack, MatrixStack matrix, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, CallbackInfo ci) { +
-        if (stack.getItem() == ExampleMod.NETHERITE_SHIELD)) { +
-            FabricShieldLibClient.renderBanner(stack, matrix, vertexConsumerProvider, light, overlay, modelFabricShield, NETHERITE_SHIELD_BASE, NETHERITE_SHIELD_BASE_NO_PATTERN);  +
-            //The first five parameters are taken from the method, while the last 3 you provide yourself. You will provide the model, and then your 2 sprite identifiers in the order of ''//SHIELD_NAME//_BASE'' and then ''//SHIELD_NAME//_BASE_NOPATTERN. +
-'' +
-        } +
-    } +
- +
-     +
-+
-</code>      +
- +
-That is now all of the complicated things done! We now only need to change our existing model, add a ''nopattern'' texture, and move our textures to the locations we identified earlier. +
- +
-In your shield model, ''netherite_shield.json'' for us, we need to change the parent and remove the texture. +
-<code javascript>+
 { {
-  "parent":"fabricshieldlib:item/fabric_banner_shield",+    "parent":"fabricshieldlib:item/fabric_shield"
 +    "textures":
 +        "shield":"tutorial:item/netherite_shield" 
 +    },
     "overrides": [     "overrides": [
         {         {
Line 483: Line 392:
                 "blocking": 1                 "blocking": 1
             },             },
-            "model": "examplemod:item/netherite_shield_blocking"+            "model": "tutorial:item/netherite_shield_blocking"
         }         }
     ]     ]
 } }
-</code>+</file
  
-You also have to change your blocking model for your shield, ''netherite_shield_blocking.json'' for us, to: +<code javascript resources/assets/tutorial/models/item/etherite_banner_shield.json>
- +
-<code javascript>+
 { {
-  "parent":"fabricshieldlib:item/fabric_banner_shield_blocking" +  "parent":"fabricshieldlib:item/fabric_banner_shield", 
-+  "overrides": [ 
-</code> +    { 
- +      "predicate": { 
-For this next stepyou will add ''_base'' to your current shield texture, so ''netherite_shield'' to ''netherite_shield_base''. +        "blocking": 1 
-Then, you will need to make a ''nopattern'' version for your shield texture, so ''netherite_shield_base_nopattern''. I recommend looking at the vanilla shield's ''nopattern'' texture. +      }
- +      "model": "tutorial:item/netherite_banner_shield_blocking"
-Then, you will move both of these textures into ''resources/assets/<modid>/textures/entity''+
- +
-For one last thing, you will need to add names for each of your shield color variants in ''en_us.json''+
-<code javascript> +
-+
-    "item.examplemod.netherite_shield": "Netherite Shield", +
-    "item.examplemod.netherite_shield.red": "Red Netherite Shield", +
-    "item.examplemod.netherite_shield.orange": "Orange Netherite Shield", +
-    "item.examplemod.netherite_shield.yellow": "Yellow Netherite Shield", +
-    "item.examplemod.netherite_shield.lime": "Lime Netherite Shield"+
-    "item.examplemod.netherite_shield.green": "Green Netherite Shield", +
-    "item.examplemod.netherite_shield.light_blue""Light Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.cyan": "Cyan Netherite Shield", +
-    "item.examplemod.netherite_shield.blue": "Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.purple": "Purple Netherite Shield", +
-    "item.examplemod.netherite_shield.magenta": "Magenta Netherite Shield", +
-    "item.examplemod.netherite_shield.pink": "Pink Netherite Shield", +
-    "item.examplemod.netherite_shield.brown": "Brown Netherite Shield", +
-    "item.examplemod.netherite_shield.white": "White Netherite Shield", +
-    "item.examplemod.netherite_shield.light_gray": "Light Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.gray": "Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.dark_gray": "Dark Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.black": "Black Netherite Shield" +
-+
-</code>     +
- +
-===== Adding banner support to your shield (1.15) ===== +
- +
-This is where mixins get involved. +
- +
-First, change the fabric_shield_lib in **gradle.properties** +
-\\  +
-<code java> +
-fabric_shield_lib_version=1.4.5-1.15 +
-</code> +
-\\  +
- +
-Next thing you will want to do is to change //FabricShieldItem// to //FabricBannerShieldItem// so that it will be able to be crafted with banners. +
- +
-<code java> +
-public static final Item NETHERITE_SHIELD = new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500).group(ItemGroup.COMBAT), 10, 13, Items.NETHERITE_INGOT); // FabricBannerShieldItem(settings.maxDamage(durability), cooldownTicks, enchantability, repairItem) +
-</code> +
- +
-Now, we have to register a few things in our ''ClientModInitalizer''+
- +
-To create our ''ClientModInitalizer'', we will make a new class called ''ExampleModClient'' and implement ''ClientModInitializer''. We will also implement and override the method ''onInitializeClient'' **(If you already have a client initializer, you can skip these next 2 steps.)** +
- +
-<code java> +
-public class ExampleModClient implements ClientModInitializer { +
-    @Override +
-    public void onInitializeClient() { +
-    +
     }     }
 +  ]
 } }
 </code> </code>
  
-Before we do any work in our client mod initializer, we need to register its entrypoint in ''fabric.mod.json''+<code javascript resources/assets/tutorial/models/item/etherite_banner_shield_blocking.json>
- +
-<code javascript>+
 { {
-  [...] +  "parent":"fabricshieldlib:item/fabric_banner_shield_blocking", 
-  "entrypoints": +  "textures":{ 
-    "main": [ +    "shield":"tutorial:item/netherite_banner_shield"
-      "net.fabricmc.ExampleMod" +
-    ], +
-    "client": +
-      "net.fabricmc.ExampleModClient" +
-    ]+
   }   }
-  [...] 
 } }
 </code> </code>
  
-Ok, so now that is done, we can work in our client initializer.+===== Changes for 1.21.1 ===== 
 +If you are working in 1.21.1, **follow the changes for all higher versions first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\
  
-The only thing that we will need to do is register our 2 ''SpriteIdentifier''s.+<file properties gradle.properties> 
 +mod_menu_version=11.0.1 
 +midnightlib_version=1.5.8-fabric 
 +</file>
  
-<code java> +Then, update your Item registries to match the old method at the [[items]] tutorial. Your item registry lines would look like this:
-public class ExampleModClient implements ClientModInitializer {+
  
-    @Override 
-    public void onInitializeClient() { 
-        ClientSpriteRegistryCallback.event(SpriteAtlasTexture.BLOCK_ATLAS_TEX).register((atlasTexture, registry) -> { 
-            registry.register(new Identifier("examplemod", "entity/netherite_shield_base")); 
-            registry.register(new Identifier("examplemod", "entity/netherite_shield_base_nopattern")); 
-        }); 
-    } 
-} 
-</code> 
- 
-And now we get to the mixin. Don't worry, its an easy one. 
- 
-If this is your first time, [[tutorial:mixin_registration|here's how to register mixins on your fabric.mod.json]] //__(Make sure to make a **client** mixin)__// 
- 
-We will make a class called ''RendererMixin'' and write: 
 <code java> <code java>
-@Mixin (BuiltinModelItemRenderer.class) +public static final Item NETHERITE_SHIELD = register(new FabricShieldItem(new Item.Settings().maxDamage(2500),10, 13, Items.NETHERITE_INGOT),"netherite_shield");
-public class RendererMixin { +
- +
-}+
 </code> </code>
- +or
-Then we will make the necessary ''Spriteidentifier''s and a ''ShieldEntityModel''. The ''Spriteidentifier''s will be the same as in your ''ClientModInitializer''.+
 <code java> <code java>
-@Mixin (BuiltinModelItemRenderer.class) +public static final Item NETHERITE_BANNER_SHIELD register(new FabricBannerShieldItem(new Item.Settings().maxDamage(2500), 1013, Items.NETHERITE_INGOT), "netherite_banner_shield");
-public class RendererMixin { +
-    private ShieldEntityModel modelNetheriteShield = new ShieldEntityModel; +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier("examplemod","entity/netherite_shield_base")); +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier("examplemod","entity/netherite_shield_base_nopattern")); +
-+
-</code>  +
-  +
-Now we get to the most important part of the mixinWe will inject a method to render a banner on our shield. +
-   +
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-    private ShieldEntityModel modelNetheriteShield = new ShieldEntityModel; +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXnew Identifier("examplemod","entity/netherite_shield_base")); +
-    private static final SpriteIdentifier NETHERITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier("examplemod","entity/netherite_shield_base_nopattern")); +
-     +
-    @Inject(method = "render"at = @At("HEAD")) +
-    private void mainRender(ItemStack stack, ModelTransformation.Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) { +
-        if (stack.getItem() == ExampleMod.NETHERITE_SHIELD)) { +
-            FabricShieldLibClient.renderBanner(stack, matrices, vertexConsumers, light, overlay, modelNetheriteShield, NETHERITE_SHIELD_BASE, NETHERITE_SHIELD_BASE_NO_PATTERN);  +
-            //The first five parameters are taken from the method, while the last 3 you provide yourself. You will provide the model, and then your 2 sprite identifiers in the order of ''//SHIELD_NAME//_BASE'' and then ''//SHIELD_NAME//_BASE_NOPATTERN. +
-'' +
-        } +
-    } +
- +
-     +
-+
-</code>      +
- +
-That is now all of the complicated things done! We now only need to change our existing model, add a ''nopattern'' texture, and move our textures to the locations we identified earlier. +
- +
-In your shield model, ''netherite_shield.json'' for us, we need to change the parent and remove the texture. +
-<code javascript> +
-+
-  "parent":"fabricshieldlib:item/fabric_banner_shield", +
-    "overrides":+
-        { +
-            "predicate":+
-                "blocking":+
-            }, +
-            "model": "examplemod:item/netherite_shield_blocking" +
-        } +
-    ] +
-}+
 </code> </code>
  
-You also have to change your blocking model for your shield, ''netherite_shield_blocking.json'' for us, to:+===== Changes for 1.20.6 ===== 
 +If you are working in 1.20.6, **follow the changes for all higher versions first**then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\
  
-<code javascript+<file properties gradle.properties
-{ +mod_menu_version=10.0.0-beta.1 
-  "parent":"fabricshieldlib:item/fabric_banner_shield_blocking" +midnightlib_version=1.5.5-fabric 
-} +</file>
-</code>+
  
-For this next stepyou will add ''_base'' to your current shield texture, so ''netherite_shield'' to ''netherite_shield_base''+Nextchange all instances of ''Identifier.of'' to ''new Identifier''; these are when you are registering your itemcreating your ''EntityModelLayer'', and creating your ''SpriteIdentifiers''.
-Then, you will need to make a ''nopattern'' version for your shield textureso ''netherite_shield_base_nopattern''. I recommend looking at the vanilla shield'''nopattern'' texture.+
  
-Then, you will move both of these textures into ''resources/assets/<modid>/textures/entity''.+Then, change your ''shield.json'' in ''resources/data/c/tags/item/tools/shield.json'' to ''shields.json'' file in ''resources/data/c/tags/items/shields.json'' 
  
-For one last thingyou will need to add names for each of your shield color variants in ''en_us.json''. +Finallymove your ''durability.json'' from ''resources/data/minecraft/tags/items/enchantable/durability.json'' to ''resources/data/minecraft/tags/item/enchantable/durability.json''
-<code javascript> +
-+
-    "item.examplemod.netherite_shield": "Netherite Shield", +
-    "item.examplemod.netherite_shield.red": "Red Netherite Shield", +
-    "item.examplemod.netherite_shield.orange": "Orange Netherite Shield", +
-    "item.examplemod.netherite_shield.yellow": "Yellow Netherite Shield", +
-    "item.examplemod.netherite_shield.lime": "Lime Netherite Shield", +
-    "item.examplemod.netherite_shield.green": "Green Netherite Shield", +
-    "item.examplemod.netherite_shield.light_blue": "Light Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.cyan": "Cyan Netherite Shield", +
-    "item.examplemod.netherite_shield.blue": "Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.purple": "Purple Netherite Shield", +
-    "item.examplemod.netherite_shield.magenta": "Magenta Netherite Shield", +
-    "item.examplemod.netherite_shield.pink": "Pink Netherite Shield", +
-    "item.examplemod.netherite_shield.brown": "Brown Netherite Shield", +
-    "item.examplemod.netherite_shield.white": "White Netherite Shield", +
-    "item.examplemod.netherite_shield.light_gray": "Light Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.gray": "Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.dark_gray": "Dark Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.black": "Black Netherite Shield" +
-+
-</code>     +
-===== Adding banner support to your shield (1.14) =====+
  
-This is where mixins get involved.+===== Changes for 1.20.4 ===== 
 +If you are working in 1.20.4, **follow the changes for all higher versions first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\
  
-First, change the fabric_shield_lib in **gradle.properties** +**gradle.properties** 
-\\  +<file properties gradle.properties
-<code java+midnightlib_version=1.5.2-fabric 
-fabric_shield_lib_version=1.4.5-1.14 +mod_menu_version=9.0.0-pre.1 
-</code> +</file>
-\\ +
  
-Next thing you will want to do is to change //FabricShieldItem// to //FabricBannerShieldItem// so that it will be able to be crafted with banners.+Additionally, **remove the** ''durability.json'' **file** completely.
  
-<code java> +===== Changes for 1.20.1 ===== 
-public static final Item NETHERITE_SHIELD new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500).group(ItemGroup.COMBAT), 10, 13, Items.NETHERITE_INGOT); // FabricBannerShieldItem(settings.maxDamage(durability)cooldownTicksenchantability, repairItem) +If you are working in 1.20.1**follow the changes for all higher versions first**then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\
-</code>+
  
-The only thing we will need to do now is to add a simple mixin.+**gradle.properties** 
 +<file properties gradle.properties> 
 +midnightlib_version=1.4.1-fabric 
 +mod_menu_version=7.1.0 
 +</file>
  
-If this is your first time[[tutorial:mixin_registration|here's how to register mixins on your fabric.mod.json]] //__(Make sure to make a **client** mixin)__//+===== Changes for 1.19 ===== 
 +If you are working in 1.19, **follow the changes for all higher versions first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\
  
-We will make a class called ''RendererMixin'' and write: +**gradle.properties** 
-<code java> +<file properties gradle.properties
-@Mixin (BuiltinModelItemRenderer.class) +midnightlib_version=1.0.0-fabric 
-public class RendererMixin { +mod_menu_version=4.2.0-beta.2 
- +</file>
-+
-</code> +
- +
-Then we will make the necessary ''Identifier''s. They will be the path to your textures and the second one will have an additional **_nopattern** added to the file name. +
-<code java+
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-    private static final Identifier NETHERITE_SHIELD_BASE new Identifier("examplemod","entity/netherite_shield_base"); +
-    private static final Identifier NETHERITE_SHIELD_BASE_NO_PATTERN = new Identifier("examplemod","entity/netherite_shield_base_nopattern"); +
-+
-</code>  +
-  +
-Now we get to the most important part of the mixinWe will inject a method to render a banner on our shield**Do not forget to mark the inject with //cancellable = true//** +
-   +
-<code java> +
-@Mixin (BuiltinModelItemRenderer.class) +
-public class RendererMixin { +
-    private static final Identifier NETHERITE_SHIELD_BASE new Identifier("examplemod","entity/netherite_shield_base"); +
-    private static final Identifier NETHERITE_SHIELD_BASE_NO_PATTERN = new Identifier("examplemod","entity/netherite_shield_base_nopattern"); +
-     +
-    @Inject(method = "render", at = @At("HEAD"), cancellable = true) +
-    private void mainRender(ItemStack stack, CallbackInfo callbackInfo) { +
-        if (stack.getItem() == ExampleMod.NETHERITE_SHIELD)) { +
-            //The first parameter is taken from the method, while you will provide your identifiers in the order of ''//SHIELD_NAME//_BASE_NOPATTERN'' and then ''//SHIELD_NAME//_BASE''. +
-            FabricShieldBannerRendering.render(stack, NETHERITE_SHIELD_BASE_NO_PATTERN, NETHERITE_SHIELD_BASE); +
-            callbackInfo.cancel(); +
-        } +
-    } +
- +
-     +
-} +
-</code>      +
- +
-That is now all of the complicated things done! We now only need to change our existing model, add a ''nopattern'' texture, and move our textures to the locations we identified earlier. +
- +
-In your shield model, ''netherite_shield.json'' for us, we need to change the parent and remove the texture. +
-<code javascript> +
-+
-  "parent":"fabricshieldlib:item/fabric_banner_shield", +
-    "overrides":+
-        { +
-            "predicate":+
-                "blocking":+
-            }, +
-            "model": "examplemod:item/netherite_shield_blocking" +
-        } +
-    ] +
-+
-</code> +
- +
-You also have to change your blocking model for your shield, ''netherite_shield_blocking.json'' for us, to: +
- +
-<code javascript> +
-+
-  "parent":"fabricshieldlib:item/fabric_banner_shield_blocking" +
-+
-</code> +
- +
-For this next step, you will add ''_base'' to your current shield texture, so ''netherite_shield'' to ''netherite_shield_base''+
-Then, you will need to make a ''nopattern'' version for your shield texture, so ''netherite_shield_base_nopattern''. I recommend looking at the vanilla shield's ''nopattern'' texture. +
- +
-Then, you will move both of these textures into ''resources/assets/<modid>/textures/entity''+
- +
-For one last thing, you will need to add names for each of your shield color variants in ''en_us.json''+
-<code javascript> +
-+
-    "item.examplemod.netherite_shield": "Netherite Shield", +
-    "item.examplemod.netherite_shield.red": "Red Netherite Shield", +
-    "item.examplemod.netherite_shield.orange": "Orange Netherite Shield", +
-    "item.examplemod.netherite_shield.yellow": "Yellow Netherite Shield", +
-    "item.examplemod.netherite_shield.lime": "Lime Netherite Shield", +
-    "item.examplemod.netherite_shield.green": "Green Netherite Shield", +
-    "item.examplemod.netherite_shield.light_blue": "Light Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.cyan": "Cyan Netherite Shield", +
-    "item.examplemod.netherite_shield.blue": "Blue Netherite Shield", +
-    "item.examplemod.netherite_shield.purple": "Purple Netherite Shield", +
-    "item.examplemod.netherite_shield.magenta": "Magenta Netherite Shield", +
-    "item.examplemod.netherite_shield.pink": "Pink Netherite Shield", +
-    "item.examplemod.netherite_shield.brown": "Brown Netherite Shield", +
-    "item.examplemod.netherite_shield.white": "White Netherite Shield", +
-    "item.examplemod.netherite_shield.light_gray": "Light Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.gray": "Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.dark_gray": "Dark Gray Netherite Shield", +
-    "item.examplemod.netherite_shield.black": "Black Netherite Shield" +
-+
-</code   +
  
-Now your shield is done and has banner support! 
tutorial/shield.1695686944.txt.gz · Last modified: 2023/09/26 00:09 by cringestar_boi