Skip to content

Commit

Permalink
Merge branch 'port/1.21.4' into fix/256
Browse files Browse the repository at this point in the history
  • Loading branch information
IMB11 authored Jan 15, 2025
2 parents 592d531 + c17721c commit 815ad87
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 87 deletions.
22 changes: 6 additions & 16 deletions develop/data-generation/advancements.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ First, we need to make our provider. Create a class that `extends FabricAdvancem

To finish setup, add this provider to your `DataGeneratorEntrypoint` within the `onInitializeDataGenerator` method.

@[code lang=java transclude={24-24}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)
@[code lang=java transclude={25-25}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)

## Advancement Structure {#advancement-structure}

Expand All @@ -42,8 +42,12 @@ Here's a simple advancement for getting a dirt block:

@[code lang=java transcludeWith=:::datagen-advancements:simple-advancement](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceAdvancementProvider.java)

::: warning
When building your advancement entries, remember that the function accepts the `Identifier` of the advancement in `String` format!
:::

::: details JSON Output
@[code lang=json](@/reference/latest/src/main/generated/data/fabric-docs-reference/advancement/fabric-docs-reference/get_dirt.json)
@[code lang=json](@/reference/latest/src/main/generated/data/fabric-docs-reference/advancement/get_dirt.json)
:::

## One More Example {#one-more-example}
Expand All @@ -52,20 +56,6 @@ Just to get the hang of it, let's add one more advancement. We'll practice addin

@[code lang=java transcludeWith=:::datagen-advancements:second-advancement](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceAdvancementProvider.java)

Don't forget to generate them! Use the terminal command below or the run configuration in IntelliJ.

::: code-group

```sh [Windows]
gradlew runDatagen
```

```sh [Linux]
./gradlew runDatagen
```

:::

## Custom Criteria {#custom-criteria}

::: warning
Expand Down
2 changes: 1 addition & 1 deletion develop/data-generation/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You will need a different provider for each type of tag (eg. one `FabricTagProvi

To finish setup, add this provider to your `DataGeneratorEntrypoint` within the `onInitializeDataGenerator` method.

@[code lang=java transclude={28-28}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)
@[code lang=java transclude={29-29}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)

## Creating a Tag {#creating-a-tag}

