Skip to content

Commit dda072f

Browse files
committed
feat: update api content and changes for 25w03a
Additions: - TestBlock and TestBlockEntity kinds as per the inclusion of the GameTest Framework. - TestBlockMode is a new property kind that can be retrieved from a TestBlock BlockState. - EquipmentGroups.SADDLE is now added as the engine is enabling further data driven determinism on what entities can be saddled - EquipmentTypes.SADDLE as per above - PigTypes added for the new variants of Pigs that can exist - EntityTypeTags.CAN_EQUIP_SADDLE for finding out if an EntityType can equip a saddle item Deprecations: - Saddleable is now marked for removal, while still currently supported, it will be phased out of guarantees. Plugin developers are encouraged to use the existing methods of retrieval. See https://minecraft.wiki/w/Java_Edition_25w03a
1 parent 2807da5 commit dda072f

File tree

18 files changed

+247
-8
lines changed

18 files changed

+247
-8
lines changed

src/main/java/org/spongepowered/api/block/BlockTypes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,6 +1966,10 @@ public final class BlockTypes {
19661966

19671967
public static final DefaultedRegistryReference<BlockType> TERRACOTTA = BlockTypes.key(ResourceKey.minecraft("terracotta"));
19681968

1969+
public static final DefaultedRegistryReference<BlockType> TEST_BLOCK = BlockTypes.key(ResourceKey.minecraft("test_block"));
1970+
1971+
public static final DefaultedRegistryReference<BlockType> TEST_INSTANCE_BLOCK = BlockTypes.key(ResourceKey.minecraft("test_instance_block"));
1972+
19691973
public static final DefaultedRegistryReference<BlockType> TINTED_GLASS = BlockTypes.key(ResourceKey.minecraft("tinted_glass"));
19701974

19711975
public static final DefaultedRegistryReference<BlockType> TNT = BlockTypes.key(ResourceKey.minecraft("tnt"));

src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public final class BlockEntityTypes {
124124

125125
public static final DefaultedRegistryReference<BlockEntityType> STRUCTURE_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("structure_block"));
126126

127+
public static final DefaultedRegistryReference<BlockEntityType> TEST_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("test_block"));
128+
129+
public static final DefaultedRegistryReference<BlockEntityType> TEST_INSTANCE_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("test_instance_block"));
130+
127131
public static final DefaultedRegistryReference<BlockEntityType> TRAPPED_CHEST = BlockEntityTypes.key(ResourceKey.minecraft("trapped_chest"));
128132

129133
public static final DefaultedRegistryReference<BlockEntityType> TRIAL_SPAWNER = BlockEntityTypes.key(ResourceKey.minecraft("trial_spawner"));

src/main/java/org/spongepowered/api/data/BlockStateKeys.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.spongepowered.api.data.type.SlabPortion;
4343
import org.spongepowered.api.data.type.StairShape;
4444
import org.spongepowered.api.data.type.StructureMode;
45+
import org.spongepowered.api.data.type.TestBlockMode;
4546
import org.spongepowered.api.data.type.Tilt;
4647
import org.spongepowered.api.data.type.TrialSpawnerState;
4748
import org.spongepowered.api.data.type.VaultState;
@@ -269,6 +270,8 @@ public final class BlockStateKeys {
269270

270271
public static final Key<Value<StructureMode>> STRUCTUREBLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), StructureMode.class);
271272

273+
public static final Key<Value<TestBlockMode>> TEST_BLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/test_block_mode"), TestBlockMode.class);
274+
272275
public static final Key<Value<Tilt>> TILT = BlockStateKeys.key(ResourceKey.minecraft("property/tilt"), Tilt.class);
273276

