Skip to content

Commit 3134a3e

Browse files
committed
feat(minecraft): update towards 25w44a
Breaking changes: - GameRules are now registered and have therefor real IDs, so all field names are changed Notable Additions: - Added Parched - Added CamelHusk See https://minecraft.wiki/w/Java_Edition_25w44a
1 parent 6a0d53e commit 3134a3e

File tree

32 files changed

+586
-159
lines changed

32 files changed

+586
-159
lines changed

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,23 @@
2424
*/
2525
package org.spongepowered.vanilla.generator.world.level;
2626

27-
import com.google.common.base.CaseFormat;
2827
import net.minecraft.core.registries.Registries;
29-
import net.minecraft.resources.ResourceLocation;
30-
import net.minecraft.world.level.GameRules;
3128
import org.spongepowered.vanilla.generator.Context;
3229
import org.spongepowered.vanilla.generator.Generator;
33-
import org.spongepowered.vanilla.generator.MapEntriesValidator;
3430
import org.spongepowered.vanilla.generator.RegistryEntriesGenerator;
3531
import org.spongepowered.vanilla.generator.RegistryEntriesValidator;
3632
import org.spongepowered.vanilla.generator.RegistryScope;
3733

38-
import java.util.HashMap;
3934
import java.util.List;
40-
import java.util.Map;
41-
import java.util.function.BiConsumer;
4235

