Skip to content

Commit a15f833

Browse files
authored
generate BlockStateKeys (#2440)
* generate BlockStateKeys and add missing enum property types rename WallType -> WallConnectionState * generate API10 properties * foobar
1 parent 25fc619 commit a15f833

File tree

6 files changed

+306
-18
lines changed

6 files changed

+306
-18
lines changed
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
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;
26+
27+
import org.spongepowered.api.ResourceKey;
28+
import org.spongepowered.api.data.type.AttachmentSurface;
29+
import org.spongepowered.api.data.type.BambooLeavesType;
30+
import org.spongepowered.api.data.type.BellAttachmentType;
31+
import org.spongepowered.api.data.type.ChestAttachmentType;
32+
import org.spongepowered.api.data.type.ComparatorMode;
33+
import org.spongepowered.api.data.type.DoorHinge;
34+
import org.spongepowered.api.data.type.DripstoneSegment;
35+
import org.spongepowered.api.data.type.InstrumentType;
36+
import org.spongepowered.api.data.type.JigsawBlockOrientation;
37+
import org.spongepowered.api.data.type.PistonType;
38+
import org.spongepowered.api.data.type.PortionType;
39+
import org.spongepowered.api.data.type.RailDirection;
40+
import org.spongepowered.api.data.type.SculkSensorState;
41+
import org.spongepowered.api.data.type.SlabPortion;
42+
import org.spongepowered.api.data.type.StairShape;
43+
import org.spongepowered.api.data.type.StructureMode;
44+
import org.spongepowered.api.data.type.Tilt;
45+
import org.spongepowered.api.data.type.WallConnectionState;
46+
import org.spongepowered.api.data.type.WireAttachmentType;
47+
import org.spongepowered.api.data.value.Value;
48+
import org.spongepowered.api.util.Axis;
49+
import org.spongepowered.api.util.Direction;
50+
51+
/**
52+
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
53+
*/
54+
@SuppressWarnings("unused")
55+
public final class BlockStateKeys {
56+
57+
public static final Key<Value<Integer>> AGE_1 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
58+
59+
public static final Key<Value<Integer>> AGE_15 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
60+
61+
public static final Key<Value<Integer>> AGE_2 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
62+
63+
public static final Key<Value<Integer>> AGE_25 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
64+
65+
public static final Key<Value<Integer>> AGE_3 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
66+
67+
public static final Key<Value<Integer>> AGE_4 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
68+
69+
public static final Key<Value<Integer>> AGE_5 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
70+
71+
public static final Key<Value<Integer>> AGE_7 = BlockStateKeys.key(ResourceKey.minecraft("property/age"), Integer.class);
72+
73+
public static final Key<Value<Boolean>> ATTACHED = BlockStateKeys.key(ResourceKey.minecraft("property/attached"), Boolean.class);
74+
75+
public static final Key<Value<AttachmentSurface>> ATTACH_FACE = BlockStateKeys.key(ResourceKey.minecraft("property/face"), AttachmentSurface.class);
76+
77+
public static final Key<Value<Axis>> AXIS = BlockStateKeys.key(ResourceKey.minecraft("property/axis"), Axis.class);
78+
79+
public static final Key<Value<BambooLeavesType>> BAMBOO_LEAVES = BlockStateKeys.key(ResourceKey.minecraft("property/leaves"), BambooLeavesType.class);
80+
81+
public static final Key<Value<PortionType>> BED_PART = BlockStateKeys.key(ResourceKey.minecraft("property/part"), PortionType.class);
82+
83+
public static final Key<Value<BellAttachmentType>> BELL_ATTACHMENT = BlockStateKeys.key(ResourceKey.minecraft("property/attachment"), BellAttachmentType.class);
84+
85+
public static final Key<Value<Boolean>> BERRIES = BlockStateKeys.key(ResourceKey.minecraft("property/berries"), Boolean.class);
86+
87+
public static final Key<Value<Integer>> BITES = BlockStateKeys.key(ResourceKey.minecraft("property/bites"), Integer.class);
88+
89+
public static final Key<Value<Boolean>> BLOOM = BlockStateKeys.key(ResourceKey.minecraft("property/bloom"), Boolean.class);
90+
91+
public static final Key<Value<Boolean>> BOTTOM = BlockStateKeys.key(ResourceKey.minecraft("property/bottom"), Boolean.class);
92+
93+
public static final Key<Value<Integer>> CANDLES = BlockStateKeys.key(ResourceKey.minecraft("property/candles"), Integer.class);
94+
95+
public static final Key<Value<Boolean>> CAN_SUMMON = BlockStateKeys.key(ResourceKey.minecraft("property/can_summon"), Boolean.class);
96+
97+
public static final Key<Value<ChestAttachmentType>> CHEST_TYPE = BlockStateKeys.key(ResourceKey.minecraft("property/type"), ChestAttachmentType.class);
98+
99+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_0_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_0_occupied"), Boolean.class);
100+
101+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_1_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_1_occupied"), Boolean.class);
102+
103+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_2_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_2_occupied"), Boolean.class);
104+
105+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_3_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_3_occupied"), Boolean.class);
106+
107+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_4_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_4_occupied"), Boolean.class);
108+
109+
public static final Key<Value<Boolean>> CHISELED_BOOKSHELF_SLOT_5_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_5_occupied"), Boolean.class);
110+
111+
public static final Key<Value<Boolean>> CONDITIONAL = BlockStateKeys.key(ResourceKey.minecraft("property/conditional"), Boolean.class);
112+
113+
public static final Key<Value<Integer>> DELAY = BlockStateKeys.key(ResourceKey.minecraft("property/delay"), Integer.class);
114+
115+
public static final Key<Value<Boolean>> DISARMED = BlockStateKeys.key(ResourceKey.minecraft("property/disarmed"), Boolean.class);
116+
117+
public static final Key<Value<Integer>> DISTANCE = BlockStateKeys.key(ResourceKey.minecraft("property/distance"), Integer.class);
118+
119+
public static final Key<Value<DoorHinge>> DOOR_HINGE = BlockStateKeys.key(ResourceKey.minecraft("property/hinge"), DoorHinge.class);
120+
121+
public static final Key<Value<PortionType>> DOUBLE_BLOCK_HALF = BlockStateKeys.key(ResourceKey.minecraft("property/half"), PortionType.class);
122+
123+
public static final Key<Value<Boolean>> DOWN = BlockStateKeys.key(ResourceKey.minecraft("property/down"), Boolean.class);
124+
125+
public static final Key<Value<Boolean>> DRAG = BlockStateKeys.key(ResourceKey.minecraft("property/drag"), Boolean.class);
126+
127+
public static final Key<Value<DripstoneSegment>> DRIPSTONE_THICKNESS = BlockStateKeys.key(ResourceKey.minecraft("property/thickness"), DripstoneSegment.class);
128+
129+
public static final Key<Value<Boolean>> EAST = BlockStateKeys.key(ResourceKey.minecraft("property/east"), Boolean.class);
130+
131+
public static final Key<Value<WireAttachmentType>> EAST_REDSTONE = BlockStateKeys.key(ResourceKey.minecraft("property/east"), WireAttachmentType.class);
132+
133+
public static final Key<Value<WallConnectionState>> EAST_WALL = BlockStateKeys.key(ResourceKey.minecraft("property/east"), WallConnectionState.class);
134+
135+
public static final Key<Value<Integer>> EGGS = BlockStateKeys.key(ResourceKey.minecraft("property/eggs"), Integer.class);
136+
137+
public static final Key<Value<Boolean>> ENABLED = BlockStateKeys.key(ResourceKey.minecraft("property/enabled"), Boolean.class);
138+
139+
public static final Key<Value<Boolean>> EXTENDED = BlockStateKeys.key(ResourceKey.minecraft("property/extended"), Boolean.class);
140+
141+
public static final Key<Value<Boolean>> EYE = BlockStateKeys.key(ResourceKey.minecraft("property/eye"), Boolean.class);
142+
143+
public static final Key<Value<Direction>> FACING = BlockStateKeys.key(ResourceKey.minecraft("property/facing"), Direction.class);
144+
145+
public static final Key<Value<Direction>> FACING_HOPPER = BlockStateKeys.key(ResourceKey.minecraft("property/facing"), Direction.class);
146+
147+
public static final Key<Value<Boolean>> FALLING = BlockStateKeys.key(ResourceKey.minecraft("property/falling"), Boolean.class);
148+
149+
public static final Key<Value<PortionType>> HALF = BlockStateKeys.key(ResourceKey.minecraft("property/half"), PortionType.class);
150+
151+
public static final Key<Value<Boolean>> HANGING = BlockStateKeys.key(ResourceKey.minecraft("property/hanging"), Boolean.class);
152+
153+
public static final Key<Value<Boolean>> HAS_BOOK = BlockStateKeys.key(ResourceKey.minecraft("property/has_book"), Boolean.class);
154+
155+
public static final Key<Value<Boolean>> HAS_BOTTLE_0 = BlockStateKeys.key(ResourceKey.minecraft("property/has_bottle_0"), Boolean.class);
156+
157+
public static final Key<Value<Boolean>> HAS_BOTTLE_1 = BlockStateKeys.key(ResourceKey.minecraft("property/has_bottle_1"), Boolean.class);
158+
159+
public static final Key<Value<Boolean>> HAS_BOTTLE_2 = BlockStateKeys.key(ResourceKey.minecraft("property/has_bottle_2"), Boolean.class);
160+
161+
public static final Key<Value<Boolean>> HAS_RECORD = BlockStateKeys.key(ResourceKey.minecraft("property/has_record"), Boolean.class);
162+
163+
public static final Key<Value<Integer>> HATCH = BlockStateKeys.key(ResourceKey.minecraft("property/hatch"), Integer.class);
164+
165+
public static final Key<Value<Axis>> HORIZONTAL_AXIS = BlockStateKeys.key(ResourceKey.minecraft("property/axis"), Axis.class);
166+
167+
public static final Key<Value<Direction>> HORIZONTAL_FACING = BlockStateKeys.key(ResourceKey.minecraft("property/facing"), Direction.class);
168+
169+
public static final Key<Value<Boolean>> INVERTED = BlockStateKeys.key(ResourceKey.minecraft("property/inverted"), Boolean.class);
170+
171+
public static final Key<Value<Boolean>> IN_WALL = BlockStateKeys.key(ResourceKey.minecraft("property/in_wall"), Boolean.class);
172+
173+
public static final Key<Value<Integer>> LAYERS = BlockStateKeys.key(ResourceKey.minecraft("property/layers"), Integer.class);
174+
175+
public static final Key<Value<Integer>> LEVEL = BlockStateKeys.key(ResourceKey.minecraft("property/level"), Integer.class);
176+
177+
public static final Key<Value<Integer>> LEVEL_CAULDRON = BlockStateKeys.key(ResourceKey.minecraft("property/level"), Integer.class);
178+
179+
public static final Key<Value<Integer>> LEVEL_COMPOSTER = BlockStateKeys.key(ResourceKey.minecraft("property/level"), Integer.class);
180+
181+
public static final Key<Value<Integer>> LEVEL_FLOWING = BlockStateKeys.key(ResourceKey.minecraft("property/level"), Integer.class);
182+
183+
public static final Key<Value<Integer>> LEVEL_HONEY = BlockStateKeys.key(ResourceKey.minecraft("property/honey_level"), Integer.class);
184+
185+
public static final Key<Value<Boolean>> LIT = BlockStateKeys.key(ResourceKey.minecraft("property/lit"), Boolean.class);
186+
187+
public static final Key<Value<Boolean>> LOCKED = BlockStateKeys.key(ResourceKey.minecraft("property/locked"), Boolean.class);
188+
189+
public static final Key<Value<ComparatorMode>> MODE_COMPARATOR = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), ComparatorMode.class);
190+
191+
public static final Key<Value<Integer>> MOISTURE = BlockStateKeys.key(ResourceKey.minecraft("property/moisture"), Integer.class);
192+
193+
public static final Key<Value<Boolean>> NORTH = BlockStateKeys.key(ResourceKey.minecraft("property/north"), Boolean.class);
194+
195+
public static final Key<Value<WireAttachmentType>> NORTH_REDSTONE = BlockStateKeys.key(ResourceKey.minecraft("property/north"), WireAttachmentType.class);
196+
197+
public static final Key<Value<WallConnectionState>> NORTH_WALL = BlockStateKeys.key(ResourceKey.minecraft("property/north"), WallConnectionState.class);
198+
199+
public static final Key<Value<Integer>> NOTE = BlockStateKeys.key(ResourceKey.minecraft("property/note"), Integer.class);
200+
201+
public static final Key<Value<InstrumentType>> NOTEBLOCK_INSTRUMENT = BlockStateKeys.key(ResourceKey.minecraft("property/instrument"), InstrumentType.class);
202+
203+
public static final Key<Value<Boolean>> OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/occupied"), Boolean.class);
204+
205+
public static final Key<Value<Boolean>> OPEN = BlockStateKeys.key(ResourceKey.minecraft("property/open"), Boolean.class);
206+
207+
public static final Key<Value<JigsawBlockOrientation>> ORIENTATION = BlockStateKeys.key(ResourceKey.minecraft("property/orientation"), JigsawBlockOrientation.class);
208+
209+
public static final Key<Value<Boolean>> PERSISTENT = BlockStateKeys.key(ResourceKey.minecraft("property/persistent"), Boolean.class);
210+
211+
public static final Key<Value<Integer>> PICKLES = BlockStateKeys.key(ResourceKey.minecraft("property/pickles"), Integer.class);
212+
213+
public static final Key<Value<PistonType>> PISTON_TYPE = BlockStateKeys.key(ResourceKey.minecraft("property/type"), PistonType.class);
214+
215+
public static final Key<Value<Integer>> POWER = BlockStateKeys.key(ResourceKey.minecraft("property/power"), Integer.class);
216+
217+
public static final Key<Value<Boolean>> POWERED = BlockStateKeys.key(ResourceKey.minecraft("property/powered"), Boolean.class);
218+
219+
public static final Key<Value<RailDirection>> RAIL_SHAPE = BlockStateKeys.key(ResourceKey.minecraft("property/shape"), RailDirection.class);
220+
221+
public static final Key<Value<RailDirection>> RAIL_SHAPE_STRAIGHT = BlockStateKeys.key(ResourceKey.minecraft("property/shape"), RailDirection.class);
222+
223+
public static final Key<Value<Integer>> RESPAWN_ANCHOR_CHARGES = BlockStateKeys.key(ResourceKey.minecraft("property/charges"), Integer.class);
224+
225+
public static final Key<Value<Integer>> ROTATION_16 = BlockStateKeys.key(ResourceKey.minecraft("property/rotation"), Integer.class);
226+
227+
public static final Key<Value<SculkSensorState>> SCULK_SENSOR_PHASE = BlockStateKeys.key(ResourceKey.minecraft("property/sculk_sensor_phase"), SculkSensorState.class);
228+
229+
public static final Key<Value<Boolean>> SHORT = BlockStateKeys.key(ResourceKey.minecraft("property/short"), Boolean.class);
230+
231+
public static final Key<Value<Boolean>> SHRIEKING = BlockStateKeys.key(ResourceKey.minecraft("property/shrieking"), Boolean.class);
232+
233+
public static final Key<Value<Boolean>> SIGNAL_FIRE = BlockStateKeys.key(ResourceKey.minecraft("property/signal_fire"), Boolean.class);
234+
235+
public static final Key<Value<SlabPortion>> SLAB_TYPE = BlockStateKeys.key(ResourceKey.minecraft("property/type"), SlabPortion.class);
236+
237+
public static final Key<Value<Boolean>> SNOWY = BlockStateKeys.key(ResourceKey.minecraft("property/snowy"), Boolean.class);
238+
239+
public static final Key<Value<Boolean>> SOUTH = BlockStateKeys.key(ResourceKey.minecraft("property/south"), Boolean.class);
240+
241+
public static final Key<Value<WireAttachmentType>> SOUTH_REDSTONE = BlockStateKeys.key(ResourceKey.minecraft("property/south"), WireAttachmentType.class);
242+
243+
public static final Key<Value<WallConnectionState>> SOUTH_WALL = BlockStateKeys.key(ResourceKey.minecraft("property/south"), WallConnectionState.class);
244+
245+
public static final Key<Value<Integer>> STABILITY_DISTANCE = BlockStateKeys.key(ResourceKey.minecraft("property/distance"), Integer.class);
246+
247+
public static final Key<Value<Integer>> STAGE = BlockStateKeys.key(ResourceKey.minecraft("property/stage"), Integer.class);
248+
249+
public static final Key<Value<StairShape>> STAIRS_SHAPE = BlockStateKeys.key(ResourceKey.minecraft("property/shape"), StairShape.class);
250+
251+
public static final Key<Value<StructureMode>> STRUCTUREBLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), StructureMode.class);
252+
253+
public static final Key<Value<Tilt>> TILT = BlockStateKeys.key(ResourceKey.minecraft("property/tilt"), Tilt.class);
254+
255+
public static final Key<Value<Boolean>> TRIGGERED = BlockStateKeys.key(ResourceKey.minecraft("property/triggered"), Boolean.class);
256+
257+
public static final Key<Value<Boolean>> UNSTABLE = BlockStateKeys.key(ResourceKey.minecraft("property/unstable"), Boolean.class);
258+
259+
public static final Key<Value<Boolean>> UP = BlockStateKeys.key(ResourceKey.minecraft("property/up"), Boolean.class);
260+
261+
public static final Key<Value<Direction>> VERTICAL_DIRECTION = BlockStateKeys.key(ResourceKey.minecraft("property/vertical_direction"), Direction.class);
262+
263+
public static final Key<Value<Boolean>> VINE_END = BlockStateKeys.key(ResourceKey.minecraft("property/vine_end"), Boolean.class);
264+
265+
public static final Key<Value<Boolean>> WATERLOGGED = BlockStateKeys.key(ResourceKey.minecraft("property/waterlogged"), Boolean.class);
266+
267+
public static final Key<Value<Boolean>> WEST = BlockStateKeys.key(ResourceKey.minecraft("property/west"), Boolean.class);
268+
269+
public static final Key<Value<WireAttachmentType>> WEST_REDSTONE = BlockStateKeys.key(ResourceKey.minecraft("property/west"), WireAttachmentType.class);
270+
271+
public static final Key<Value<WallConnectionState>> WEST_WALL = BlockStateKeys.key(ResourceKey.minecraft("property/west"), WallConnectionState.class);
272+
273+
private BlockStateKeys() {
274+
}
275+
276+
private static <T> Key<Value<T>> key(final ResourceKey resourceKey, final Class<T> type) {
277+
return Key.builder().key(resourceKey).elementType(type).build();
278+
}
279+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
import org.spongepowered.api.data.type.Tilt;
9090
import org.spongepowered.api.data.type.TropicalFishShape;
9191
import org.spongepowered.api.data.type.VillagerType;
92+
import org.spongepowered.api.data.type.WallConnectionState;
9293
import org.spongepowered.api.data.type.WireAttachmentType;
9394
import org.spongepowered.api.data.value.ListValue;
9495
import org.spongepowered.api.data.value.MapValue;
@@ -3173,6 +3174,14 @@ public final class Keys {
31733174
*/
31743175
public static final Key<Value<Double>> WALKING_SPEED = Keys.key(ResourceKey.sponge("walking_speed"), Double.class);
31753176

3177+
/**
3178+
* The connection state of a wall in all four cardinal directions (north, west, east, and south).
3179+
* <p>See {@link BlockStateKeys#NORTH_WALL}, {@link BlockStateKeys#EAST_WALL},
3180+
* {@link BlockStateKeys#SOUTH_WALL} or {@link BlockStateKeys#WEST_WALL} for the individual connections.
3181+
* </p>
3182+
*/
3183+
public static final Key<MapValue<Direction, WallConnectionState>> WALL_CONNECTION_STATES = Keys.mapKey(ResourceKey.sponge("wall_connection_states"), Direction.class, WallConnectionState.class);
3184+
31763185
/**
31773186
* The color of water in a {@link Biome}.
31783187
* Readonly

src/main/java/org/spongepowered/api/data/type/WallType.java renamed to src/main/java/org/spongepowered/api/data/type/WallConnectionState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/**
3131
* Represents the type of wall BlockStates
3232
*/
33-
@CatalogedBy(WallTypes.class)
34-
public interface WallType extends DefaultedRegistryValue, Comparable<WallType> {
33+
@CatalogedBy(WallConnectionStates.class)
34+
public interface WallConnectionState extends DefaultedRegistryValue, Comparable<WallConnectionState> {
3535

3636
}

0 commit comments

Comments
 (0)