Skip to content

Commit 26199b1

Browse files
committed
feat(minecraft): update to 26.3-snapshot-1
Mojang collapsed the type/configuration split in worldgen: the "configured" instances are now the data pack registries themselves, dispatched by codec-only *_TYPE registries. The same reshaping hit surface rules and structure placement. CHANGED: - ConfiguredFeature removed; FeatureMixin_API rewritten as an interface mixin on vanilla Feature, which now carries its own configuration and codec. PlacedFeature, jigsaw pool elements, the bonus chest and the dragon gateway tracker redirect are re-typed to Holder<Feature> - worldgen/configured_feature is now worldgen/feature, and worldgen/feature_type holds the bare codecs — the old name no longer means the type registry - StructurePlacement is an interface; StructurePlacementMixin_API converted - Surface rules are data pack driven: SpongeSurfaceRulesFactory resolves out of MATERIAL_RULE/MATERIAL_CONDITION and NoiseGeneratorSettings exposes materialRule as Holder<RuleSource> - Pack resources reshaped: AbstractPackResources split into AbstractPackMetadataResources, ResourcesSupplier opens metadata and a stream of resources, and Pack#open returns Stream<PackResources> - Block ticks use setBlockAndUpdate over setBlock; Fire and Leaves injections retargeted accordingly - FarmlandBlock#turnToDirt is now the instance method turnToBaseBlock, and TntBlock#prime takes the igniting ItemStack - PotDecorations hold ItemStackTemplate, with sherds validated by the decorated_pot_sherds item tag - Renames: Entity#hurtMarked to the public syncVelocity field, BlockState#blocksMotion to the blocks_motion tag, ItemContainerContents#allItemsCopyStream to itemCopies, ChunkMap#getStorageName to storageInfo().level(), and ResourceManager#listResources from Predicate to Selector - generator emits Features from FEATURE and FeatureTypes from FEATURE_TYPE REMOVED: - ConfiguredFeatureMixin_API ADDITION: - SpongeFeatureType backing the codec-only feature_type entries, resolved lazily because early registry setup runs before BuiltInRegistries is frozen - OverworldMaterialRulesAccessor exposing createOverworldLike and the private SURFACE/UNDERGROUND keys, so overworldLike delegates rather than reimplements FIXED: - BiomeData and the noise config builder no longer dereference holders that are still unbound while data pack registries load - Feature.Builder#build round-trips through the codec so it yields a distinct instance; registries reject an already-registered value by identity See: https://minecraft.wiki/w/Java_Edition_26.3_Snapshot_1
1 parent eafcbad commit 26199b1

39 files changed

Lines changed: 323 additions & 223 deletions

File tree

