Skip to content

Commit

Permalink
Remove dfu
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 8, 2024
1 parent bcd5c8a commit 98e3b24
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 110 deletions.
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ terminalconsoleappender = "net.minecrell:terminalconsoleappender:1.3.0"
slf4j = "org.slf4j:slf4j-api:2.0.16"
disruptor = "com.lmax:disruptor:4.0.0"
brigadier = "com.mojang:brigadier:1.1.8"
datafixerupper = "com.mojang:datafixerupper:7.0.14"
picoli = "info.picocli:picocli:4.7.6"
picoli-codegen = "info.picocli:picocli-codegen:4.7.6"
mcprotocollib = { module = "com.github.AlexProgrammerDE:MCProtocolLib", version.ref = "mcprotocollib" }
Expand Down
1 change: 0 additions & 1 deletion server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies {
}
api(libs.mcstructs)
api(libs.bundles.kyori)
api(libs.datafixerupper)

// Netty raknet support for ViaBedrock
api(libs.netty.raknet) {
Expand Down
6 changes: 0 additions & 6 deletions server/src/main/java/com/soulfiremc/server/data/Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package com.soulfiremc.server.data;

import com.mojang.serialization.Codec;
import com.soulfiremc.server.protocol.codecs.ExtraCodecs;
import it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ReferenceMap;
Expand All @@ -33,11 +31,7 @@ public class Registry<T extends RegistryValue<T>> {
@Getter
private final ResourceKey<? extends Registry<T>> registryKey;
private final Object2ReferenceMap<Key, T> FROM_KEY = new Object2ReferenceOpenHashMap<>();
@Getter
private final Codec<T> keyCodec = ExtraCodecs.KYORI_KEY_CODEC.xmap(this::getByKey, RegistryValue::key);
private final Int2ReferenceMap<T> FROM_ID = new Int2ReferenceOpenHashMap<>();
@Getter
private final Codec<T> idCodec = Codec.INT.xmap(this::getById, RegistryValue::id);

@SuppressWarnings("unchecked")
public Registry(ResourceKey<?> registryKey) {
Expand Down
18 changes: 0 additions & 18 deletions server/src/main/java/com/soulfiremc/server/data/TagKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/
package com.soulfiremc.server.data;

import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import com.soulfiremc.server.protocol.codecs.ExtraCodecs;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;

Expand All @@ -32,19 +29,4 @@ public static <T extends RegistryValue<T>> TagKey<T> key(@KeyPattern String key,
public static <T extends RegistryValue<T>> TagKey<T> key(Key key, ResourceKey<?> registry) {
return new TagKey<>((ResourceKey<? extends Registry<T>>) registry, key);
}

public static <T extends RegistryValue<T>> Codec<TagKey<T>> codec(ResourceKey<? extends Registry<T>> registry) {
return ExtraCodecs.KYORI_KEY_CODEC.xmap(path -> new TagKey<>(registry, path), TagKey::key);
}

@SuppressWarnings("PatternValidation")
public static <T extends RegistryValue<T>> Codec<TagKey<T>> hashedCodec(ResourceKey<? extends Registry<T>> registry) {
return Codec.STRING
.comapFlatMap(
location -> location.startsWith("#") && Key.parseable(location.substring(1))
? DataResult.success(new TagKey<>(registry, Key.key(location.substring(1))))
: DataResult.error(() -> "Not a tag id"),
tagKey -> "#" + tagKey.key()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
*/
package com.soulfiremc.server.util.mcstructs;


import com.google.common.collect.Iterators;
import com.mojang.serialization.DataResult;
import com.soulfiremc.server.util.MathHelper;
import org.cloudburstmc.math.vector.Vector3d;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.math.vector.Vector3i;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;

import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.function.Predicate;
import java.util.stream.Stream;

Expand All @@ -53,7 +53,7 @@ public enum Direction {
.sorted(Comparator.comparingInt(arg -> arg.data2d))
.toArray(Direction[]::new);

private Direction(
Direction(
final int j, final int k, final int l, final String string2, final Direction.AxisDirection arg, final Direction.Axis arg2, final Vector3i arg3
) {
this.data3d = j;
Expand Down Expand Up @@ -149,19 +149,19 @@ private Direction getClockWiseZ() {
return switch (this) {
case DOWN -> WEST;
case UP -> EAST;
default -> throw new IllegalStateException("Unable to get Z-rotated facing of " + this);
case WEST -> UP;
case EAST -> DOWN;
default -> throw new IllegalStateException("Unable to get Z-rotated facing of " + this);
};
}

private Direction getCounterClockWiseZ() {
return switch (this) {
case DOWN -> EAST;
case UP -> WEST;
default -> throw new IllegalStateException("Unable to get Z-rotated facing of " + this);
case WEST -> DOWN;
case EAST -> UP;
default -> throw new IllegalStateException("Unable to get Z-rotated facing of " + this);
};
}

Expand Down Expand Up @@ -274,10 +274,6 @@ public String toString() {
return this.name;
}

private static DataResult<Direction> verifyVertical(Direction direction) {
return direction.getAxis().isVertical() ? DataResult.success(direction) : DataResult.error(() -> "Expected a vertical direction");
}

public static Direction get(Direction.AxisDirection axisDirection, Direction.Axis axis) {
for (Direction lv : VALUES) {
if (lv.getAxisDirection() == axisDirection && lv.getAxis() == axis) {
Expand All @@ -299,7 +295,7 @@ public boolean isFacingAngle(float degrees) {
return (float)this.normal.getX() * h + (float)this.normal.getZ() * i > 0.0F;
}

public static enum Axis implements Predicate<Direction> {
public enum Axis implements Predicate<Direction> {
X("x") {
@Override
public int choose(int x, int y, int z) {
Expand Down Expand Up @@ -412,14 +408,14 @@ public Direction.Plane getPlane() {
public abstract double choose(double x, double y, double z);
}

public static enum AxisDirection {
public enum AxisDirection {
POSITIVE(1, "Towards positive"),
NEGATIVE(-1, "Towards negative");

private final int step;
private final String name;

private AxisDirection(final int j, final String string2) {
AxisDirection(final int j, final String string2) {
this.step = j;
this.name = string2;
}
Expand All @@ -442,14 +438,14 @@ public Direction.AxisDirection opposite() {
}
}

public static enum Plane implements Iterable<Direction>, Predicate<Direction> {
public enum Plane implements Iterable<Direction>, Predicate<Direction> {
HORIZONTAL(new Direction[]{Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}, new Direction.Axis[]{Direction.Axis.X, Direction.Axis.Z}),
VERTICAL(new Direction[]{Direction.UP, Direction.DOWN}, new Direction.Axis[]{Direction.Axis.Y});

private final Direction[] faces;
private final Direction.Axis[] axis;

private Plane(final Direction[] args, final Direction.Axis[] args2) {
Plane(final Direction[] args, final Direction.Axis[] args2) {
this.faces = args;
this.axis = args2;
}
Expand Down

This file was deleted.

0 comments on commit 98e3b24

Please sign in to comment.