diff --git a/.vitepress/sidebars/develop.ts b/.vitepress/sidebars/develop.ts index dffe80ddb..2b4c44964 100644 --- a/.vitepress/sidebars/develop.ts +++ b/.vitepress/sidebars/develop.ts @@ -53,6 +53,30 @@ export default [ text: "develop.items", collapsed: true, items: [ + { + text: "develop.items.first-item", + link: "/develop/items/first-item" + }, + { + text: "develop.items.food", + link: "/develop/items/food" + }, + { + text: "develop.items.custom-tools", + link: "/develop/items/custom-tools" + }, + { + text: "develop.items.custom-armor", + link: "/develop/items/custom-armor" + }, + { + text: "develop.items.custom-item-groups", + link: "/develop/items/custom-item-groups" + }, + { + text: "develop.items.custom-item-interactions", + link: "/develop/items/custom-item-interactions" + }, { text: "develop.items.potions", link: "/develop/items/potions", @@ -155,8 +179,12 @@ export default [ }, { text: "develop.misc.events", - link: "/develop/events", + link: "/develop/events" }, - ], - }, -] as Fabric.SidebarItem[]; + { + text: "develop.misc.text-and-translations", + link: "/develop/text-and-translations" + } + ] + } +] as ExtendedSidebarItem[]; \ No newline at end of file diff --git a/.vitepress/theme/components/ColorSwatch.vue b/.vitepress/theme/components/ColorSwatch.vue new file mode 100644 index 000000000..94c52910e --- /dev/null +++ b/.vitepress/theme/components/ColorSwatch.vue @@ -0,0 +1,20 @@ + + + + + \ No newline at end of file diff --git a/.vitepress/theme/components/DownloadEntry.vue b/.vitepress/theme/components/DownloadEntry.vue new file mode 100644 index 000000000..8fa73a1bb --- /dev/null +++ b/.vitepress/theme/components/DownloadEntry.vue @@ -0,0 +1,50 @@ + + + + + \ No newline at end of file diff --git a/.vitepress/theme/components/VideoPlayer.vue b/.vitepress/theme/components/VideoPlayer.vue new file mode 100644 index 000000000..b6db695e4 --- /dev/null +++ b/.vitepress/theme/components/VideoPlayer.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 0a988680c..5abd9346a 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -1,18 +1,33 @@ import { useData } from "vitepress"; import DefaultTheme from "vitepress/theme"; -import { h } from "vue"; +import { h, nextTick, onMounted, watch } from "vue"; +import { Theme, useRoute } from 'vitepress'; + +import mediumZoom from 'medium-zoom'; import BannerComponent from "./components/BannerComponent.vue"; import NotFoundComponent from "./components/NotFoundComponent.vue"; import AuthorsComponent from "./components/AuthorsComponent.vue"; +import PageAuthorComponent from './components/PageAuthorComponent.vue'; +import DownloadEntry from './components/DownloadEntry.vue'; +import ColorSwatch from './components/ColorSwatch.vue'; +import VideoPlayer from './components/VideoPlayer.vue'; import "./style.css"; export default { extends: DefaultTheme, + enhanceApp({ app }) { + // Vidstack Videoplayer Component + app.config.compilerOptions.isCustomElement = (tag) => tag.startsWith('media-'); + + app.component('DownloadEntry', DownloadEntry); + app.component('ColorSwatch', ColorSwatch); + app.component('VideoPlayer', VideoPlayer); + }, Layout() { const children = { - "aside-outline-after": () => h(AuthorsComponent), + "aside-outline-after": () => h(PageAuthorComponent), "layout-top": () => h(BannerComponent), }; @@ -22,4 +37,17 @@ export default { return h(DefaultTheme.Layout, null, children); }, -}; + setup() { + const route = useRoute(); + const initZoom = () => { + mediumZoom('.main img', { background: 'var(--vp-c-bg)' }); + }; + onMounted(() => { + initZoom(); + }); + watch( + () => route.path, + () => nextTick(() => initZoom()) + ); + }, +} satisfies Theme; diff --git a/.vitepress/theme/style.css b/.vitepress/theme/style.css index 3de71cd12..bfec87201 100644 --- a/.vitepress/theme/style.css +++ b/.vitepress/theme/style.css @@ -81,6 +81,14 @@ transform-origin: top center; } +.medium-zoom-overlay { + z-index: 10000; +} + +.medium-zoom-image { + z-index: 10001; +} + @keyframes show { 100% { opacity: 1; diff --git a/develop/entities/effects.md b/develop/entities/effects.md index b4a641520..a20ebc411 100644 --- a/develop/entities/effects.md +++ b/develop/entities/effects.md @@ -44,16 +44,14 @@ The status effect icon is a 18x18 PNG which will appear in the player's inventor resources/assets/fabric-docs-reference/textures/mob_effect/tater.png ``` -![Effect in player inventory](/assets/develop/tater-effect.png) + ### Translations {#translations} Like any other translation, you can add an entry with ID format `"effect..": "Value"` to the language file. -::: code-group - -```json[assets/fabric-docs-reference/lang/en_us.json] +```json { "effect.fabric-docs-reference.tater": "Tater" } diff --git a/develop/items/custom-armor.md b/develop/items/custom-armor.md new file mode 100644 index 000000000..a461d33fb --- /dev/null +++ b/develop/items/custom-armor.md @@ -0,0 +1,166 @@ +--- +title: Custom Armor +description: Learn how to create your own armor sets. +authors: + - IMB11 +--- + +# Custom Armor + +Armor provides the player with increased defense against attacks from mobs and other players. + +## Creating an Armor Material + +::: info +If you plan to make multiple armor materials, consider using an `Enum` to store them. Vanilla does this in the `ArmorMaterials` class, which stores all the armor materials that are used in the game. + +This class can also be used to determine your armor material's properties in relation to vanilla armor materials. +::: + +All armor items - like tools - have an armor material. + +The armor material tells the game what protection and durability the armor item should have depending on the slot. + +You'll need to create a class that inherits `ArmorMaterial`, like so: + +@[code transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java) + +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)` + + Returns the durability for a specific armor type - in hit points. + + The hit points specify the amount of hits the armor item can take before breaking. + + **Example** + + @[code transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java) + +- #### Protection - `getProtection(ArmorItem.Type type)` + + Returns the protection value for a specific armor type. + + Usually this is always the same, regardless of your armor material. + + **Example** + + @[code transcludeWith=:::3](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java) + +- #### Enchantability - `getEnchantability()` + + How easy is it to get better and higher level enchantments with this item? + + **Example** + + @[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? + + **Example** + + @[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? + + **Example** + + @[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. + + **Example** + + @[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? + + For reference, everything except diamond (`2.0F`) and netherite (`4.0F`) have a toughness of zero. + + **Example** + + @[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? + + **Example** + + @[code transcludeWith=:::9](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java) + +## Creating an Instance of the ArmorMaterial + +To use the armor material with the armor items, you'll need to create an instance of it - similar to a tool material: + +@[code transcludeWith=:::_10](@/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java) + +You can place this instance in the armor material class itself. + +## Creating the Armor Items + +Now that you've created an instance of the material, you can create the armor items in your `ModItems` class: + +Obviously, an armor set doesn't need every type to be satisfied, you can have a set with just boots, or leggings etc. - the vanilla turtle shell helmet is a good example of an armor set with missing slots. + +@[code transcludeWith=:::6](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +You will also need to **add the items to an item group** if you want them to be accessible from the creative inventory. + +As with all items, you should create translation keys for them as well. + +## Texturing and Modelling + +You will need to create two sets of textures: + +- Textures and models for the items themselves. +- The actual armor texture that is visible when an entity wears the armor. + +### Item Textures and Model + +These textures are no different to other items - you must create the textures, and create a generic generated item model - which was covered in the [Creating Your First Item](./first-item.md#adding-a-texture-and-model) guide. + +For example purposes, you may use the following textures and model JSON as a reference. + + + +::: info +You will need model JSON files for all the items, not just the helmet, it's the same principle as other item models. +::: + +@[code](@/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_helmet.json) + +As you can see, in-game the armor items should have suitable models: + +![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: + +![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. + +There are two layers for the armor texture, both must be present. + +Since the armor material name in our case is `guidite`, the locations of the textures will be: + +- `assets/minecraft/textures/models/armor/guidite_layer_1.png` +- `assets/minecraft/textures/models/armor/guidite_layer_2.png` + + + +The first layer contains textures for the helmet and chestplate, whilst the second layer contains textures for leggings and boots. + +When these textures are present, you should be able to see your armor on entities that wear it: + +![Working armor model on player.](/assets/develop/items/armor_3.png) diff --git a/develop/items/custom-item-groups.md b/develop/items/custom-item-groups.md new file mode 100644 index 000000000..6876bdd4c --- /dev/null +++ b/develop/items/custom-item-groups.md @@ -0,0 +1,38 @@ +--- +title: Custom Item Groups +description: Learn how to create your own item group and add items to it. +authors: + - IMB11 +--- + +# Custom Item Groups + +Item groups are the tabs in the creative inventory that store items. You can create your own item group to store your items in a separate tab. This is pretty useful if your mod adds a lot of items and you want to keep them organized in one location for your players to easily access. + +## Creating the Item Group + +It's surprisingly easy to create an item group. Simply create a new static final field in your items class to store the item group and a registry key for it, you can then use the item group event similarly to how you added your items to the vanilla item groups: + +@[code transcludeWith=:::9](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +@[code transcludeWith=:::_12](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +
+ +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. + +![Item group without translation in creative menu](/assets/develop/items/itemgroups_0.png) + +## Adding a Translation Key + +If you used `Text.translatable` for the `displayName` method of the item group builder, you will need to add the translation to your language file. + +```json +{ + "itemGroup.fabric_docs_reference": "Fabric Docs Reference" +} +``` + +Now, as you can see, the item group should be correctly named: + +![Fully completed item group with translation and items](/assets/develop/items/itemgroups_1.png) diff --git a/develop/items/custom-item-interactions.md b/develop/items/custom-item-interactions.md new file mode 100644 index 000000000..010db0178 --- /dev/null +++ b/develop/items/custom-item-interactions.md @@ -0,0 +1,71 @@ +--- +title: Custom Item Interactions +description: Learn how to create an item that uses built-in vanilla events. +authors: + - IMB11 +--- + +# Custom Item Interactions + +Basic items can only go so far - eventually you will need an item that interacts with the world when it is used. + +There are some key classes you must understand before taking a look at the vanilla item events. + +## TypedActionResult + +For items, the most common `TypedActionResult` you'll see is for `ItemStacks` - this class tells the game what to replace the item stack (or not to replace) after the event has occured. + +If nothing has occured in the event, you should use the `TypedActionResult#pass(stack)` method where `stack` is the current item stack. + +You can get the current item stack by getting the stack in the player's hand. Usually events that require a `TypedActionResult` pass the hand to the event method. + +```java +TypedActionResult.pass(user.getStackInHand(hand)) +``` + +If you pass the current stack - nothing will change, regardless of if you declare the event as failed, passed/ignored or successful. + +If you want to delete the current stack, you should pass an empty one. The same can be said about decrementing, you fetch the current stack and decrement it by the amount you want: + +```java +ItemStack heldStack = user.getStackInHand(hand); +heldStack.decrement(1); +TypedActionResult.success(heldStack); +``` + +## ActionResult + +Similarly, an `ActionResult` tells the game the status of the event, whether it was passed/ignored, failed or successful. + +## Overridable Events + +Luckily, the Item class has many methods that can be overriden to add extra functionality to your items. + +::: info +A great example of these events being used can be found in the [Playing SoundEvents](../sounds/using-sounds.md) page, which uses the `useOnBlock` event to play a sound when the player right clicks a block. +::: + +| Method | Information | +| --------------- | ------------------------------------------------------- | +| `postHit` | Ran when the player hits an entity. | +| `postMine` | Ran when the player mines a block. | +| `inventoryTick` | Ran every tick whilst the item is in an inventory. | +| `onCraft` | Ran when the item is crafted. | +| `useOnBlock` | Ran when the player right clicks a block with the item. | +| `use` | Ran when the player right clicks the item. | + +## 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. + +@[code transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java) + +The `use` event is probably the most useful out of them all - you can use this event to spawn our lightning bolt, you should spawn it 10 blocks in front of the players facing direction. + +@[code transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java) + +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. + + diff --git a/develop/items/custom-tools.md b/develop/items/custom-tools.md new file mode 100644 index 000000000..f61330bd4 --- /dev/null +++ b/develop/items/custom-tools.md @@ -0,0 +1,104 @@ +--- +title: Tools and Weapons +description: Learn how to create your own tools and configure their properties. +authors: + - IMB11 +--- + +# Tools + +Tools are essential for survival and progression, allowing players to gather resources, construct buildings, and defend themselves. + +## 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. + +This class can also be used to determine your tool material's properties in relation to vanilla tool materials. +::: + +You can create a tool material by creating a new class that inherits it - in this example, I'll be creating "Guidite" tools: + +@[code transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java) + +The tool material tells the game the following information: + +- ### 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()` + + 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`. + + **Example** + + @[code transcludeWith=:::3](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java) + +- ### 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()` + + What blocks can be broken by this tool? Can it mine diamonds? + + A mining level of 3+ is needed to require obsidian whilst a level of 2 is required to mine diamonds. + + **Example** + + @[code transcludeWith=:::5](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java) + +- ### 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()` + + What item or items are used to repair the tool? + + **Example** + + @[code transcludeWith=:::7](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java) + +Once you have created your tool material and tweaked it to your likings, you can create an instance of it to be used in the tool item constructors. + +@[code transcludeWith=:::8](@/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java) + +## Creating Tool Items + +Using the same way you registered your first item, you should register each tool similarly: + +@[code transcludeWith=:::7](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +Remember to add them to an item group if you want to access them from the creative inventory! + +@[code transcludeWith=:::8](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +You will also have to add a texture, item translation and item model. However, for the item model, you'll want to use the `item/handheld` model as your parent. + +For this example, I will be using the following model and texture for the "Guidite Sword" item: + +@[code](@/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_sword.json) + + + +--- + +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. + +![Finished tools in inventory](/assets/develop/items/tools_1.png) diff --git a/develop/items/first-item.md b/develop/items/first-item.md new file mode 100644 index 000000000..393500d4f --- /dev/null +++ b/develop/items/first-item.md @@ -0,0 +1,151 @@ +--- +title: Creating Your First Item +description: Learn how to register a simple item and how to texture, model and name it. +authors: + - IMB11 + - dicedpixels +--- + +# Creating Your First Item + +This page will introduce you into some key concepts relating to items, and how you can register, texture, model and name them. + +If you aren't aware, everything in Minecraft is stored in registries, and items are no exception to that. + +## Preparing Your Items Class + +To simplify the registering of items, you can create a method that accepts an instance of an item and a string identifier. + +This method will create an item with the provided identifier and register it with the game's item registry. + +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. + +@[code transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +## Registering an Item + +You can now register an item using the method now. + +The item constructor takes in an instance of the `Items.Settings` class as a parameter. This class allows you to configure the item's properties through various builder methods. + +::: tip +If you want to change your item's stack size, you can use the `maxCount` method in the `Items.Settings`/`FabricItemSettings` class. + +This will not work if you've marked the item as damageable, as the stack size is always 1 for damageable items to prevent duplication exploits. +::: + +@[code transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +However, when you go in-game, you can see that our item doesn't exist! This is because you don't statically initialize the class. + +To do this, you can add a public static initialize method to your class and call it from your `ModInitializer` class. Currently, this method doesn't need anything inside it. + +@[code transcludeWith=:::3](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +@[code transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/FabricDocsReferenceItems.java) + +Calling a method on a class statically initializes it if it hasn't been previously loaded - this means that all `static` fields are evaluated. This is what this dummy `initialize` method is for. + +## Adding the Item to an Item Group + +::: info +If you want to add the item to a custom `ItemGroup`, checkout the [Custom Item Groups](./item-groups.md) page for more information. +::: + +For example purposes, we will add this item to the ingredients `ItemGroup`, you will need to use Fabric API's item group events - specifically `ItemGroupEvents.modifyEntriesEvent` + +This can be done in the `initialize` method of your items class. + +@[code transcludeWith=:::4](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +Loading into the game, you can see that our item has been registered, and is in the Ingredients item group: + +![Item in the ingredients group](/assets/develop/items/first_item_0.png) + +However, it's missing the following: + +- Item Model +- Texture +- Translation (name) + +## Naming The Item + +The item currently doesn't have a translation, so you will need to add one. The translation key has already been provided by Minecraft: `item.mod_id.suspicious_substance`. + +Create a new JSON file at: `src/main/resources/assets//lang/en_us.json` and put in the translation key, and it's value: + +```json +{ + "item.mod_id.suspicious_substance": "Suspicious Substance" +} +``` + +You can either restart the game or build your mod and press F3 + T to apply changes. + +## Adding a Texture and Model + +To give your item a texture and model, simply create a 16x16 texture image for your item and save it in the `assets//textures/item` folder. Name the texture file the same as the item's identifier, but with a `.png` extension. + +For example purposes, you can use this example texture for `suspicious_substance.png` + + + +When restarting/reloading the game - you should see that the item still has no texture, that's because you will need to add a model that uses this texture. + +You're going to create a simple `item/generated` model, which takes in an input texture and nothing else. + +Create the model JSON in the `assets//models/item` folder, with the same name as the item; `suspicious_substance.json` + +@[code](@/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/suspicious_substance.json) + +### Breaking Down the Model JSON + +- `parent`: This is the parent model that this model will inherit from. In this case, it's the `item/generated` model. +- `textures`: This is where you define the textures for the model. The `layer0` key is the texture that the model will use. + +Most items will use the `item/generated` model as their parent, as it's a simple model that just displays the texture. + +There are alternatives, such as `item/handheld` which is used for items that are held in the player's hand, such as tools. + +Your item should now look like this in-game: + +![Item with correct model](/assets/develop/items/first_item_2.png) + +## Making the Item Compostable or a Fuel + +Fabric API provides various registries that can be used to add additional properties to your item. + +For example, if you want to make your item compostable, you can use the `CompostableItemRegistry`: + +@[code transcludeWith=:::_10](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +Alternatively, if you want to make your item a fuel, you can use the `FuelRegistry` class: + +@[code transcludeWith=:::_11](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +## Adding a Basic Crafting Recipe + + + +If you want to add a crafting recipe for your item, you will need to place a recipe JSON file in the `data//recipes` folder. + +For more information on the recipe format, checkout these resources: + +- [Recipe JSON Generator](https://crafting.thedestruc7i0n.ca/) +- [Minecraft Wiki - Recipe JSON](https://minecraft.wiki/w/Recipe#JSON_Format) + +## Custom Tooltips + +If you want your item to have a custom tooltip, you will need to create a class that extends `Item` and override the `appendTooltip` method. + +::: info +This example uses the `LightningStick` class created in the [Custom Item Interactions](./custom-item-interactions.md) page. +::: + +@[code lang=java transcludeWith=:::3](@/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java) + +Each call to `add()` will add one line to the tooltip. + +![Tooltip Showcase](/assets/develop/items/first_item_3.png) diff --git a/develop/items/food.md b/develop/items/food.md new file mode 100644 index 000000000..42551b14f --- /dev/null +++ b/develop/items/food.md @@ -0,0 +1,51 @@ +--- +title: Food Items +description: Learn how to add a FoodComponent to an item to make it edible, and configure it. +authors: + - IMB11 +--- + +# Food Items + +Food is a core aspect of survival Minecraft, so when creating edible items you have to consider the food's usage with other edible items. + +Unless you're making a mod with overpowered items, you should consider: + +- How much hunger your edible item adds or removes. +- What potion effect(s) does it grant? +- Is it early-game or endgame accessible? + +## Adding the Food Component + +To add a food component to an item, we can pass it to the `FabricItemSettings` instance: + +```java +new FabricItemSettings().food(new FoodComponent.Builder().build()) +``` + +Right now, this just makes the item edible and nothing more. + +The `FoodComponent.Builder` class has many methods that allow you to modify what happens when a player eats your item: + +| Method | Description | +| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `hunger` | Sets the amount of hunger points your item will replenish. | +| `saturationModifier` | Sets the amount of saturation points your item will add. | +| `meat` | Declares your item as meat. Carnivorous entities, such as wolves, will be able to eat it. | +| `alwaysEdible` | Allows your item to be eaten regardless of hunger level. | +| `snack` | Declares your item as a snack. | +| `statusEffect` | Adds a status effect when you eat your item. Usually a status effect instance and chance is passed to this method, where chance is a decimal percentage (`1f = 100%`) | + +When you've modified the builder to your liking, you can call the `build()` method to get the `FoodComponent` + +Using the example created in the [Creating Your First Item](./first-item.md) page, I'll be using the following options for the builder: + +@[code transcludeWith=:::5](@/reference/latest/src/main/java/com/example/docs/item/ModItems.java) + +This makes the item: + +- Always edible, it can be eaten regardless of hunger level. +- A "snack". +- Always give Poison II for 6 seconds when eaten. + + diff --git a/develop/sounds/using-sounds.md b/develop/sounds/using-sounds.md index 3a30821e4..1fb8edc9c 100644 --- a/develop/sounds/using-sounds.md +++ b/develop/sounds/using-sounds.md @@ -13,11 +13,11 @@ Make sure to execute the `playSound()` method on the logical server side when us In this example, the `useOnEntity()` and `useOnBlock()` methods for a custom interactive item are used to play a "placing copper block" and a pillager sound. -@[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/CustomSoundItem.java) +@[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java) The `playSound()` method is used with the `LivingEntity` object. Only the SoundEvent, the volume and the pitch need to be specified. You can also use the `playSound()` method from the world instance to have a higher level of control. -@[code lang=java transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/CustomSoundItem.java) +@[code lang=java transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java) ### SoundEvent and SoundCategory {#soundevent-and-soundcategory} diff --git a/develop/text-and-translations.md b/develop/text-and-translations.md new file mode 100644 index 000000000..7f178510f --- /dev/null +++ b/develop/text-and-translations.md @@ -0,0 +1,113 @@ +--- +title: Text and Translations +description: Comprehensive documentation for Minecraft's handling of formatted text and translations. +authors: + - IMB11 +--- + +# Text and Translations + +Whenever Minecraft displays text ingame, it's probably defined using a `Text` object. +This custom type is used instead of a `String` to allow for more advanced formatting, +including colors, boldness, obfuscation, and click events. They also allow easy access +to the translation system, making it simple to translate any interface elements into +different languages. + +If you've worked with datapacks or functions before, you may see parallels with the +json text format used for displayNames, books, and signs among other things. As you +can probably guess, this is just a json representation of a `Text` object, and can be +converted to and from using `Text.Serializer`. + +When making a mod, it is generally preferred to construct your `Text` objects directly +in code, making use of translations whenever possible. + +## Text Literals + +The simplest way to create a `Text` object is to make a literal. This is just a string +that will be displayed as-is, by default without any formatting. + +These are created using the `Text.of` or `Text.literal` methods, which both act slightly +differently. `Text.of` accepts nulls as input, and will return a `Text` instance. In +contrast, `Text.literal` should not be given a null input, but returns a `MutableText`, +this being a subclass of `Text` that can be easily styled and concatenated. More about +this later. + +```java +Text literal = Text.of("Hello, world!"); +MutableText mutable = Text.literal("Hello, world!"); +// Keep in mind that a MutableText can be used as a Text, making this valid: +Text mutableAsText = mutable; +``` + +## Translatable Text + +When you want to provide multiple translations for the same string of text, you can use the `Text.translatable` method to reference a translation key in any language file. If the key doesn't exist, the translation key is converted to a literal. + +```java +Text translatable = Text.translatable("my_mod.text.hello"); + +// Similarly to literals, translatable text can be easily made mutable. +MutableText mutable = Text.translatable("my_mod.text.bye"); +``` + +The language file, `en_us.json`, looks like the following: + +```json +{ + "my_mod.text.hello": "Hello!", + "my_mod.text.bye": "Goodbye :(" +} +``` + +## Serializing Text + + + +As mentioned before, you can serialize text to JSON using the following serializer class: + +@[code transcludeWith=:::1](@/reference/latest/src/client/java/com/example/docs/rendering/TextTests.java) + +This produces JSON that can be used datapacks, commands and other places that accept the JSON format of text instead of literal or translatable text. + +## Deserializing Text + +Furthermore, to deserialize a JSON text object into an actual `Text` class, you can use the `fromJson` method: + +@[code transcludeWith=:::2](@/reference/latest/src/client/java/com/example/docs/rendering/TextTests.java) + +## Formatting + +You may be familiar with Minecraft's formatting standards: + +You can apply these formattings using the `Formatting` enum on the `MutableText` class: + +```java +MutableText result = Text.literal("Hello World!") + .formatted(Formatting.AQUA, Formatting.BOLD, Formatting.UNDERLINE); +``` + + + + + + + + + + + + + + + + + + + + + + + + + +
ColorNameChat CodeMOTD CodeHex Code
Black (black)§0\u00A70#000000
Dark Blue (dark_blue)§1\u00A71#0000AA
Dark Green (dark_green)§2\u00A72#00AA00
Dark Aqua (dark_aqua)§3\u00A73#00AAAA
Dark Red (dark_red)§4\u00A74#AA0000
Dark Purple (dark_purple)§5\u00A75#AA00AA
Gold (gold)§6\u00A76#FFAA00
Gray (gray)§7\u00A77#AAAAAA
Dark Gray (dark_gray)§8\u00A78#555555
Blue (blue)§9\u00A79#5555FF
Green (green)§a\u00A7a#55FF55
Aqua (aqua)§b\u00A7b#55FFFF
Red (red)§c\u00A7c#FF5555
Light Purple (light_purple)§d\u00A7d#FF55FF
Yellow (yellow)§e\u00A7e#FFFF55
White (white)§f\u00A7f#FFFFFF
Reset§r
Bold§l
Strikethrough§m
Underline§n
Italic§o
Obfuscated§k
diff --git a/package-lock.json b/package-lock.json index ea314973f..7c5315b33 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,8 @@ "dependencies": { "markdown-it-mathjax3": "^4.3.2", "markdown-it-vuepress-code-snippet-enhanced": "github:IMB11/md-it-enhanced-snippets#dfb9fa2", + "medium-zoom": "^1.1.0", + "vidstack": "^1.11.22", "vitepress": "^1.2.3", "vitepress-versioning-plugin": "^1.0.2", "vue": "^3.4.27" @@ -1262,6 +1264,17 @@ } } }, + "node_modules/acorn": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", + "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/algoliasearch": { "version": "4.23.3", "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.23.3.tgz", @@ -1294,6 +1307,18 @@ "node": ">=6" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1310,12 +1335,34 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/cheerio": { "version": "1.0.0-rc.10", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", @@ -1353,6 +1400,29 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/cli-color": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.4.tgz", @@ -1655,6 +1725,17 @@ "type": "^2.7.2" } }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/focus-trap": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", @@ -1678,6 +1759,17 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/hookable": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", @@ -1703,6 +1795,44 @@ "entities": "^2.0.0" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-promise": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", @@ -1938,6 +2068,19 @@ "dev": true, "license": "MIT" }, + "node_modules/media-captions": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/media-captions/-/media-captions-1.0.3.tgz", + "integrity": "sha512-y2Qi5rqjwgH97zoko1vzu5Q6nnS0KzEQSvd4NOjnFym9JqnFb5VSsUg21RNb5cQ/nhCFJ0wz/XK+2uMwFCr6TQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/medium-zoom": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/medium-zoom/-/medium-zoom-1.1.0.tgz", + "integrity": "sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==" + }, "node_modules/memoizee": { "version": "0.4.17", "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.17.tgz", @@ -2043,6 +2186,14 @@ } } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -2082,6 +2233,17 @@ "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", "license": "ISC" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/postcss": { "version": "8.4.38", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", @@ -2130,6 +2292,17 @@ "node": ">=6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/rfdc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", @@ -2278,6 +2451,17 @@ "tslib": "^2.0.3" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -2310,6 +2494,20 @@ "devOptional": true, "license": "MIT" }, + "node_modules/unplugin": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.10.1.tgz", + "integrity": "sha512-d6Mhq8RJeGA8UfKCu54Um4lFA0eSaRa3XxdAJg8tIdxbu1ubW0hBCZUL7yI2uGyYCRndvbK8FLHzqy2XKfeMsg==", + "dependencies": { + "acorn": "^8.11.3", + "chokidar": "^3.6.0", + "webpack-sources": "^3.2.3", + "webpack-virtual-modules": "^0.6.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/valid-data-url": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/valid-data-url/-/valid-data-url-3.0.1.tgz", @@ -2319,6 +2517,18 @@ "node": ">=10" } }, + "node_modules/vidstack": { + "version": "1.11.22", + "resolved": "https://registry.npmjs.org/vidstack/-/vidstack-1.11.22.tgz", + "integrity": "sha512-prJUMxRNSJElzVv6imqAoZMR/x+mYSTC2bCjovXToE3tMGrBCFlYLwuaOht55vm0QS6oU03dDp3tqKGXqhMZOg==", + "dependencies": { + "media-captions": "^1.0.1", + "unplugin": "^1.10.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/vite": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.1.tgz", @@ -2501,6 +2711,19 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack-virtual-modules": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", + "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", diff --git a/package.json b/package.json index 3f8aa8fc2..81fa3baad 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "dependencies": { "markdown-it-mathjax3": "^4.3.2", "markdown-it-vuepress-code-snippet-enhanced": "github:IMB11/md-it-enhanced-snippets#dfb9fa2", + "medium-zoom": "^1.1.0", + "vidstack": "^1.11.22", "vitepress": "^1.2.3", "vitepress-versioning-plugin": "^1.0.2", "vue": "^3.4.27" diff --git a/public/assets/develop/items/armor_0.png b/public/assets/develop/items/armor_0.png new file mode 100644 index 000000000..fd6731d0a Binary files /dev/null and b/public/assets/develop/items/armor_0.png differ diff --git a/public/assets/develop/items/armor_1.png b/public/assets/develop/items/armor_1.png new file mode 100644 index 000000000..cca4a07c4 Binary files /dev/null and b/public/assets/develop/items/armor_1.png differ diff --git a/public/assets/develop/items/armor_2.png b/public/assets/develop/items/armor_2.png new file mode 100644 index 000000000..ed53fd5d3 Binary files /dev/null and b/public/assets/develop/items/armor_2.png differ diff --git a/public/assets/develop/items/armor_3.png b/public/assets/develop/items/armor_3.png new file mode 100644 index 000000000..779acd6b1 Binary files /dev/null and b/public/assets/develop/items/armor_3.png differ diff --git a/public/assets/develop/items/custom_items_0.webm b/public/assets/develop/items/custom_items_0.webm new file mode 100644 index 000000000..76ae25019 Binary files /dev/null and b/public/assets/develop/items/custom_items_0.webm differ diff --git a/public/assets/develop/items/example_armor_item_textures.zip b/public/assets/develop/items/example_armor_item_textures.zip new file mode 100644 index 000000000..05ad3f773 Binary files /dev/null and b/public/assets/develop/items/example_armor_item_textures.zip differ diff --git a/public/assets/develop/items/example_armor_layer_textures.zip b/public/assets/develop/items/example_armor_layer_textures.zip new file mode 100644 index 000000000..ce94222ef Binary files /dev/null and b/public/assets/develop/items/example_armor_layer_textures.zip differ diff --git a/public/assets/develop/items/first_item_0.png b/public/assets/develop/items/first_item_0.png new file mode 100644 index 000000000..4cca48ced Binary files /dev/null and b/public/assets/develop/items/first_item_0.png differ diff --git a/public/assets/develop/items/first_item_1.png b/public/assets/develop/items/first_item_1.png new file mode 100644 index 000000000..ffa7cf42b Binary files /dev/null and b/public/assets/develop/items/first_item_1.png differ diff --git a/public/assets/develop/items/first_item_1_small.png b/public/assets/develop/items/first_item_1_small.png new file mode 100644 index 000000000..9575ebbc9 Binary files /dev/null and b/public/assets/develop/items/first_item_1_small.png differ diff --git a/public/assets/develop/items/first_item_2.png b/public/assets/develop/items/first_item_2.png new file mode 100644 index 000000000..92df7e62e Binary files /dev/null and b/public/assets/develop/items/first_item_2.png differ diff --git a/public/assets/develop/items/first_item_3.png b/public/assets/develop/items/first_item_3.png new file mode 100644 index 000000000..60c247fdf Binary files /dev/null and b/public/assets/develop/items/first_item_3.png differ diff --git a/public/assets/develop/items/food_0.webm b/public/assets/develop/items/food_0.webm new file mode 100644 index 000000000..2db10f008 Binary files /dev/null and b/public/assets/develop/items/food_0.webm differ diff --git a/public/assets/develop/items/itemgroups_0.png b/public/assets/develop/items/itemgroups_0.png new file mode 100644 index 000000000..bb6965c61 Binary files /dev/null and b/public/assets/develop/items/itemgroups_0.png differ diff --git a/public/assets/develop/items/itemgroups_1.png b/public/assets/develop/items/itemgroups_1.png new file mode 100644 index 000000000..726931764 Binary files /dev/null and b/public/assets/develop/items/itemgroups_1.png differ diff --git a/public/assets/develop/items/tools_0.png b/public/assets/develop/items/tools_0.png new file mode 100644 index 000000000..7b3015277 Binary files /dev/null and b/public/assets/develop/items/tools_0.png differ diff --git a/public/assets/develop/items/tools_0_small.png b/public/assets/develop/items/tools_0_small.png new file mode 100644 index 000000000..fcaeb83d6 Binary files /dev/null and b/public/assets/develop/items/tools_0_small.png differ diff --git a/public/assets/develop/items/tools_1.png b/public/assets/develop/items/tools_1.png new file mode 100644 index 000000000..9e3e255ef Binary files /dev/null and b/public/assets/develop/items/tools_1.png differ diff --git a/public/assets/develop/tater-effect-icon.png b/public/assets/develop/tater-effect-icon.png new file mode 100644 index 000000000..511a7bc68 Binary files /dev/null and b/public/assets/develop/tater-effect-icon.png differ diff --git a/reference/checkstyle.xml b/reference/checkstyle.xml index 3fd9f801c..4aafd0f16 100644 --- a/reference/checkstyle.xml +++ b/reference/checkstyle.xml @@ -108,7 +108,7 @@ - + diff --git a/reference/latest/src/client/java/com/example/docs/rendering/TextTests.java b/reference/latest/src/client/java/com/example/docs/rendering/TextTests.java new file mode 100644 index 000000000..036207d27 --- /dev/null +++ b/reference/latest/src/client/java/com/example/docs/rendering/TextTests.java @@ -0,0 +1,18 @@ +package com.example.docs.rendering; + +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; + +public class TextTests { + public void test() { + // :::1 + MutableText mutable = Text.translatable("my_mod.text.bye"); + String json = Text.Serialization.toJsonString(mutable); + // :::1 + + // :::2 + String jsonString = Text.Serialization.toJsonString(mutable); + MutableText deserialized = Text.Serialization.fromJson(jsonString); + // :::2 + } +} diff --git a/reference/latest/src/main/java/com/example/docs/item/FabricDocsReferenceItems.java b/reference/latest/src/main/java/com/example/docs/item/FabricDocsReferenceItems.java index 4ef92e186..68d98da4a 100644 --- a/reference/latest/src/main/java/com/example/docs/item/FabricDocsReferenceItems.java +++ b/reference/latest/src/main/java/com/example/docs/item/FabricDocsReferenceItems.java @@ -1,28 +1,12 @@ package com.example.docs.item; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; +import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.item.v1.FabricItemSettings; - -import com.example.docs.FabricDocsReference; - -public class FabricDocsReferenceItems { - private FabricDocsReferenceItems() { - // private empty constructor to avoid accidental instantiation - } - - public static final CustomSoundItem CUSTOM_SOUND_ITEM = register("custom-sound-item", - new CustomSoundItem(new FabricItemSettings().maxCount(1))); - - private static T register(String name, T item) { - Identifier identifier = new Identifier(FabricDocsReference.MOD_ID, name); - return Registry.register(Registries.ITEM, identifier, item); - } - - public static void initialize() { - FabricDocsReference.LOGGER.info("initializing items"); +// :::1 +public class FabricDocsReferenceItems implements ModInitializer { + @Override + public void onInitialize() { + ModItems.initialize(); } } +// :::1 diff --git a/reference/latest/src/main/java/com/example/docs/item/ModItems.java b/reference/latest/src/main/java/com/example/docs/item/ModItems.java new file mode 100644 index 000000000..851ccbc79 --- /dev/null +++ b/reference/latest/src/main/java/com/example/docs/item/ModItems.java @@ -0,0 +1,137 @@ +package com.example.docs.item; + +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.item.ArmorItem; +import net.minecraft.item.FoodComponent; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.ItemStack; +import net.minecraft.item.SwordItem; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; + +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.fabricmc.fabric.api.registry.CompostingChanceRegistry; +import net.fabricmc.fabric.api.registry.FuelRegistry; + +import com.example.docs.FabricDocsReference; +import com.example.docs.item.armor.GuiditeArmorMaterial; +import com.example.docs.item.custom.LightningStick; +import com.example.docs.item.tool.GuiditeMaterial; + +// :::1 +public class ModItems { + // :::1 + + // :::6 + public static final Item GUIDITE_HELMET = register(new ArmorItem(GuiditeArmorMaterial.INSTANCE, ArmorItem.Type.HELMET, new Item.Settings()), "guidite_helmet"); + public static final Item GUIDITE_BOOTS = register(new ArmorItem(GuiditeArmorMaterial.INSTANCE, ArmorItem.Type.BOOTS, new Item.Settings()), "guidite_boots"); + public static final Item GUIDITE_LEGGINGS = register(new ArmorItem(GuiditeArmorMaterial.INSTANCE, ArmorItem.Type.LEGGINGS, new Item.Settings()), "guidite_leggings"); + public static final Item GUIDITE_CHESTPLATE = register(new ArmorItem(GuiditeArmorMaterial.INSTANCE, ArmorItem.Type.CHESTPLATE, new Item.Settings()), "guidite_chestplate"); + // :::6 + public static final Item LIGHTNING_STICK = register(new LightningStick(new FabricItemSettings()), "lightning_stick"); + // :::7 + public static final Item GUIDITE_SWORD = register(new SwordItem(GuiditeMaterial.INSTANCE, 2, 0.5F, new FabricItemSettings()), "guidite_sword"); + // :::7 + // :::9 + public static final RegistryKey CUSTOM_ITEM_GROUP_KEY = RegistryKey.of(Registries.ITEM_GROUP.getKey(), new Identifier(FabricDocsReference.MOD_ID, "item_group")); + public static final ItemGroup CUSTOM_ITEM_GROUP = FabricItemGroup.builder() + .icon(() -> new ItemStack(ModItems.GUIDITE_SWORD)) + .displayName(Text.translatable("itemGroup.fabric_docs_reference")) + .build(); + // :::9 + // :::5 + public static final FoodComponent SUSPICIOUS_FOOD_COMPONENT = new FoodComponent.Builder() + .alwaysEdible() + .snack() + // The duration is in ticks, 20 ticks = 1 second + .statusEffect(new StatusEffectInstance(StatusEffects.POISON, 6 * 20, 1), 1.0f) + .build(); + // :::5 + + // :::2 + public static final Item SUSPICIOUS_SUBSTANCE = register( + // Ignore the food component for now, we'll cover it later in the food section. + new Item(new FabricItemSettings().food(SUSPICIOUS_FOOD_COMPONENT)), + "suspicious_substance" + ); + // :::2 + + // :::1 + public static Item register(Item item, String id) { + // Create the identifier for the item. + Identifier itemID = new Identifier(FabricDocsReference.MOD_ID, id); + + // Register the item. + Item registeredItem = Registry.register(Registries.ITEM, itemID, item); + + // Return the registered item! + return registeredItem; + } + + // :::1 + + // :::3 + public static void initialize() { + // :::3 + // :::4 + // Get the event for modifying entries in the ingredients group. + // And register an event handler that adds our suspicious item to the ingredients group. + ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS) + .register((itemGroup) -> itemGroup.add(ModItems.SUSPICIOUS_SUBSTANCE)); + // :::4 + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS) + .register((itemGroup) -> { + itemGroup.add(ModItems.GUIDITE_HELMET); + itemGroup.add(ModItems.GUIDITE_BOOTS); + itemGroup.add(ModItems.GUIDITE_LEGGINGS); + itemGroup.add(ModItems.GUIDITE_CHESTPLATE); + }); + + // :::8 + ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS) + .register((itemGroup) -> itemGroup.add(ModItems.GUIDITE_SWORD)); + // :::8 + + // :::_12 + // Register the group. + Registry.register(Registries.ITEM_GROUP, CUSTOM_ITEM_GROUP_KEY, CUSTOM_ITEM_GROUP); + + // Register items to the custom item group. + ItemGroupEvents.modifyEntriesEvent(CUSTOM_ITEM_GROUP_KEY).register(itemGroup -> { + itemGroup.add(ModItems.SUSPICIOUS_SUBSTANCE); + itemGroup.add(ModItems.GUIDITE_SWORD); + itemGroup.add(ModItems.GUIDITE_HELMET); + itemGroup.add(ModItems.GUIDITE_BOOTS); + itemGroup.add(ModItems.GUIDITE_LEGGINGS); + itemGroup.add(ModItems.GUIDITE_CHESTPLATE); + itemGroup.add(ModItems.LIGHTNING_STICK); + // ... + }); + // :::_12 + + // :::_10 + // Add the suspicious substance to the composting registry with a 30% chance of increasing the composter's level. + CompostingChanceRegistry.INSTANCE.add(ModItems.SUSPICIOUS_SUBSTANCE, 0.3f); + // :::_10 + + // :::_11 + // Add the suspicious substance to the flammable block registry with a burn time of 30 seconds. + // Remember, Minecraft deals with logical based-time using ticks. + // 20 ticks = 1 second. + FuelRegistry.INSTANCE.add(ModItems.GUIDITE_SWORD, 30 * 20); + // :::_11 + // :::3 + } + + // :::3 +} +// :::1 diff --git a/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java b/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java new file mode 100644 index 000000000..d267b5ae1 --- /dev/null +++ b/reference/latest/src/main/java/com/example/docs/item/armor/GuiditeArmorMaterial.java @@ -0,0 +1,97 @@ +package com.example.docs.item.armor; + +import net.minecraft.item.ArmorItem; +import net.minecraft.item.ArmorMaterial; +import net.minecraft.recipe.Ingredient; +import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; + +import com.example.docs.item.ModItems; + +// :::1 +public class GuiditeArmorMaterial implements ArmorMaterial { + // ... + //:::1 + // :::_10 + public static final GuiditeArmorMaterial INSTANCE = new GuiditeArmorMaterial(); + + // :::_10 + // :::2 + @Override + public int getDurability(ArmorItem.Type type) { + // Replace this multiplier by a constant value for the durability of the armor. + // For reference, diamond uses 33 for all armor pieces, whilst leather uses 5. + int DURABILITY_MULTIPLIER = 12; + return switch (type) { + case BOOTS -> 13 * DURABILITY_MULTIPLIER; + case LEGGINGS -> 15 * DURABILITY_MULTIPLIER; + case CHESTPLATE -> 16 * DURABILITY_MULTIPLIER; + case HELMET -> 11 * DURABILITY_MULTIPLIER; + default -> 0; + }; + } + + // :::2 + // :::3 + @Override + public int getProtection(ArmorItem.Type type) { + // Protection values for all the slots. + // For reference, diamond uses 3 for boots, 6 for leggings, 8 for chestplate, and 3 for helmet, + // whilst leather uses 1, 2, 3 and 1 respectively. + return switch (type) { + case BOOTS, HELMET -> 3; + case LEGGINGS -> 6; + case CHESTPLATE -> 8; + default -> 0; + }; + } + + // :::3 + // :::4 + @Override + public int getEnchantability() { + return 5; + } + + // :::4 + // :::5 + @Override + public SoundEvent getEquipSound() { + // Example for Iron Armor + return SoundEvents.ITEM_ARMOR_EQUIP_IRON; + } + + // :::5 + // :::6 + @Override + public Ingredient getRepairIngredient() { + return Ingredient.ofItems(ModItems.SUSPICIOUS_SUBSTANCE); + } + + // :::6 + // :::7 + @Override + public String getName() { + return "guidite"; + } + + // :::7 + // :::8 + @Override + public float getToughness() { + return 2.0F; + } + + // :::8 + // :::9 + @Override + public float getKnockbackResistance() { + // We don't want knockback resistance for guidite armor, but if you do, + // change this value to 0.XF, where X is the level of knockback resistance you want. + return 0; + } + + // :::9 + // :::1 +} +// :::1 diff --git a/reference/latest/src/main/java/com/example/docs/item/CustomSoundItem.java b/reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java similarity index 93% rename from reference/latest/src/main/java/com/example/docs/item/CustomSoundItem.java rename to reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java index d8c58260e..7d15908e8 100644 --- a/reference/latest/src/main/java/com/example/docs/item/CustomSoundItem.java +++ b/reference/latest/src/main/java/com/example/docs/item/custom/CustomSoundItem.java @@ -1,4 +1,4 @@ -package com.example.docs.item; +package com.example.docs.item.custom; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -32,7 +32,6 @@ public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity // :::2 @Override public ActionResult useOnBlock(ItemUsageContext context) { - // Tip of the day: Check out "Guard Clauses" to keep your code clean. if (!context.getWorld().isClient()) { // Play the sound and specify location, category and who made the sound. // No entity made the sound, so we specify null. diff --git a/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java b/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java new file mode 100644 index 000000000..14fd6c366 --- /dev/null +++ b/reference/latest/src/main/java/com/example/docs/item/custom/LightningStick.java @@ -0,0 +1,58 @@ +package com.example.docs.item.custom; + +import java.util.List; + +import org.jetbrains.annotations.Nullable; + +import net.minecraft.client.item.TooltipContext; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LightningEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +// :::1 +public class LightningStick extends Item { + public LightningStick(Settings settings) { + super(settings); + } + + // :::1 + // :::2 + @Override + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + // Ensure we don't spawn the lightning only on the client. + // This is to prevent desync. + if (world.isClient) { + return TypedActionResult.pass(user.getStackInHand(hand)); + } + + BlockPos frontOfPlayer = user.getBlockPos().offset(user.getHorizontalFacing(), 10); + + // Spawn the lightning bolt. + LightningEntity lightningBolt = new LightningEntity(EntityType.LIGHTNING_BOLT, world); + lightningBolt.setPosition(frontOfPlayer.toCenterPos()); + world.spawnEntity(lightningBolt); + + // Nothing has changed to the item stack, + // so we just return it how it was. + return TypedActionResult.success(user.getStackInHand(hand)); + } + + // :::2 + // :::3 + @Override + public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { + tooltip.add(Text.translatable("itemTooltip.fabric-docs-reference.lightning_stick").formatted(Formatting.GOLD)); + } + + // :::3 + // :::1 +} +// :::1 diff --git a/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java b/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java new file mode 100644 index 000000000..9e217f700 --- /dev/null +++ b/reference/latest/src/main/java/com/example/docs/item/tool/GuiditeMaterial.java @@ -0,0 +1,62 @@ +package com.example.docs.item.tool; + +import net.minecraft.item.Items; +import net.minecraft.item.ToolMaterial; +import net.minecraft.recipe.Ingredient; + +import com.example.docs.item.ModItems; + +// :::1 +public class GuiditeMaterial implements ToolMaterial { + // Your IDE should override the interface's methods for you, or at least shout at you to do so. + // :::1 + // :::8 + public static final GuiditeMaterial INSTANCE = new GuiditeMaterial(); + // :::8 + + // :::2 + @Override + public int getDurability() { + return 455; + } + + // :::2 + // :::3 + @Override + public float getMiningSpeedMultiplier() { + return 5.0F; + } + + // :::3 + // :::4 + @Override + public float getAttackDamage() { + return 1.5F; + } + + // :::4 + // :::5 + @Override + public int getMiningLevel() { + return 3; + } + + // :::5 + // :::6 + @Override + public int getEnchantability() { + return 22; + } + + // :::6 + // :::7 + @Override + public Ingredient getRepairIngredient() { + return Ingredient.ofItems(ModItems.SUSPICIOUS_SUBSTANCE, Items.POTATO); + } + + // :::7 + + // :::1 +} +// :::1 diff --git a/reference/latest/src/main/java/com/example/docs/sound/CustomSounds.java b/reference/latest/src/main/java/com/example/docs/sound/CustomSounds.java index aeaeda243..c988b966f 100644 --- a/reference/latest/src/main/java/com/example/docs/sound/CustomSounds.java +++ b/reference/latest/src/main/java/com/example/docs/sound/CustomSounds.java @@ -17,8 +17,8 @@ private CustomSounds() { // actual registration of all the custom SoundEvents private static SoundEvent registerSound(String id) { - SoundEvent sound = SoundEvent.of(new Identifier(FabricDocsReferenceSounds.MOD_ID, id)); - return Registry.register(Registries.SOUND_EVENT, new Identifier(FabricDocsReferenceSounds.MOD_ID, id), sound); + Identifier identifier = new Identifier(FabricDocsReferenceSounds.MOD_ID, id); + return Registry.register(Registries.SOUND_EVENT, identifier, SoundEvent.of(identifier)); } // This static method starts class initialization, which then initializes diff --git a/reference/latest/src/main/java/com/example/docs/sound/FabricDocsReferenceSounds.java b/reference/latest/src/main/java/com/example/docs/sound/FabricDocsReferenceSounds.java index f71e28568..cc45f2bda 100644 --- a/reference/latest/src/main/java/com/example/docs/sound/FabricDocsReferenceSounds.java +++ b/reference/latest/src/main/java/com/example/docs/sound/FabricDocsReferenceSounds.java @@ -10,7 +10,6 @@ import net.fabricmc.api.ModInitializer; import com.example.docs.FabricDocsReference; -import com.example.docs.item.FabricDocsReferenceItems; // :::2 public class FabricDocsReferenceSounds implements ModInitializer { @@ -25,8 +24,7 @@ public void onInitialize() { SoundEvent.of(new Identifier(MOD_ID, "metal_whistle"))); // ... the cleaner approach. // [!code focus] - CustomSounds.initialize(); // [!code focus] - FabricDocsReferenceItems.initialize(); // [!code focus] + // CustomSounds.initialize(); // [!code focus] } } // :::2 diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/lang/en_us.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/lang/en_us.json index 6bc49df99..17f54e795 100644 --- a/reference/latest/src/main/resources/assets/fabric-docs-reference/lang/en_us.json +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/lang/en_us.json @@ -1,6 +1,15 @@ { "effect.fabric-docs-reference.tater": "Tater", "sound.fabric-docs-reference.metal_whistle": "Metal Whistle", - "item.minecraft.potion.effect.tater": "Tater Potion" - "death.attack.tater": "%1$s died from Tater damage!" + "item.minecraft.potion.effect.tater": "Tater Potion", + "death.attack.tater": "%1$s died from Tater damage!", + "item.fabric-docs-reference.suspicious_substance": "Suspicous Substance", + "item.fabric-docs-reference.guidite_sword": "Guidite Sword", + "item.fabric-docs-reference.guidite_helmet": "Guidite Helmet", + "item.fabric-docs-reference.guidite_chestplate": "Guidite Chestplate", + "item.fabric-docs-reference.guidite_leggings": "Guidite Leggings", + "item.fabric-docs-reference.guidite_boots": "Guidite Boots", + "item.fabric-docs-reference.lightning_stick": "Lightning Stick", + "itemTooltip.fabric-docs-reference.lightning_stick": "This is an extremely powerful weapon that can summon lightning bolts.", + "itemGroup.fabric_docs_reference": "Fabric Docs Reference" } \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_boots.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_boots.json new file mode 100644 index 000000000..0c9ff00bb --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/guidite_boots" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_chestplate.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_chestplate.json new file mode 100644 index 000000000..2b67f83f3 --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/guidite_chestplate" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_helmet.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_helmet.json new file mode 100644 index 000000000..ee6e315fd --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/guidite_helmet" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_leggings.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_leggings.json new file mode 100644 index 000000000..c022ad8e7 --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/guidite_leggings" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_sword.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_sword.json new file mode 100644 index 000000000..64046c93a --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/guidite_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "fabric-docs-reference:item/guidite_sword" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/lightning_stick.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/lightning_stick.json new file mode 100644 index 000000000..c29f9a83b --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/lightning_stick.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "item/stick" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/suspicious_substance.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/suspicious_substance.json new file mode 100644 index 000000000..09e3d2f4d --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/item/suspicious_substance.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/suspicious_substance" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_boots.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_boots.png new file mode 100644 index 000000000..b6092f234 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_boots.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_chestplate.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_chestplate.png new file mode 100644 index 000000000..996534bfd Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_chestplate.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_helmet.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_helmet.png new file mode 100644 index 000000000..e0c6582db Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_helmet.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_leggings.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_leggings.png new file mode 100644 index 000000000..4d37c8da9 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_leggings.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_sword.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_sword.png new file mode 100644 index 000000000..fcaeb83d6 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/guidite_sword.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/suspicious_substance.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/suspicious_substance.png new file mode 100644 index 000000000..9575ebbc9 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/suspicious_substance.png differ diff --git a/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_1.png b/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_1.png new file mode 100644 index 000000000..a02174be7 Binary files /dev/null and b/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_1.png differ diff --git a/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_2.png b/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_2.png new file mode 100644 index 000000000..a2c9693c3 Binary files /dev/null and b/reference/latest/src/main/resources/assets/minecraft/textures/models/armor/guidite_layer_2.png differ diff --git a/reference/latest/src/main/resources/fabric.mod.json b/reference/latest/src/main/resources/fabric.mod.json index 8013e823a..4f221da57 100644 --- a/reference/latest/src/main/resources/fabric.mod.json +++ b/reference/latest/src/main/resources/fabric.mod.json @@ -13,12 +13,11 @@ "com.example.docs.effect.FabricDocsReferenceEffects", "com.example.docs.potion.FabricDocsReferencePotions", "com.example.docs.sound.FabricDocsReferenceSounds", - "com.example.docs.damage.FabricDocsReferenceDamageTypes" + "com.example.docs.damage.FabricDocsReferenceDamageTypes", + "com.example.docs.item.FabricDocsReferenceItems" ], "client": [ "com.example.docs.FabricDocsReferenceClient", - "com.example.docs.rendering.RenderingConceptsEntrypoint", - "com.example.docs.rendering.HudRenderingEntrypoint", "com.example.docs.client.command.FabricDocsReferenceClientCommands" ], "fabric-datagen": [ diff --git a/sidebar_translations.json b/sidebar_translations.json index a66cec0ab..996ac1230 100644 --- a/sidebar_translations.json +++ b/sidebar_translations.json @@ -20,6 +20,12 @@ "develop.gettingStarted.projectStructure": "Project Structure", "develop.gettingStarted.launchGame": "Launching the Game", "develop.items": "Items", + "develop.items.first-item": "Creating Your First Item", + "develop.items.food": "Food Items", + "develop.items.custom-armor": "Custom Armor", + "develop.items.custom-tools": "Custom Tools", + "develop.items.custom-item-groups": "Custom Item Groups", + "develop.items.custom-item-interactions": "Custom Item Interactions", "develop.items.potions": "Potions", "develop.entities": "Entities", "develop.entities.effects": "Status Effects", @@ -40,6 +46,7 @@ "develop.misc": "Miscellaneous Pages", "develop.misc.codecs": "Codecs", "develop.misc.events": "Events", + "develop.misc.text-and-translations": "Text and Translations", "develop.sounds": "Sounds", "develop.sounds.using-sounds": "Playing Sounds", "develop.sounds.custom": "Creating Custom Sounds"