diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index 7477d1ce8..bba714b55 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -32,12 +32,49 @@ config: style: asterisk MD053: false MD054: - # these link styles are not easily localizable - collapsed: false # A link to [keyword][]. - shortcut: false # A link to [keyword]. - # [keyword]: + # A link to [keyword][]. + collapsed: false + # A link to [keyword]. + # [keyword]: + shortcut: false url_inline: false MD055: style: leading_and_trailing + search-replace: + rules: + - name: missing-heading-anchor + message: "Add anchors to headings. Use lowercase characters, numbers and dashes" + searchPattern: "/^#+.*$(?` which serializes t The Codec API itself also contains some codecs for primitive types, such as `Codec.INT` and `Codec.STRING`. These are available as statics on the `Codec` class, and are usually used as the base for more complex codecs, as explained below. -## Building Codecs +## Building Codecs {#building-codecs} Now that we've seen how to use codecs, let's take a look at how we can build our own. Suppose we have the following class, and we want to deserialize instances of it from json files: @@ -117,7 +117,7 @@ We can get the first one from the aforementioned primitive codecs in the `Codec` the second one can be obtained from the `Registries.ITEM` registry, which has a `getCodec()` method that returns a `Codec`. We don't have a default codec for `List`, but we can make one from `BlockPos.CODEC`. -### Lists +### Lists {#lists} `Codec#listOf` can be used to create a list version of any codec: @@ -126,10 +126,10 @@ Codec> listCodec = BlockPos.CODEC.listOf(); ``` It should be noted that codecs created in this way will always deserialize to an `ImmutableList`. If you need a mutable -list instead, you can make use of [xmap](#mutually-convertible-types-and-you) to convert to one during +list instead, you can make use of [xmap](#mutually-convertible-types) to convert to one during deserialization. -### Merging Codecs for Record-Like Classes +### Merging Codecs for Record-Like Classes {#merging-codecs-for-record-like-classes} Now that we have separate codecs for each field, we can combine them into one codec for our class using a `RecordCodecBuilder`. This assumes that our class has a constructor containing every field we want to serialize, and @@ -183,7 +183,7 @@ fields, as explained in the [Merging Codecs for Record-like Classes](#merging-co above, they can also be turned back into regular codecs using `MapCodec#codec`, which will retain the same behavior of boxing their input value. -#### Optional Fields +#### Optional Fields {#optional-fields} `Codec#optionalFieldOf` can be used to create an optional map codec. This will, when the specified field is not present in the container during deserialization, either be deserialized as an empty `Optional` or a specified default value. @@ -202,9 +202,9 @@ the field is present, but the value is invalid, the field will always be deseria **Since 1.20.2**, Minecraft itself (not DFU!) does however provide `Codecs#createStrictOptionalFieldCodec`, which fails to deserialize at all if the field value is invalid. -### Constants, Constraints, and Composition +### Constants, Constraints, and Composition {#constants-constraints-composition} -#### Unit +#### Unit {#unit} `Codec.unit` can be used to create a codec that always deserializes to a constant value, regardless of the input. When serializing, it will do nothing. @@ -213,7 +213,7 @@ serializing, it will do nothing. Codec theMeaningOfCodec = Codec.unit(42); ``` -#### Numeric Ranges +#### Numeric Ranges {#numeric-ranges} `Codec.intRange` and its pals, `Codec.floatRange` and `Codec.doubleRange` can be used to create a codec that only accepts number values within a specified **inclusive** range. This applies to both serialization and deserialization. @@ -223,7 +223,7 @@ accepts number values within a specified **inclusive** range. This applies to bo Codec amountOfFriendsYouHave = Codec.intRange(0, 2); ``` -#### Pair +#### Pair {#pair} `Codec.pair` merges two codecs, `Codec` and `Codec`, into a `Codec>`. Keep in mind it only works properly with codecs that serialize to a specific field, such as [converted `MapCodec`s](#mapcodec) or @@ -253,13 +253,13 @@ Will output this json: } ``` -#### Either +#### Either {#either} `Codec.either` combines two codecs, `Codec` and `Codec`, into a `Codec>`. The resulting codec will, during deserialization, attempt to use the first codec, and _only if that fails_, attempt to use the second one. If the second one also fails, the error of the _second_ codec will be returned. -#### Maps +#### Maps {#maps} For processing maps with arbitrary keys, such as `HashMap`s, `Codec.unboundedMap` can be used. This returns a `Codec>` for a given `Codec` and `Codec`. The resulting codec will serialize to a json object or @@ -289,12 +289,12 @@ This will output this json: ``` As you can see, this works because `Identifier.CODEC` serializes directly to a string value. A similar effect can be -achieved for simple objects that don't serialize to strings by using [xmap & friends](#mutually-convertible-types-and-you) to +achieved for simple objects that don't serialize to strings by using [xmap & friends](#mutually-convertible-types) to convert them. -### Mutually Convertible Types and You +### Mutually Convertible Types {#mutually-convertible-types} -#### `xmap` +#### `xmap` {#xmap} Say we have two classes that can be converted to each other, but don't have a parent-child relationship. For example, a vanilla `BlockPos` and `Vec3d`. If we have a codec for one, we can use `Codec#xmap` to create a codec for the other by @@ -317,7 +317,7 @@ Codec blockPosCodec = Vec3d.CODEC.xmap( // method references in your `xmap` call. ``` -#### flatComapMap, comapFlatMap, and flatXMap +#### flatComapMap, comapFlatMap, and flatXMap {#flatcomapmap-comapflatmap-flatxmap} `Codec#flatComapMap`, `Codec#comapFlatMap` and `flatXMap` are similar to xmap, but they allow one or both of the conversion functions to return a DataResult. This is useful in practice because a specific object instance may not @@ -358,7 +358,7 @@ one to use: | `Codec#flatComapMap` | Yes | No | | `Codec#flatXMap` | No | No | -### Registry Dispatch +### Registry Dispatch {#registry-dispatch} `Codec#dispatch` let us define a registry of codecs and dispatch to a specific one based on the value of a field in the serialized data. This is very useful when deserializing objects that have different fields depending on @@ -409,7 +409,7 @@ Our new codec will serialize beans to json like this, grabbing only fields that } ``` -### Recursive Codecs +### Recursive Codecs {#recursive-codecs} Sometimes it is useful to have a codec that uses _itself_ to decode specific fields, for example when dealing with certain recursive data structures. In vanilla code, this is used for `Text` objects, which may store other `Text`s as children. Such a codec can be constructed using `Codecs#createRecursive`. @@ -453,10 +453,10 @@ A serialized `ListNode` may then look like this: } ``` -## References +## References {#references} - A much more comprehensive documentation of Codecs and related APIs can be found at the - [Unofficial DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html). + [Unofficial DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec). - The general structure of this guide was heavily inspired by the [Forge Community Wiki's page on Codecs](https://forge.gemwire.uk/wiki/Codecs), a more Forge-specific take on the same topic. diff --git a/develop/commands/arguments.md b/develop/commands/arguments.md index aa9cce558..7bba9ad51 100644 --- a/develop/commands/arguments.md +++ b/develop/commands/arguments.md @@ -3,7 +3,7 @@ title: Command Arguments description: Learn how to create commands with complex arguments. --- -# Command Arguments +# Command Arguments {#command-arguments} Arguments are used in most of the commands. Sometimes they can be optional, which means if you do not provide that argument, @@ -28,7 +28,7 @@ both executions. @[code lang=java highlight={3,5,6,7} transcludeWith=:::6](@/reference/latest/src/main/java/com/example/docs/command/FabricDocsReferenceCommands.java) -## Custom Argument Types +## Custom Argument Types {#custom-argument-types} If vanilla does not have the argument type you need, you can create your own. To do this, you need to create a class that inherits the `ArgumentType` interface where `T` is the type of the argument. @@ -38,7 +38,7 @@ For example, you can create an argument type that parses a `BlockPos` from a str @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/command/BlockPosArgumentType.java) -### Registering Custom Argument Types +### Registering Custom Argument Types {#registering-custom-argument-types} ::: warning You need to register the custom argument type on both the server and the client or else the command will not work! @@ -48,7 +48,7 @@ You can register your custom argument type in the `onInitialize` method of your @[code lang=java transcludeWith=:::11](@/reference/latest/src/main/java/com/example/docs/command/FabricDocsReferenceCommands.java) -### Using Custom Argument Types +### Using Custom Argument Types {#using-custom-argument-types} We can use our custom argument type in a command - by passing an instance of it into the `.argument` method on the command builder. diff --git a/develop/commands/basics.md b/develop/commands/basics.md index 3febf4bea..6e1316879 100644 --- a/develop/commands/basics.md +++ b/develop/commands/basics.md @@ -17,18 +17,19 @@ authors: - xpple --- -# Creating Commands +# Creating Commands {#creating-commands} Creating commands can allow a mod developer to add functionality that can be used through a command. This tutorial will teach you how to register commands and the general command structure of Brigadier. ::: info Brigadier is a command parser and dispatcher written by Mojang for Minecraft. It is a tree-based command library where -you -build a tree of commands and arguments. Brigadier is open source: +you build a tree of commands and arguments. + +Brigadier is open-source: ::: -## The `Command` Interface +## The `Command` Interface {#the-command-interface} `com.mojang.brigadier.Command` is a functional interface, which runs some specific code, and throws a `CommandSyntaxException` in certain cases. It has a generic type `S`, which defines the type of the _command source_. @@ -52,7 +53,7 @@ The integer can be considered the result of the command. Typically values less t do nothing. Positive values mean the command was successful and did something. Brigadier provides a constant to indicate success; `Command#SINGLE_SUCCESS`. -### What Can the `ServerCommandSource` Do? +### What Can the `ServerCommandSource` Do? {#what-can-the-servercommandsource-do} A `ServerCommandSource` provides some additional implementation-specific context when a command is run. This includes the @@ -68,7 +69,7 @@ Command command = context -> { }; ``` -## Registering a Basic Command +## Registering a Basic Command {#registering-a-basic-command} Commands are registered within the `CommandRegistrationCallback` provided by the Fabric API. @@ -80,7 +81,7 @@ The event should be registered in your mod's initializer. The callback has three parameters: -- `CommandDispatcher dispatcher` - Used to register, parse and execute commands. `S` is the type +- `CommandDispatcher dispatcher` - Used to register, parse and execute commands. `S` is the type of command source the command dispatcher supports. - `CommandRegistryAccess registryAccess` - Provides an abstraction to registries that may be passed to certain command argument methods @@ -107,14 +108,14 @@ your own exception. To execute this command, you must type `/foo`, which is case-sensitive. -### Registration Environment +### Registration Environment {#registration-environment} If desired, you can also make sure a command is only registered under some specific circumstances, for example, only in the dedicated environment: @[code lang=java highlight={2} transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/command/FabricDocsReferenceCommands.java) -### Command Requirements +### Command Requirements {#command-requirements} Let's say you have a command that you only want operators to be able to execute. This is where the `requires()` method comes into play. The `requires()` method has one argument of a `Predicate` which will supply a `ServerCommandSource` @@ -128,7 +129,7 @@ blocks. Otherwise, the command is not registered. This has the side effect of not showing this command in tab completion to anyone who is not a level 2 operator. This is also why you cannot tab-complete most commands when you do not enable cheats. -### Sub Commands +### Sub Commands {#sub-commands} To add a sub command, you register the first literal node of the command normally. To have a sub command, you have to append the next literal node to the existing node. @@ -139,23 +140,21 @@ and `/subtater subcommand` will be valid. @[code lang=java highlight={2,8} transcludeWith=:::8](@/reference/latest/src/main/java/com/example/docs/command/FabricDocsReferenceCommands.java) -## Client Commands +## Client Commands {#client-commands} Fabric API has a `ClientCommandManager` in `net.fabricmc.fabric.api.client.command.v2` package that can be used to register client-side commands. The code should exist only in client-side code. @[code lang=java transcludeWith=:::1](@/reference/latest/src/client/java/com/example/docs/client/command/FabricDocsReferenceClientCommands.java) -## Command Redirects +## Command Redirects {#command-redirects} Command redirects - also known as aliases - are a way to redirect the functionality of one command to another. This is useful for when you want to change the name of a command, but still want to support the old name. @[code lang=java transcludeWith=:::12](@/reference/latest/src/client/java/com/example/docs/client/command/FabricDocsReferenceClientCommands.java) -## FAQ - -
+## FAQ {#faq} -### Why Does My Code Not Compile? +### Why Does My Code Not Compile? {#why-does-my-code-not-compile} - Catch or throw a `CommandSyntaxException` - `CommandSyntaxException` is not a `RuntimeException`. If you throw it, that should be in methods that throw `CommandSyntaxException` in method signatures, or it should be caught. @@ -171,7 +170,7 @@ Command redirects - also known as aliases - are a way to redirect the functional - A Command should return an integer - When registering commands, the `executes()` method accepts a `Command` object, which is usually a lambda. The lambda should return an integer, instead of other types. -### Can I Register Commands at Runtime? +### Can I Register Commands at Runtime? {#can-i-register-commands-at-runtime} ::: warning You can do this, but it is not recommended. You would get the `CommandManager` from the server and add anything commands @@ -184,7 +183,7 @@ This is required because the client locally caches the command tree it receives are sent) for local completions-rich error messages. ::: -### Can I Unregister Commands at Runtime? +### Can I Unregister Commands at Runtime? {#can-i-unregister-commands-at-runtime} ::: warning You can also do this, however, it is much less stable than registering commands at runtime and could cause unwanted side diff --git a/develop/commands/suggestions.md b/develop/commands/suggestions.md index 1d9933ee8..650be9161 100644 --- a/develop/commands/suggestions.md +++ b/develop/commands/suggestions.md @@ -5,21 +5,21 @@ authors: - IMB11 --- -# Command Suggestions +# Command Suggestions {#command-suggestions} Minecraft has a powerful command suggestion system that's used in many places, such as the `/give` command. This system allows you to suggest values for command arguments to the user, which they can then select from - it's a great way to make your commands more user-friendly and ergonomic. -## Suggestion Providers +## Suggestion Providers {#suggestion-providers} A `SuggestionProvider` is used to make a list of suggestions that will be sent to the client. A suggestion provider is a functional interface that takes a `CommandContext` and a `SuggestionBuilder` and returns some `Suggestions`. The `SuggestionProvider` returns a `CompletableFuture` as the suggestions may not be available immediately. -## Using Suggestion Providers +## Using Suggestion Providers {#using-suggestion-providers} To use a suggestion provider, you need to call the `suggests` method on the argument builder. This method takes a `SuggestionProvider` and returns the modified argument builder with the suggestion provider attached. @[code java transcludeWith=:::9 highlight={4}](@/reference/latest/src/main/java/com/example/docs/command/FabricDocsReferenceCommands.java) -## Built-in Suggestion Providers +## Built-in Suggestion Providers {#built-in-suggestion-providers} There are a few built-in suggestion providers that you can use: @@ -30,7 +30,7 @@ There are a few built-in suggestion providers that you can use: | `LootCommand.SUGGESTION_PROVIDER` | Suggests all loot tables that are available. | | `SuggestionProviders.ALL_BIOMES` | Suggests all biomes that are available. | -## Creating a Custom Suggestion Provider +## Creating a Custom Suggestion Provider {#creating-a-custom-suggestion-provider} If a built-in provider doesn't satisfy your needs, you can create your own suggestion provider. To do this, you need to create a class that implements the `SuggestionProvider` interface and override the `getSuggestions` method. diff --git a/develop/entities/damage-types.md b/develop/entities/damage-types.md index 5193295f9..5735fb545 100644 --- a/develop/entities/damage-types.md +++ b/develop/entities/damage-types.md @@ -7,12 +7,12 @@ authors: - mattidragon --- -# Damage Types +# Damage Types {#damage-types} Damage types define types of damage that entities can take. Since Minecraft 1.19.4, the creation of new damage types has become data-driven, meaning they are created using JSON files. -## Creating a Damage Type +## Creating a Damage Type {#creating-a-damage-type} Let's create a custom damage type called _Tater_. We start by creating a JSON file for your custom damage. This file will @@ -37,7 +37,7 @@ Refer to the [Minecraft Wiki](https://minecraft.wiki/w/Damage_type#JSON_format) ::: -### Accessing Damage Types Through Code +### Accessing Damage Types Through Code {#accessing-damage-types-through-code} When we need to access our custom damage type through code, we will use it's `RegistryKey` to build an instance of `DamageSource`. @@ -46,7 +46,7 @@ The `RegistryKey` can be obtained as follows: @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/damage/FabricDocsReferenceDamageTypes.java) -### Using Damage Types +### Using Damage Types {#using-damage-types} To demonstrate the use of custom damage types, we will use a custom block called _Tater Block_. Let's make is so that when a living entity steps on a _Tater Block_, it deals _Tater_ damage. @@ -67,7 +67,7 @@ The complete block implementation: Now whenever a living entity steps on our custom block, it'll take 5 damage (2.5 hearts) using our custom damage type. -### Custom Death Message +### Custom Death Message {#custom-death-message} You can define a death message for the damage type in the format of `death.attack.` in our mod's `en_us.json` file. @@ -78,7 +78,7 @@ Upon death from our damage type, you'll see the following death message: ![Effect in player inventory](/assets/develop/tater-damage-death.png) -### Damage Type Tags +### Damage Type Tags {#damage-type-tags} Some damage types can bypass armor, bypass status effects, and such. Tags are used to control these kinds of properties of damage types. diff --git a/develop/entities/effects.md b/develop/entities/effects.md index 2bcb320af..b4a641520 100644 --- a/develop/entities/effects.md +++ b/develop/entities/effects.md @@ -12,37 +12,33 @@ authors-nogithub: - tao0lu --- -# Status Effects +# Status Effects {#status-effects} Status effects, also known as effects, are a condition that can affect an entity. They can be positive, negative or neutral in nature. The base game applies these effects in various ways such as food, potions etc. The `/effect` command can be used to apply effects on an entity. -## Custom Status Effects +## Custom Status Effects {#custom-status-effects} In this tutorial we'll add a new custom effect called _Tater_ which gives you one experience point every game tick. -### Extend `StatusEffect` +### Extend `StatusEffect` {#extend-statuseffect} Let's create a custom effect class by extending `StatusEffect`, which is the base class for all effects. @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/effect/TaterEffect.java) -### Registering Your Custom Effect +### Registering Your Custom Effect {#registering-your-custom-effect} Similar to block and item registration, we use `Registry.register` to register our custom effect into the `STATUS_EFFECT` registry. This can be done in our initializer. @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/effect/FabricDocsReferenceEffects.java) -### Translations and Textures +### Texture {#texture} -You can assign a name to your status effect and provide a texture icon that will appear in the player inventory screen. - -#### Texture - -The status effect icon is a 18x18 PNG. Place your custom icon in: +The status effect icon is a 18x18 PNG which will appear in the player's inventory screen. Place your custom icon in: ```:no-line-numbers resources/assets/fabric-docs-reference/textures/mob_effect/tater.png @@ -50,7 +46,7 @@ resources/assets/fabric-docs-reference/textures/mob_effect/tater.png ![Effect in player inventory](/assets/develop/tater-effect.png) -#### Translations +### Translations {#translations} Like any other translation, you can add an entry with ID format `"effect..": "Value"` to the language file. @@ -63,7 +59,7 @@ language file. } ``` -### Testing +### Testing {#testing} Use the command `/effect give @p fabric-docs-reference:tater` to give the player our Tater effect. Use `/effect clear @p fabric-docs-reference:tater` to remove the effect. diff --git a/develop/events.md b/develop/events.md index 85eec7bab..c82617659 100644 --- a/develop/events.md +++ b/develop/events.md @@ -17,7 +17,7 @@ authors-nogithub: - stormyfabric --- -# Events +# Events {#events} Fabric API provides a system that allows mods to react to actions or occurrences, also defined as _events_ that occur in the game. @@ -27,25 +27,23 @@ Fabric API provides events for important areas in the Minecraft codebase that mu Events are represented by instances of `net.fabricmc.fabric.api.event.Event` which stores and calls _callbacks_. Often there is a single event instance for a callback, which is stored in a static field `EVENT` of the callback interface, but there are other patterns as well. For example, `ClientTickEvents` groups several related events together. -## Callbacks +## Callbacks {#callbacks} Callbacks are a piece of code that is passed as an argument to an event. When the event is triggered by the game, the passed piece of code will be executed. -### Callback Interfaces +### Callback Interfaces {#callback-interfaces} Each event has a corresponding callback interface, conventionally named `Callback`. Callbacks are registered by calling `register()` method on an event instance, with an instance of the callback interface as the argument. All event callback interfaces provided by Fabric API can be found in the `net.fabricmc.fabric.api.event` package. -## Listening to Events - -### A Simple Example +## Listening to Events {#listening-to-events} This example registers an `AttackBlockCallback` to damage the player when they hit blocks that don't drop an item when hand-mined. @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/event/FabricDocsReferenceEvents.java) -### Adding Items to Existing Loot Tables +### Adding Items to Existing Loot Tables {#adding-items-to-existing-loot-tables} Sometimes you may want to add items to loot tables. For example, adding your drops to a vanilla block or entity. @@ -53,13 +51,13 @@ The simplest solution, replacing the loot table file, can break other mods. What We'll be adding eggs to the coal ore loot table. -#### Listening to Loot Table Loading +#### Listening to Loot Table Loading {#listening-to-loot-table-loading} Fabric API has an event that is fired when loot tables are loaded, `LootTableEvents.MODIFY`. You can register a callback for it in your mod initializer. Let's also check that the current loot table is the coal ore loot table. @[code lang=java transclude={38-40}](@/reference/latest/src/main/java/com/example/docs/event/FabricDocsReferenceEvents.java) -#### Adding Items to the Loot Table +#### Adding Items to the Loot Table {#adding-items-to-the-loot-table} In loot tables, items are stored in _loot pool entries_, and entries are stored in _loot pools_. To add an item, we'll need to add a pool with an item entry to the loot table. @@ -69,7 +67,7 @@ Our pool doesn't have any items either, so we'll make an item entry using `ItemE @[code highlight={6-7} transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/event/FabricDocsReferenceEvents.java) -## Custom Events +## Custom Events {#custom-events} Some areas of the game do not have hooks provided by the Fabric API, so you can either use a mixin or create your own event. @@ -79,7 +77,7 @@ We'll look at creating an event that is triggered when sheep are sheared. The pr - Triggering the event from a mixin - Creating a test implementation -### Creating the Event Callback Interface +### Creating the Event Callback Interface {#creating-the-event-callback-interface} The callback interface describes what must be implemented by event listeners that will listen to your event. The callback interface also describes how the event will be called from our mixin. It is conventional to place an `Event` object as a field in the callback interface, which will identify our actual event. @@ -109,13 +107,13 @@ We can add Javadoc comments to the top of callback classes to document what each @[code lang=java transclude={9-16}](@/reference/latest/src/main/java/com/example/docs/event/SheepShearCallback.java) -### Triggering the Event From a Mixin +### Triggering the Event From a Mixin {#triggering-the-event-from-a-mixin} We now have the basic event skeleton, but we need to trigger it. Because we want to have the event called when a player attempts to shear a sheep, we call the event `invoker` in `SheepEntity#interactMob` when `sheared()` is called (i.e. sheep can be sheared, and the player is holding shears): @[code lang=java transcludeWith=:::](@/reference/latest/src/main/java/com/example/docs/mixin/event/SheepEntityMixin.java) -### Creating a Test Implementation +### Creating a Test Implementation {#creating-a-test-implementation} Now we need to test our event. You can register a listener in your initialization method (or another area, if you prefer) and add custom logic there. Here's an example that drops a diamond instead of wool at the sheep's feet: diff --git a/develop/getting-started/creating-a-project.md b/develop/getting-started/creating-a-project.md index 4330e3aaa..6949c12b0 100644 --- a/develop/getting-started/creating-a-project.md +++ b/develop/getting-started/creating-a-project.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Creating a Project +# Creating a Project {#creating-a-project} Fabric provides an easy way to create a new mod project using the Fabric Template Mod Generator - if you want, you can manually create a new project using the example mod repository, you should refer to the [Manual Project Creation](#manual-project-creation) section. -## Generating a Project +## Generating a Project {#generating-a-project} You can use the [Fabric Template Mod Generator](https://fabricmc.net/develop/template/) to generate a new project for your mod - you should fill in the required fields, such as the package name and mod name, and the Minecraft version that you want to develop for. @@ -25,7 +25,7 @@ You should extract this zip file to a location of your choice, and then open the ![Open Project Prompt](/assets/develop/getting-started/open-project.png) -## Importing the Project +## Importing the Project {#importing-the-project} Once you've opened the project in IntelliJ IDEA, the IDE should automatically load the project's Gradle configuration and perform the necessary setup tasks. @@ -35,7 +35,7 @@ If you receive a notification talking about a Gradle build script, you should cl Once the project has been imported, you should see the project's files in the project explorer, and you should be able to start developing your mod. -## Manual Project Creation +## Manual Project Creation {#manual-project-creation} ::: warning You will need [Git](https://git-scm.com/) installed in order to clone the example mod repository. @@ -57,7 +57,7 @@ Once you've opened the project in IntelliJ IDEA, it should automatically load th Again, as previously mentioned, if you receive a notification talking about a Gradle build script, you should click the `Import Gradle Project` button. -### Modifying the Template +### Modifying the Template {#modifying-the-template} Once the project has been imported, you should modify the project's details to match your mod's details: diff --git a/develop/getting-started/introduction-to-fabric-and-modding.md b/develop/getting-started/introduction-to-fabric-and-modding.md index 24a5e62b3..04f4aa4d4 100644 --- a/develop/getting-started/introduction-to-fabric-and-modding.md +++ b/develop/getting-started/introduction-to-fabric-and-modding.md @@ -8,9 +8,9 @@ authors-nogithub: - basil4088 --- -# Introduction to Fabric and Modding +# Introduction to Fabric and Modding {#introduction-to-fabric-and-modding} -## Prerequisites +## Prerequisites {#prerequisites} Before you start, you should have a basic understanding of developing with Java, and an understanding of Object-Oriented Programming (OOP). @@ -21,7 +21,7 @@ If you are unfamiliar with these concepts, you may want to look into some tutori - [W3: Java OOP](https://www.w3schools.com/java/java_oop.asp) - [Medium: Introduction to OOP](https://medium.com/@Adekola_Olawale/beginners-guide-to-object-oriented-programming-a94601ea2fbd) -### Terminology +### Terminology {#terminology} Before we start, let's go over some of the terms that you will encounter when modding with Fabric: @@ -33,7 +33,7 @@ Before we start, let's go over some of the terms that you will encounter when mo - **Obfuscation**: The process of making code difficult to understand, used by Mojang to protect Minecraft's code. - **Remapping**: The process of mapping obfuscated code to human-readable code. -## What Is Fabric? +## What Is Fabric? {#what-is-fabric} Fabric is a lightweight modding toolchain for Minecraft: Java Edition. @@ -46,7 +46,7 @@ You should be aware of the four main components of Fabric: - **Fabric API**: A set of APIs and tools for mod developers to use when creating mods. - **Yarn**: A set of open Minecraft mappings, free for everyone to use under the Creative Commons Zero license. -## Why Is Fabric Necessary to Mod Minecraft? +## Why Is Fabric Necessary to Mod Minecraft? {#why-is-fabric-necessary-to-mod-minecraft} > Modding is the process of modifying a game in order to change its behavior or add new features - in the case of Minecraft, this can be anything from adding new items, blocks, or entities, to changing the game's mechanics or adding new game modes. @@ -56,7 +56,7 @@ Loom remaps the obfuscated code to a human-readable format using these mappings, Loom allows you to easily develop and compile mods against remapped code, and Fabric Loader allows you to load these mods into the game. -## What Does Fabric API Provide, and Why Is It Needed? +## What Does Fabric API Provide, and Why Is It Needed? {#what-does-fabric-api-provide-and-why-is-it-needed} > Fabric API is a set of APIs and tools for mod developers to use when creating mods. diff --git a/develop/getting-started/launching-the-game.md b/develop/getting-started/launching-the-game.md index a4fe223f8..404d33b5d 100644 --- a/develop/getting-started/launching-the-game.md +++ b/develop/getting-started/launching-the-game.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Launching the Game +# Launching the Game {#launching-the-game} Fabric Loom provides a variety of launch profiles to help you start and debug your mods in a live game environment. This guide will cover the various launch profiles and how to use them to debug and playtest your mods. -## Launch Profiles +## Launch Profiles {#launch-profiles} If you're using IntelliJ IDEA, you can find the launch profiles in the top-right corner of the window. Click the dropdown menu to see the available launch profiles. @@ -17,7 +17,7 @@ There should be a client and server profile, with the option to either run it no ![Launch Profiles](/assets/develop/getting-started/launch-profiles.png) -## Gradle Tasks +## Gradle Tasks {#gradle-tasks} If you're using the command line, you can use the following Gradle commands to start the game: @@ -26,7 +26,7 @@ If you're using the command line, you can use the following Gradle commands to s The only problem with this approach is that you can't easily debug your code. If you want to debug your code, you'll need to use the launch profiles in IntelliJ IDEA or via your IDE's Gradle integration. -## Hotswapping Classes +## Hotswapping Classes {#hotswapping-classes} When you run the game in debug mode, you can hotswap your classes without restarting the game. This is useful for quickly testing changes to your code. @@ -36,13 +36,13 @@ You're still quite limited though: - You can't change method parameters - You can't add or remove fields -## Hotswapping Mixins +## Hotswapping Mixins {#hotswapping-mixins} If you're using Mixins, you can hotswap your Mixin classes without restarting the game. This is useful for quickly testing changes to your Mixins. You will need to install the Mixin Java agent for this to work though. -### 1. Locate the Mixin Library Jar +### 1. Locate the Mixin Library Jar {#1-locate-the-mixin-library-jar} In IntelliJ IDEA, you can find the mixin library jar in the "External Libraries" section of the "Project" section: @@ -50,7 +50,7 @@ In IntelliJ IDEA, you can find the mixin library jar in the "External Libraries" You will need to copy the jar's "Absolute Path" for the next step. -### 2. Add the `-javaagent` VM Argument +### 2. Add the `-javaagent` VM Argument {#2-add-the--javaagent-vm-argument} In your "Minecraft Client" and or "Minecraft Server" run configuration, add the following to the VM Arguments option: diff --git a/develop/getting-started/project-structure.md b/develop/getting-started/project-structure.md index 7020a0e92..04d33bfdd 100644 --- a/develop/getting-started/project-structure.md +++ b/develop/getting-started/project-structure.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Project Structure +# Project Structure {#project-structure} This page will go over the structure of a Fabric mod project, and the purpose of each file and folder in the project. -## `fabric.mod.json` +## `fabric.mod.json` {#fabric-mod-json} The `fabric.mod.json` file is the main file that describes your mod to Fabric Loader. It contains information such as the mod's ID, version, and dependencies. @@ -28,7 +28,7 @@ You can see an example `fabric.mod.json` file below - this is the `fabric.mod.js @[code lang=json](@/reference/latest/src/main/resources/fabric.mod.json) ::: -## Entrypoints +## Entrypoints {#entrypoints} As mentioned before, the `fabric.mod.json` file contains a field called `entrypoints` - this field is used to specify the entrypoints that your mod provides. @@ -38,7 +38,7 @@ The template mod generator creates both a `main` and `client` entrypoint by defa The above is an example of a simple `main` entrypoint that logs a message to the console when the game starts. -## `src/main/resources` +## `src/main/resources` {#src-main-resources} The `src/main/resources` folder is used to store the resources that your mod uses, such as textures, models, and sounds. @@ -46,14 +46,14 @@ It's also the location of `fabric.mod.json` and any mixin configuration files th Assets are stored in a structure that mirrors the structure of resource packs - for example, a texture for a block would be stored in `assets/modid/textures/block/block.png`. -## `src/client/resources` +## `src/client/resources` {#src-client-resources} The `src/client/resources` folder is used to store client-specific resources, such as textures, models, and sounds that are only used on the client side. -## `src/main/java` +## `src/main/java` {#src-main-java} The `src/main/java` folder is used to store the Java source code for your mod - it exists on both the client and server environments. -## `src/client/java` +## `src/client/java` {#src-client-java} The `src/client/java` folder is used to store client-specific Java source code, such as rendering code or client-side logic - such as block color providers. diff --git a/develop/getting-started/setting-up-a-development-environment.md b/develop/getting-started/setting-up-a-development-environment.md index eee94b2ec..fb57880b2 100644 --- a/develop/getting-started/setting-up-a-development-environment.md +++ b/develop/getting-started/setting-up-a-development-environment.md @@ -18,17 +18,17 @@ authors-nogithub: - siglong --- -# Setting up a Development Environment +# Setting up a Development Environment {#setting-up-a-development-environment} To start developing mods with Fabric, you will need to set up a development environment using IntelliJ IDEA. -## Installing JDK 17 +## Installing JDK 17 {#installing-jdk-17} To develop mods for Minecraft 1.20.4, you will need JDK 17. If you need help installing Java, you can refer to the various Java installation guides in the [player guides section](../../players/index). -## Installing IntelliJ IDEA +## Installing IntelliJ IDEA {#installing-intellij-idea} ::: info You can obviously use other IDEs, such as Eclipse or Visual Studio Code, but the majority of the pages on this documentation site will assume that you are using IntelliJ IDEA - you should refer to the documentation for your IDE if you are using a different one. @@ -42,11 +42,11 @@ You may have to scroll down to find the Community edition download link - it loo ![IDEA Community Edition Download Prompt](/assets/develop/getting-started/idea-community.png) -## Installing IDEA Plugins +## Installing IDEA Plugins {#installing-idea-plugins} Although these plugins aren't strictly necessary, they can make modding with Fabric much easier - you should consider installing them. -### Minecraft Development +### Minecraft Development {#minecraft-development} The Minecraft Development plugin provides support for modding with Fabric, and it is the most important plugin to install. diff --git a/develop/index.md b/develop/index.md index 81a2aef5d..4dd500f94 100644 --- a/develop/index.md +++ b/develop/index.md @@ -3,7 +3,7 @@ title: Developer Guides description: Our curated developer guides, written by the community, span a wide range of topics from setting up a development environment to more advanced topics, such as rendering and networking. --- -# Developer Guides +# Developer Guides {#developer-guides} Our curated developer guides, written by the community, span a wide range of topics from setting up a development environment to more advanced topics, such as rendering and networking. diff --git a/develop/items/potions.md b/develop/items/potions.md index 0b94705ac..1cddcec2f 100644 --- a/develop/items/potions.md +++ b/develop/items/potions.md @@ -7,12 +7,12 @@ authors: - Drakonkinst --- -# Potions +# Potions {#potions} Potions are consumables that grants an entity an effect. A player can brew potions using a Brewing Stand or obtain them as items through various other game mechanics. -## Custom Potions +## Custom Potions {#custom-potions} Adding a potion follows a similar path as adding an item. You will create an instance of your potion and register it by calling `BrewingRecipeRegistry.registerPotionRecipe`. @@ -21,7 +21,7 @@ calling `BrewingRecipeRegistry.registerPotionRecipe`. When Fabric API is present, `BrewingRecipeRegistry.registerPotionRecipe` is made accessible through an Access Widener. ::: -### Creating the Potion +### Creating the Potion {#creating-the-potion} Let's start by declaring a field to store your `Potion` instance. We will be directly using the initializer class to hold this. @@ -39,7 +39,7 @@ We pass an instance of `StatusEffectInstance`, which takes 3 parameters: To create your own effect, please see the [Effects](../entities/effects) guide. ::: -### Registering the Potion +### Registering the Potion {#registering-the-potion} In our initializer, we call `BrewingRecipeRegistry.registerPotionRecipe`. @@ -68,7 +68,7 @@ With the help of Fabric API, it's possible to register a potion using an `Ingred net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistry`. ::: -### Registering the Potion Without Fabric API +### Registering the Potion Without Fabric API {#registering-the-potion-without-fabric-api} Without Fabric API, `BrewingRecipeRegistry.registerPotionRecipe` will be private. In order to access this method, use the following mixin invoker or use an Access Widener. diff --git a/develop/rendering/basic-concepts.md b/develop/rendering/basic-concepts.md index d4aa54f3b..fcc509434 100644 --- a/develop/rendering/basic-concepts.md +++ b/develop/rendering/basic-concepts.md @@ -6,7 +6,7 @@ authors: - "0x3C50" --- -# Basic Rendering Concepts +# Basic Rendering Concepts {#basic-rendering-concepts} ::: warning Although Minecraft is built using OpenGL, as of version 1.17+ you cannot use legacy OpenGL methods to render your own things. Instead, you must use the new `BufferBuilder` system, which formats rendering data and uploads it to OpenGL to draw. @@ -18,21 +18,21 @@ This page will cover the basics of rendering using the new system, going over ke Although much of rendering in Minecraft is abstracted through the various `DrawContext` methods, and you'll likely not need to touch anything mentioned here, it's still important to understand the basics of how rendering works. -## The `Tessellator` +## The `Tessellator` {#the-tessellator} The `Tessellator` is the main class used to render things in Minecraft. It is a singleton, meaning that there is only one instance of it in the game. You can get the instance using `Tessellator.getInstance()`. -## The `BufferBuilder` +## The `BufferBuilder` {#the-bufferbuilder} The `BufferBuilder` is the class used to format and upload rendering data to OpenGL. It is used to create a buffer, which is then uploaded to OpenGL to draw. The `Tessellator` is used to create a `BufferBuilder`, which is used to format and upload rendering data to OpenGL. You can create a `BufferBuilder` using `Tessellator.getBuffer()`. -### Initializing the `BufferBuilder` +### Initializing the `BufferBuilder` {#initializing-the-bufferbuilder} Before you can write anything to the `BufferBuilder`, you must initialize it. This is done using `BufferBuilder.begin(...)`, which takes in a `VertexFormat` and a draw mode. -#### Vertex Formats +#### Vertex Formats {#vertex-formats} The `VertexFormat` defines the elements that we include in our data buffer and outlines how these elements should be transmitted to OpenGL. @@ -55,7 +55,7 @@ The following `VertexFormat` elements are available: | `POSITION_TEXTURE_LIGHT_COLOR` | `{ position, uv, light, color }` | | `POSITION_TEXTURE_COLOR_NORMAL` | `{ position, uv, color, normal }` | -#### Draw Modes +#### Draw Modes {#draw-modes} The draw mode defines how the data is drawn. The following draw modes are available: @@ -70,7 +70,7 @@ The draw mode defines how the data is drawn. The following draw modes are availa | `DrawMode.TRIANGLE_FAN` | Starts with 3 vertices for the first triangle. Each additional vertex forms a new triangle with the first vertex and the last vertex. | | `DrawMode.QUADS` | Each element is made up of 4 vertices, forming a quadrilateral. | -### Writing to the `BufferBuilder` +### Writing to the `BufferBuilder` {#writing-to-the-bufferbuilder} Once the `BufferBuilder` is initialized, you can write data to it. @@ -80,7 +80,7 @@ This method returns a vertex builder, which we can use to specify additional inf It's also worth understanding the concept of culling. Culling is the process of removing faces of a 3D shape that aren't visible from the viewer's perspective. If the vertices for a face are specified in the wrong order, the face might not render correctly due to culling. -#### What Is a Transformation Matrix? +#### What Is a Transformation Matrix? {#what-is-a-transformation-matrix} A transformation matrix is a 4x4 matrix that is used to transform a vector. In Minecraft, the transformation matrix is just transforming the coordinates we give into the vertex call. The transformations can scale our model, move it around and rotate it. @@ -92,7 +92,7 @@ It's usually obtained via the `MatrixStack` class, which can be obtained via the drawContext.getMatrices().peek().getPositionMatrix(); ``` -#### A Practical Example: Rendering a Triangle Strip +#### Rendering a Triangle Strip {#rendering-a-triangle-strip} It's easier to explain how to write to the `BufferBuilder` using a practical example. Let's say we want to render something using the `DrawMode.TRIANGLE_STRIP` draw mode and the `POSITION_COLOR` vertex format. @@ -121,7 +121,7 @@ This results in the following being drawn on the HUD: Try mess around with the colors and positions of the vertices to see what happens! You can also try using different draw modes and vertex formats. ::: -## The `MatrixStack` +## The `MatrixStack` {#the-matrixstack} After learning how to write to the `BufferBuilder`, you might be wondering how to transform your model - or even animate it. This is where the `MatrixStack` class comes in. @@ -147,7 +147,7 @@ Make sure to push the matrix stack before you get a transformation matrix! ![A video showing the diamond scaling up and down](/assets/develop/rendering/concepts-matrix-stack.webp) -## Quaternions (Rotating Things) +## Quaternions (Rotating Things) {#quaternions-rotating-things} Quaternions are a way of representing rotations in 3D space. They are used to rotate the top matrix on the `MatrixStack` via the `multiply(Quaternion, x, y, z)` method. diff --git a/develop/rendering/draw-context.md b/develop/rendering/draw-context.md index 401ee3c6e..7ba1f9aab 100644 --- a/develop/rendering/draw-context.md +++ b/develop/rendering/draw-context.md @@ -5,17 +5,17 @@ authors: - IMB11 --- -# Using the Drawing Context +# Using the Drawing Context {#using-the-drawing-context} This page assumes you've taken a look at the [Basic Rendering Concepts](./basic-concepts) page. The `DrawContext` class is the main class used for rendering in the game. It is used for rendering shapes, text and textures, and as previously seen, used to manipulate `MatrixStack`s and use `BufferBuilder`s. -## Drawing Shapes +## Drawing Shapes {#drawing-shapes} The `DrawContext` class can be used to easily draw **square-based** shapes. If you want to draw triangles, or any non-square based shape, you will need to use a `BufferBuilder`. -### Drawing Rectangles +### Drawing Rectangles {#drawing-rectangles} You can use the `DrawContext.fill(...)` method to draw a filled rectangle. @@ -23,7 +23,7 @@ You can use the `DrawContext.fill(...)` method to draw a filled rectangle. ![A rectangle](/assets/develop/rendering/draw-context-rectangle.png) -### Drawing Outlines/Borders +### Drawing Outlines/Borders {#drawing-outlines-borders} Let's say we want to outline the rectangle we just drew. We can use the `DrawContext.drawBorder(...)` method to draw an outline. @@ -31,7 +31,7 @@ Let's say we want to outline the rectangle we just drew. We can use the `DrawCon ![Rectangle with border](/assets/develop/rendering/draw-context-rectangle-border.png) -### Drawing Individual Lines +### Drawing Individual Lines {#drawing-individual-lines} We can use the `DrawContext.drawHorizontalLine(...)` and `DrawContext.drawVerticalLine(...)` methods to draw lines. @@ -39,11 +39,11 @@ We can use the `DrawContext.drawHorizontalLine(...)` and `DrawContext.drawVertic ![Lines](/assets/develop/rendering/draw-context-lines.png) -## The Scissor Manager +## The Scissor Manager {#the-scissor-manager} The `DrawContext` class has a built-in scissor manager. This allows you to easily clip your rendering to a specific area. This is useful for rendering things like tooltips, or other elements that should not be rendered outside of a specific area. -### Using the Scissor Manager +### Using the Scissor Manager {#using-the-scissor-manager} ::: tip Scissor regions can be nested! But make sure that you disable the scissor manager the same amount of times as you enabled it. @@ -57,11 +57,11 @@ To enable the scissor manager, simply use the `DrawContext.enableScissor(...)` m As you can see, even though we tell the game to render the gradient across the entire screen, it only renders within the scissor region. -## Drawing Textures +## Drawing Textures {#drawing-textures} There is no one "correct" way to draw textures onto a screen, as the `drawTexture(...)` method has many different overloads. This section will go over the most common use cases. -### Drawing an Entire Texture +### Drawing an Entire Texture {#drawing-an-entire-texture} Generally, it's recommended that you use the overload that specifies the `textureWidth` and `textureHeight` parameters. This is because the `DrawContext` class will assume these values if you don't provide them, which can sometimes be wrong. @@ -69,7 +69,7 @@ Generally, it's recommended that you use the overload that specifies the `textur ![Drawing whole texture example](/assets/develop/rendering/draw-context-whole-texture.png) -### Drawing a Portion of a Texture +### Drawing a Portion of a Texture {#drawing-a-portion-of-a-texture} This is where `u` and `v` come in. These parameters specify the top-left corner of the texture to draw, and the `regionWidth` and `regionHeight` parameters specify the size of the portion of the texture to draw. @@ -83,7 +83,7 @@ If we want to only draw a region that contains the magnifying glass, we can use ![Region Texture](/assets/develop/rendering/draw-context-region-texture.png) -## Drawing Text +## Drawing Text {#drawing-text} The `DrawContext` class has various self-explanatory text rendering methods - for the sake of brevity, they will not be covered here. diff --git a/develop/rendering/gui/custom-screens.md b/develop/rendering/gui/custom-screens.md index 9bd59b574..21ba16d27 100644 --- a/develop/rendering/gui/custom-screens.md +++ b/develop/rendering/gui/custom-screens.md @@ -5,7 +5,7 @@ authors: - IMB11 --- -# Custom Screens +# Custom Screens {#custom-screens} ::: info This page refers to normal screens, not handled ones - these screens are the ones that are opened by the player on the client, not the ones that are handled by the server. @@ -15,7 +15,7 @@ Screens are essentially the GUIs that the player interacts with, such as the tit You can create your own screens to display custom content, a custom settings menu, or more. -## Creating a Screen +## Creating a Screen {#creating-a-screen} To create a screen, you need to extend the `Screen` class and override the `init` method - you may optionally override the `render` method as well - but make sure to call it's super method or it wont render the background, widgets etc. @@ -32,7 +32,7 @@ As an example, we can create a simple screen that has a button and a label above ![Custom Screen 1](/assets/develop/rendering/gui/custom-1-example.png) -## Opening the Screen +## Opening the Screen {#opening-the-screen} You can open the screen using the `MinecraftClient`'s `setScreen` method - you can do this from many places, such as a key binding, a command, or a client packet handler. @@ -42,7 +42,7 @@ MinecraftClient.getInstance().setScreen( ); ``` -## Closing the Screen +## Closing the Screen {#closing-the-screen} If you want to close the screen, simply set the screen to `null`: diff --git a/develop/rendering/gui/custom-widgets.md b/develop/rendering/gui/custom-widgets.md index 3db833114..4058c3170 100644 --- a/develop/rendering/gui/custom-widgets.md +++ b/develop/rendering/gui/custom-widgets.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Custom Widgets +# Custom Widgets {#custom-widgets} Widgets are essentially containerized rendering components that can be added to a screen, and can be interacted with by the player through various events such as mouse clicks, key presses, and more. -## Creating a Widget +## Creating a Widget {#creating-a-widget} There are multiple ways to create a widget class, such as extending `ClickableWidget`. This class provides a lot of useful utilities, such as managing width, height, position, and handling events - it implements the `Drawable`, `Element`, `Narratable`, and `Selectable` interfaces: @@ -20,7 +20,7 @@ There are multiple ways to create a widget class, such as extending `ClickableWi @[code lang=java transcludeWith=:::1](@/reference/latest/src/client/java/com/example/docs/rendering/screens/CustomWidget.java) -## Adding the Widget to the Screen +## Adding the Widget to the Screen {#adding-the-widget-to-the-screen} Like all widgets, you need to add it to the screen using the `addDrawableChild` method, which is provided by the `Screen` class. Make sure you do this in the `init` method. @@ -28,7 +28,7 @@ Like all widgets, you need to add it to the screen using the `addDrawableChild` ![Custom widget on screen](/assets/develop/rendering/gui/custom-widget-example.png) -## Widget Events +## Widget Events {#widget-events} You can handle events such as mouse clicks, key presses, by overriding the `onMouseClicked`, `onMouseReleased`, `onKeyPressed`, and other methods. diff --git a/develop/rendering/hud.md b/develop/rendering/hud.md index 59771f46e..e5832a3b0 100644 --- a/develop/rendering/hud.md +++ b/develop/rendering/hud.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Rendering in the Hud +# Rendering in the Hud {#rendering-in-the-hud} We already briefly touched on rendering things to the hud in the [Basic Rendering Concepts](./basic-concepts) page and [Using The Drawing Context](./draw-context), so on this page we'll stick to the `HudRenderCallback` event and the `deltaTick` parameter. -## HudRenderCallback +## HudRenderCallback {#hudrendercallback} The `HudRenderCallback` event - provided by Fabric API - is called every frame, and is used to render things to the HUD. @@ -19,13 +19,11 @@ The draw context can be used to access the various rendering utilities provided You should check out the [Draw Context](./draw-context) page to learn more about the draw context. -### DeltaTick +### DeltaTick {#deltatick} The `deltaTick` parameter is the time since the last frame, in seconds. This can be used to make animations and other time-based effects. -#### Example: Lerping a Color Over Time - -Let's say you want to lerp a color over time. You can use the `deltaTick` parameter to do this. +For example, let's say you want to lerp a color over time. You can use the `deltaTick` parameter to do this: @[code lang=java transcludeWith=:::1](@/reference/latest/src/client/java/com/example/docs/rendering/HudRenderingEntrypoint.java) diff --git a/develop/rendering/particles/creating-particles.md b/develop/rendering/particles/creating-particles.md index 2746a9903..8e570d500 100644 --- a/develop/rendering/particles/creating-particles.md +++ b/develop/rendering/particles/creating-particles.md @@ -5,11 +5,11 @@ authors: - Superkat32 --- -# Creating Custom Particles +# Creating Custom Particles {#creating-custom-particles} Particles are a powerful tool. They can add ambience to a beautiful scene, or add tension to an edge of your seat boss battle. Let's add one! -## Register a Custom Particle +## Register a Custom Particle {#register-a-custom-particle} We'll be adding a new sparkle particle which will mimic the movement of an end rod particle. @@ -19,7 +19,7 @@ We first need to register a `ParticleType` in your mod initializer class using y The "sparkle_particle" in lowercase letters is the JSON path for the particle's texture. You will be creating a new JSON file with that exact name later. -## Client-Side Registration +## Client-Side Registration {#client-side-registration} After you have registered the particle in the `ModInitializer` entrypoint, you will also need to register the particle in the `ClientModInitializer` entrypoint. @@ -34,7 +34,7 @@ You can see all the particle factories by looking at all the implementations of - Visual Studio Code's hotkey: Ctrl+F12 ::: -## Creating a JSON File and Adding Textures +## Creating a JSON File and Adding Textures {#creating-a-json-file-and-adding-textures} You will need to create 2 folders in your `resources/assets//` folder. @@ -53,7 +53,7 @@ Next, create a new JSON file in `particles` with the same name as the JSON path You can add more textures to the `textures` array to create a particle animation. The particle will cycle through the textures in the array, starting with the first texture. ::: -## Testing the New Particle +## Testing the New Particle {#testing-the-new-particle} Once you have completed the JSON file and saved your work, you are good to load up Minecraft and test everything out! diff --git a/develop/sounds/custom.md b/develop/sounds/custom.md index 16ee81a73..2885c4c6b 100644 --- a/develop/sounds/custom.md +++ b/develop/sounds/custom.md @@ -5,9 +5,9 @@ authors: - JR1811 --- -# Creating Custom Sounds +# Creating Custom Sounds {#creating-custom-sounds} -## Preparing the Audio File +## Preparing the Audio File {#preparing-the-audio-file} Your audio files need to be formatted in a specific way. OGG Vorbis is an open container format for multimedia data, such as audio, and is used in case of Minecraft's sound files. To avoid problems with how Minecraft handles distancing, your audio needs to have only a single channel (Mono). @@ -27,7 +27,7 @@ When exporting or rendering the audio file, make sure to choose the OGG file for Also keep in mind that audio files can increase the file size of your mod drastically. If needed, compress the audio when editing and exporting the file to keep the file size of your finished product to a minimum. -## Loading the Audio File +## Loading the Audio File {#loading-the-audio-file} Add the new `resources/assets//sounds` directory for the sounds in your mod, and put the exported audio file `metal_whistle.ogg` in there. @@ -37,7 +37,7 @@ Continue with creating the `resources/assets//sounds.json` file if The subtitle entry provides more context for the player. The subtitle name is used in the language files in the `resources/assets//lang` directory and will be displayed if the in-game subtitle setting is turned on and this custom sound is being played. -## Registering the Custom Sound +## Registering the Custom Sound {#registering-the-custom-sound} To add the custom sound to the mod, register a SoundEvent in the class which implements the `ModInitializer` entrypoint. @@ -46,7 +46,7 @@ Registry.register(Registries.SOUND_EVENT, new Identifier(MOD_ID, "metal_whistle" SoundEvent.of(new Identifier(MOD_ID, "metal_whistle"))); ``` -## Cleaning up the Mess +## Cleaning up the Mess {#cleaning-up-the-mess} Depending on how many Registry entries there are, this can get messy quickly. To avoid that, we can make use of a new helper class. @@ -58,6 +58,6 @@ This way, the `ModInitializer` implementing entrypoint class needs to only imple @[code lang=java transcludeWith=:::2](@/reference/latest/src/main/java/com/example/docs/sound/FabricDocsReferenceSounds.java) -## Using the Custom SoundEvent +## Using the Custom SoundEvent {#using-the-custom-soundevent} Use the helper class to access the custom SoundEvent. Checkout the [Playing SoundEvents](./using-sounds) page to learn how to play sounds. diff --git a/develop/sounds/using-sounds.md b/develop/sounds/using-sounds.md index 8ece35eef..3a30821e4 100644 --- a/develop/sounds/using-sounds.md +++ b/develop/sounds/using-sounds.md @@ -3,11 +3,11 @@ title: Playing Sounds description: Learn how to play sound events. --- -# Playing Sounds +# Playing Sounds {#playing-sounds} Minecraft has a big selection of sounds which you can choose from. Check out the `SoundEvents` class to view all the vanilla sound event instances that Mojang has provided. -## Using Sounds in Your Mod +## Using Sounds in Your Mod {#using-sounds} Make sure to execute the `playSound()` method on the logical server side when using sounds! @@ -15,17 +15,17 @@ In this example, the `useOnEntity()` and `useOnBlock()` methods for a custom int @[code lang=java transcludeWith=:::1](@/reference/latest/src/main/java/com/example/docs/item/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. +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) -### SoundEvent and SoundCategory +### SoundEvent and SoundCategory {#soundevent-and-soundcategory} The SoundEvent defines which sound will be played. You can also [register your own SoundEvents](./custom) to include your own sound. Minecraft has several audio sliders in the in-game settings. The `SoundCategory` enum is used to determine which slider will adjust your sound's volume. -### Volume and Pitch +### Volume and Pitch {#volume-and-pitch} The volume parameter can be a bit misleading. In the range of `0.0f - 1.0f` the actual volume of the sound can be changed. If the number gets bigger than that, the volume of `1.0f` will be used and only the distance, in which your sound can be heard, gets adjusted. The block distance can be roughly calculated by `volume * 16`. diff --git a/index.md b/index.md index 32787b3e7..c858a6668 100644 --- a/index.md +++ b/index.md @@ -22,7 +22,7 @@ features:
-## Want to Contribute? +## Want to Contribute? {#contribute} If you want to contribute to the Fabric Documentation, you can find the source code on [GitHub](https://github.com/FabricMC/fabric-docs), and the relevant [contribution guidelines](./contributing). diff --git a/package-lock.json b/package-lock.json index d35c329f4..ea314973f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,12 +8,13 @@ "markdown-it-mathjax3": "^4.3.2", "markdown-it-vuepress-code-snippet-enhanced": "github:IMB11/md-it-enhanced-snippets#dfb9fa2", "vitepress": "^1.2.3", - "vitepress-versioning-plugin": "^1.0.1", + "vitepress-versioning-plugin": "^1.0.2", "vue": "^3.4.27" }, "devDependencies": { - "@types/node": "^20.14.2", + "@types/node": "^20.14.5", "markdownlint": "^0.34.0", + "markdownlint-rule-search-replace": "^1.2.0", "markdownlint-rule-titlecase": "^0.1.0" }, "optionalDependencies": { @@ -905,9 +906,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.14.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.3.tgz", - "integrity": "sha512-Nuzqa6WAxeGnve6SXqiPAM9rA++VQs+iLZ1DDd56y0gdvygSZlQvZuvdFPR3yLqkVxPu4WrO02iDEyH1g+wazw==", + "version": "20.14.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.6.tgz", + "integrity": "sha512-JbA0XIJPL1IiNnU7PFxDXyfAwcwVVrOoqyzzyQTyMeVhBzkJVMSkC1LlVsRQ2lpqiY4n6Bb9oCS6lzDKVQxbZw==", "devOptional": true, "license": "MIT", "dependencies": { @@ -1874,6 +1875,39 @@ "dev": true, "license": "MIT" }, + "node_modules/markdownlint-rule-search-replace": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-search-replace/-/markdownlint-rule-search-replace-1.2.0.tgz", + "integrity": "sha512-l2eeVjb0ijxO+dO1ZrODcht+qnJ0VuiAAdBx1J8oa2kAugXl3NhxAGjfNuTfEJae5OQbdSGT+NjMczyzBXvWMA==", + "license": "MIT", + "dependencies": { + "markdownlint-rule-helpers": "0.21.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/markdownlint-rule-search-replace/node_modules/markdownlint-micromark": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.2.tgz", + "integrity": "sha512-jRxlQg8KpOfM2IbCL9RXM8ZiYWz2rv6DlZAnGv8ASJQpUh6byTBnEsbuMZ6T2/uIgntyf7SKg/mEaEBo1164fQ==", + "license": "MIT", + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/markdownlint-rule-search-replace/node_modules/markdownlint-rule-helpers": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.21.0.tgz", + "integrity": "sha512-27WM6H76t79EZjEl3jSabV0ZzXsC5QaSslI/5N1XuXV0mJRA6i3BPMGFrtZUbhlCNgtY6oC9h5JhtpDMv95tKg==", + "license": "MIT", + "dependencies": { + "markdownlint-micromark": "0.1.2" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/markdownlint-rule-titlecase": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/markdownlint-rule-titlecase/-/markdownlint-rule-titlecase-0.1.0.tgz", @@ -2380,9 +2414,9 @@ } }, "node_modules/vitepress-versioning-plugin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/vitepress-versioning-plugin/-/vitepress-versioning-plugin-1.0.1.tgz", - "integrity": "sha512-qDoyF9fFOV53JTEU3KnCv2wrUVxGWV9eCgmYRdciWRqQGTD9UuU6Q2wvXBugRtuL9DQRdAE1YZQEGpfFviMv8Q==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/vitepress-versioning-plugin/-/vitepress-versioning-plugin-1.0.2.tgz", + "integrity": "sha512-3xjZL1kdplWuhu2ZG+AEtojJ5FTFpZSws0OMfFkStD7X1tTu+46BLxaWBlyySq1xltkF7Zzyn5jLzhfBBHR68g==", "license": "MIT", "dependencies": { "@types/lodash": "^4.17.5", diff --git a/package.json b/package.json index ae6bcbc7b..3f8aa8fc2 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "devDependencies": { "@types/node": "^20.14.5", "markdownlint": "^0.34.0", + "markdownlint-rule-search-replace": "^1.2.0", "markdownlint-rule-titlecase": "^0.1.0" }, "optionalDependencies": { diff --git a/players/faq.md b/players/faq.md index 11d2dd97d..886be051e 100644 --- a/players/faq.md +++ b/players/faq.md @@ -3,17 +3,15 @@ title: Frequently Asked Questions for Players description: Frequently asked questions for players and server administrators relating to Fabric. --- -# Frequently Asked Questions +# Frequently Asked Questions {#faq} There are a lot of questions that are asked frequently, so we've compiled a list of them here. -## General Questions - -### What Minecraft Versions Does Fabric Support? +## What Minecraft Versions Does Fabric Support? {#what-minecraft-versions-does-fabric-support} Officially, Fabric supports all versions of Minecraft starting from snapshots `18w43b` and above, and releases `1.14` and above. -### Where Can I Download Published Fabric Mods? +## Where Can I Download Published Fabric Mods? {#where-can-i-download-published-fabric-mods} ::: info You should always check if mods are from a trustworthy source. Check out the [Finding Trustworthy Mods](./finding-mods) guide for more information. @@ -21,7 +19,7 @@ You should always check if mods are from a trustworthy source. Check out the [Fi The majority of authors publish their mods to [Modrinth](https://modrinth.com/mods?g=categories:%27fabric%27) and [CurseForge](https://www.curseforge.com/minecraft/search?class=mc-mods&gameVersionTypeId=4), however some may choose to upload them on their personal websites, or on other platforms, such as a GitHub repository. -### Where Can I Find Premade Fabric Modpacks? +## Where Can I Find Premade Fabric Modpacks? {#where-can-i-find-premade-fabric-modpacks} You can find premade Fabric modpacks on a variety of platforms, such as: diff --git a/players/finding-mods.md b/players/finding-mods.md index 7159d4045..c556348de 100644 --- a/players/finding-mods.md +++ b/players/finding-mods.md @@ -5,23 +5,23 @@ authors: - IMB11 --- -# Finding Trustworthy Mods +# Finding Trustworthy Mods {#finding-mods} Firstly, trust is subjective, and you should always use your own judgement when downloading mods. However, there are some things you can do to help you find trustworthy mods. -## 1. Use a Source That Is Known to Be Trustworthy +## 1. Use a Source That Is Known to Be Trustworthy {#trustworthy-source} The majority of authors publish their mods to [Modrinth](https://modrinth.com/mods?g=categories:%27fabric%27) and [CurseForge](https://www.curseforge.com/minecraft/search?class=mc-mods&gameVersionTypeId=4). These websites check that the mods are what they say they are, and that they do not contain malicious code. You can also report malicious mods on those websites, and they will take action relatively quickly. -## 2. Check With Others! +## 2. Check With Others! {#with-others} If you are downloading a mod from a source that is not known to be trustworthy, you should check with others to see if they have downloaded the mod before from the location you're downloading from, and if they have had any issues with it. If in doubt, you are welcome to ask in the [Fabric Discord](https://discord.gg/v6v4pMv) in the `#player-support` channel. -## 3. Avoid Common Malware Sites! +## 3. Avoid Common Malware Sites! {#avoid-malware} ::: info Malware sites may not be obvious to everyone. If you are unsure, you should ask for opinions from others or avoid the site altogether and rely only on trusted sources, such as Modrinth and CurseForge. diff --git a/players/index.md b/players/index.md index 1305e1cb7..61c3a80e3 100644 --- a/players/index.md +++ b/players/index.md @@ -3,7 +3,7 @@ title: Player Guides description: A collection of guides for players and server administrators on installing and using Fabric. --- -# Player Guides +# Player Guides {#player-guides} This section of the Fabric Documentation is dedicated to players and server administrators who want to learn how to install, use, and troubleshoot Fabric. diff --git a/players/installing-fabric.md b/players/installing-fabric.md index 5c7a6b715..9d85eeb89 100644 --- a/players/installing-fabric.md +++ b/players/installing-fabric.md @@ -5,13 +5,13 @@ authors: - IMB11 --- -# Installing Fabric +# Installing Fabric {#installing-fabric} This guide will walk you through installing Fabric for the official Minecraft Launcher. For third party launchers, you should consult their documentation. -## 1. Download the Fabric Installer +## 1. Download the Fabric Installer {#1-download-the-fabric-installer} You can download the Fabric Installer from the [Fabric Website](https://fabricmc.net/use/). @@ -19,7 +19,7 @@ If you use Windows, download the `.exe` version (`Download For Windows`), becaus For macOS and Linux, you should download the `.jar` version. Sometimes, you need to install Java before this step. -## 2. Run the Fabric Installer +## 2. Run the Fabric Installer {#2-run-the-fabric-installer} ::: warning Close Minecraft and the Minecraft Launcher first before installing. @@ -42,14 +42,12 @@ To install Fabric, simply choose your game version from the dropdown, and click **Make sure that 'Create Profile' is checked.** -## 3. You're Done! +## 3. You're Done! {#3-you-re-done} Once the installer has finished, you can open the Minecraft Launcher and select the Fabric profile from the dropdown in the bottom left corner and press Play! ![Minecraft Launcher with Fabric profile selected](/assets/players/installing-fabric/launcher-screen.png) -## Next Steps - Now that you've installed Fabric, you can add mods to your game! Check out the [Finding Trustworthy Mods](./finding-mods) guide for more information. If you encounter any issues while following this guide, you can ask for help in the [Fabric Discord](https://discord.gg/v6v4pMv) in the `#player-support` channel. diff --git a/players/installing-java/linux.md b/players/installing-java/linux.md index 93b9163d9..2502ade89 100644 --- a/players/installing-java/linux.md +++ b/players/installing-java/linux.md @@ -5,11 +5,11 @@ authors: - IMB11 --- -# Installing Java on Linux +# Installing Java on Linux {#installing-java-on-linux} This guide will walk you through installing Java 17 on Linux. -## 1. Check if Java Is Already Installed +## 1. Check if Java Is Already Installed {#1-check-if-java-is-already-installed} Open a terminal, type `java -version`, and press Enter. @@ -19,11 +19,11 @@ Open a terminal, type `java -version`, and press Enter. To use the majority of modern Minecraft versions, you'll need at least Java 17 installed. If this command displays any version lower than 17, you'll need to update your existing Java installation. ::: -## 2. Downloading and Installing Java 17 +## 2. Downloading and Installing Java 17 {#2-downloading-and-installing-java-17} We recommend using OpenJDK 17, which is available for most Linux distributions. -### Arch Linux +### Arch Linux {#arch-linux} ::: info For more information on installing Java on Arch Linux, see the [Arch Linux Wiki](https://wiki.archlinux.org/title/Java). @@ -47,7 +47,7 @@ If you plan to develop mods, you'll need the JDK instead: sudo pacman -S jdk-openjdk ``` -### Debian/Ubuntu +### Debian/Ubuntu {#debian-ubuntu} You can install Java 17 using `apt` with the following commands: @@ -56,7 +56,7 @@ sudo apt update sudo apt install openjdk-17-jdk ``` -### Fedora +### Fedora {#fedora} You can install Java 17 using `dnf` with the following commands: @@ -76,13 +76,13 @@ If you plan to develop mods, you'll need the JDK instead: sudo dnf install java-17-openjdk-devel ``` -### Other Linux Distributions +### Other Linux Distributions {#other-linux-distributions} If your distribution isn't listed above, you can download the latest JRE from [Adoptium](https://adoptium.net/temurin/) You should refer to an alternative guide for your distribution if you plan to develop mods. -## 3. Verify That Java 17 Is Installed +## 3. Verify That Java 17 Is Installed {#3-verify-that-java-17-is-installed} Once the installation is complete, you can verify that Java 17 is installed by opening a terminal and typing `java -version`. diff --git a/players/installing-java/windows.md b/players/installing-java/windows.md index a6ef0c03f..700e76a63 100644 --- a/players/installing-java/windows.md +++ b/players/installing-java/windows.md @@ -5,17 +5,17 @@ authors: - IMB11 --- -# Installing Java on Windows +# Installing Java on Windows {#installing-java-on-windows} This guide will walk you through installing Java 17 on Windows. The Minecraft Launcher comes with its own Java installation, so this section is only relevant if you want to use the Fabric `.jar` based installer, or if you want to use the Minecraft Server `.jar`. -## 1. Check if Java Is Already Installed +## 1. Check if Java Is Already Installed {#1-check-if-java-is-already-installed} To check if Java is already installed, you must first open the command prompt. -You can do this by pressing Win + R and typing `cmd.exe` into the box that appears. +You can do this by pressing Win R and typing `cmd.exe` into the box that appears. ![Windows Run Dialog with "cmd.exe" in the run bar](/assets/players/installing-java/windows-run-dialog.png) @@ -29,7 +29,7 @@ If the command runs successfully, you will see something like this. If the comma To use the majority of modern Minecraft versions, you'll need at least Java 17 installed. If this command displays any version lower than 17, you'll need to update your existing Java installation. ::: -## 2. Download the Java 17 Installer +## 2. Download the Java 17 Installer {#2-download-the-java-17-installer} To install Java 17, you'll need to download the installer from [Adoptium](https://adoptium.net/en-GB/temurin/releases/?os=windows&package=jdk&version=17). @@ -41,7 +41,7 @@ You should choose `x86` if you have a 32-bit operating system, or `x64` if you h The majority of modern computers will have a 64-bit operating system. If you are unsure, try using the 64-bit download. -## 3. Run the Installer! +## 3. Run the Installer! {#3-run-the-installer} Follow the steps in the installer to install Java 17. When you reach this page, you should set the following features to "Entire feature will be installed on local hard drive": @@ -52,7 +52,7 @@ Follow the steps in the installer to install Java 17. When you reach this page, Once you've done that, you can click `Next` and continue with the installation. -## 4. Verify That Java 17 Is Installed +## 4. Verify That Java 17 Is Installed {#4-verify-that-java-17-is-installed} Once the installation is complete, you can verify that Java 17 is installed by opening the command prompt again and typing `java -version`. diff --git a/players/installing-mods.md b/players/installing-mods.md index fcaacd864..7f59be111 100644 --- a/players/installing-mods.md +++ b/players/installing-mods.md @@ -5,13 +5,13 @@ authors: - IMB11 --- -# Installing Mods +# Installing Mods {#installing-mods} This guide will walk you through installing mods for Fabric using the Minecraft Launcher. For third party launchers, you should consult their documentation. -## 1. Download the Mod +## 1. Download the Mod {#1-download-the-mod} ::: warning You should only download mods from sources you trust. For more information on finding mods, see the [Finding Trustworthy Mods](./finding-mods) guide. @@ -25,7 +25,7 @@ When downloading mods, ensure that: - They are for Fabric and not another mod loader. - Furthermore, they are for the correct edition of Minecraft (Java Edition). -## 2. Move the Mod to the `mods` Folder +## 2. Move the Mod to the `mods` Folder {#2-move-the-mod-to-the-mods-folder} The mods folder can be found in the following locations for each operating system. @@ -51,13 +51,13 @@ Once you've found the `mods` folder, you can move the mod `.jar` files into it. ![Installed mods in the mods folder](/assets/players/installing-mods.png) -## 3. You're Done! +## 3. You're Done! {#3-you-re-done} Once you've moved the mods into the `mods` folder, you can open the Minecraft Launcher and select the Fabric profile from the dropdown in the bottom left corner and press play! ![Minecraft Launcher with Fabric profile selected](/assets/players/installing-fabric/launcher-screen.png) -## Troubleshooting +## Troubleshooting {#troubleshooting} If you encounter any issues whilst following this guide, you can ask for help in the [Fabric Discord](https://discord.gg/v6v4pMv) in the `#player-support` channel. diff --git a/players/troubleshooting/crash-reports.md b/players/troubleshooting/crash-reports.md index 754a6b699..c5c4a7986 100644 --- a/players/troubleshooting/crash-reports.md +++ b/players/troubleshooting/crash-reports.md @@ -5,7 +5,7 @@ authors: - IMB11 --- -# Crash Reports +# Crash Reports {#crash-reports} ::: tip If you're having any difficulty with finding the cause of the crash, you can ask for help in the [Fabric Discord](https://discord.gg/v6v4pMv) in the `#player-support` or `#server-admin-support` channel. @@ -13,7 +13,7 @@ If you're having any difficulty with finding the cause of the crash, you can ask Crash reports are a very important part of troubleshooting issues with your game or server. They contain a lot of information about the crash, and can help you find the cause of the crash. -## Finding Crash Reports +## Finding Crash Reports {#finding-crash-reports} Crash reports are stored in the `crash-reports` folder in your game directory. If you are using a server, they are stored in the `crash-reports` folder in the server directory. @@ -37,7 +37,7 @@ Crash reports can be found in the following locations: ::: -## Reading Crash Reports +## Reading Crash Reports {#reading-crash-reports} Crash reports are very long, and can be very confusing to read. However, they contain a lot of information about the crash, and can help you find the cause of the crash. @@ -49,16 +49,16 @@ For this guide, we will be using [this crash report](/public/assets/players/cras ::: -### Crash Report Sections +### Crash Report Sections {#crash-report-sections} Crash reports consist of several sections, each separated using a header: - `---- Minecraft Crash Report ----`, the summary of the report. This section will contain the main error that caused the crash, the time it occurred, and the relevant stack trace. This is the most important section of the crash report as the stack trace can usually contain references to the mod that caused the crash. -- `-- Last Reload --`, this section isn't really useful unless the crash occurred during a resource reload (F3+T). This section will contain the time of the last reload, and the relevant stack trace of any errors that occurred during the reload process. These errors are usually caused by resource packs, and can be ignored unless they are causing issues with the game. +- `-- Last Reload --`, this section isn't really useful unless the crash occurred during a resource reload (F3 T). This section will contain the time of the last reload, and the relevant stack trace of any errors that occurred during the reload process. These errors are usually caused by resource packs, and can be ignored unless they are causing issues with the game. - `-- System Details --`, this section contains information about your system, such as the operating system, Java version, and the amount of memory allocated to the game. This section is useful for determining if you are using the correct version of Java, and if you have allocated enough memory to the game. - In this section, Fabric will have included a custom line that says `Fabric Mods:`, followed by a list of all the mods you have installed. This section is useful for determining if any conflicts could have occurred between mods. -### Breaking Down the Crash Report +### Breaking Down the Crash Report {#breaking-down-the-crash-report} Now that we know what each section of the crash report is, we can start to break down the crash report and find the cause of the crash. @@ -75,7 +75,7 @@ In this case, the mod that caused the crash is `snownee`, as it is the first mod However, with the amount of mods mentioned, it could mean there are some compatibility issues between the mods, and the mod that caused the crash may not be the mod that is at fault. In this case, it is best to report the crash to the mod author, and let them investigate the crash. -## Mixin Crashes +## Mixin Crashes {#mixin-crashes} ::: info Mixins are a way for mods to modify the game without having to modify the game's source code. They are used by many mods, and are a very powerful tool for mod developers. @@ -91,7 +91,7 @@ Method mixins will contain `modid$handlerName` in the stack trace, where `modid` You can use this information to find the mod that caused the crash, and report the crash to the mod author. -## What to Do with Crash Reports +## What to Do with Crash Reports {#what-to-do-with-crash-reports} The best thing to do with crash reports is to upload them to a paste site, and then share the link with the mod author, either on their issue trackers or through some form of communication (Discord etc.). diff --git a/players/troubleshooting/uploading-logs.md b/players/troubleshooting/uploading-logs.md index 9196bc94b..a9a4b0d96 100644 --- a/players/troubleshooting/uploading-logs.md +++ b/players/troubleshooting/uploading-logs.md @@ -5,23 +5,23 @@ authors: - IMB11 --- -# Uploading Logs +# Uploading Logs {#uploading-logs} When troubleshooting issues, it is often necessary to provide logs to help identify the cause of the issue. -## Why Should I Upload Logs? +## Why Should I Upload Logs? {#why-should-i-upload-logs} Uploading logs allows others to help you troubleshoot your issues much quicker than simply pasting the logs into a chat or forum post. It also allows you to share your logs with others without having to copy and paste them. Some paste sites also provide syntax highlighting for logs, which makes them easier to read, and may censor sensitive information, such as your username, or system information. -## Crash Reports +## Crash Reports {#crash-reports} Crash reports are automatically generated when the game crashes. They only contain crash information and not the actual logs of the game. They are located in the `crash-reports` folder in the game directory. For more information on crash reports, see [Crash Reports](./crash-reports). -## Locating Logs +## Locating Logs {#locating-logs} This guide covers the official Minecraft Launcher (commonly referred to as the "vanilla launcher") - for third party launchers, you should consult their documentation. @@ -45,7 +45,7 @@ Logs are located in the `logs` folder in the game directory, the game directory The latest log is called `latest.log`, and previous logs use the naming pattern `yyyy-mm-dd_number.log.gz`. -## Uploading Logs +## Uploading Logs Online {#uploading-logs-online} Logs can be uploaded to a variety of services, such as: diff --git a/players/updating-fabric.md b/players/updating-fabric.md index 3136fb026..b8a7baad3 100644 --- a/players/updating-fabric.md +++ b/players/updating-fabric.md @@ -6,7 +6,7 @@ authors: - modmuss50 --- -# Updating Fabric +# Updating Fabric {#updating-fabric} This guide will walk you through updating Fabric for the Minecraft Launcher. @@ -14,7 +14,7 @@ For third party launchers, you should consult their documentation. Updating Fabric is a very similar process to installing Fabric, so parts of this guide will be the same as the [Installing Fabric](./installing-fabric) guide. -## Why Should I Update Fabric Loader? +## Why Should I Update Fabric Loader? {#why-should-i-update-fabric-loader} Newer mods may require a newer version of Fabric Loader to work, so it's important to keep it up to date to ensure you can use the latest mods. @@ -23,9 +23,11 @@ Newer mods may require a newer version of Fabric Loader to work, so it's importa To update Fabric, simply ensure the game version and Loader version is correct then click `Install`. -**Make sure to uncheck 'Create Profile' when running the installer, otherwise it will create a new profile, which in this case we don't need.** +::: important +Make sure to uncheck 'Create Profile' when running the installer, otherwise it will create a new profile, which in this case we don't need. +::: -## 3. Open the Profile in the Minecraft Launcher +## 3. Open the Profile in the Minecraft Launcher {#3-open-the-profile-in-the-minecraft-launcher} Once the installer has finished, you can open the Minecraft Launcher and go to the `Installations` tab. You should go to your Fabric profile and open the edit screen. @@ -33,7 +35,7 @@ Replace the version with the new version of Fabric Loader you just installed, an ![Updating Fabric Loader version in the Minecraft Launcher](/assets/players/updating-fabric.png) -## 4. You're Done! +## 4. You're Done! {#4-you-re-done} Once you've completed the steps you can go back to the `Play` tab, select the Fabric profile from the dropdown in the bottom left corner and press play! diff --git a/translated/de_de/develop/codecs.md b/translated/de_de/develop/codecs.md index 69b63df2a..95e2dc23d 100644 --- a/translated/de_de/develop/codecs.md +++ b/translated/de_de/develop/codecs.md @@ -64,7 +64,7 @@ Nachdem wir nun gesehen haben, wie man Codecs verwendet, wollen wir uns ansehen, ```java public class CoolBeansClass { - + private final int beansAmount; private final Item beanType; private final List beanPositions; @@ -106,7 +106,7 @@ Den ersten können wir aus den oben erwähnten primitiven Codecs in der Klasse ` Codec> listCodec = BlockPos.CODEC.listOf(); ``` -Es sollte beachtet werden, dass Codecs, die auf diese Weise erstellt werden, immer in eine `ImmutableList` deserialisiert werden. Wenn du stattdessen eine veränderbare Liste benötigst, kannst du [xmap](#Wechselseitig-konvertierbare-Typen) verwenden, um sie während der Deserialisierung in eine solche zu konvertieren. +Es sollte beachtet werden, dass Codecs, die auf diese Weise erstellt werden, immer in eine `ImmutableList` deserialisiert werden. Wenn du stattdessen eine veränderbare Liste benötigst, kannst du [xmap](#wechselseitig-konvertierbare-typen) verwenden, um sie während der Deserialisierung in eine solche zu konvertieren. ### Zusammenführung von Codecs für Record-ähnliche Klassen @@ -125,7 +125,7 @@ public static final Codec CODEC = RecordCodecBuilder.create(inst Jede Zeile in der Gruppe gibt einen Codec, einen Attributname und eine Getter-Methode an. Der Aufruf `Codec#fieldOf` wird verwendet, um den Codec in einen [MapCodec](#mapcodec) zu konvertieren, und der Aufruf `forGetter` spezifiziert die Getter-Methode, die verwendet wird, um den Wert des Attributs von einer Instanz der Klasse abzurufen. In der Zwischenzeit gibt der Aufruf `apply` den Konstruktor an, der zur Erzeugung neuer Instanzen verwendet wird. Beachte, dass die Reihenfolge der Attribute in der Gruppe dieselbe sein sollte wie die Reihenfolge der Argumente im Konstruktor. -Du kannst auch `Codec#optionalFieldOf` in diesem Zusammenhang verwenden, um ein Feld optional zu machen, wie in dem Abschnitt [Optionale Attribute](#Optionale-Attribute) erklärt. +Du kannst auch `Codec#optionalFieldOf` in diesem Zusammenhang verwenden, um ein Feld optional zu machen, wie in dem Abschnitt [Optionale Attribute](#optionale-attribute) erklärt. ### MapCodec, nicht zu verwechseln mit Codec<Map> {#mapcodec} @@ -241,7 +241,7 @@ Dadurch wird dieses JSON ausgegeben: } ``` -Wie du sehen kannst, funktioniert dies, weil `Identifier.CODEC` direkt zu einem String-Wert serialisiert wird. Einen ähnlichen Effekt kann man für einfache Objekte, die nicht in Strings serialisiert werden, erreichen, indem [Wechselseitig konvertierbare Typen](#Wechselseitig-konvertierbare-Typen) verwendet werden, um um sie zu konvertieren. +Wie du sehen kannst, funktioniert dies, weil `Identifier.CODEC` direkt zu einem String-Wert serialisiert wird. Einen ähnlichen Effekt kann man für einfache Objekte, die nicht in Strings serialisiert werden, erreichen, indem [Wechselseitig konvertierbare Typen](#wechselseitig-konvertierbare-typen) verwendet werden, um um sie zu konvertieren. ### Wechselseitig konvertierbare Typen @@ -259,9 +259,9 @@ Codec blockPosCodec = Vec3d.CODEC.xmap( pos -> new Vec3d(pos.getX(), pos.getY(), pos.getZ()) ); -// Bei der Konvertierung einer bestehenden Klasse (zum Beispiel `X`) -// in deine eigene Klasse (`Y`), kann es sinnvoll sein -// die Methode `toX` und die statische Methode `fromX` zu `Y` und +// Bei der Konvertierung einer bestehenden Klasse (zum Beispiel `X`) +// in deine eigene Klasse (`Y`), kann es sinnvoll sein +// die Methode `toX` und die statische Methode `fromX` zu `Y` und // Methodenreferenzen in deinem `xmap`-Aufruf hinzufügen. ``` @@ -287,7 +287,7 @@ public class Identifier { return DataResult.error("Not a valid resource location: " + id + " " + e.getMessage()); } } - + // ... } ``` @@ -323,11 +323,11 @@ Mit all dem können wir einen Registry Dispatch Codec für Bohnen erstellen: @[code transcludeWith=:::](@/reference/latest/src/main/java/com/example/docs/codec/BeanTypes.java) ```java -// Jetzt können wir einen Codec für Bohnentypen erstellen +// Jetzt können wir einen Codec für Bohnentypen erstellen // auf der Grundlage des zuvor erstellten Registry Codec> beanTypeCodec = BeanType.REGISTRY.getCodec(); -// Und darauf aufbauend, hier ist unser Registry Dispatch Codec für Bohnen! +// Und darauf aufbauend, hier ist unser Registry Dispatch Codec für Bohnen! // Das erste Argument ist der Argumentname für den Bohnen-Typ. // Wenn du das Attribut weglässt, wird es standardmäßig auf "type" gesetzt. Codec beanCodec = beanTypeCodec.dispatch("type", Bean::getType, BeanType::getCodec); @@ -395,5 +395,5 @@ Ein serialisierter `ListNode` kann dann wie folgt aussehen: ## Referenzen -- Eine viel umfassendere Dokumentation von Codecs und verwandten APIs findest du in der [Inoffiziellen DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html). +- Eine viel umfassendere Dokumentation von Codecs und verwandten APIs findest du in der [Inoffiziellen DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec). - Die allgemeine Struktur dieses Leitfadens wurde stark von dem [Forge Community Wiki's Seiten zu Codecs](https://forge.gemwire.uk/wiki/Codecs) inspiriert, einer eher Forge-spezifischen Darstellung desselben Themas. diff --git a/translated/de_de/develop/commands/basics.md b/translated/de_de/develop/commands/basics.md index 604012c75..73acd3316 100644 --- a/translated/de_de/develop/commands/basics.md +++ b/translated/de_de/develop/commands/basics.md @@ -50,7 +50,7 @@ Du kannst auf die Befehlsquelle von einem Befehlskontext aus zugreifen, indem du ```java Command command = context -> { - ServerCommandSource source = context.getSource(); + ServerCommandSource source = context.getSource(); return 0; }; ``` diff --git a/translated/de_de/players/troubleshooting/crash-reports.md b/translated/de_de/players/troubleshooting/crash-reports.md index a85284a3e..928d0c971 100644 --- a/translated/de_de/players/troubleshooting/crash-reports.md +++ b/translated/de_de/players/troubleshooting/crash-reports.md @@ -63,7 +63,7 @@ Der Stacktrace im `---- Minecraft Crash Report ----`-Abschnitt ist in diesem Fal Mit der Anzahl an Mods, die sich in diesem Stacktrace befinden, kann es schwierig sein, den Schuldigen zu finden, aber das Erste, was zu tun ist, ist die Mod zu finden, die den Absturz verursacht. ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52) diff --git a/translated/es_es/develop/codecs.md b/translated/es_es/develop/codecs.md index b0d3b95dd..5156ab5ad 100644 --- a/translated/es_es/develop/codecs.md +++ b/translated/es_es/develop/codecs.md @@ -37,7 +37,7 @@ Ahora podemos obtener nuestro valor serializado y convertirlo de vuelta a un `Bl // Cuando desarrolles un mod, querrás obviamente manejar Opcionales vaciós apropiadamente JsonElement json = result.resultOrPartial(LOGGER::error).orElseThrow(); -// Aquí tenemos nuestro valor json, que debería corresponder a `[1, 2, 3]`, +// Aquí tenemos nuestro valor json, que debería corresponder a `[1, 2, 3]`, // ya que es el formato usado por el codec de BlockPos. LOGGER.info("Serialized BlockPos: {}", json); @@ -63,7 +63,7 @@ Ahora que hemos visto como usar codecs, veamos como podemos hacer nuestros propi ```java public class CoolBeansClass { - + private final int beansAmount; private final Item beanType; private final List beanPositions; @@ -287,7 +287,7 @@ public class Identifier { return DataResult.error("Not a valid resource location: " + id + " " + e.getMessage()); } } - + // ... } ``` @@ -311,7 +311,7 @@ Por ejemplo, digamos que tenemos una interfaz abstracta `Bean`, con dos clases i - Una clase `BeanType` o un record que represente el tipo de bean, y que pueda retornar un codec para él. - Una función en `Bean` para obtener su `BeanType`. - Una asociación o registro para asociar `Identifier`s a `BeanType`s. -- Un `Codec>` basado en este registro. Si usas un `net.minecraft.registry.Registry`, puedes hacer una fácilmente con `Registry#getCodec`. +- Un `Codec>` basado en este registro. Si usas un `net.minecraft.registry.Registry`, puedes hacer una fácilmente con `Registry#getCodec`. Con todo esto, puedes crear un despacho de registros para beans: @@ -394,5 +394,5 @@ Un `ListNode` serializado se podría ver algo así: ## Fuentes y Referencias -- Puedes encontrar una documentación más completa sobre codecs y los APIs relacionados en los [Javadocs de DFU no oficiales](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html). +- Puedes encontrar una documentación más completa sobre codecs y los APIs relacionados en los [Javadocs de DFU no oficiales](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec). - La estructura general de esta guía fue inspirada en gran medida por la [página Wiki de Forge sobre codecs](https://forge.gemwire.uk/wiki/Codecs), una versión de esta página más enfocada para Forge. diff --git a/translated/es_es/develop/commands/basics.md b/translated/es_es/develop/commands/basics.md index 98ee6a7df..f5e5feaa8 100644 --- a/translated/es_es/develop/commands/basics.md +++ b/translated/es_es/develop/commands/basics.md @@ -50,7 +50,7 @@ Puedes acceder la fuente del comando desde un contexto de comando llamando `getS ```java Command command = context -> { - ServerCommandSource source = context.getSource(); + ServerCommandSource source = context.getSource(); return 0; }; ``` diff --git a/translated/es_es/players/troubleshooting/crash-reports.md b/translated/es_es/players/troubleshooting/crash-reports.md index 538d8f118..c71b7e0ce 100644 --- a/translated/es_es/players/troubleshooting/crash-reports.md +++ b/translated/es_es/players/troubleshooting/crash-reports.md @@ -63,7 +63,7 @@ El stack trace en la sección de `---- Minecraft Crash Report ----` es la más i Con la cantidad de mods mencionados en el stack trace, puede ser difícil encontrar el mod culpable, pero lo primero que se debe hacer es encontrar el mod que causó el crasheo. ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52) diff --git a/translated/fr_fr/develop/codecs.md b/translated/fr_fr/develop/codecs.md index 324d2779c..226c7f129 100644 --- a/translated/fr_fr/develop/codecs.md +++ b/translated/fr_fr/develop/codecs.md @@ -63,7 +63,7 @@ Maintenant qu'on sait utiliser les codecs, regardons comment construire le nôtr ```java public class CoolBeansClass { - + private final int beansAmount; private final Item beanType; private final List beanPositions; @@ -286,7 +286,7 @@ public class Identifier { return DataResult.error("Not a valid resource location: " + id + " " + e.getMessage()); } } - + // ... } ``` @@ -393,5 +393,5 @@ Un `ListNode` sérialisé pourrait alors ressembler à ceci : ## Références -- Il y a une documentation bien plus exhaustive des codecs et des APIs attenantes dans la [JavaDoc DFU non-officielle](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html). +- Il y a une documentation bien plus exhaustive des codecs et des APIs attenantes dans la [JavaDoc DFU non-officielle](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec). - La structure globale de ce guide s'inspire beaucoup de [la page du Forge Community Wiki sur les codecs](https://forge.gemwire.uk/wiki/Codecs), qui propose une approche du même sujet plus centrée autour de Forge. diff --git a/translated/it_it/develop/codecs.md b/translated/it_it/develop/codecs.md index 5f741949f..f44de98e4 100644 --- a/translated/it_it/develop/codecs.md +++ b/translated/it_it/develop/codecs.md @@ -394,5 +394,5 @@ Un `ListNode` serializzato potrebbe avere questo aspetto: ## Riferimenti -- Una documentazione molto più dettagliata sui Codec e sulle relative API può essere trovata presso la [JavaDoc non Ufficiale di DFU](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html). +- Una documentazione molto più dettagliata sui Codec e sulle relative API può essere trovata presso la [JavaDoc non Ufficiale di DFU](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec). - La struttura generale di questa guida è fortemente ispirata dalla [pagina sui codec della Wiki della Community di Forge](https://forge.gemwire.uk/wiki/Codecs), una pagina più orientata verso Forge sullo stesso argomento. diff --git a/translated/ko_kr/develop/commands/basics.md b/translated/ko_kr/develop/commands/basics.md index 03155add4..af67c585d 100644 --- a/translated/ko_kr/develop/commands/basics.md +++ b/translated/ko_kr/develop/commands/basics.md @@ -49,7 +49,7 @@ Command command = context -> { ```java Command command = context -> { - ServerCommandSource source = context.getSource(); + ServerCommandSource source = context.getSource(); return 0; }; ``` diff --git a/translated/ko_kr/develop/entities/damage-types.md b/translated/ko_kr/develop/entities/damage-types.md index ab8c63321..9b9e13736 100644 --- a/translated/ko_kr/develop/entities/damage-types.md +++ b/translated/ko_kr/develop/entities/damage-types.md @@ -13,7 +13,7 @@ authors: ## 피해 유형 추가하기 -_Tater_ 라는 이름의 사용자 정의 피해 유형을 추가해 봅시다. 이는 피해 유형의 JSON 파일을 생성하며 시작됩니다. 이 파일은 모드 리소스의 `data` 디렉토리의 `damage_type` 폴더에 저장됩니다. +_Tater_ 라는 이름의 사용자 정의 피해 유형을 추가해 봅시다. 이는 피해 유형의 JSON 파일을 생성하며 시작됩니다. 이 파일은 모드 리소스의 `data` 디렉토리의 `damage_type` 폴더에 저장됩니다. ```:no-line-numbers resources/data/fabric-docs-reference/damage_type/tater.json diff --git a/translated/ko_kr/develop/rendering/gui/custom-screens.md b/translated/ko_kr/develop/rendering/gui/custom-screens.md index 7ad209771..6c73a43bb 100644 --- a/translated/ko_kr/develop/rendering/gui/custom-screens.md +++ b/translated/ko_kr/develop/rendering/gui/custom-screens.md @@ -23,7 +23,7 @@ authors: - 생성자 메소드에서 화면이 초기화되지 않기 때문에 위젯또한 생성되지 않습니다. - `init` 메소드는 화면이 초기화되었을 때 호출되므로, 위젯을 만들기에 가장 좋은 위치입니다. - - 모든 그려질 수 있는 위젯이 입력되는 `addDrawableChild` 메소드를 통해 위젯을 추가합니다. + - 모든 그려질 수 있는 위젯이 입력되는 `addDrawableChild` 메소드를 통해 위젯을 추가합니다. - `render` 메소드는 매 프레임마다 호출되므로, 메소드를 통해 그려지는 컨텍스트, 마우스 포인터의 위치에 접근할 수 있습니다. 예를 들어, 라벨이 위에 있는 버튼이 있는 간단한 화면을 만들어 보겠습니다. diff --git a/translated/ko_kr/players/troubleshooting/crash-reports.md b/translated/ko_kr/players/troubleshooting/crash-reports.md index 081cdc474..03aeaf4b2 100644 --- a/translated/ko_kr/players/troubleshooting/crash-reports.md +++ b/translated/ko_kr/players/troubleshooting/crash-reports.md @@ -50,7 +50,7 @@ authors: - `---- Minecraft Crash Report ----`, 보고서 요약본. 이는 충돌을 일으킨 주요 오류, 발생한 시간, 그리고 관련 스택트레이스로 이루어집니다. 대부분의 경우에서 스택트레이스에 충돌을 일으킨 모드의 리퍼런스가 포함되므로 보고서의 가장 중요한 부분이라고 할 수 있습니다. - `-- Last Reload --`, 충돌이 리소스 다시 로드 (F3+T) 도중 발생하지 않았다면 대부분 불필요합니다. 다시 로드가 진행된 시간, 다시 로드 중 발생한 오류의 관련 스택 트레이스 등을 포함합니다. 이러한 오류는 대부분 리소스 팩에서 발생하며, 게임에 문제를 일으키지 않는 한 신경 쓸 필요는 없습니다. - `-- System Details --`, 시스템에 대한 정보. 운영체제, Java 버전, 게임에 할당된 메모리의 양 등이 기록됩니다. 게임에 적당한 양의 메모리가 할당되었는지, 올바른 Java 버전을 사용했는지 등을 확인할 때 유용합니다. - - Fabric의 경우, 여기에 설치된 모드가 기록되는 `Fabric Mods:` 가 추가됩니다. 모드 간 충돌을 파악할 때 유용합니다. + - Fabric의 경우, 여기에 설치된 모드가 기록되는 `Fabric Mods:` 가 추가됩니다. 모드 간 충돌을 파악할 때 유용합니다. ### 충돌 보고서 분해하기 @@ -63,7 +63,7 @@ authors: 스택트레이스에 언급된 모드의 개수에 따라, 정확히 지목하기 어려울 수 있지만, 가장 먼저 해야 할 일은 충돌을 일으킨 모드를 찾는 것입니다. ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52) diff --git a/translated/ru_ru/players/troubleshooting/crash-reports.md b/translated/ru_ru/players/troubleshooting/crash-reports.md index 576d79fbc..23833a51f 100644 --- a/translated/ru_ru/players/troubleshooting/crash-reports.md +++ b/translated/ru_ru/players/troubleshooting/crash-reports.md @@ -63,7 +63,7 @@ authors: Учитывая количество модов, упомянутых в стеке, может быть трудно указать на конкретную причину, но первое, что нужно сделать, это найти мод, который вызвал сбой. ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52) diff --git a/translated/zh_cn/develop/codecs.md b/translated/zh_cn/develop/codecs.md index c86e44d1c..83c618d40 100644 --- a/translated/zh_cn/develop/codecs.md +++ b/translated/zh_cn/develop/codecs.md @@ -62,7 +62,7 @@ Codec API 自己包含了一些 基础类型的 codec,就像 `Codec.INT` 和 ` ```java public class CoolBeansClass { - + private final int beansAmount; private final Item beanType; private final List beanPositions; @@ -259,7 +259,7 @@ Codec blockPosCodec = Vec3d.CODEC.xmap( // 当转换一个存在的类 (比如 `X`)到您自己的类 (`Y`) // 最好是在 `Y` 类中添加 `toX` 和静态的 `fromX` 方法 -// 并且使用在您的 `xmap` 调用中使用方法引用 +// 并且使用在您的 `xmap` 调用中使用方法引用 ``` #### flatComapMap、comapFlatMap 与 flatXMap @@ -284,7 +284,7 @@ public class Identifier { return DataResult.error("Not a valid resource location: " + id + " " + e.getMessage()); } } - + // ... } ``` @@ -308,7 +308,7 @@ public class Identifier { - 一个 `BeanType` 类或 record,代表 bean 的类型并可返回它的 codec。 - 一个在 `Bean` 中可以用于检索其 `BeanType` 的函数。 - 一个 `Identifier` 到 `BeanType` 的 map 或注册表 -- 一个基于改注册表的 `Codec>`。 如果你使用 `net.minecraft.registry.Registry` 可以简单的调用 `Registry#getCodec`。 +- 一个基于改注册表的 `Codec>`。 如果你使用 `net.minecraft.registry.Registry` 可以简单的调用 `Registry#getCodec`。 集齐这些,我们可以创建一个 bean 的注册表分派 codec。 @@ -347,5 +347,5 @@ Codec beanCodec = beanTypeCodec.dispatch("type", Bean::getType, BeanType:: ## 引用 -- 关于编解码器及相关API的更全面的文档,可以在[非官方DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec.html)中找到。 +- 关于编解码器及相关API的更全面的文档,可以在[非官方DFU JavaDoc](https://kvverti.github.io/Documented-DataFixerUpper/snapshot/com/mojang/serialization/Codec)中找到。 - 本指南的总体结构受到了 [Forge 社区 Wiki 关于 Codec 的页面](https://forge.gemwire.uk/wiki/Codecs)的重大启发,这是对同一主题的更具 Forge 特色的解读。 diff --git a/translated/zh_cn/develop/commands/basics.md b/translated/zh_cn/develop/commands/basics.md index daf8136b3..d3b836038 100644 --- a/translated/zh_cn/develop/commands/basics.md +++ b/translated/zh_cn/develop/commands/basics.md @@ -50,7 +50,7 @@ Command command = context -> { ```java Command command = context -> { - ServerCommandSource source = context.getSource(); + ServerCommandSource source = context.getSource(); return 0; }; ``` @@ -67,7 +67,7 @@ Command command = context -> { 回调一共有三个参数: -- `CommandDispatcher dispatcher` - 用于注册,解析,执行命令。 `S` 是分发器支持的命令源类型。 +- `CommandDispatcher dispatcher` - 用于注册,解析,执行命令。 `S` 是分发器支持的命令源类型。 - `CommandRegistryAccess registryAccess` - 为可传递给某些命令参数方法的注册表提供一个抽象概念 - `CommandManager.RegistrationEnvironment environment` - 标识注册命令的服务器类型。 diff --git a/translated/zh_cn/players/installing-fabric.md b/translated/zh_cn/players/installing-fabric.md index 59f6d1c5c..978fc0cfc 100644 --- a/translated/zh_cn/players/installing-fabric.md +++ b/translated/zh_cn/players/installing-fabric.md @@ -29,14 +29,14 @@ authors: 在 macOS 上,您可能需要右键点击在您下载目录中的 `.jar`,然后点击 `Open` 来运行它。 -![高亮 "Install" 的 Fabric 安装程序](/assets/players/installing-fabric/macos-downloads.png) +![高亮 "Install" 的 Fabric 安装程序](/assets/players/installing-fabric/macos-downloads.png) 当询问您 "Are you sure you want to open it?" 的时候,再次点击 `Open`。 ::: 当您打开安装器的时候,您将会看到像是这样的屏幕: -![高亮 "Install" 的 Fabric 安装程序](/assets/players/installing-fabric/installer-screen.png) +![高亮 "Install" 的 Fabric 安装程序](/assets/players/installing-fabric/installer-screen.png) 要安装 Fabric,只需从下拉列表中选择您的游戏版本,然后单击 `Install`。 diff --git a/translated/zh_cn/players/troubleshooting/crash-reports.md b/translated/zh_cn/players/troubleshooting/crash-reports.md index 14aa5dece..cf100898c 100644 --- a/translated/zh_cn/players/troubleshooting/crash-reports.md +++ b/translated/zh_cn/players/troubleshooting/crash-reports.md @@ -60,10 +60,10 @@ authors: `-- Last Reload --`,除非崩溃发生在资源重载过程中 (F3+T) ,否则这部分并没有什么用处。 该部分将包含上次重载的发生时间,以及重载过程中出现的任何错误的相关堆栈跟踪。 这些错误通常是由资源包引起的,可以忽略不计,除非它们导致游戏出现问题。 在这种情况下,`---- Minecraft Crash Report ----` 部分中的堆栈跟踪最为重要,因为它包含导致崩溃的主要错误。 在这里,错误为`java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2248.method_9539()" because "net.minecraft.class_2248.field_10540" is null`. -由于堆栈跟踪中提到了大量的模组,因此很难指认崩溃“凶手”,不过,首先要做的是查找导致崩溃的部分。 +由于堆栈跟踪中提到了大量的模组,因此很难指认崩溃"凶手",不过,首先要做的是查找导致崩溃的部分。 ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52) diff --git a/translated/zh_tw/players/troubleshooting/crash-reports.md b/translated/zh_tw/players/troubleshooting/crash-reports.md index 9eaac8ef7..556033fb6 100644 --- a/translated/zh_tw/players/troubleshooting/crash-reports.md +++ b/translated/zh_tw/players/troubleshooting/crash-reports.md @@ -63,7 +63,7 @@ authors: 由於堆疊追蹤中提到了大量的模組,要指出責任者可能有些困難,但首先要做的是尋找導致崩潰的模組。 ```:no-line-numbers -at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) +at snownee.snow.block.ShapeCaches.get(ShapeCaches.java:51) at snownee.snow.block.SnowWallBlock.method_9549(SnowWallBlock.java:26) // [!code focus] ... at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache.shouldDrawSide(BlockOcclusionCache.java:52)