tutorial:shield
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:shield [2024/07/03 07:08] – solidblock | tutorial:shield [2024/09/29 19:35] (current) – updated with 1.21 guide and past guides cringestar_boi | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Making a Custom Shield in Minecraft [1.19-1.20] ====== | + | ====== Making a Custom Shield in Minecraft [1.19-1.21.1] ====== |
:!: The tutorial depends on third-party libraries. | :!: The tutorial depends on third-party libraries. | ||
Line 16: | Line 16: | ||
**gradle.properties** | **gradle.properties** | ||
<file properties gradle.properties> | <file properties gradle.properties> | ||
- | fabric_shield_lib_version=1.7.2-1.20.4 | + | fabric_shield_lib_version=1.7.2-1.21.1 |
- | midnightlib_version=1.5.2-fabric | + | midnightlib_version=1.5.8-fabric |
- | mod_menu_version=9.0.0-pre.1 | + | mod_menu_version=11.0.1 |
fabricasm_version=2.3 | fabricasm_version=2.3 | ||
</ | </ | ||
Line 31: | Line 31: | ||
At the time of writing, the latest project.fabric_shield_lib_version should be 1.7.2, which supports versions: | At the time of writing, the latest project.fabric_shield_lib_version should be 1.7.2, which supports versions: | ||
+ | * **1.21** - **1.21.1** ('' | ||
+ | * **1.20.5** - **1.20.6** ('' | ||
* **1.20.2** - **1.20.4** ('' | * **1.20.2** - **1.20.4** ('' | ||
* **1.20** - **1.20.1** ('' | * **1.20** - **1.20.1** ('' | ||
Line 57: | Line 59: | ||
public final class TutorialItems { | public final class TutorialItems { | ||
// ... | // ... | ||
- | public static final Item NETHERITE_SHIELD = register(new FabricShieldItem(new FabricItemSettings().maxDamage(2500), | + | public static final Item NETHERITE_SHIELD = register(new FabricShieldItem(new FabricItemSettings().maxDamage(2500), |
+ | //The constructor for the item takes in the following values: FabricBannerShieldItem(settings.maxDamage(durability), | ||
// ... | // ... | ||
} | } | ||
Line 112: | Line 115: | ||
</ | </ | ||
- | Lastly, as a [[tags|conventional tag]], create a '' | + | Then, as a [[tags|conventional tag]], create a '' |
<code javascript resources/ | <code javascript resources/ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Lastly, to make it enchantable, | ||
+ | <code javascript resources/ | ||
{ | { | ||
" | " | ||
Line 137: | Line 150: | ||
public static final Item NETHERITE_BANNER_SHIELD = register(new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500), | public static final Item NETHERITE_BANNER_SHIELD = register(new FabricBannerShieldItem(new FabricItemSettings().maxDamage(2500), | ||
</ | </ | ||
- | + | If you want to add your shield to a [[itemgroup|item groups]], for example, the " | |
- | If you want to add your shield to a [[itemgroup|item groups]], for example, the " | + | |
- | + | < | |
- | < | + | public class ExampleMod implements ModInitializer { |
- | public class ExampleMod implements ModInitializer { | + | @Override |
- | @Override | + | public void onInitialize() { |
- | public void onInitialize() { | + | ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> { |
- | ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> { | + | // ... |
- | // ... | + | entries.add(NETHERITE_BANNER_SHIELD); |
- | entries.add(NETHERITE_BANNER_SHIELD); | + | }); |
- | }); | + | } |
- | } | + | } |
- | } | + | |
</ | </ | ||
Line 158: | Line 170: | ||
@Environment(EnvType.CLIENT) | @Environment(EnvType.CLIENT) | ||
public class ExampleModClient implements ClientModInitializer { | public class ExampleModClient implements ClientModInitializer { | ||
- | public static final EntityModelLayer NETHERITE_BANNER_SHIELD_MODEL_LAYER = new EntityModelLayer(new Identifier(" | + | public static final EntityModelLayer NETHERITE_BANNER_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of(" |
@Override | @Override | ||
Line 173: | Line 185: | ||
public class ExampleModClient implements ClientModInitializer { | public class ExampleModClient implements ClientModInitializer { | ||
- | public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(new Identifier(" | + | public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of(" |
@Override | @Override | ||
Line 187: | Line 199: | ||
@Environment(EnvType.CLIENT) | @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(" | + | public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of(" |
| | ||
public static ShieldEntityModel modelNetheriteShield; | public static ShieldEntityModel modelNetheriteShield; | ||
Line 203: | Line 215: | ||
@Environment(EnvType.CLIENT) | @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(" | + | public static final EntityModelLayer NETHERITE_SHIELD_MODEL_LAYER = new EntityModelLayer(Identifier.of(" |
| | ||
public static ShieldEntityModel modelNetheriteShield; | public static ShieldEntityModel modelNetheriteShield; | ||
Line 224: | Line 236: | ||
public class ExampleModClient implements ClientModInitializer { | public class ExampleModClient implements ClientModInitializer { | ||
- | public static final EntityModelLayer netherite_banner_shield_model_layer = new EntityModelLayer(new Identifier(" | + | public static final EntityModelLayer netherite_banner_shield_model_layer = new EntityModelLayer(Identifier.of(" |
public static ShieldEntityModel modelNetheriteShield; | public static ShieldEntityModel modelNetheriteShield; | ||
- | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, | + | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, |
- | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, | + | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, |
@Override | @Override | ||
Line 247: | Line 259: | ||
@Environment(EnvType.CLIENT) | @Environment(EnvType.CLIENT) | ||
public class ExampleModClient implements ClientModInitializer { | public class ExampleModClient implements ClientModInitializer { | ||
- | public static final EntityModelLayer netherite_banner_shield_model_layer = new EntityModelLayer(new Identifier(" | + | public static final EntityModelLayer netherite_banner_shield_model_layer = new EntityModelLayer(Identifier.of(" |
public static ShieldEntityModel modelNetheriteShield; | public static ShieldEntityModel modelNetheriteShield; | ||
- | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, | + | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, |
- | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, | + | public static final SpriteIdentifier NETHERITE_BANNER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, |
@Override | @Override | ||
Line 289: | Line 301: | ||
</ | </ | ||
- | Next, inside '' | + | Next, inside '' |
<code javascript resources/ | <code javascript resources/ | ||
{ | { | ||
Line 310: | Line 321: | ||
" | " | ||
" | " | ||
- | " | + | " |
} | } | ||
} | } | ||
Line 319: | Line 330: | ||
Then, you will move both of these textures into '' | Then, you will move both of these textures into '' | ||
- | Lastly, create a '' | + | Next, create a '' |
<code javascript resources/ | <code javascript resources/ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Finally create a '' | ||
+ | <code javascript resources/ | ||
{ | { | ||
" | " | ||
Line 354: | Line 375: | ||
And now your shield is fully completed and supports banner decoration! | And now your shield is fully completed and supports banner decoration! | ||
+ | |||
+ | ===== Changes for 1.20.6 ===== | ||
+ | If you are working in 1.20.6, first change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\ | ||
+ | |||
+ | <file properties gradle.properties> | ||
+ | mod_menu_version=10.0.0-beta.1 | ||
+ | midnightlib_version=1.5.5-fabric | ||
+ | </ | ||
+ | |||
+ | Next, change all instances of '' | ||
+ | |||
+ | Then, change your '' | ||
+ | |||
+ | Finally, move your '' | ||
+ | |||
+ | ===== Changes for 1.20.4 ===== | ||
+ | If you are working in 1.20.4, **follow the changes for 1.20.6 first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\ | ||
+ | |||
+ | **gradle.properties** | ||
+ | <file properties gradle.properties> | ||
+ | midnightlib_version=1.5.2-fabric | ||
+ | mod_menu_version=9.0.0-pre.1 | ||
+ | </ | ||
+ | |||
+ | Additionally, | ||
===== Changes for 1.19 ===== | ===== Changes for 1.19 ===== | ||
- | If you are working in 1.19, make sure to change the FabricShieldLib and FAPI versions accordingly | + | If you are working in 1.19, **follow the changes for 1.20.6 and 1.20.4 first**, then change the FabricShieldLib and FAPI versions accordingly and change your other dependencies to these versions:\\ |
**gradle.properties** | **gradle.properties** | ||
- | <code java> | + | <file properties gradle.properties> |
midnightlib_version=1.0.0-fabric | midnightlib_version=1.0.0-fabric | ||
mod_menu_version=4.2.0-beta.2 | mod_menu_version=4.2.0-beta.2 | ||
- | </code> | + | </file> |
tutorial/shield.1719990499.txt.gz · Last modified: 2024/07/03 07:08 by solidblock