Skip to content

Commit a68c57b

Browse files
committed
chore(update): update to 24w38a
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
1 parent 3de731c commit a68c57b

File tree

5 files changed

+98
-234
lines changed

5 files changed

+98
-234
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
1212
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json
1313
superClassChanges=common.superclasschange
1414

15-
minecraftVersion=24w37a
15+
minecraftVersion=24w38a
1616
recommendedVersion=0-SNAPSHOT
1717

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

src/main/java/org/spongepowered/common/util/DirectionUtil.java

Lines changed: 97 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
package org.spongepowered.common.util;
2626

2727

28-
import net.minecraft.world.level.block.state.properties.DirectionProperty;
28+
import net.minecraft.world.level.block.state.properties.EnumProperty;
2929
import org.spongepowered.api.util.Direction;
3030

3131
import java.util.Objects;
@@ -34,45 +34,31 @@ public final class DirectionUtil {
3434

3535
public static net.minecraft.core.Direction getFor(final Direction direction) {
3636
Objects.requireNonNull(direction);
37-
switch (direction) {
38-
case UP:
39-
return net.minecraft.core.Direction.UP;
40-
case DOWN:
41-
return net.minecraft.core.Direction.DOWN;
42-
case WEST:
43-
return net.minecraft.core.Direction.WEST;
44-
case SOUTH:
45-
return net.minecraft.core.Direction.SOUTH;
46-
case EAST:
47-
return net.minecraft.core.Direction.EAST;
48-
case NORTH:
49-
return net.minecraft.core.Direction.NORTH;
50-
default:
51-
return null;
52-
}
37+
return switch (direction) {
38+
case UP -> net.minecraft.core.Direction.UP;
39+
case DOWN -> net.minecraft.core.Direction.DOWN;
40+
case WEST -> net.minecraft.core.Direction.WEST;
41+
case SOUTH -> net.minecraft.core.Direction.SOUTH;
42+
case EAST -> net.minecraft.core.Direction.EAST;
43+
case NORTH -> net.minecraft.core.Direction.NORTH;
44+
default -> null;
45+
};
5346
}
5447

5548
public static Direction getFor(final net.minecraft.core.Direction facing) {
5649
Objects.requireNonNull(facing);
57-
switch (facing) {
58-
case UP:
59-
return Direction.UP;
60-
case DOWN:
61-
return Direction.DOWN;
62-
case WEST:
63-
return Direction.WEST;
64-
case SOUTH:
65-
return Direction.SOUTH;
66-
case EAST:
67-
return Direction.EAST;
68-
case NORTH:
69-
return Direction.NORTH;
70-
default:
71-
throw new IllegalStateException();
72-
}
50+
return switch (facing) {
51+
case UP -> Direction.UP;
52+
case DOWN -> Direction.DOWN;
53+
case WEST -> Direction.WEST;
54+
case SOUTH -> Direction.SOUTH;
55+
case EAST -> Direction.EAST;
56+
case NORTH -> Direction.NORTH;
57+
default -> throw new IllegalStateException();
58+
};
7359
}
7460

75-
public static net.minecraft.world.level.block.state.BlockState set(final net.minecraft.world.level.block.state.BlockState holder, final Direction value, final DirectionProperty property) {
61+
public static net.minecraft.world.level.block.state.BlockState set(final net.minecraft.world.level.block.state.BlockState holder, final Direction value, final EnumProperty<net.minecraft.core.Direction> property) {
7662
final net.minecraft.core.Direction direction = DirectionUtil.getFor(value);
7763
if (direction == null || !property.getPossibleValues().contains(direction)) {
7864
return holder;
@@ -81,168 +67,101 @@ public static net.minecraft.world.level.block.state.BlockState set(final net.min
8167
}
8268

8369
public static Direction fromRotation(int i) {
84-
switch (i) {
85-
case 0:
86-
return Direction.SOUTH;
87-
case 1:
88-
return Direction.SOUTH_SOUTHWEST;
89-
case 2:
90-
return Direction.SOUTHWEST;
91-
case 3:
92-
return Direction.WEST_SOUTHWEST;
93-
case 4:
94-
return Direction.WEST;
95-
case 5:
96-
return Direction.WEST_NORTHWEST;
97-
case 6:
98-
return Direction.NORTHWEST;
99-
case 7:
100-
return Direction.NORTH_NORTHWEST;
101-
case 8:
102-
return Direction.NORTH;
103-
case 9:
104-
return Direction.NORTH_NORTHEAST;
105-
case 10:
106-
return Direction.NORTHEAST;
107-
case 11:
108-
return Direction.EAST_NORTHEAST;
109-
case 12:
110-
return Direction.EAST;
111-
case 13:
112-
return Direction.EAST_SOUTHEAST;
113-
case 14:
114-
return Direction.SOUTHEAST;
115-
case 15:
116-
return Direction.SOUTH_SOUTHEAST;
117-
default:
118-
return Direction.NORTH;
119-
}
70+
return switch (i) {
71+
case 0 -> Direction.SOUTH;
72+
case 1 -> Direction.SOUTH_SOUTHWEST;
73+
case 2 -> Direction.SOUTHWEST;
74+
case 3 -> Direction.WEST_SOUTHWEST;
75+
case 4 -> Direction.WEST;
76+
case 5 -> Direction.WEST_NORTHWEST;
77+
case 6 -> Direction.NORTHWEST;
78+
case 7 -> Direction.NORTH_NORTHWEST;
79+
case 8 -> Direction.NORTH;
80+
case 9 -> Direction.NORTH_NORTHEAST;
81+
case 10 -> Direction.NORTHEAST;
82+
case 11 -> Direction.EAST_NORTHEAST;
83+
case 12 -> Direction.EAST;
84+
case 13 -> Direction.EAST_SOUTHEAST;
85+
case 14 -> Direction.SOUTHEAST;
86+
case 15 -> Direction.SOUTH_SOUTHEAST;
87+
default -> Direction.NORTH;
88+
};
12089
}
12190
public static int toRotation(final Direction direction) {
122-
switch (direction) {
123-
case SOUTH:
124-
return 0;
125-
case SOUTH_SOUTHWEST:
126-
return 1;
127-
case SOUTHWEST:
128-
return 2;
129-
case WEST_SOUTHWEST:
130-
return 3;
131-
case WEST:
132-
return 4;
133-
case WEST_NORTHWEST:
134-
return 5;
135-
case NORTHWEST:
136-
return 6;
137-
case NORTH_NORTHWEST:
138-
return 7;
139-
case NORTH:
140-
return 8;
141-
case NORTH_NORTHEAST:
142-
return 9;
143-
case NORTHEAST:
144-
return 10;
145-
case EAST_NORTHEAST:
146-
return 11;
147-
case EAST:
148-
return 12;
149-
case EAST_SOUTHEAST:
150-
return 13;
151-
case SOUTHEAST:
152-
return 14;
153-
case SOUTH_SOUTHEAST:
154-
return 15;
155-
default:
156-
return 0;
157-
}
91+
return switch (direction) {
92+
case SOUTH -> 0;
93+
case SOUTH_SOUTHWEST -> 1;
94+
case SOUTHWEST -> 2;
95+
case WEST_SOUTHWEST -> 3;
96+
case WEST -> 4;
97+
case WEST_NORTHWEST -> 5;
98+
case NORTHWEST -> 6;
99+
case NORTH_NORTHWEST -> 7;
100+
case NORTH -> 8;
101+
case NORTH_NORTHEAST -> 9;
102+
case NORTHEAST -> 10;
103+
case EAST_NORTHEAST -> 11;
104+
case EAST -> 12;
105+
case EAST_SOUTHEAST -> 13;
106+
case SOUTHEAST -> 14;
107+
case SOUTH_SOUTHEAST -> 15;
108+
default -> 0;
109+
};
158110
}
159111

160112
public static Direction fromHorizontalHanging(int i) {
161-
switch (i) {
162-
case 0:
163-
return Direction.SOUTH;
164-
case 1:
165-
return Direction.WEST;
166-
case 2:
167-
return Direction.NORTH;
168-
case 3:
169-
return Direction.EAST;
170-
default:
171-
return Direction.NORTH;
172-
}
113+
return switch (i) {
114+
case 0 -> Direction.SOUTH;
115+
case 1 -> Direction.WEST;
116+
case 2 -> Direction.NORTH;
117+
case 3 -> Direction.EAST;
118+
default -> Direction.NORTH;
119+
};
173120
}
174121

175122
public static int toHorizontalHanging(Direction direction) {
176-
switch (direction) {
177-
case SOUTH:
178-
return 0;
179-
case WEST:
180-
return 1;
181-
case NORTH:
182-
return 2;
183-
case EAST:
184-
return 3;
185-
default:
186-
return 0;
187-
}
123+
return switch (direction) {
124+
case SOUTH -> 0;
125+
case WEST -> 1;
126+
case NORTH -> 2;
127+
case EAST -> 3;
128+
default -> 0;
129+
};
188130
}
189131

190132

191133
public static Direction fromHanging(int i) {
192-
switch (i) {
193-
case 0:
194-
return Direction.DOWN;
195-
case 1:
196-
return Direction.UP;
197-
case 2:
198-
return Direction.NORTH;
199-
case 3:
200-
return Direction.SOUTH;
201-
case 4:
202-
return Direction.WEST;
203-
case 5:
204-
return Direction.EAST;
205-
default:
206-
return Direction.DOWN;
207-
}
134+
return switch (i) {
135+
case 0 -> Direction.DOWN;
136+
case 1 -> Direction.UP;
137+
case 2 -> Direction.NORTH;
138+
case 3 -> Direction.SOUTH;
139+
case 4 -> Direction.WEST;
140+
case 5 -> Direction.EAST;
141+
default -> Direction.DOWN;
142+
};
208143
}
209144

210145
public static int toHanging(Direction direction) {
211-
switch (direction) {
212-
case DOWN:
213-
return 0;
214-
case UP:
215-
return 1;
216-
case NORTH:
217-
return 2;
218-
case SOUTH:
219-
return 3;
220-
case WEST:
221-
return 4;
222-
case EAST:
223-
return 5;
224-
default:
225-
return 0;
226-
}
146+
return switch (direction) {
147+
case DOWN -> 0;
148+
case UP -> 1;
149+
case NORTH -> 2;
150+
case SOUTH -> 3;
151+
case WEST -> 4;
152+
case EAST -> 5;
153+
default -> 0;
154+
};
227155
}
228156

229157
public static int directionToIndex(final Direction direction) {
230-
switch (direction) {
231-
case NORTH:
232-
case NORTHEAST:
233-
case NORTHWEST:
234-
return 0;
235-
case SOUTH:
236-
case SOUTHEAST:
237-
case SOUTHWEST:
238-
return 1;
239-
case EAST:
240-
return 2;
241-
case WEST:
242-
return 3;
243-
default:
244-
throw new IllegalArgumentException("Unexpected direction");
245-
}
158+
return switch (direction) {
159+
case NORTH, NORTHEAST, NORTHWEST -> 0;
160+
case SOUTH, SOUTHEAST, SOUTHWEST -> 1;
161+
case EAST -> 2;
162+
case WEST -> 3;
163+
default -> throw new IllegalArgumentException("Unexpected direction");
164+
};
246165
}
247166

248167
private DirectionUtil() {

src/mixins/java/org/spongepowered/common/mixin/core/server/network/ServerGamePacketListenerImplMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public abstract class ServerGamePacketListenerImplMixin extends ServerCommonPack
126126
@Shadow private double vehicleFirstGoodX;
127127
@Shadow private double vehicleFirstGoodY;
128128
@Shadow private double vehicleFirstGoodZ;
129-
@Shadow private int chatSpamTickCount;
130129

131130
@Shadow public abstract void shadow$teleport(PositionMoveRotation pitch, Set<Relative> relativeArguments);
132131
@Shadow protected abstract CompletableFuture<List<FilteredText>> shadow$filterTextPacket(final List<String> $$0);

src/mixins/java/org/spongepowered/common/mixin/tracker/world/level/LevelAccessorMixin_Tracker.java

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

src/mixins/resources/mixins.sponge.tracker.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"world.item.ItemStackMixin_Tracker",
3434
"world.level.BlockEventDataMixin_Tracker",
3535
"world.level.ServerExplosionMixin_Tracker",
36-
"world.level.LevelAccessorMixin_Tracker",
3736
"world.level.LevelHeightAccessorMixin_Tracker",
3837
"world.level.LevelMixin_Tracker",
3938
"world.level.block.BlockMixin_Tracker",

0 commit comments

Comments
 (0)