Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to MC 1.21.2 #4125

Draft
wants to merge 109 commits into
base: api-12
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
8fbd60f
wip: start updating to 24w34a
gabizou Aug 25, 2024
59e575a
fix BiomeTest
Faithcaio Aug 26, 2024
3354a0a
fix Ingredient
Faithcaio Aug 26, 2024
f956a36
fix adventure selector conversion
Faithcaio Aug 26, 2024
8fdd9c4
fix vanilla ingredient check
Faithcaio Aug 26, 2024
1bfcd73
bump API
Faithcaio Aug 26, 2024
84dbf5c
fixing recipes
Faithcaio Aug 26, 2024
8271de8
fix ToolRuleFactory
Faithcaio Aug 26, 2024
9dd2d49
git ignore snapshot run dir
Faithcaio Aug 26, 2024
0e653d1
fix explosion builder
Faithcaio Aug 26, 2024
2e13d65
tab list order
Faithcaio Aug 26, 2024
c2689a4
item component
Faithcaio Aug 26, 2024
8de6acc
fix resendProfile
Faithcaio Aug 26, 2024
b697399
fix BlockTypeItemStackData
Faithcaio Aug 26, 2024
348a325
TODO fix client
Faithcaio Aug 26, 2024
668a7c0
ClientboundSetCarriedItemPacket -> ClientboundSetHeldSlotPacket
Faithcaio Aug 26, 2024
cafd3ed
fix sponge chunk data
Faithcaio Aug 26, 2024
59a388d
TODO check overwrite - fix interaction result
Faithcaio Aug 26, 2024
c00e592
fix interaction
Faithcaio Aug 26, 2024
1a5747a
TODO check if correctly consumed - fix interaction
Faithcaio Aug 26, 2024
6b66291
TODO MovementType fix random teleport effect
Faithcaio Aug 26, 2024
11ff944
fix firework rocket interaction
Faithcaio Aug 26, 2024
ab49fd3
fix fishing rod interaction
Faithcaio Aug 26, 2024
3d42e54
fix SerializableChunkData
Faithcaio Aug 26, 2024
e05fe22
fix ChunkMapMixin SerializationBehavior
Faithcaio Aug 27, 2024
61b5d71
delete PowerableMobMixin_API
Faithcaio Aug 27, 2024
547d7ff
TODO fix ServerExplosionMixin_Tracker
Faithcaio Aug 27, 2024
ed6e428
fix fluid blockstate tracking
Faithcaio Aug 27, 2024
7a8612d
start fixing explosions
Faithcaio Aug 27, 2024
fe46fbf
fixing explosions
Faithcaio Aug 27, 2024
5f1536e
fix ServerChunkCacheMixin_Tracker
Faithcaio Aug 27, 2024
275598c
fix entity spawning
Faithcaio Aug 27, 2024
2a8e173
fix entity spawning
Faithcaio Aug 27, 2024
dcad310
fix checkinsideblock
Faithcaio Aug 27, 2024
b41ac1e
fix cooking recipe codec
Faithcaio Aug 27, 2024
b173895
fix ProjectileUtilMixin
Faithcaio Aug 27, 2024
753be55
fix firework explosion
Faithcaio Aug 27, 2024
f3cc2db
fix isSpawnAnimals removal (its now always true)
Faithcaio Aug 27, 2024
c4bcdae
fix TeleportCommandMixin - TODO this probably needs a rewrite
Faithcaio Aug 27, 2024
506d801
fix DifficultyCommandMixin
Faithcaio Aug 27, 2024
437a53e
fix api explosion
Faithcaio Aug 27, 2024
02785bd
fix level min/max/height
Faithcaio Aug 27, 2024
3c7997c
fix getTagNames
Faithcaio Aug 27, 2024
4e0f24f
fix Entity#copy
Faithcaio Aug 27, 2024
8a44dfe
fix recipebook placement
Faithcaio Aug 27, 2024
efe3a38
fix tp
Faithcaio Aug 27, 2024
5111e33
TODO remove from API? fix spawnanimals
Faithcaio Aug 27, 2024
b4c05ca
fix vanish consume effects
Faithcaio Aug 27, 2024
f87d7e4
fix consuming
Faithcaio Aug 27, 2024
a501971
TODO only when affected? - fix stepon
Faithcaio Aug 27, 2024
eb12d9d
AgeableWaterCreature
Faithcaio Aug 27, 2024
2f5fc1c
fix crafting menu mixin
Faithcaio Aug 27, 2024
43e7587
AgeableWaterCreature
Faithcaio Aug 27, 2024
17e4f00
fix crafting menu
Faithcaio Aug 27, 2024
b2a37dc
fix max light is gone?
Faithcaio Aug 27, 2024
1f1b67a
fix attack crit
Faithcaio Aug 27, 2024
fb3b713
fix saving world
Faithcaio Aug 27, 2024
203db78
fix ArmorMaterial repairIngredient
Faithcaio Aug 27, 2024
b23aea7
TODO fix NeighborUpdaterMixin_Tracker
Faithcaio Aug 27, 2024
43e02b1
TODO damage is never set? - fix enderpearl
Faithcaio Aug 27, 2024
ff0cdc0
fix minecart slowdown factor - TODO new behaviour?
Faithcaio Aug 27, 2024
11db1af
set camera on tp
Faithcaio Aug 27, 2024
aa13916
TODO check if this can be simplified now
Faithcaio Aug 27, 2024
c96ec4f
fix wool color mapping
Faithcaio Aug 27, 2024
ba88298
fix InventoryMenuMixin_TrackedMenuBridge_Inventory
Faithcaio Aug 27, 2024
1190c77
fix ProjectileDispenseBehaviorMixin
Faithcaio Aug 28, 2024
c461c9a
fix recipe ingredients
Faithcaio Aug 28, 2024
4da752b
fix recipes
Faithcaio Aug 28, 2024
645cadd
fix SavedDataMixin
Faithcaio Aug 28, 2024
1873391
fix registry loading
Faithcaio Aug 28, 2024
c1840c2
fix explosion
Faithcaio Aug 28, 2024
8bfcb6d
fix IOWorkerMixin
Faithcaio Aug 28, 2024
877dd35
fix DimensionDataStorageMixin
Faithcaio Aug 28, 2024
12c9b3d
fix ChunkMapMixin_Tracker
Faithcaio Aug 28, 2024
672dc5b
fix tracked players
Faithcaio Aug 28, 2024
0334c6d
fix spawnlimits
Faithcaio Aug 28, 2024
028dab5
fix cooldowns
Faithcaio Aug 28, 2024
6eb5338
fix server ticking
Faithcaio Aug 28, 2024
811851f
24w35a
Faithcaio Aug 29, 2024
43aa9be
fix registry usage
Faithcaio Aug 29, 2024
119694b
fix UpdateLightSideEffect
Faithcaio Aug 29, 2024
4b9d701
feat: update to 24w36a
gabizou Sep 8, 2024
4fb3a6b
feat: update to 24w37a
gabizou Sep 12, 2024
69a2cca
chore(ci): disable snapshot builds of forge
gabizou Sep 13, 2024
f0701fb
fix: allow the snapshot to compile
gabizou Sep 13, 2024
7dd13c8
chore: update dependencies before updating to the next snapshot
gabizou Sep 21, 2024
3de731c
chore: merge upstream for lwjgl library fix
gabizou Sep 22, 2024
668afe2
chore(update): update to 24w38a
gabizou Sep 22, 2024
3b268bc
chore: merge upstream changes
gabizou Sep 28, 2024
42a6077
chore: update dependency metadata
gabizou Sep 28, 2024
dac0c11
chore(update): update to 24w39a
gabizou Oct 3, 2024
87d71af
chore(update): start update for 24w40a
gabizou Oct 3, 2024
f79def5
fix some recipe
Faithcaio Oct 3, 2024
4739588
chore(update): update for 1.21.2-pre1
gabizou Oct 9, 2024
1ec66a9
chore: merge upstream for neo addition
gabizou Oct 10, 2024
2d5bfca
chore(ci): enable publishing vanilla jars for update branches
gabizou Oct 10, 2024
411f9f5
fix: update for incorrect api removal
gabizou Oct 10, 2024
805eb43
fix: potentially fix recipe api implementation
gabizou Oct 10, 2024
29e4beb
chore: merge upstream for api cleanup
gabizou Oct 12, 2024
c588b3d
chore: update to 1.21.2-pre3
gabizou Oct 12, 2024
20c98f2
wip: update Generator for api content updates
gabizou Oct 12, 2024
d36a5a8
chore: update api data types for 1.21.2 content
gabizou Oct 15, 2024
146836e
feat: add creaking data
gabizou Oct 15, 2024
960a47b
chore: bump to next major version
gabizou Oct 16, 2024
218bac8
feat: enable cooldown group data keys
gabizou Oct 16, 2024
22c156c
chore: update to 1.21.2-rc1
gabizou Oct 18, 2024
e33ecc7
chore: merge upstream for changes and fixes
gabizou Oct 21, 2024
e974645
chore: update to 1.21.2-rc2
gabizou Oct 22, 2024
03ec64a
chore: merge upstream for changes and fixes
gabizou Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ max_line_length = 120
tab_width = 4

