Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 committed Jun 15, 2024
1 parent b405de9 commit 6d17d6d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
14 changes: 4 additions & 10 deletions develop/items/custom-armor.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You'll need to create a class that inherits `ArmorMaterial` - and add the follow

The following methods will have to be implemented as well - these methods tell the game vital information on your armor items:

- #### Durability - `getDurability(ArmorItem.Type type)`
- ### Durability - `getDurability(ArmorItem.Type type)`

Returns the durability for a specific armor type - in hit points.

Expand Down Expand Up @@ -55,8 +55,6 @@ The following methods will have to be implemented as well - these methods tell t

@[code transcludeWith=:::4](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java)



- #### Equip Sound - `getEquipsound()`

What sound should be played when the armor is equipped?
Expand All @@ -65,7 +63,6 @@ The following methods will have to be implemented as well - these methods tell t

@[code transcludeWith=:::5](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java)


- #### Repair Ingredient - `getRepairIngredient()`

What item or items can be used in an anvil to repair the armor items?
Expand All @@ -74,7 +71,6 @@ The following methods will have to be implemented as well - these methods tell t

@[code transcludeWith=:::6](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java)


- #### Name - `getName()`

The name of the armor material - must be lowercase.
Expand All @@ -83,7 +79,6 @@ The following methods will have to be implemented as well - these methods tell t

@[code transcludeWith=:::7](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java)


- #### Toughness - `getToughness()`

How much protection should be given for high-damage attacks?
Expand All @@ -94,7 +89,6 @@ The following methods will have to be implemented as well - these methods tell t

@[code transcludeWith=:::8](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java)


- #### Knockback Resistance - `getKnockbackResistance()`

How much knockback resistance should the armor give the entity?
Expand Down Expand Up @@ -146,13 +140,13 @@ You will need model JSON files for all the items, not just the helmet, it's the

As you can see, in-game the armor items should have suitable models:

![](/assets/develop/items/armor_1.png)
![Armor item models](/assets/develop/items/armor_1.png)

## Armor Textures and Model

When an entity wears your armor, currently the missing texture will appear:

![](/assets/develop/items/armor_2.png)
![Broken armor model on player.](/assets/develop/items/armor_2.png)

This is because all armor textures are hardcoded by vanilla, to create our own, we'll have to place the texture in the vanilla armor texture folder.

Expand All @@ -169,4 +163,4 @@ The first layer contains textures for the helmet and chestplate, whilst the seco

When these textures are present, you should be able to see your armor on entities that wear it:

![](/assets/develop/items/armor_3.png)
![Working armor model on player.](/assets/develop/items/armor_3.png)
4 changes: 2 additions & 2 deletions develop/items/custom-item-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ To add items to the group, you can use the modify item group event similarly to

You should see the item group is now in the creative inventory menu. However, it is untranslated - you must add a translation key to your translations file - similarly to how you translated your first item.

![](/assets/develop/items/itemgroups_0.png)
![Item group without translation in creative menu](/assets/develop/items/itemgroups_0.png)

## Adding a Translation Key

Expand All @@ -45,4 +45,4 @@ If you used `Text.translatable` for the `displayName` method of the item group b

Now, as you can see, the item group should be correctly named:

