Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

Commit 4a42a9b

Browse files
authored
Merge pull request #99 from DrexHD/Beta
Update to Pre3
2 parents 5b324e2 + 7984f9e commit 4a42a9b

7 files changed

Lines changed: 26 additions & 12 deletions

File tree

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx2G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/use or on https://modmuss50.me/fabric.html
6-
minecraft_version=1.16-pre2
7-
yarn_mappings=1.16-pre2+build.1
6+
minecraft_version=1.16-pre3
7+
yarn_mappings=1.16-pre3+build.1
88
loader_version=0.8.7+build.201
99

1010
# Mod Properties

src/main/java/org/kilocraft/essentials/ServerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public void reloadKiloEssentials() {
9393
public void reloadMinecraftServer(Action<Throwable> fallback) {
9494
ResourcePackManager<ResourcePackProfile> resourcePackManager = this.server.getDataPackManager();
9595
SaveProperties saveProperties = this.getMinecraftServer().getSaveProperties();
96-
Collection<String> collection = resourcePackManager.method_29210();
96+
Collection<String> collection = resourcePackManager.getEnabledNames();
9797

9898
Collection<String> modifiedCollection = Lists.newArrayList(collection);
9999
resourcePackManager.scanPacks();
100-
for (String string : resourcePackManager.method_29206()) {
101-
if (!saveProperties.method_29589().method_29550().contains(string) && !modifiedCollection.contains(string)) {
100+
for (String string : resourcePackManager.getNames()) {
101+
if (!saveProperties.method_29589().getDisabled().contains(string) && !modifiedCollection.contains(string)) {
102102
modifiedCollection.add(string);
103103
}
104104
}

src/main/java/org/kilocraft/essentials/commands/teleport/RtpCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import net.minecraft.world.World;
2121
import net.minecraft.world.biome.Biome;
2222
import net.minecraft.world.biome.Biome.Category;
23+
import net.minecraft.world.dimension.DimensionType;
2324
import org.apache.commons.lang3.time.StopWatch;
2425
import org.apache.logging.log4j.LogManager;
2526
import org.apache.logging.log4j.Logger;
@@ -255,7 +256,7 @@ static void teleport(ServerCommandSource src, ServerPlayerEntity target, Logger
255256
BlockState state;
256257
int tries = 0;
257258
boolean hasAirSpace;
258-
boolean isNether = target.getServerWorld().getDimension().isNether();
259+
boolean isNether = RegistryUtils.isNether(world.getDimension());
259260
boolean safe;
260261

261262
do {

src/main/java/org/kilocraft/essentials/commands/teleport/TeleportCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private static int teleportHere(CommandContext<ServerCommandSource> ctx) throws
109109
}
110110

111111
private static int teleportIn(CommandContext<ServerCommandSource> ctx, ServerPlayerEntity target) throws CommandSyntaxException {
112-
ServerWorld targetWorld = KiloServer.getServer().getMinecraftServer().getWorld(DimensionArgumentType.getDimensionArgument(ctx, "dimension"));
112+
ServerWorld targetWorld = KiloServer.getServer().getMinecraftServer().getWorld(RegistryUtils.toWorldKey(DimensionArgumentType.getDimensionArgument(ctx, "dimension").getDimension()));
113113
Vec3d vec = getVec3(ctx, "pos");
114114

115115
KiloServer.getServer().getOnlineUser(target).saveLocation();

src/main/java/org/kilocraft/essentials/mixin/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
@Mixin(ServerPlayerEntity.class)
2121
public abstract class ServerPlayerEntityMixin {
2222

23-
@Inject(method = "changeDimension", cancellable = true, at = @At(value = "HEAD", target = "Lnet/minecraft/server/network/ServerPlayerEntity;changeDimension(Lnet/minecraft/world/dimension/DimensionType;)Lnet/minecraft/entity/Entity;"))
24-
private void modify(RegistryKey<World> registryKey, CallbackInfoReturnable<Entity> cir) {
25-
if (LocationUtil.shouldBlockAccessTo(RegistryUtils.toDimension(registryKey))) {
23+
@Inject(method = "changeDimension", cancellable = true, at = @At(value = "HEAD", target = "Lnet/minecraft/server/network/ServerPlayerEntity;changeDimension(Lnet/minecraft/server/world/ServerWorld;)Lnet/minecraft/entity/Entity;"))
24+
private void modify(ServerWorld serverWorld, CallbackInfoReturnable<Entity> cir) {
25+
if (LocationUtil.shouldBlockAccessTo(serverWorld.getDimension())) {
2626
cir.cancel();
27-
KiloChat.sendLangMessageTo((ServerPlayerEntity) (Object) this, "general.dimension_not_allowed", RegistryUtils.dimensionToName(registryKey.getValue()));
27+
KiloChat.sendLangMessageTo((ServerPlayerEntity) (Object) this, "general.dimension_not_allowed", RegistryUtils.dimensionToName(serverWorld.getDimension()));
2828
}
2929

3030
ServerUser.saveLocationOf((ServerPlayerEntity) (Object) this);

src/main/java/org/kilocraft/essentials/util/LocationUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void validateIsSafe(@NotNull final Location loc) throws InsecureDe
6060
BlockState state;
6161
int tries = 0;
6262
boolean hasAirSpace;
63-
boolean isNether = loc.getDimensionType().isNether();
63+
boolean isNether = RegistryUtils.isNether(loc.getDimensionType());
6464
boolean safe;
6565

6666
do {

src/main/java/org/kilocraft/essentials/util/registry/RegistryUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,17 @@ public static RegistryKey<World> dimensionTypeToRegistryKey(@NotNull final Dimen
8585
public static Set<RegistryKey<World>> getWorldsKeySet() {
8686
return server.getWorldRegistryKeys();
8787
}
88+
89+
public static boolean isOverworld(@NotNull final DimensionType type) {
90+
return type.equals(toDimension(DimensionType.OVERWORLD_REGISTRY_KEY.getValue()));
91+
}
92+
93+
public static boolean isNether(@NotNull final DimensionType type) {
94+
return type.equals(toDimension(DimensionType.THE_NETHER_REGISTRY_KEY.getValue()));
95+
}
96+
97+
public static boolean isEnd(@NotNull final DimensionType type) {
98+
return type.equals(toDimension(DimensionType.THE_END_REGISTRY_KEY.getValue()));
99+
}
100+
88101
}

0 commit comments

Comments
 (0)