[*mixins*.json]
indent_size = 4
indent_size = 4

[*.yaml]
indent_size = 2
38 changes: 24 additions & 14 deletions .github/workflows/common-run-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,30 @@ jobs:
# Only run on PRs if the source branch is on someone else's repo
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
runs-on: ubuntu-22.04
strategy:
matrix:
project:
- vanilla
- forge
- neoforge
include:
- project: vanilla
gradleProject: SpongeVanilla
- project: forge
gradleProject: SpongeForge
- project: neoforge
gradleProject: SpongeNeo
steps:
- name: setup
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
with:
runtime_version: 21
publishing_branch_regex: 'api-\d+'
- name: setup / cache minecraft dependencies
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
with:
path: |
${{ github.workspace}}/buildSrc/.gradle/
Expand All @@ -28,15 +43,18 @@ jobs:
restore-keys: |
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
- name: setup / environment
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: build with Gradle
run: ./gradlew -Pprojects=vanilla,forge,neoforge,testplugins build --stacktrace
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
run: ./gradlew -Pprojects=${{ matrix.project }},testplugins build --stacktrace
env:
CI_SYSTEM: Github Actions
- name: Archive artifacts for build
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: Sponge Jars
Expand All @@ -46,22 +64,14 @@ jobs:
${{ github.workspace }}/vanilla/build/libs/*.jar
${{ github.workspace }}/forge/build/libs/*.jar
${{ github.workspace }}/neoforge/build/libs/*.jar
- name: SpongeVanilla Production Jar
- name: ${{ matrix.gradleProject }} Production Jar
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: SpongeVanilla Production Jar
path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar"
- name: SpongeForge Production Jar
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: SpongeForge Production Jar
path: "${{ github.workspace }}/forge/build/libs/*-universal.jar"
- name: SpongeNeo Production Jar
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: SpongeNeo Production Jar
path: "${{ github.workspace }}/neoforge/build/libs/*-universal.jar"
name: ${{ matrix.gradleProject }} Production Jar
path: "${{ github.workspace }}/${{ matrix.project }}/build/libs/*-universal.jar"
- name: SpongeVanilla libraries
if: "matrix.project == 'vanilla'"
uses: "actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3" # v4.3.1
with:
name: SpongeVanilla installer libraries
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ name: Build and Deploy

on:
push:
branches: [ 'api-*' ]
branches:
- 'api-*'
- 'update/*'
tags-ignore: [ '**' ]

env:
Expand All @@ -22,13 +24,30 @@ jobs:
publish:
needs: integrationTest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
project:
- vanilla
- forge
- neoforge
include:
- project: vanilla
gradleProject: SpongeVanilla
- project: forge
gradleProject: SpongeForge
- project: neoforge
gradleProject: SpongeNeo
steps:
- name: setup
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
id: setup
uses: SpongePowered/.github/.github/actions/setup-java-env@master
with:
runtime_version: 21
publishing_branch_regex: ''
- name: setup / minecraft cache
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
with:
path: |
Expand All @@ -39,12 +58,14 @@ jobs:
${{ runner.os }}-minecraft-${{ env.CACHE_REV }}-
# We don't need to run tests again, so we just publish
- name: setup / workspace
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
run: |
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Publish to Sponge Maven & GitHub Packages
run: ./gradlew -s -Pprojects=vanilla,forge,neoforge :publish :SpongeVanilla:publish :SpongeForge:publish :SpongeNeo:publish
if: "!startsWith(github.ref, 'refs/heads/update/') || matrix.project == 'vanilla'"
run: ./gradlew -s -Pprojects=vanilla,${{ matrix.project }} :${{ matrix.gradleProject }}:publish
env:
CI_SYSTEM: Github Actions
GITHUB_USERNAME: "${{ github.actor }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dist
lib
out
run
run_snap
/target
*.com
*.class
Expand Down
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 60 files
+1 −1 gradle.properties
+1 −1 src/main/java/org/spongepowered/api/advancement/criteria/trigger/Triggers.java
+98 −0 src/main/java/org/spongepowered/api/block/BlockTypes.java
+2 −0 src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java
+39 −0 src/main/java/org/spongepowered/api/block/entity/CreakingHeart.java
+5 −0 src/main/java/org/spongepowered/api/data/BlockStateKeys.java
+40 −3 src/main/java/org/spongepowered/api/data/Keys.java
+4 −5 src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java
+0 −2 src/main/java/org/spongepowered/api/data/type/BoatType.java
+35 −0 src/main/java/org/spongepowered/api/data/type/CreakingHeart.java
+7 −20 src/main/java/org/spongepowered/api/data/type/CreakingHearts.java
+4 −0 src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java
+54 −4 src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java
+4 −0 src/main/java/org/spongepowered/api/entity/Entity.java
+45 −3 src/main/java/org/spongepowered/api/entity/EntityTypes.java
+8 −2 src/main/java/org/spongepowered/api/entity/ai/goal/builtin/creature/AvoidLivingGoal.java
+33 −31 src/main/java/org/spongepowered/api/entity/attribute/type/AttributeTypes.java
+1 −1 src/main/java/org/spongepowered/api/entity/explosive/Explosive.java
+2 −1 src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java
+3 −1 src/main/java/org/spongepowered/api/entity/living/aquatic/Squid.java
+48 −0 src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java
+1 −0 src/main/java/org/spongepowered/api/entity/living/monster/zombie/Zombie.java
+29 −10 src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java
+32 −0 src/main/java/org/spongepowered/api/entity/vehicle/Raft.java
+4 −0 src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypes.java
+3 −2 src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java
+134 −0 src/main/java/org/spongepowered/api/item/ItemTypes.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/ItemStack.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/ItemStackSnapshot.java
+0 −8 src/main/java/org/spongepowered/api/item/recipe/Recipe.java
+10 −37 src/main/java/org/spongepowered/api/item/recipe/cooking/CookingResult.java
+9 −33 src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java
+0 −8 src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeResult.java
+7 −0 src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java
+7 −0 src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java
+7 −0 src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
+22 −0 src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java
+6 −3 src/main/java/org/spongepowered/api/registry/RegistryTypes.java
+4 −0 src/main/java/org/spongepowered/api/state/BooleanStateProperties.java
+5 −0 src/main/java/org/spongepowered/api/state/EnumStateProperties.java
+2 −0 src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
+2 −0 src/main/java/org/spongepowered/api/tag/BlockTypeTags.java
+2 −0 src/main/java/org/spongepowered/api/tag/DamageTypeTags.java
+2 −0 src/main/java/org/spongepowered/api/tag/EntityTypeTags.java
+46 −0 src/main/java/org/spongepowered/api/tag/ItemTypeTags.java
+2 −0 src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java
+1 −2 src/main/java/org/spongepowered/api/world/biome/Biome.java
+6 −0 src/main/java/org/spongepowered/api/world/biome/Biomes.java
+4 −3 src/main/java/org/spongepowered/api/world/explosion/Explosion.java
+4 −6 src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.java
+54 −0 src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java
+4 −0 src/main/java/org/spongepowered/api/world/gamerule/GameRules.java
+10 −2 src/main/java/org/spongepowered/api/world/generation/feature/Features.java
+6 −2 src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatures.java
+0 −2 src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierTypes.java
+4 −0 src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPools.java
+1 −0 src/main/java/org/spongepowered/api/world/schematic/Schematic.java
+2 −1 src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java
+1 −2 src/main/java/org/spongepowered/api/world/storage/WorldProperties.java
+146 −0 src/test/java/org/spongepowered/api/util/ColorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.core.FrontAndTop;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CreakingHeartBlock;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.entity.vault.VaultState;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -131,6 +132,7 @@ static PropertyType ofProperty(final Property<?> prop) {
vanillaEnumTypeMapping.put(StructureMode.class, BlockStatePropertiesGenerator.inDataTypePkg("StructureMode"));
vanillaEnumTypeMapping.put(PistonType.class, BlockStatePropertiesGenerator.inDataTypePkg("PistonType"));
vanillaEnumTypeMapping.put(BambooLeaves.class, BlockStatePropertiesGenerator.inDataTypePkg("BambooLeavesType"));
vanillaEnumTypeMapping.put(CreakingHeartBlock.CreakingHeartState.class, BlockStatePropertiesGenerator.inDataTypePkg("CreakingHeart"));
vanillaEnumTypeMapping.put(WallSide.class, BlockStatePropertiesGenerator.inDataTypePkg("WallConnectionState"));
vanillaEnumTypeMapping.put(RailShape.class, BlockStatePropertiesGenerator.inDataTypePkg("RailDirection"));
vanillaEnumTypeMapping.put(AttachFace.class, BlockStatePropertiesGenerator.inDataTypePkg("AttachmentSurface"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.squareup.javapoet.TypeVariableName;
import net.minecraft.core.Direction;
import net.minecraft.core.FrontAndTop;
import net.minecraft.world.level.block.CreakingHeartBlock;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.entity.vault.VaultState;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -129,6 +130,7 @@ static BlockStatePropertyKeysGenerator.PropertyType ofProperty(final Property<?>
vanillaEnumTypeMapping.put(StructureMode.class, BlockStatePropertyKeysGenerator.inDataTypePkg("StructureMode"));
vanillaEnumTypeMapping.put(PistonType.class, BlockStatePropertyKeysGenerator.inDataTypePkg("PistonType"));
vanillaEnumTypeMapping.put(BambooLeaves.class, BlockStatePropertyKeysGenerator.inDataTypePkg("BambooLeavesType"));
vanillaEnumTypeMapping.put(CreakingHeartBlock.CreakingHeartState.class, BlockStatePropertyKeysGenerator.inDataTypePkg("CreakingHeart"));
vanillaEnumTypeMapping.put(WallSide.class, BlockStatePropertyKeysGenerator.inDataTypePkg("WallConnectionState"));
vanillaEnumTypeMapping.put(RailShape.class, BlockStatePropertyKeysGenerator.inDataTypePkg("RailDirection"));
vanillaEnumTypeMapping.put(AttachFace.class, BlockStatePropertyKeysGenerator.inDataTypePkg("AttachmentSurface"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ public void generate(final Context ctx) {

// Sort field entries and add them back to the class
processedFields.sort(Comparator.comparing(field -> field.getVariable(0).getNameAsString()));
primaryTypeDeclaration.getMembers().addAll(lastNonFieldIndex, processedFields);
var indextoAddAt = lastNonFieldIndex;
if (indextoAddAt == -1) {
indextoAddAt = 0;
}
primaryTypeDeclaration.getMembers().addAll(indextoAddAt, processedFields);

if (!added.isEmpty()) {
Logger.info("Added {} entries to {} that will require manual action to implement: {}", added.size(), this.targetClassSimpleName, added);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
import net.minecraft.Util;
import net.minecraft.advancements.AdvancementType;
import net.minecraft.commands.Commands.CommandSelection;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.*;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.CloseableResourceManager;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagLoader;
import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageEffects;
import net.minecraft.world.damagesource.DamageScaling;
Expand All @@ -62,14 +62,14 @@
import net.minecraft.world.entity.animal.horse.Markings;
import net.minecraft.world.entity.animal.horse.Variant;
import net.minecraft.world.entity.monster.SpellcasterIllager;
import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.component.FireworkExplosion;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.WorldDataConfiguration;
import net.minecraft.world.level.block.CreakingHeartBlock;
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerState;
import net.minecraft.world.level.block.state.properties.BambooLeaves;
import net.minecraft.world.level.block.state.properties.DripstoneThickness;
Expand All @@ -91,6 +91,7 @@
import java.util.concurrent.ExecutionException;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* A generator that will output source code containing constants used in <em>Minecraft: Java Edition</em>.
Expand Down Expand Up @@ -161,35 +162,36 @@ private static Pair<RegistryAccess.Frozen, ReloadableServerResources> loadVanill
// We don't currently try to load any datapacks here
final var packRepository = ServerPacksSource.createVanillaTrustedRepository();
MinecraftServer.configurePackRepository(packRepository, WorldDataConfiguration.DEFAULT, /* safeMode = */ false, true);
final CloseableResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, packRepository.openAllSelected());
final CloseableResourceManager rm = new MultiPackResourceManager(PackType.SERVER_DATA, packRepository.openAllSelected());

