Skip to content

Commit

Permalink
chore(update): update to 24w38a
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
  • Loading branch information
gabizou committed Sep 23, 2024
1 parent 3de731c commit 668afe2
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 234 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mixinConfigs=mixins.sponge.accessors.json,mixins.sponge.api.json,mixins.sponge.c
mixins.sponge.tracker.json,mixins.sponge.ipforward.json,mixins.sponge.optimization.json
superClassChanges=common.superclasschange

minecraftVersion=24w37a
minecraftVersion=24w38a
recommendedVersion=0-SNAPSHOT

org.gradle.dependency.verification.console=verbose
Expand Down
3 changes: 3 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,9 @@
</artifact>
</component>
<component group="com.mojang" name="jtracy" version="1.0.29">
<artifact name="jtracy-1.0.29-natives-linux.jar">
<sha256 value="d9f5ed87582bdd39e3f36641373d1aa60e6d097f699f759feb595abace5c76b1" origin="Generated by Gradle"/>
</artifact>
<artifact name="jtracy-1.0.29-natives-macos.jar">
<sha256 value="9c48e08acc0f3de41c82cbb803ed8da349834682a52f8f24efde0b77ef8e4723" origin="Generated by Gradle"/>
</artifact>
Expand Down
275 changes: 97 additions & 178 deletions src/main/java/org/spongepowered/common/util/DirectionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
package org.spongepowered.common.util;


import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.spongepowered.api.util.Direction;

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

public static net.minecraft.core.Direction getFor(final Direction direction) {
Objects.requireNonNull(direction);
switch (direction) {
case UP:
return net.minecraft.core.Direction.UP;
case DOWN:
return net.minecraft.core.Direction.DOWN;
case WEST:
return net.minecraft.core.Direction.WEST;
case SOUTH:
return net.minecraft.core.Direction.SOUTH;
case EAST:
return net.minecraft.core.Direction.EAST;
case NORTH:
return net.minecraft.core.Direction.NORTH;
default:
return null;
}
return switch (direction) {
case UP -> net.minecraft.core.Direction.UP;
case DOWN -> net.minecraft.core.Direction.DOWN;
case WEST -> net.minecraft.core.Direction.WEST;
case SOUTH -> net.minecraft.core.Direction.SOUTH;
case EAST -> net.minecraft.core.Direction.EAST;
case NORTH -> net.minecraft.core.Direction.NORTH;
default -> null;
};
}

