Skip to content

Commit 4f2036c

Browse files
committed
Merge 1.17 block and block entity additions. Merges #2357
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
2 parents 5102882 + 87b39f4 commit 4f2036c

File tree

10 files changed

+370
-3
lines changed

10 files changed

+370
-3
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.block.entity;
26+
27+
public interface SculkSensor extends BlockEntity {
28+
29+
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import net.kyori.adventure.text.Component;
2828
import org.spongepowered.api.data.Keys;
2929
import org.spongepowered.api.data.value.ListValue;
30-
import org.spongepowered.api.service.permission.Subject;
30+
import org.spongepowered.api.data.value.Value;
3131
import org.spongepowered.api.util.Nameable;
3232

3333
/**
@@ -45,4 +45,11 @@ default ListValue.Mutable<Component> lines() {
4545
return this.requireValue(Keys.SIGN_LINES).asMutable();
4646
}
4747

48+
/**
49+
* {@return Whether this sign has glowing text}.
50+
*/
51+
default Value.Mutable<Boolean> glowingText() {
52+
return this.requireValue(Keys.GLOWING_TEXT).asMutable();
53+
}
54+
4855
}

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

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.spongepowered.api.data.type.ChestAttachmentType;
5858
import org.spongepowered.api.data.type.ComparatorMode;
5959
import org.spongepowered.api.data.type.DoorHinge;
60+
import org.spongepowered.api.data.type.DripstoneSegment;
6061
import org.spongepowered.api.data.type.DyeColor;
6162
import org.spongepowered.api.data.type.FoxType;
6263
import org.spongepowered.api.data.type.HandPreference;
@@ -78,12 +79,14 @@
7879
import org.spongepowered.api.data.type.ProfessionType;
7980
import org.spongepowered.api.data.type.RabbitType;
8081
import org.spongepowered.api.data.type.RailDirection;
82+
import org.spongepowered.api.data.type.SculkSensorState;
8183
import org.spongepowered.api.data.type.SkinPart;
8284
import org.spongepowered.api.data.type.SlabPortion;
8385
import org.spongepowered.api.data.type.SpellType;
8486
import org.spongepowered.api.data.type.SpellTypes;
8587
import org.spongepowered.api.data.type.StairShape;
8688
import org.spongepowered.api.data.type.StructureMode;
89+
import org.spongepowered.api.data.type.Tilt;
8790
import org.spongepowered.api.data.type.TropicalFishShape;
8891
import org.spongepowered.api.data.type.VillagerType;
8992
import org.spongepowered.api.data.type.WireAttachmentType;
@@ -521,6 +524,11 @@ public final class Keys {
521524
*/
522525
public static final Key<Value<Boolean>> CAN_PLACE_AS_BLOCK = Keys.key(ResourceKey.sponge("can_place_as_block"), Boolean.class);
523526

527+
/**
528+
* The number of candles within a candle block.
529+
*/
530+
public static final Key<Value<Integer>> CANDLES = Keys.key(ResourceKey.sponge("candles"), Integer.class);
531+
524532
/**
525533
* The current casting time of a {@link Spellcaster}.
526534
*/
@@ -704,6 +712,11 @@ public final class Keys {
704712
*/
705713
public static final Key<Value<Boolean>> DO_EXACT_TELEPORT = Keys.key(ResourceKey.sponge("do_exact_teleport"), Boolean.class);
706714

715+
/**
716+
* The type of dripstone a certain {@link BlockTypes#DRIPSTONE_BLOCK} represents.
717+
*/
718+
public static final Key<Value<DripstoneSegment>> DRIPSTONE_SEGMENT = Keys.key(ResourceKey.sponge("dripstone_segment"), DripstoneSegment.class);
719+
707720
/**
708721
* The remaining duration (in ticks) of an {@link AreaEffectCloud}.
709722
*/
@@ -931,6 +944,12 @@ public final class Keys {
931944
*/
932945
public static final Key<Value<Integer>> GENERATION = Keys.key(ResourceKey.sponge("generation"), Integer.class);
933946

947+
/**
948+
* Whether a {@link Sign} has glowing text (from dying
949+
* with {@link ItemTypes#GLOW_INK_SAC}).
950+
*/
951+
public static final Key<Value<Boolean>> GLOWING_TEXT = Keys.key(ResourceKey.sponge("glowing_text"), Boolean.class);
952+
934953
/**
935954
* The "growth stage" state of a {@link BlockState}.
936955
* e.g. {@link BlockTypes#CACTUS} or {@link BlockTypes#WHEAT} etc.
@@ -947,6 +966,12 @@ public final class Keys {
947966
*/
948967
public static final Key<Value<Boolean>> HAS_BASE_PLATE = Keys.key(ResourceKey.sponge("has_base_plate"), Boolean.class);
949968

969+
/**
970+
* Whether a {@link BlockTypes#CAVE_VINES} or
971+
* {@link BlockTypes#CAVE_VINES_PLANT} has glow berries.
972+
*/
973+
public static final Key<Value<Boolean>> HAS_BERRIES = Keys.key(ResourceKey.sponge("has_berries"), Boolean.class);
974+
950975
/**
951976
* Whether a {@link PackHorse} has a chest.
952977
*/
@@ -2304,6 +2329,11 @@ public final class Keys {
23042329
*/
23052330
public static final Key<SetValue<String>> SCOREBOARD_TAGS = Keys.setKey(ResourceKey.sponge("scoreboard_tags"), String.class);
23062331

2332+
/**
2333+
* The triggering state of a {@link BlockTypes#SCULK_SENSOR}.
2334+
*/
2335+
public static final Key<Value<SculkSensorState>> SCULK_SENSOR_STATE = Keys.key(ResourceKey.sponge("sculk_sensor_state"), SculkSensorState.class);
2336+
23072337
/**
23082338
* A {@link Beacon}'s secondary effect.
23092339
*/
@@ -2320,7 +2350,7 @@ public final class Keys {
23202350
public static final Key<Value<ProjectileSource>> SHOOTER = Keys.key(ResourceKey.sponge("shooter"), ProjectileSource.class);
23212351

23222352
/**
2323-
* Whether a {@link EndCrystal} should show it's bottom bedrock platform.
2353+
* Whether a {@link EndCrystal} should show its bottom bedrock platform.
23242354
*/
23252355
public static final Key<Value<Boolean>> SHOW_BOTTOM = Keys.key(ResourceKey.sponge("show_bottom"), Boolean.class);
23262356

@@ -2570,6 +2600,12 @@ public final class Keys {
25702600
*/
25712601
public static final Key<Value<Ticks>> TICKS_REMAINING = Keys.key(ResourceKey.sponge("ticks_remaining"), Ticks.class);
25722602

2603+
/**
2604+
* The tilt of a {@link BlockTypes#BIG_DRIPLEAF} block, as triggered by
2605+
* player motion.
2606+
*/
2607+
public static final Key<Value<Tilt>> TILT = Keys.key(ResourceKey.sponge("tilt"), Tilt.class);
2608+
25732609
/**
25742610
* The {@link ItemTier} of an {@link ItemStack} tool.
25752611
* Readonly
@@ -2623,9 +2659,16 @@ public final class Keys {
26232659
*/
26242660
public static final Key<Value<Boolean>> UNSTABLE = Keys.key(ResourceKey.sponge("unstable"), Boolean.class);
26252661

2662+
/**
2663+
* Whether a {@link BlockTypes#POINTED_DRIPSTONE} is facing up or down.
2664+
*
2665+
* <p>Only supports {@link Direction#UP} or {@link Direction#DOWN}</p>
2666+
*/
2667+
public static final Key<Value<Direction>> UP_OR_DOWN = Keys.key(ResourceKey.sponge("up_or_down"), Direction.class);
2668+
26262669
/**
26272670
* Whether changes to {@link Keys#SKIN_PROFILE_PROPERTY} should
2628-
* be reflected in an entitie's {@link GameProfile}.
2671+
* be reflected in an entity's {@link GameProfile}.
26292672
*/
26302673
public static final Key<Value<Boolean>> UPDATE_GAME_PROFILE = Keys.key(ResourceKey.sponge("update_game_profile"), Boolean.class);
26312674

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(DripstoneSegments.class)
31+
public interface DripstoneSegment extends DefaultedRegistryValue {
32+
33+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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.RegistryKey;
31+
import org.spongepowered.api.registry.RegistryScope;
32+
import org.spongepowered.api.registry.RegistryScopes;
33+
import org.spongepowered.api.registry.RegistryTypes;
34+
35+
@SuppressWarnings("unused")
36+
@RegistryScopes(scopes = RegistryScope.GAME)
37+
public final class DripstoneSegments {
38+
39+
public static final DefaultedRegistryReference<DripstoneSegment> TIP_MERGE = DripstoneSegments.key(ResourceKey.sponge("tip_merge"));
40+
41+
public static final DefaultedRegistryReference<DripstoneSegment> TIP = DripstoneSegments.key(ResourceKey.sponge("tip"));
42+
43+
public static final DefaultedRegistryReference<DripstoneSegment> FRUSTUM = DripstoneSegments.key(ResourceKey.sponge("frustum"));
44+
45+
public static final DefaultedRegistryReference<DripstoneSegment> MIDDLE = DripstoneSegments.key(ResourceKey.sponge("middle"));
46+
47+
public static final DefaultedRegistryReference<DripstoneSegment> BASE = DripstoneSegments.key(ResourceKey.sponge("base"));
48+
49+
private DripstoneSegments() {
50+
}
51+
52+
private static DefaultedRegistryReference<DripstoneSegment> key(final ResourceKey location) {
53+
return RegistryKey.of(RegistryTypes.DRIPSTONE_SEGMENT, location).asDefaultedReference(Sponge::game);
54+
}
55+
56+
}
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(SculkSensorStates.class)
31+
public interface SculkSensorState extends DefaultedRegistryValue {
32+
33+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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.RegistryKey;
31+
import org.spongepowered.api.registry.RegistryScope;
32+
import org.spongepowered.api.registry.RegistryScopes;
33+
import org.spongepowered.api.registry.RegistryTypes;
34+
35+
@SuppressWarnings("unused")
36+
@RegistryScopes(scopes = RegistryScope.GAME)
37+
public final class SculkSensorStates {
38+
39+
// @formatter:off
40+
// SORTFIELDS:ON
41+
42+
public static final DefaultedRegistryReference<SculkSensorState> INACTIVE = SculkSensorStates.key(ResourceKey.sponge("inactive"));
43+
44+
public static final DefaultedRegistryReference<SculkSensorState> ACTIVE = SculkSensorStates.key(ResourceKey.sponge("active"));
45+
46+
public static final DefaultedRegistryReference<SculkSensorState> COOLDOWN = SculkSensorStates.key(ResourceKey.sponge("cooldown"));
47+
48+
// SORTFIELDS:OFF
49+
// @formatter:on
50+
51+
private SculkSensorStates() {
52+
}
53+
54+
private static DefaultedRegistryReference<SculkSensorState> key(final ResourceKey location) {
55+
return RegistryKey.of(RegistryTypes.SCULK_SENSOR_STATE, location).asDefaultedReference(Sponge::game);
56+
}
57+
58+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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(Tilts.class)
31+
public interface Tilt extends DefaultedRegistryValue {
32+
33+
/**
34+
* {@return Whether a block entering this tilt state will trigger any
35+
* vibration-based blocks}.
36+
*/
37+
boolean triggersVibrations();
38+
39+
}

0 commit comments

Comments
 (0)