4336
public class LevelDataRegistries {
4437

4538
public static List<Generator> levelDataRegistries(final Context context) {
4639
return List.<Generator>of(
47-
new MapEntriesValidator<>(
40+
new RegistryEntriesValidator<>(
4841
"world.gamerule",
4942
"GameRules",
50-
GameRules.class,
51-
"GAME_RULE_TYPES",
52-
map -> {
53-
final Map<ResourceLocation, Object> out = new HashMap<>(map.size());
54-
map.forEach((BiConsumer<Object, Object>) (k, v) -> {
55-
var key = (GameRules.Key<?>) k;
56-
out.put(ResourceLocation.fromNamespaceAndPath("sponge", CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, key.getId())), v);
57-
});
58-
return out;
59-
}
43+
Registries.GAME_RULE
6044
),
6145
new RegistryEntriesGenerator<>(
6246
"map.decoration",

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=25w42a
14+
minecraftVersion=25w44a
1515
recommendedVersion=0-SNAPSHOT
1616

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

gradle/verification-metadata.xml

Lines changed: 419 additions & 10 deletions
Large diffs are not rendered by default.

src/accessors/java/org/spongepowered/common/accessor/world/level/GameRulesAccessor.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@
2424
*/
2525
package org.spongepowered.common.accessor.world.level;
2626

27-
import net.minecraft.world.level.GameRules;
27+
import net.minecraft.world.level.gamerules.GameRuleMap;
28+
import net.minecraft.world.level.gamerules.GameRules;
2829
import org.spongepowered.asm.mixin.Mixin;
2930
import org.spongepowered.asm.mixin.gen.Accessor;
30-
import org.spongepowered.common.UntransformedAccessorError;
3131

32-
import java.util.Map;
3332

3433
@Mixin(GameRules.class)
3534
public interface GameRulesAccessor {
3635

37-
@Accessor("rules") Map<GameRules.Key<?>, GameRules.Value<?>> accessor$rules();
36+
@Accessor("rules") GameRuleMap accessor$rules();
3837

39-
@Accessor("GAME_RULE_TYPES") static Map<GameRules.Key<?>, GameRules.Type<?>> accessor$GAME_RULE_TYPES() {
40-
throw new UntransformedAccessorError();
41-
}
4238

4339
}

src/accessors/java/org/spongepowered/common/accessor/world/level/GameRules_ValueAccessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@
2424
*/
2525
package org.spongepowered.common.accessor.world.level;
2626

27-
import net.minecraft.world.level.GameRules;
27+
import com.mojang.serialization.DataResult;
28+
import net.minecraft.world.level.gamerules.GameRule;
2829
import org.spongepowered.asm.mixin.Mixin;
2930
import org.spongepowered.asm.mixin.gen.Invoker;
3031

31-
@Mixin(GameRules.Value.class)
32+
@Mixin(GameRule.class)
3233
public interface GameRules_ValueAccessor {
3334

34-
@Invoker("deserialize") void invoker$deserialize(final String serialized);
35+
@Invoker("deserialize") DataResult<?> invoker$deserialize(final String serialized);
3536

3637
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@
202202
"world.level.chunk.LevelChunk$BoundTickingBlockEntityAccessor",
203203
"world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapperAccessor",
204204
"world.level.chunk.LevelChunkAccessor",
205-
"world.level.chunk.storage.ChunkStorageAccessor",
206205
"world.level.chunk.storage.IOWorker$PendingStoreAccessor",
207206
"world.level.chunk.storage.RegionFileAccessor",
208207
"world.level.chunk.storage.SimpleRegionStorageAccessor",

src/main/java/org/spongepowered/common/data/provider/world/WorldPropertiesData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
package org.spongepowered.common.data.provider.world;
2626

2727
import net.minecraft.core.GlobalPos;
28-
import net.minecraft.world.level.GameRules;
2928
import net.minecraft.world.level.GameType;
3029
import net.minecraft.world.level.dimension.DimensionType;
30+
import net.minecraft.world.level.gamerules.GameRules;
3131
import net.minecraft.world.level.storage.LevelData;
3232
import net.minecraft.world.level.storage.PrimaryLevelData;
3333
import net.minecraft.world.level.storage.ServerLevelData;
@@ -88,7 +88,7 @@ public static void register(final DataProviderRegistrator registrator) {
8888
.create(Keys.WORLD_TYPE)
8989
.get(h -> (WorldType) (Object) h.bridge$dimensionType())
9090
.create(Keys.PVP)
91-
.get(h -> h.bridge$pvp().orElseGet(() -> SpongeCommon.server().getWorldData().getGameRules().getBoolean(GameRules.RULE_PVP)))
91+
.get(h -> h.bridge$pvp().orElseGet(() -> SpongeCommon.server().getWorldData().getGameRules().get(GameRules.PVP)))
9292
.create(Keys.SERIALIZATION_BEHAVIOR)
9393
.get(h -> h.bridge$serializationBehavior().orElse(SerializationBehavior.AUTOMATIC))
9494
.create(Keys.VIEW_DISTANCE)

src/main/java/org/spongepowered/common/data/provider/world/biome/BiomeData.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static void register(final DataProviderRegistrator registrator) {
9595
return Color.ofRgb(value);
9696
})
9797
.create(Keys.WATER_COLOR)
98-
.get(h -> Color.ofRgb(h.getSpecialEffects().getWaterColor()))
98+
.get(h -> Color.ofRgb(h.getSpecialEffects().waterColor()))
9999
.create(Keys.WATER_FOG_COLOR)
100100
.get(h -> {
101101
final var value = h.getAttributes().applyModifier(EnvironmentAttributes.WATER_FOG_COLOR, EnvironmentAttributes.WATER_FOG_COLOR.defaultValue());
@@ -107,11 +107,11 @@ public static void register(final DataProviderRegistrator registrator) {
107107
return Color.ofRgb(value);
108108
})
109109
.create(Keys.FOLIAGE_COLOR)
110-
.get(h -> h.getSpecialEffects().getFoliageColorOverride().map(Color::ofRgb).orElse(null))
110+
.get(h -> h.getSpecialEffects().foliageColorOverride().map(Color::ofRgb).orElse(null))
111111
.create(Keys.GRASS_COLOR)
112-
.get(h -> h.getSpecialEffects().getGrassColorOverride().map(Color::ofRgb).orElse(null))
112+
.get(h -> h.getSpecialEffects().grassColorOverride().map(Color::ofRgb).orElse(null))
113113
.create(Keys.GRASS_COLOR_MODIFIER)
114-
.get(h -> (GrassColorModifier) (Object) h.getSpecialEffects().getGrassColorModifier())
114+
.get(h -> (GrassColorModifier) (Object) h.getSpecialEffects().grassColorModifier())
115115
.create(Keys.BACKGROUND_MUSIC)
116116
.get(h -> {
117117
final var value = h.getAttributes().applyModifier(EnvironmentAttributes.BACKGROUND_MUSIC, EnvironmentAttributes.BACKGROUND_MUSIC.defaultValue());

src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
import net.minecraft.world.damagesource.DamageSource;
3737
import net.minecraft.world.entity.LivingEntity;
3838
import net.minecraft.world.item.ItemStack;
39-
import net.minecraft.world.level.GameRules;
4039
import net.minecraft.world.level.Level;
4140
import net.minecraft.world.level.block.Block;
4241
import net.minecraft.world.level.block.DirectionalBlock;
4342
import net.minecraft.world.level.block.entity.JukeboxBlockEntity;
4443
import net.minecraft.world.level.block.piston.PistonStructureResolver;
44+
import net.minecraft.world.level.gamerules.GameRules;
4545
import net.minecraft.world.level.saveddata.maps.MapId;
4646
import net.minecraft.world.level.saveddata.maps.MapIndex;
4747
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
@@ -515,7 +515,7 @@ public static DestructEntityEvent.Death callDestructEntityEventDeath(final Livin
515515

516516
final DestructEntityEvent.Death event = SpongeEventFactory.createDestructEntityEventDeath(frame.currentCause(),
517517
originalChannel, Optional.of(originalChannel), originalMessage, originalMessage, (Living) entity,
518-
((ServerLevel) entity.level()).getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY), messageCancelled);
518+
((ServerLevel) entity.level()).getGameRules().get(GameRules.KEEP_INVENTORY), messageCancelled);
519519
SpongeCommon.post(event);
520520

521521
return event;

0 commit comments

Comments
 (0)