public static Direction getFor(final net.minecraft.core.Direction facing) {
Objects.requireNonNull(facing);
switch (facing) {
case UP:
return Direction.UP;
case DOWN:
return Direction.DOWN;
case WEST:
return Direction.WEST;
case SOUTH:
return Direction.SOUTH;
case EAST:
return Direction.EAST;
case NORTH:
return Direction.NORTH;
default:
throw new IllegalStateException();
}
return switch (facing) {
case UP -> Direction.UP;
case DOWN -> Direction.DOWN;
case WEST -> Direction.WEST;
case SOUTH -> Direction.SOUTH;
case EAST -> Direction.EAST;
case NORTH -> Direction.NORTH;
default -> throw new IllegalStateException();
};
}

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) {
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) {
final net.minecraft.core.Direction direction = DirectionUtil.getFor(value);
if (direction == null || !property.getPossibleValues().contains(direction)) {
return holder;
Expand All @@ -81,168 +67,101 @@ public static net.minecraft.world.level.block.state.BlockState set(final net.min
}

public static Direction fromRotation(int i) {
switch (i) {
case 0:
return Direction.SOUTH;
case 1:
return Direction.SOUTH_SOUTHWEST;
case 2:
return Direction.SOUTHWEST;
case 3:
return Direction.WEST_SOUTHWEST;
case 4:
return Direction.WEST;
case 5:
return Direction.WEST_NORTHWEST;
case 6:
return Direction.NORTHWEST;
case 7:
return Direction.NORTH_NORTHWEST;
case 8:
return Direction.NORTH;
case 9:
return Direction.NORTH_NORTHEAST;
case 10:
return Direction.NORTHEAST;
case 11:
return Direction.EAST_NORTHEAST;
case 12:
return Direction.EAST;
case 13:
return Direction.EAST_SOUTHEAST;
case 14:
return Direction.SOUTHEAST;
case 15:
return Direction.SOUTH_SOUTHEAST;
default:
return Direction.NORTH;
}
return switch (i) {
case 0 -> Direction.SOUTH;
case 1 -> Direction.SOUTH_SOUTHWEST;
case 2 -> Direction.SOUTHWEST;
case 3 -> Direction.WEST_SOUTHWEST;
case 4 -> Direction.WEST;
case 5 -> Direction.WEST_NORTHWEST;
case 6 -> Direction.NORTHWEST;
case 7 -> Direction.NORTH_NORTHWEST;
case 8 -> Direction.NORTH;
case 9 -> Direction.NORTH_NORTHEAST;
case 10 -> Direction.NORTHEAST;
case 11 -> Direction.EAST_NORTHEAST;
case 12 -> Direction.EAST;
case 13 -> Direction.EAST_SOUTHEAST;
case 14 -> Direction.SOUTHEAST;
case 15 -> Direction.SOUTH_SOUTHEAST;
default -> Direction.NORTH;
};
}
public static int toRotation(final Direction direction) {
switch (direction) {
case SOUTH:
return 0;
case SOUTH_SOUTHWEST:
return 1;
case SOUTHWEST:
return 2;
case WEST_SOUTHWEST:
return 3;
case WEST:
return 4;
case WEST_NORTHWEST:
return 5;
case NORTHWEST:
return 6;
case NORTH_NORTHWEST:
return 7;
case NORTH:
return 8;
case NORTH_NORTHEAST:
return 9;
case NORTHEAST:
return 10;
case EAST_NORTHEAST:
return 11;
case EAST:
return 12;
case EAST_SOUTHEAST:
return 13;
case SOUTHEAST:
return 14;
case SOUTH_SOUTHEAST:
return 15;
default:
return 0;
}
return switch (direction) {
case SOUTH -> 0;
case SOUTH_SOUTHWEST -> 1;
case SOUTHWEST -> 2;
case WEST_SOUTHWEST -> 3;
case WEST -> 4;
case WEST_NORTHWEST -> 5;
case NORTHWEST -> 6;
case NORTH_NORTHWEST -> 7;
case NORTH -> 8;
case NORTH_NORTHEAST -> 9;
case NORTHEAST -> 10;
case EAST_NORTHEAST -> 11;
case EAST -> 12;
case EAST_SOUTHEAST -> 13;
case SOUTHEAST -> 14;
case SOUTH_SOUTHEAST -> 15;
default -> 0;
};
}

public static Direction fromHorizontalHanging(int i) {
switch (i) {
case 0:
return Direction.SOUTH;
case 1:
return Direction.WEST;
case 2:
return Direction.NORTH;
case 3:
return Direction.EAST;
default:
return Direction.NORTH;
}
return switch (i) {
case 0 -> Direction.SOUTH;
case 1 -> Direction.WEST;
case 2 -> Direction.NORTH;
case 3 -> Direction.EAST;
default -> Direction.NORTH;
};
}

public static int toHorizontalHanging(Direction direction) {
switch (direction) {
case SOUTH:
return 0;
case WEST:
return 1;
case NORTH:
return 2;
case EAST:
return 3;
default:
return 0;
}
return switch (direction) {
case SOUTH -> 0;
case WEST -> 1;
case NORTH -> 2;
case EAST -> 3;
default -> 0;
};
}


public static Direction fromHanging(int i) {
switch (i) {
case 0:
return Direction.DOWN;
case 1:
return Direction.UP;
case 2:
return Direction.NORTH;
case 3:
return Direction.SOUTH;
case 4:
return Direction.WEST;
case 5:
return Direction.EAST;
default:
return Direction.DOWN;
}
return switch (i) {
case 0 -> Direction.DOWN;
case 1 -> Direction.UP;
case 2 -> Direction.NORTH;
case 3 -> Direction.SOUTH;
case 4 -> Direction.WEST;
case 5 -> Direction.EAST;
default -> Direction.DOWN;
};
}

public static int toHanging(Direction direction) {
switch (direction) {
case DOWN:
return 0;
case UP:
return 1;
case NORTH:
return 2;
case SOUTH:
return 3;
case WEST:
return 4;
case EAST:
return 5;
default:
return 0;
}
return switch (direction) {
case DOWN -> 0;
case UP -> 1;
case NORTH -> 2;
case SOUTH -> 3;
case WEST -> 4;
case EAST -> 5;
default -> 0;
};
}

public static int directionToIndex(final Direction direction) {
switch (direction) {
case NORTH:
case NORTHEAST:
case NORTHWEST:
return 0;
case SOUTH:
case SOUTHEAST:
case SOUTHWEST:
return 1;
case EAST:
return 2;
case WEST:
return 3;
default:
throw new IllegalArgumentException("Unexpected direction");
}
return switch (direction) {
case NORTH, NORTHEAST, NORTHWEST -> 0;
case SOUTH, SOUTHEAST, SOUTHWEST -> 1;
case EAST -> 2;
case WEST -> 3;
default -> throw new IllegalArgumentException("Unexpected direction");
};
}

private DirectionUtil() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public abstract class ServerGamePacketListenerImplMixin extends ServerCommonPack
@Shadow private double vehicleFirstGoodX;
@Shadow private double vehicleFirstGoodY;
@Shadow private double vehicleFirstGoodZ;
@Shadow private int chatSpamTickCount;

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

0 comments on commit 668afe2

Please sign in to comment.