Fix world map not updating after creating new world (#64)

This commit is contained in:
IzzelAliz 2020-10-23 14:28:23 +08:00
parent 102af6c339
commit 298bcc82cc
2 changed files with 3 additions and 0 deletions

View File

@ -133,6 +133,7 @@ public abstract class CraftServerMixin implements CraftServerBridge {
@Inject(method = "unloadWorld(Lorg/bukkit/World;Z)Z", require = 1, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;getChunkProvider()Lnet/minecraft/world/server/ServerChunkProvider;"))
private void arclight$unloadForge(World world, boolean save, CallbackInfoReturnable<Boolean> cir) {
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(((CraftWorld) world).getHandle()));
this.console.markWorldsDirty();
}
@Override

View File

@ -119,6 +119,7 @@ public abstract class MinecraftServerMixin extends RecursiveEventLoop<TickDelaye
@Shadow protected abstract void func_240778_a_(IServerConfiguration p_240778_1_);
@Shadow protected IServerConfiguration field_240768_i_;
@Shadow private static void func_240786_a_(ServerWorld p_240786_0_, IServerWorldInfo p_240786_1_, boolean hasBonusChest, boolean p_240786_3_, boolean p_240786_4_) { }
@Shadow @Deprecated public abstract void markWorldsDirty();
// @formatter:on
public MinecraftServerMixin(String name) {
@ -404,6 +405,7 @@ public abstract class MinecraftServerMixin extends RecursiveEventLoop<TickDelaye
// bukkit methods
public void loadSpawn(IChunkStatusListener listener, ServerWorld serverWorld) {
this.markWorldsDirty();
MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(serverWorld));
if (!((WorldBridge) serverWorld).bridge$getWorld().getKeepSpawnInMemory()) {
return;