Skip to content

Commit 2adc06b

Browse files
committed
feat(api)!: bump to 20.0.0-SNAPSHOT
Updates API to align with Minecraft 26.2 breaking changes. Removes ProcessorType and ProcessorTypes, collapsing their functionality into Processors. Processor parsing and serialization updated accordingly. See: https://minecraft.wiki/w/Java_Edition_26.2-snapshot-1
1 parent a71b70c commit 2adc06b

6 files changed

Lines changed: 118 additions & 130 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=org.spongepowered
2-
version=19.0.0-SNAPSHOT
2+
version=20.0.0-SNAPSHOT
33
organization=SpongePowered
44
projectUrl=https://www.spongepowered.org
55
projectDescription=A plugin API for Minecraft: Java Edition

src/main/java/org/spongepowered/api/registry/RegistryTypes.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@
195195
import org.spongepowered.api.world.generation.structure.StructureType;
196196
import org.spongepowered.api.world.generation.structure.jigsaw.JigsawPool;
197197
import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorList;
198-
import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorType;
199198
import org.spongepowered.api.world.schematic.PaletteType;
200199
import org.spongepowered.api.world.server.WorldArchetypeType;
201200
import org.spongepowered.api.world.teleport.TeleportHelperFilter;
@@ -272,8 +271,6 @@ public final class RegistryTypes {
272271

273272
public static final DefaultedRegistryType<ProcessorList> PROCESSOR_LIST = RegistryTypes.minecraftKeyInServer("worldgen/processor_list");
274273

275-
public static final DefaultedRegistryType<ProcessorType> PROCESSOR_TYPE = RegistryTypes.minecraftKeyInGame("worldgen/structure_processor");
276-
277274
public static final DefaultedRegistryType<ProfessionType> PROFESSION_TYPE = RegistryTypes.minecraftKeyInGame("villager_profession");
278275

279276
public static final DefaultedRegistryType<PushReaction> PUSH_REACTION = RegistryTypes.spongeKeyInGame("push_reaction");

src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/Processor.java

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,71 @@
2424
*/
2525
package org.spongepowered.api.world.generation.structure.jigsaw;
2626

27+
import org.spongepowered.api.ResourceKey;
28+
import org.spongepowered.api.Sponge;
2729
import org.spongepowered.api.data.persistence.DataContainer;
30+
import org.spongepowered.api.data.persistence.DataView;
31+
import org.spongepowered.api.registry.RegistryHolder;
32+
33+
import java.io.IOException;
2834

2935
/**
3036
* A structure processor affecting blocks in a structure.
37+
*
38+
* <p>Minecraft 26.2-snapshot-1 collapsed the previous split between a
39+
* processor instance and a standalone "processor type" object. A processor now
40+
* carries its own codec, and the vanilla {@code
41+
* minecraft:worldgen/structure_processor} registry stores those codecs keyed
42+
* by {@link ResourceKey resource keys}. See {@link Processors} for the set of
43+
* vanilla-provided processor IDs.</p>
3144
*/
3245
public interface Processor {
3346

3447
/**
35-
* Returns the type of processor
48+
* Parses a {@link Processor} of the given registry ID from a serialized
49+
* {@link DataView configuration}.
50+
*
51+
* <p>The {@link RegistryHolder} is required because processor codecs may
52+
* reference holder entries from other registries (tags, block states,
53+
* etc.) during deserialization.</p>
54+
*
55+
* @param registries the registry holder used to resolve holder references
56+
* @param id the registry ID of the processor, as registered in {@code
57+
* minecraft:worldgen/structure_processor} (see {@link Processors})
58+
* @param config the serialized processor configuration
59+
* @return the parsed processor
60+
* @throws IOException if the configuration is malformed or the ID is
61+
* unknown
62+
*/
63+
static Processor parse(final RegistryHolder registries, final ResourceKey id, final DataView config) throws IOException {
64+
return Sponge.game().factoryProvider().provide(Factory.class).parse(registries, id, config);
65+
}
66+
67+
/**
68+
* Returns the registry ID of this processor.
69+
*
70+
* <p>This is the key under which this processor's codec is registered in
71+
* the {@code minecraft:worldgen/structure_processor} registry.</p>
3672
*
37-
* @return The type of processor
73+
* @return the processor registry ID
3874
*/
39-
ProcessorType type();
75+
ResourceKey type();
4076

4177
/**
42-
* Returns the processor configuration
78+
* Returns the processor configuration.
4379
*
44-
* @return The processor configuration
80+
* @return the processor configuration
4581
*/
4682
DataContainer toContainer();
83+
84+
/**
85+
* Implementation-provided factory for {@link Processor}.
86+
*/
87+
interface Factory {
88+
89+
/**
90+
* @see Processor#parse(RegistryHolder, ResourceKey, DataView)
91+
*/
92+
Processor parse(RegistryHolder registries, ResourceKey id, DataView config) throws IOException;
93+
}
4794
}

src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorType.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorTypes.java

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* This file is part of SpongeAPI, 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.api.world.generation.structure.jigsaw;
26+
27+
import org.spongepowered.api.ResourceKey;
28+
29+
/**
30+
* Registry IDs of the vanilla {@link Processor structure processors}.
31+
*
32+
* <p>Since Minecraft 26.2-snapshot-1, processor kinds are no longer
33+
* represented by a per-kind object in SpongeAPI — the vanilla registry stores
34+
* codecs directly. This class holds the stable {@link ResourceKey} identifiers
35+
* of the processors provided by vanilla, suitable for passing to
36+
* {@link Processor#parse(org.spongepowered.api.registry.RegistryHolder,
37+
* ResourceKey, org.spongepowered.api.data.persistence.DataView)}.</p>
38+
*/
39+
public final class Processors {
40+
41+
public static final ResourceKey BLACKSTONE_REPLACE = ResourceKey.minecraft("blackstone_replace");
42+
43+
public static final ResourceKey BLOCK_AGE = ResourceKey.minecraft("block_age");
44+
45+
public static final ResourceKey BLOCK_IGNORE = ResourceKey.minecraft("block_ignore");
46+
47+
public static final ResourceKey BLOCK_ROT = ResourceKey.minecraft("block_rot");
48+
49+
public static final ResourceKey CAPPED = ResourceKey.minecraft("capped");
50+
51+
public static final ResourceKey GRAVITY = ResourceKey.minecraft("gravity");
52+
53+
public static final ResourceKey JIGSAW_REPLACEMENT = ResourceKey.minecraft("jigsaw_replacement");
54+
55+
public static final ResourceKey LAVA_SUBMERGED_BLOCK = ResourceKey.minecraft("lava_submerged_block");
56+
57+
public static final ResourceKey NOP = ResourceKey.minecraft("nop");
58+
59+
public static final ResourceKey PROTECTED_BLOCKS = ResourceKey.minecraft("protected_blocks");
60+
61+
public static final ResourceKey RULE = ResourceKey.minecraft("rule");
62+
63+
private Processors() {
64+
}
65+
}

0 commit comments

Comments
 (0)