![](/assets/develop/items/itemgroups_1.png)
![Fully completed item group with translation and items](/assets/develop/items/itemgroups_1.png)
4 changes: 2 additions & 2 deletions develop/items/custom-item-interactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ A great example of these events being used can be found in the [Playing SoundEve
| `useOnBlock` | Ran when the player right clicks a block with the item. |
| `use` | Ran when the player right clicks the item. |

## The "use" event.
## The `use()` Event

Let's say you want to make an item that summons a lightning bolt infront of the player - you would need to create a custom class.

Expand All @@ -67,4 +67,4 @@ As usual, you should register your item, add a model and texture.

As you can see, the lightning bolt should spawn 10 blocks infront of you - the player.

![](/assets/develop/items/interactive_0.webp)
![Lightning bolt striking the ground after player uses item.](/assets/develop/items/interactive_0.webp)
24 changes: 12 additions & 12 deletions develop/items/custom-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors:

Tools are essential for survival and progression, allowing players to gather resources, construct buildings, and defend themselves.

## Creating a tool material.
## Creating a Tool Material

::: info
If you're creating multiple tool materials, consider using an `Enum` to store them. Vanilla does this in the `ToolMaterials` class, which stores all the tool materials that are used in the game.
Expand All @@ -23,16 +23,16 @@ You can create a tool material by creating a new class that inherits it - in thi

The tool material tells the game the following information:

- #### Durability - `getDurability()`
- ### Durability - `getDurability()`

How many times the tool can be used before breaking.

**Example**

@[code transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

- #### Mining Speed - `getMiningSpeedMultiplier()`
- ### Mining Speed - `getMiningSpeedMultiplier()`

If the tool is used to break blocks, how fast should it break the blocks?

For reference purposes, the diamond tool material has a mining speed of `8.0F` whilst the stone tool material has a mining speed of `4.0F`.
Expand All @@ -41,15 +41,15 @@ The tool material tells the game the following information:

@[code transcludeWith=:::3](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

- #### Attack Damage - `getAttackDamage()`
- ### Attack Damage - `getAttackDamage()`

How many points of damage should the tool do when used as a weapon against another entity?

**Example**

@[code transcludeWith=:::4](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

- #### Mining Level - `getMiningLevel()`
- ### Mining Level - `getMiningLevel()`

What blocks can be broken by this tool? Can it mine diamonds?

Expand All @@ -59,16 +59,16 @@ The tool material tells the game the following information:

@[code transcludeWith=:::5](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

- #### Enchantability - `getEnchantability()`
- ### Enchantability - `getEnchantability()`

How easy is it to get better and higher level enchantments with this item? For reference, Gold has an enchantability of 22 whilst Netherite has an enchantability of 15.

**Example**

@[code transcludeWith=:::6](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

- #### Repair Ingredient(s) - `getRepairIngredient()`
- ### Repair Ingredient(s) - `getRepairIngredient()`

What item or items are used to repair the tool?

**Example**
Expand All @@ -79,7 +79,7 @@ Once you have created your tool material and tweaked it to your likings, you can

@[code transcludeWith=:::8](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java)

## Creating tool items.
## Creating Tool Items

Using the same way you registered your first item, you should register each tool similarly:

Expand All @@ -99,4 +99,4 @@ You will also have to add a texture, item translation and item model. However, f

That's pretty much it! If you go in-game you should see your tool item(s) in the tools tab of the creative inventory menu.

![](/assets/develop/items/tools_1.png)
![Finished tools in inventory](/assets/develop/items/tools_1.png)
8 changes: 4 additions & 4 deletions develop/items/first-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you aren't aware, everything in Minecraft is stored in registries, and items

To simplify the registering of items, you can create a method that accepts an instance of an item and a string identifier.

You can put this method in a class called `ModItems` (or whatever you want to name the class!).
You can put this method in a class called `ModItems` (or whatever you want to name the class!).

Mojang does this with their items as well! Check out the `Items` class for inspiration.

Expand Down Expand Up @@ -64,7 +64,7 @@ This can be done in the `initialize` method of your items class.

Loading into the game, you can see that our item has been registered, and is in the Ingredients item group:

![](/assets/develop/items/first_item_0.png)
![Item in the ingredients group](/assets/develop/items/first_item_0.png)

However, it's missing the following:

Expand Down Expand Up @@ -102,7 +102,7 @@ Create the model JSON in the `assets/<mod id here>/models/item` folder, with the

@[code](@/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/suspicious_substance.json)

![](/assets/develop/items/first_item_2.png)
![Item with correct model](/assets/develop/items/first_item_2.png)

## Making the Item Compostable or a Fuel

Expand Down Expand Up @@ -139,4 +139,4 @@ This example uses the `LightningStick` class created in the [Custom Item Interac

Each call to `add()` will add one line to the tooltip.

![Tooltip Showcase](/assets/develop/items/first_item_3.png)
![Tooltip Showcase](/assets/develop/items/first_item_3.png)
2 changes: 1 addition & 1 deletion develop/items/food.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ This makes the item:
- A "snack".
- Always give Poison II for 6 seconds when eaten.

![](/assets/develop/items/food_0.webp)
![Player eating the food and getting the aforementioned effects.](/assets/develop/items/food_0.webp)
2 changes: 1 addition & 1 deletion develop/text-and-translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ MutableText result = Text.literal("Hello World!")
<tr><td></td><td><u>Underline</u></td><td>§n</td><td></td><td></td></tr>
<tr><td></td><td><i>Italic</i></td><td>§o</td><td></td><td></td></tr>
<tr><td></td><td>Obfuscated</td><td>§k</td><td></td><td></td></tr>
</table>
</table>

0 comments on commit 6d17d6d

Please sign in to comment.