Backport updates to Fabric 1.18
This commit is contained in:
1 parent
8783e099b1
commit
d793a1d902
6 files changed
+17
-14
No files matched your search
@@ -5,10 +5,10 @@ plugins {
|
||||
val shade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
minecraft(group = "com.mojang", name = "minecraft", version = "1.19")
|
||||
mappings(group = "net.fabricmc", name = "yarn", version = "1.19+build.1", classifier = "v2")
|
||||
minecraft(group = "com.mojang", name = "minecraft", version = "1.18")
|
||||
mappings(group = "net.fabricmc", name = "yarn", version = "1.18+build.1", classifier = "v2")
|
||||
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.14.6")
|
||||
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "0.55.2+1.19")
|
||||
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "0.43.1+1.18")
|
||||
implementation(project(":chunky-common"))
|
||||
shade(project(":chunky-common"))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
@@ -56,7 +56,7 @@ public class ChunkyFabric implements ModInitializer {
|
||||
chunky.disable();
|
||||
}
|
||||
});
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
||||
final LiteralArgumentBuilder<ServerCommandSource> command = literal(CommandLiteral.CHUNKY)
|
||||
.requires(serverCommandSource -> serverCommandSource.hasPermissionLevel(2))
|
||||
.executes(context -> {
|
||||
|
||||
+4
-3
@@ -7,6 +7,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import org.popcraft.chunky.Chunky;
|
||||
import org.popcraft.chunky.GenerationTask;
|
||||
import org.popcraft.chunky.event.task.GenerationTaskUpdateEvent;
|
||||
@@ -57,11 +58,11 @@ public class BossBarTaskUpdateListener implements Consumer<GenerationTaskUpdateE
|
||||
|
||||
private CommandBossBar createNewBossBar(final BossBarManager bossBarManager, final Identifier barIdentifier, final Identifier worldIdentifier) {
|
||||
final CommandBossBar bossBar = bossBarManager.add(barIdentifier, Text.of(barIdentifier.toString()));
|
||||
if (net.minecraft.world.World.OVERWORLD.getValue().equals(worldIdentifier)) {
|
||||
if (DimensionType.OVERWORLD_ID.equals(worldIdentifier)) {
|
||||
bossBar.setColor(BossBar.Color.GREEN);
|
||||
} else if (net.minecraft.world.World.NETHER.getValue().equals(worldIdentifier)) {
|
||||
} else if (DimensionType.THE_NETHER_ID.equals(worldIdentifier)) {
|
||||
bossBar.setColor(BossBar.Color.RED);
|
||||
} else if (net.minecraft.world.World.END.getValue().equals(worldIdentifier)) {
|
||||
} else if (DimensionType.THE_END_ID.equals(worldIdentifier)) {
|
||||
bossBar.setColor(BossBar.Color.PURPLE);
|
||||
} else {
|
||||
bossBar.setColor(BossBar.Color.BLUE);
|
||||
|
||||
@@ -9,9 +9,6 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@SuppressWarnings("UnnecessaryInterfaceModifier")
|
||||
@Mixin(ThreadedAnvilChunkStorage.class)
|
||||
public interface ThreadedAnvilChunkStorageMixin {
|
||||
@@ -19,7 +16,7 @@ public interface ThreadedAnvilChunkStorageMixin {
|
||||
public ChunkHolder invokeGetChunkHolder(long pos);
|
||||
|
||||
@Invoker("getUpdatedChunkNbt")
|
||||
public CompletableFuture<Optional<NbtCompound>> invokeGetUpdatedChunkNbt(ChunkPos pos);
|
||||
public NbtCompound invokeGetUpdatedChunkNbt(ChunkPos pos);
|
||||
|
||||
@Accessor("chunksToUnload")
|
||||
public Long2ObjectLinkedOpenHashMap<ChunkHolder> getChunksToUnload();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.popcraft.chunky.platform;
|
||||
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.world.ChunkHolder;
|
||||
import net.minecraft.server.world.ChunkTicketType;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
@@ -62,7 +63,11 @@ public class FabricWorld implements World {
|
||||
if (unloadedChunkHolder != null && unloadedChunkHolder.getCurrentStatus() == ChunkStatus.FULL) {
|
||||
return true;
|
||||
}
|
||||
return chunkStorageMixin.invokeGetUpdatedChunkNbt(chunkPos).join().map(chunkNbt -> chunkNbt.contains("Status", 8) && "full".equals(chunkNbt.getString("Status"))).orElse(false);
|
||||
final NbtCompound chunkNbt = chunkStorageMixin.invokeGetUpdatedChunkNbt(chunkPos);
|
||||
if (chunkNbt != null && chunkNbt.contains("Status", 8)) {
|
||||
return "full".equals(chunkNbt.getString("Status"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"fabric": "*",
|
||||
"minecraft": ">=1.19",
|
||||
"minecraft": ">=1.18",
|
||||
"java": ">=17"
|
||||
},
|
||||
"custom": {
|
||||
|
||||
Reference in new issue
Block a user