// WorldLoader.load
final LayeredRegistryAccess<RegistryLayer> staticRegistries = RegistryLayer.createRegistryAccess();
final LayeredRegistryAccess<RegistryLayer> withWorldgen = staticRegistries.replaceFrom(
RegistryLayer.WORLDGEN,
RegistryDataLoader.load(resourceManager, staticRegistries.getAccessForLoading(RegistryLayer.WORLDGEN), RegistryDataLoader.WORLDGEN_REGISTRIES)
);
final LayeredRegistryAccess<RegistryLayer> withDimensions = withWorldgen.replaceFrom(
RegistryLayer.DIMENSIONS,
RegistryDataLoader.load(resourceManager, staticRegistries.getAccessForLoading(RegistryLayer.DIMENSIONS), RegistryDataLoader.DIMENSION_REGISTRIES)
);

List<Registry.PendingTags<?>> pendingTags = TagLoader.loadTagsForExistingRegistries(rm, staticRegistries.getLayer(RegistryLayer.STATIC));
final var wga = staticRegistries.getAccessForLoading(RegistryLayer.WORLDGEN);
List<HolderLookup.RegistryLookup<?>> tl = TagLoader.buildUpdatedLookups(wga, pendingTags);
RegistryAccess.Frozen wgr = RegistryDataLoader.load(rm, tl, RegistryDataLoader.WORLDGEN_REGISTRIES);
List<HolderLookup.RegistryLookup<?>> cl = Stream.concat(tl.stream(), wgr.listRegistries()).toList();
final LayeredRegistryAccess<RegistryLayer> withWorldGen = staticRegistries.replaceFrom(RegistryLayer.WORLDGEN, wgr);
RegistryAccess.Frozen da = RegistryDataLoader.load(rm, cl, RegistryDataLoader.DIMENSION_REGISTRIES);
final LayeredRegistryAccess<RegistryLayer> withDimensions = withWorldGen.replaceFrom(RegistryLayer.DIMENSIONS, da);
TagLoader.loadTagsForExistingRegistries(rm, withDimensions.getLayer(RegistryLayer.WORLDGEN));

