mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-26 04:25:31 +01:00
Update fabric version for 1.16
This commit is contained in:
parent
c6d28c318b
commit
42b70271a6
@ -9,10 +9,10 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:1.15.2"
|
||||
mappings "net.fabricmc:yarn:1.15.2+build.15:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:0.8.2+build.194"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.5.1+build.294-1.15"
|
||||
minecraft "com.mojang:minecraft:1.16.1"
|
||||
mappings "net.fabricmc:yarn:1.16.1+build.21:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:0.9.0+build.204"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.16.2+build.385-1.16.1"
|
||||
|
||||
shadowInclude (project(':BlueMapCommon')) {
|
||||
//exclude dependencies provided by fabric
|
||||
@ -50,7 +50,7 @@ shadowJar {
|
||||
}
|
||||
|
||||
task ramappedShadowJar(type: RemapJarTask) {
|
||||
destinationDir = file '../build/unsupported'
|
||||
destinationDir = file '../build/release'
|
||||
dependsOn tasks.shadowJar
|
||||
input = tasks.shadowJar.archivePath
|
||||
addNestedDependencies = true
|
||||
|
@ -20,11 +20,11 @@
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.server.ServerStartCallback;
|
||||
import net.fabricmc.fabric.api.event.server.ServerStopCallback;
|
||||
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
public class FabricMod implements ModInitializer, ServerInterface {
|
||||
|
||||
@ -57,11 +57,11 @@ public UUID load(ServerWorld key) throws Exception {
|
||||
public void onInitialize() {
|
||||
|
||||
//register commands
|
||||
CommandRegistry.INSTANCE.register(true, dispatcher -> {
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
||||
new Commands<>(pluginInstance, dispatcher, fabricSource -> new FabricCommandSource(this, pluginInstance, fabricSource));
|
||||
});
|
||||
|
||||
ServerStartCallback.EVENT.register((MinecraftServer server) -> {
|
||||
ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> {
|
||||
new Thread(()->{
|
||||
Logger.global.logInfo("Loading BlueMap...");
|
||||
|
||||
@ -74,7 +74,7 @@ public void onInitialize() {
|
||||
}).start();
|
||||
});
|
||||
|
||||
ServerStopCallback.EVENT.register((MinecraftServer server) -> {
|
||||
ServerLifecycleEvents.SERVER_STOPPING.register((MinecraftServer server) -> {
|
||||
pluginInstance.unload();
|
||||
Logger.global.logInfo("BlueMap unloaded!");
|
||||
});
|
||||
@ -114,7 +114,11 @@ public UUID getUUIDForWorld(ServerWorld world) throws IOException {
|
||||
}
|
||||
|
||||
private UUID loadUUIDForWorld(ServerWorld world) throws IOException {
|
||||
File dimensionDir = world.getDimension().getType().getSaveDirectory(world.getSaveHandler().getWorldDir());
|
||||
MinecraftServer server = world.getServer();
|
||||
String worldName = server.getSaveProperties().getLevelName();
|
||||
File worldFolder = new File(world.getServer().getRunDirectory(), worldName);
|
||||
File dimensionFolder = DimensionType.getSaveDirectory(world.getRegistryKey(), worldFolder);
|
||||
File dimensionDir = dimensionFolder.getCanonicalFile();
|
||||
return getUUIDForWorld(dimensionDir);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package de.bluecolored.bluemap.fabric.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@ -10,23 +8,16 @@
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
|
||||
import de.bluecolored.bluemap.fabric.events.ChunkFinalizeCallback;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public class MixinChunkGenerator {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
protected IWorld world;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "generateFeatures")
|
||||
public void generateFeatures(ChunkRegion region, CallbackInfo ci) {
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkFinalizeCallback.EVENT.invoker().onChunkFinalized((ServerWorld) world, new Vector2i(region.getCenterChunkX(), region.getCenterChunkZ()));
|
||||
}
|
||||
public void generateFeatures(ChunkRegion region, StructureAccessor accessor, CallbackInfo ci) {
|
||||
ChunkFinalizeCallback.EVENT.invoker().onChunkFinalized(region.getWorld(), new Vector2i(region.getCenterChunkX(), region.getCenterChunkZ()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,13 +8,12 @@
|
||||
import de.bluecolored.bluemap.fabric.events.WorldSaveCallback;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ProgressListener;
|
||||
import net.minecraft.world.SessionLockException;
|
||||
|
||||
@Mixin(ServerWorld.class)
|
||||
public abstract class MixinServerWorld {
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "save")
|
||||
public void save(ProgressListener progressListener, boolean flush, boolean bl, CallbackInfo ci) throws SessionLockException {
|
||||
public void save(ProgressListener progressListener, boolean flush, boolean bl, CallbackInfo ci) {
|
||||
WorldSaveCallback.EVENT.invoker().onWorldSaved((ServerWorld) (Object) this);
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,9 @@
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"fabricloader": ">=0.9.0",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.15.x"
|
||||
"minecraft": "1.16.x"
|
||||
},
|
||||
"suggests": {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user