forge/src/mixins/java/org/spongepowered/forge/mixin/core/resources/RegistryDataLoaderMixin_Forge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public class RegistryDataLoaderMixin_Forge {
101101

102102
// Only fire plugin registry events on the server side (ResourceManager-backed loads).
103103
// Client-side network loads only receive SYNCHRONIZED_REGISTRIES and lack server-only
104-
// registries (placed_feature, configured_feature, etc.) that plugins may declare as
104+
// registries (placed_feature, worldgen/feature, etc.) that plugins may declare as
105105
// dependencies, causing freeze validation to fail.
106106
if (k != ResourceManager.Empty.INSTANCE) {
107107
lifecycle.processServerRegistries(registryHolder, v.stream()

generator/src/main/java/org/spongepowered/vanilla/generator/world/level/LevelDataRegistries.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ public static List<Generator> levelDataRegistries(final Context context) {
155155
"Features",
156156
"FEATURE",
157157
context.relativeClass("world.generation.feature", "Feature"),
158-
Registries.CONFIGURED_FEATURE,
158+
Registries.FEATURE,
159159
$ -> true, RegistryScope.SERVER
160160
),
161161
new RegistryEntriesGenerator<>(
162162
"world.generation.feature",
163163
"FeatureTypes",
164164
"FEATURE_TYPE",
165165
context.relativeClass("world.generation.feature", "FeatureType"),
166-
Registries.FEATURE,
167-
$ -> true, RegistryScope.SERVER
166+
Registries.FEATURE_TYPE,
167+
$ -> true, RegistryScope.GAME
168168
),
169169
new RegistryEntriesGenerator<>(
170170
"world.generation.feature",

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
1111
mixins.sponge.entityactivation.json,mixins.sponge.exploit.json,mixins.sponge.inventory.json,mixins.sponge.movementcheck.json,\
1212
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json,mixins.sponge.test.json
1313

14-
minecraftVersion=26.2
14+
minecraftVersion=26.3-snapshot-1
1515
recommendedVersion=0-SNAPSHOT
1616

1717
org.gradle.dependency.verification.console=verbose

neoforge/src/mixins/java/org/spongepowered/neoforge/mixin/core/resources/RegistryDataLoaderMixin_Neo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class RegistryDataLoaderMixin_Neo {
103103

104104
// Only fire plugin registry events on the server side (ResourceManager-backed loads).
105105
// Client-side network loads only receive SYNCHRONIZED_REGISTRIES and lack server-only
106-
// registries (placed_feature, configured_feature, etc.) that plugins may declare as
106+
// registries (placed_feature, worldgen/feature, etc.) that plugins may declare as
107107
// dependencies, causing freeze validation to fail.
108108
if (k != ResourceManager.Empty.INSTANCE) {
109109
lifecycle.processServerRegistries(registryHolder, v.stream()
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is part of Sponge, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.common.accessor.data.worldgen.material;
26+
27+
import net.minecraft.core.HolderGetter;
28+
import net.minecraft.data.worldgen.material.OverworldMaterialRules;
29+
import net.minecraft.resources.ResourceKey;
30+
import net.minecraft.world.level.levelgen.SurfaceRules;
31+
import org.spongepowered.asm.mixin.Mixin;
32+
import org.spongepowered.asm.mixin.gen.Accessor;
33+
import org.spongepowered.asm.mixin.gen.Invoker;
34+
import org.spongepowered.common.UntransformedInvokerError;
35+
36+
@Mixin(OverworldMaterialRules.class)
37+
public interface OverworldMaterialRulesAccessor {
38+
39+
@Accessor("SURFACE") static ResourceKey<SurfaceRules.RuleSource> accessor$SURFACE() {
40+
throw new UntransformedInvokerError();
41+
}
42+
43+
@Accessor("UNDERGROUND") static ResourceKey<SurfaceRules.RuleSource> accessor$UNDERGROUND() {
44+
throw new UntransformedInvokerError();
45+
}
46+
47+
@Invoker("createOverworldLike") static SurfaceRules.RuleSource invoker$createOverworldLike(
48+
final HolderGetter<SurfaceRules.RuleSource> rules, final boolean doPreliminarySurfaceCheck, final boolean bedrockRoof,
49+
final boolean bedrockFloor, final SurfaceRules.RuleSource mainRuleCloseToSurface, final SurfaceRules.RuleSource underground
50+
) {
51+
throw new UntransformedInvokerError();
52+
}
53+
}

src/accessors/resources/mixins.sponge.accessors.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"commands.arguments.selector.options.EntitySelectorOptions_OptionAccessor",
1717
"commands.arguments.selector.options.EntitySelectorOptionsAccessor",
1818
"core.MappedRegistryAccessor",
19+
"data.worldgen.material.OverworldMaterialRulesAccessor",
1920
"entity.animal.equine.AbstractChestedHorseEntityAccessor",
2021
"entity.animal.frog.FrogAccessor",
2122
"entity.vehicle.minecart.AbstractMinecartAccessor",

src/main/java/org/spongepowered/common/data/provider/block/entity/DecoratedPotData.java

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
*/
2525
package org.spongepowered.common.data.provider.block.entity;
2626

27-
import net.minecraft.core.registries.BuiltInRegistries;
28-
import net.minecraft.resources.ResourceKey;
27+
import net.minecraft.tags.ItemTags;
2928
import net.minecraft.world.item.Item;
29+
import net.minecraft.world.item.ItemStackTemplate;
3030
import net.minecraft.world.item.Items;
3131
import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity;
32-
import net.minecraft.world.level.block.entity.DecoratedPotPatterns;
3332
import net.minecraft.world.level.block.entity.PotDecorations;
3433
import org.checkerframework.checker.nullness.qual.Nullable;
3534
import org.spongepowered.api.data.Keys;
@@ -38,38 +37,33 @@
3837
import org.spongepowered.common.accessor.world.level.block.entity.DecoratedPotBlockEntityAccessor;
3938
import org.spongepowered.common.data.provider.DataProviderRegistrator;
4039

41-
import java.util.HashSet;
4240
import java.util.Optional;
43-
import java.util.Set;
4441

4542
public final class DecoratedPotData {
4643

47-
private static final Set<ResourceKey<Item>> POTTERY_SHERD_ITEMS;
48-
static {
49-
final Set<ResourceKey<Item>> set = new HashSet<>();
50-
DecoratedPotPatterns.itemToPatternMappings((itemKey, patternKey) -> set.add(itemKey));
51-
POTTERY_SHERD_ITEMS = Set.copyOf(set);
52-
}
53-
5444
public static void register(final DataProviderRegistrator registrator) {
5545
// @formatter:off
5646
registrator.asMutable(DecoratedPotBlockEntity.class)
5747
.create(Keys.POT_FRONT_DECORATION)
58-
.get((h) -> h.getDecorations().front().map(ItemType.class::cast).orElseGet(ItemTypes.BRICK))
48+
.get((h) -> DecoratedPotData.itemType(h.getDecorations().front()))
5949
.setAnd((h, v) -> DecoratedPotData.setPotDirection(h, PotDirection.FRONT, v))
6050
.create(Keys.POT_BACK_DECORATION)
61-
.get((h) -> h.getDecorations().back().map(ItemType.class::cast).orElseGet(ItemTypes.BRICK))
51+
.get((h) -> DecoratedPotData.itemType(h.getDecorations().back()))
6252
.setAnd((h, v) -> DecoratedPotData.setPotDirection(h, PotDirection.BACK, v))
6353
.create(Keys.POT_LEFT_DECORATION)
64-
.get((h) -> h.getDecorations().left().map(ItemType.class::cast).orElseGet(ItemTypes.BRICK))
54+
.get((h) -> DecoratedPotData.itemType(h.getDecorations().left()))
6555
.setAnd((h, v) -> DecoratedPotData.setPotDirection(h, PotDirection.LEFT, v))
6656
.create(Keys.POT_RIGHT_DECORATION)
67-
.get((h) -> h.getDecorations().right().map(ItemType.class::cast).orElseGet(ItemTypes.BRICK))
57+
.get((h) -> DecoratedPotData.itemType(h.getDecorations().right()))
6858
.setAnd((h, v) -> DecoratedPotData.setPotDirection(h, PotDirection.RIGHT, v))
6959
;
7060
// @formatter:on
7161
}
7262

63+
private static ItemType itemType(final Optional<ItemStackTemplate> decoration) {
64+
return decoration.<ItemType>map(template -> (ItemType) template.item().value()).orElseGet(ItemTypes.BRICK);
65+
}
66+
7367
static boolean setPotDirection(DecoratedPotBlockEntity h, PotDirection direction, ItemType v) {
7468
if (v == Items.BRICK) {
7569
var current = h.getDecorations();
@@ -78,12 +72,12 @@ static boolean setPotDirection(DecoratedPotBlockEntity h, PotDirection direction
7872
h.setChanged();
7973
return true;
8074
}
81-
final var itemKey = BuiltInRegistries.ITEM.getResourceKey((Item) v).orElse(null);
82-
if (itemKey == null || !POTTERY_SHERD_ITEMS.contains(itemKey)) {
75+
final var item = (Item) v;
76+
if (!item.builtInRegistryHolder().is(ItemTags.DECORATED_POT_SHERDS)) {
8377
return false;
8478
}
8579
var current = h.getDecorations();
86-
var newDecorations = direction.applyToDirection(current, (Item) v);
80+
var newDecorations = direction.applyToDirection(current, item);
8781
((DecoratedPotBlockEntityAccessor) h).accessor$setDecorations(newDecorations);
8882
h.setChanged();
8983
return true;
@@ -97,15 +91,15 @@ PotDecorations applyToDirection(PotDecorations existing, @Nullable Item value) {
9791
existing.back(),
9892
existing.left(),
9993
existing.right(),
100-
Optional.ofNullable(value)
94+
Optional.ofNullable(value).map(ItemStackTemplate::new)
10195
);
10296
}
10397
},
10498
BACK {
10599
@Override
106100
PotDecorations applyToDirection(PotDecorations existing, @Nullable Item value) {
107101
return new PotDecorations(
108-
Optional.ofNullable(value),
102+
Optional.ofNullable(value).map(ItemStackTemplate::new),
109103
existing.left(),
110104
existing.right(),
111105
existing.front()
@@ -117,7 +111,7 @@ PotDecorations applyToDirection(PotDecorations existing, @Nullable Item value) {
117111
PotDecorations applyToDirection(PotDecorations existing, @Nullable Item value) {
118112
return new PotDecorations(
119113
existing.back(),
120-
Optional.ofNullable(value),
114+
Optional.ofNullable(value).map(ItemStackTemplate::new),
121115
existing.right(),
122116
existing.front()
123117
);
@@ -129,7 +123,7 @@ PotDecorations applyToDirection(PotDecorations existing, @Nullable Item value) {
129123
return new PotDecorations(
130124
existing.back(),
131125
existing.left(),
132-
Optional.ofNullable(value),
126+
Optional.ofNullable(value).map(ItemStackTemplate::new),
133127
existing.front()
134128
);
135129
}

src/main/java/org/spongepowered/common/data/provider/block/state/BlockData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
package org.spongepowered.common.data.provider.block.state;
2626

27+
import net.minecraft.tags.BlockTags;
2728
import net.minecraft.world.item.BlockItem;
2829
import net.minecraft.world.item.Item;
2930
import net.minecraft.world.level.block.Block;
@@ -90,7 +91,7 @@ public static void register(final DataProviderRegistrator registrator) {
9091
})
9192
.supports(h -> h.hasProperty(ChestBlock.TYPE))
9293
.create(Keys.IS_PASSABLE)
93-
.get(h -> !h.blocksMotion())
94+
.get(h -> !h.is(BlockTags.BLOCKS_MOTION))
9495
.create(Keys.IS_FLAMMABLE)
9596
.get(((BaseFireBlockAccessor) Blocks.FIRE)::invoker$canBurn)
9697
.create(Keys.IS_SOLID)

src/main/java/org/spongepowered/common/data/provider/entity/EntityData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ public static void register(final DataProviderRegistrator registrator) {
231231
.resetOnDelete(Vector3d.ZERO)
232232
.set((h, v) -> {
233233
h.setDeltaMovement(VecHelper.toVanillaVector3d(v));
234-
h.hurtMarked = true;
234+
h.syncVelocity = true;
235235
})
236236
.create(Keys.SWIFTNESS)
237237
.get(m -> m.getDeltaMovement().length())
238238
.set((m, v) -> {
239239
m.setDeltaMovement(m.getDeltaMovement().normalize().scale(v));
240-
m.hurtMarked = true;
240+
m.syncVelocity = true;
241241
})
242242
.supports(m -> m.getDeltaMovement().lengthSqr() > 0)
243243
.create(Keys.PORTAL)

0 commit comments

Comments
 (0)