Expand Down
2 changes: 1 addition & 1 deletion develop/data-generation/translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You will need a different provider for each language you want to generate (eg. o

To finish setup, add this provider to your `DataGeneratorEntrypoint` within the `onInitializeDataGenerator` method.

@[code lang=java transclude={26-26}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)
@[code lang=java transclude={27-27}](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java)

## Creating Translations {#creating-translations}

Expand Down
12 changes: 9 additions & 3 deletions develop/entities/damage-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ You can override `onSteppedOn` to inflict this damage.

We start by creating a `DamageSource` of our custom damage type.

@[code lang=java transclude={21-24}](@/reference/latest/src/main/java/com/example/docs/damage/TaterBlock.java)
@[code lang=java transclude={22-26}](@/reference/latest/src/main/java/com/example/docs/damage/TaterBlock.java)

Then, we call `entity.damage()` with our `DamageSource` and an amount.

@[code lang=java transclude={25-25}](@/reference/latest/src/main/java/com/example/docs/damage/TaterBlock.java)
@[code lang=java transclude={27-27}](@/reference/latest/src/main/java/com/example/docs/damage/TaterBlock.java)

The complete block implementation:

Expand All @@ -72,7 +72,13 @@ Now whenever a living entity steps on our custom block, it'll take 5 damage (2.5
You can define a death message for the damage type in the format of `death.attack.<message_id>` in our
mod's `en_us.json` file.

@[code lang=json transclude={4-4}](@/reference/latest/src/main/resources/assets/fabric-docs-reference/lang/en_us.json)
```json
{
// ...
"death.attack.tater": "%1$s died from Tater damage!",
// ...
}
```

Upon death from our damage type, you'll see the following death message:

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void generateAdvancement(RegistryWrapper.WrapperLookup wrapperLookup, Con
// "got_dirt" is the name referenced by other advancements when they want to have "requirements."
.criterion("got_dirt", InventoryChangedCriterion.Conditions.items(Items.DIRT))
// Give the advancement an id
.build(consumer, FabricDocsReference.MOD_ID + "/get_dirt");
.build(consumer, FabricDocsReference.MOD_ID + ":get_dirt");
// :::datagen-advancements:simple-advancement
// :::datagen-advancements:second-advancement
final RegistryWrapper.Impl<Item> itemLookup = wrapperLookup.getOrThrow(RegistryKeys.ITEM);
Expand All @@ -66,7 +66,7 @@ public void generateAdvancement(RegistryWrapper.WrapperLookup wrapperLookup, Con
)
.criterion("ate_apple", ConsumeItemCriterion.Conditions.item(wrapperLookup.getOrThrow(RegistryKeys.ITEM), Items.APPLE))
.criterion("ate_cooked_beef", ConsumeItemCriterion.Conditions.item(itemLookup, Items.COOKED_BEEF))
.build(consumer, FabricDocsReference.MOD_ID + "/apple_and_beef");
.build(consumer, FabricDocsReference.MOD_ID + ":apple_and_beef");
// :::datagen-advancements:second-advancement
// :::datagen-advancements:custom-criteria-advancement
AdvancementEntry breakBlockWithTool = Advancement.Builder.create()
Expand All @@ -82,7 +82,7 @@ public void generateAdvancement(RegistryWrapper.WrapperLookup wrapperLookup, Con
false
)
.criterion("break_block_with_tool", ModCriteria.USE_TOOL.create(new UseToolCriterion.Conditions(Optional.empty())))
.build(consumer, FabricDocsReference.MOD_ID + "/break_block_with_tool");
.build(consumer, FabricDocsReference.MOD_ID + ":break_block_with_tool");
// :::datagen-advancements:custom-criteria-advancement
// :::datagen-advancements:new-custom-criteria-advancement
AdvancementEntry breakBlockWithToolFiveTimes = Advancement.Builder.create()
Expand All @@ -98,7 +98,7 @@ public void generateAdvancement(RegistryWrapper.WrapperLookup wrapperLookup, Con
false
)
.criterion("break_block_with_tool_five_times", ModCriteria.PARAMETERIZED_USE_TOOL.create(new ParameterizedUseToolCriterion.Conditions(Optional.empty(), 5)))
.build(consumer, FabricDocsReference.MOD_ID + "/break_block_with_tool_five_times");
.build(consumer, FabricDocsReference.MOD_ID + ":break_block_with_tool_five_times");
// :::datagen-advancements:new-custom-criteria-advancement
// :::datagen-advancements:provider-start
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.example.docs.block.custom.PrismarineLampBlock;
import com.example.docs.item.ModItems;


/**
* This generator is just for the reference item and block models.
* Not for describing how to use the model provider.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:fabric-docs-reference/get_dirt",
"parent": "fabric-docs-reference:get_dirt",
"criteria": {
"ate_apple": {
"conditions": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:fabric-docs-reference/get_dirt",
"parent": "fabric-docs-reference:get_dirt",
"criteria": {
"break_block_with_tool": {
"trigger": "minecraft:fabric-docs-reference/use_tool"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "minecraft:fabric-docs-reference/break_block_with_tool",
"parent": "fabric-docs-reference:break_block_with_tool",
"criteria": {
"break_block_with_tool_five_times": {
"conditions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static Block register(Block block, RegistryKey<Block> blockKey, boolean s
// Sometimes, you may not want to register an item for the block.
// Eg: if it's a technical block like `minecraft:air` or `minecraft:end_gateway`
if (shouldRegisterItem) {
// Items need to be registered with a different type of registry key, but the ID
// Items need to be registered with a different type of registry key, but the ID
// can be the same.
RegistryKey<Item> itemKey = RegistryKey.of(RegistryKeys.ITEM, blockKey.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.fabricmc.api.ModInitializer;


// :::1
public class FabricDocsReferenceItems implements ModInitializer {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.example.docs.FabricDocsReference;

public class GuiditeArmorMaterial {

// :::base_durability
public static final int BASE_DURABILITY = 15;
// :::base_durability
Expand Down Expand Up @@ -46,4 +45,4 @@ public class GuiditeArmorMaterial {
GUIDITE_ARMOR_MATERIAL_KEY
);
// :::guidite_armor_material
}
}

0 comments on commit 815ad87

Please sign in to comment.