final RegistryAccess.Frozen compositeRegistries = withDimensions.getAccessForLoading(RegistryLayer.RELOADABLE);
final var resourcesFuture = ReloadableServerResources.loadResources(
resourceManager,
rm,
withDimensions,
pendingTags,
packRepository.getRequestedFeatureFlags(),
CommandSelection.ALL,
2, // functionPermissionLevel
Util.backgroundExecutor(), // prepareExecutor
Runnable::run // applyExecutor
).whenComplete((result, ex) -> {
if (ex != null) {
resourceManager.close();
rm.close();
}
}).thenApply(resources -> {
resources.updateRegistryTags();
resources.updateStaticRegistryTags();
return resources;
});

Expand All @@ -216,7 +218,7 @@ private static List<Generator> generators(final Context context) {
// Prepare a set of generators
// We are starting out by just generating Vanilla registry-backed catalogs
// Enum-backed (automatically-named) catalogs can be added later as necessary
return List.of(
return List.<Generator>of(
new MapEntriesValidator<>(
"world.gamerule",
"GameRules",
Expand Down Expand Up @@ -246,18 +248,11 @@ private static List<Generator> generators(final Context context) {
"sponge"
),
new EnumEntriesValidator<>(
"data.type",
"BoatTypes",
Boat.Type.class,
"getSerializedName",
"sponge"
),
new RegistryEntriesGenerator<>(
"data.type",
"ArmorMaterials",
"ARMOR_MATERIAL",
context.relativeClass("data.type", "ArmorMaterial"),
Registries.ARMOR_MATERIAL
"data.type",
"CreakingHearts",
CreakingHeartBlock.CreakingHeartState.class,
"getSerializedName",
"sponge"
),
new RegistryEntriesGenerator<>(
"map.decoration",
Expand Down Expand Up @@ -318,14 +313,14 @@ private static List<Generator> generators(final Context context) {
new EnumEntriesValidator<>(
"data.type",
"MooshroomTypes",
MushroomCow.MushroomType.class,
MushroomCow.Variant.class,
"getSerializedName",
"sponge"
),
new EnumEntriesValidator<>(
"data.type",
"FoxTypes",
Fox.Type.class,
Fox.Variant.class,
"getSerializedName",
"sponge"
),
Expand Down Expand Up @@ -378,6 +373,13 @@ private static List<Generator> generators(final Context context) {
"getSerializedName",
"sponge"
),
new EnumEntriesValidator<>(
"world.explosion",
"ExplosionBlockInteractions",
Explosion.BlockInteraction.class,
"name",
"sponge"
),
new RegistryEntriesGenerator<>(
"data.type",
"ArtTypes",
Expand Down Expand Up @@ -789,13 +791,14 @@ private static List<Generator> generators(final Context context) {
"getSerializedName",
"sponge"
),
new EnumEntriesValidator<>(
"data.type",
"ItemTiers",
Tiers.class,
"name",
"sponge"
),
// TODO - Figure out this change since ToolMaterials aren't registered, nor an enum anymore. - Snapshot 24w34a
// new EnumEntriesValidator<>(
// "data.type",
// "ItemTiers",
// ToolMaterial.class,
// "name",
// "sponge"
// ),
new EnumEntriesValidator<>(
"entity.display",
"BillboardTypes",
Expand Down
Loading
Loading