274277
public static final Key<Value<Boolean>> TIP = BlockStateKeys.key(ResourceKey.minecraft("property/tip"), Boolean.class);

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import org.spongepowered.api.data.type.ParrotType;
8080
import org.spongepowered.api.data.type.PhantomPhase;
8181
import org.spongepowered.api.data.type.PickupRule;
82+
import org.spongepowered.api.data.type.PigType;
8283
import org.spongepowered.api.data.type.PistonType;
8384
import org.spongepowered.api.data.type.PortionType;
8485
import org.spongepowered.api.data.type.ProfessionType;
@@ -2624,6 +2625,14 @@ public final class Keys {
26242625
*/
26252626
public static final Key<Value<PickupRule>> PICKUP_RULE = Keys.key(ResourceKey.sponge("pickup_rule"), PickupRule.class);
26262627

2628+
/**
2629+
* The {@link PigType} for a {@link Pig}, which can vary based on
2630+
* {@link Biome}.
2631+
*
2632+
* @see <a href="https://minecraft.wiki/w/Java_Edition_25w02a#Mobs">Pig Variant Changes</a>
2633+
*/
2634+
public static final Key<Value<PigType>> PIG_TYPE = Keys.key(ResourceKey.sponge("pig_variant"), PigType.class);
2635+
26272636
/**
26282637
* Whether a {@link WorldType} is safe for {@link Piglin} to not transform
26292638
* into {@link ZombifiedPiglin} over time in a {@link ServerWorld world} of that type
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.data.type;
26+
27+
import org.spongepowered.api.registry.DefaultedRegistryValue;
28+
import org.spongepowered.api.util.annotation.CatalogedBy;
29+
30+
@CatalogedBy(PigTypes.class)
31+
public interface PigType extends DefaultedRegistryValue {
32+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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.data.type;
26+
27+
import org.spongepowered.api.ResourceKey;
28+
import org.spongepowered.api.Sponge;
29+
import org.spongepowered.api.registry.DefaultedRegistryReference;
30+
import org.spongepowered.api.registry.Registry;
31+
import org.spongepowered.api.registry.RegistryKey;
32+
import org.spongepowered.api.registry.RegistryScope;
33+
import org.spongepowered.api.registry.RegistryScopes;
34+
import org.spongepowered.api.registry.RegistryTypes;
35+
36+
/**
37+
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
38+
*/
39+
@SuppressWarnings("unused")
40+
@RegistryScopes(scopes = RegistryScope.ENGINE)
41+
public final class PigTypes {
42+
43+
public static final DefaultedRegistryReference<PigType> COLD = PigTypes.key(ResourceKey.minecraft("cold"));
44+
45+
public static final DefaultedRegistryReference<PigType> TEMPERATE = PigTypes.key(ResourceKey.minecraft("temperate"));
46+
47+
public static final DefaultedRegistryReference<PigType> WARM = PigTypes.key(ResourceKey.minecraft("warm"));
48+
49+
private PigTypes() {
50+
}
51+
52+
public static Registry<PigType> registry() {
53+
return Sponge.server().registry(RegistryTypes.PIG_TYPE);
54+
}
55+
56+
private static DefaultedRegistryReference<PigType> key(final ResourceKey location) {
57+
return RegistryKey.of(RegistryTypes.PIG_TYPE, location).asDefaultedReference(Sponge::server);
58+
}
59+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.data.type;
26+
27+
import org.spongepowered.api.registry.DefaultedRegistryValue;
28+
import org.spongepowered.api.util.annotation.CatalogedBy;
29+
30+
@CatalogedBy(TestBlockModes.class)
31+
public interface TestBlockMode extends Comparable<TestBlockMode>, DefaultedRegistryValue, StringRepresentable {
32+
33+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.data.type;
26+
27+
import org.spongepowered.api.ResourceKey;
28+
import org.spongepowered.api.Sponge;
29+
import org.spongepowered.api.registry.DefaultedRegistryReference;
30+
import org.spongepowered.api.registry.Registry;
31+
import org.spongepowered.api.registry.RegistryKey;
32+
import org.spongepowered.api.registry.RegistryTypes;
33+
34+
/**
35+
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
36+
*/
37+
public class TestBlockModes {
38+
39+
public static final DefaultedRegistryReference<TestBlockMode> ACCEPT = TestBlockModes.key(ResourceKey.sponge("accept"));
40+
41+
public static final DefaultedRegistryReference<TestBlockMode> FAIL = TestBlockModes.key(ResourceKey.sponge("fail"));
42+
43+
public static final DefaultedRegistryReference<TestBlockMode> LOG = TestBlockModes.key(ResourceKey.sponge("log"));
44+
45+
public static final DefaultedRegistryReference<TestBlockMode> START = TestBlockModes.key(ResourceKey.sponge("start"));
46+
47+
48+
public static Registry<TestBlockMode> registry() {
49+
return Sponge.game().registry(RegistryTypes.TEST_BLOCK_MODE);
50+
}
51+
52+
private static DefaultedRegistryReference<TestBlockMode> key(final ResourceKey location) {
53+
return RegistryKey.of(RegistryTypes.TEST_BLOCK_MODE, location).asDefaultedReference(Sponge::game);
54+
}
55+
}

src/main/java/org/spongepowered/api/entity/Saddleable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@
2626

2727
import org.spongepowered.api.data.Keys;
2828
import org.spongepowered.api.data.value.Value;
29+
import org.spongepowered.api.tag.EntityTypeTags;
30+
import org.spongepowered.api.tag.Tag;
2931

3032
/**
3133
* Represents an {@link Entity} which can be saddled.
34+
*
35+
* @deprecated Use {@link EntityType#is(Tag) EntityType.is} {@link EntityTypeTags#CAN_EQUIP_SADDLE} as
36+
* other {@link Entity entities} may be now saddled based on the tag definition
3237
*/
38+
@Deprecated(forRemoval = true, since = "15")
3339
public interface Saddleable extends Entity {
3440

3541
/**

src/main/java/org/spongepowered/api/entity/living/animal/Pig.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,24 @@
2424
*/
2525
package org.spongepowered.api.entity.living.animal;
2626

27-
import org.spongepowered.api.entity.Saddleable;
27+
import org.spongepowered.api.data.Keys;
28+
import org.spongepowered.api.data.type.PigType;
29+
import org.spongepowered.api.data.value.Value;
2830

2931
/**
3032
* Represents a Pig.
3133
*/
32-
public interface Pig extends Animal, Saddleable {
34+
@SuppressWarnings("removal")
35+
public interface Pig extends Animal, org.spongepowered.api.entity.Saddleable {
36+
37+
/**
38+
* Gets the variant {@link PigType} of this Pig.
39+
*
40+
* @see <a href="https://minecraft.wiki/w/Java_Edition_25w02a#Mobs">Pig Variant Changes</a>
41+
* @return The {@link PigType} of this Pig.
42+
*/
43+
default Value<PigType> variant() {
44+
return this.requireValue(Keys.PIG_TYPE).asMutable();
45+
}
3346

3447
}

0 commit comments

Comments
 (0)