fabric-1.18: remove ChunkDataEvents.SAVE

This commit is contained in:
Kosma Moczek 2021-12-16 20:22:19 +01:00
parent 32d618e99b
commit 261e3ddc00
4 changed files with 0 additions and 52 deletions

View File

@ -46,7 +46,6 @@ import org.dynmap.fabric_1_18.command.DmarkerCommand;
import org.dynmap.fabric_1_18.command.DynmapCommand;
import org.dynmap.fabric_1_18.command.DynmapExpCommand;
import org.dynmap.fabric_1_18.event.BlockEvents;
import org.dynmap.fabric_1_18.event.ChunkDataEvents;
import org.dynmap.fabric_1_18.event.CustomServerLifecycleEvents;
import org.dynmap.fabric_1_18.event.PlayerEvents;
import org.dynmap.fabric_1_18.mixin.BiomeEffectsAccessor;

View File

@ -1,24 +0,0 @@
package org.dynmap.fabric_1_18.event;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.chunk.Chunk;
public class ChunkDataEvents {
private ChunkDataEvents() {
}
public static Event<Save> SAVE = EventFactory.createArrayBacked(Save.class,
(listeners) -> (world, chunk) -> {
for (Save callback : listeners) {
callback.onSave(world, chunk);
}
}
);
@FunctionalInterface
public interface Save {
void onSave(ServerWorld world, Chunk chunk);
}
}

View File

@ -1,26 +0,0 @@
package org.dynmap.fabric_1_18.mixin;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import net.minecraft.world.chunk.Chunk;
import org.dynmap.fabric_1_18.event.ChunkDataEvents;
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.CallbackInfoReturnable;
@Mixin(ThreadedAnvilChunkStorage.class)
public abstract class ThreadedAnvilChunkStorageMixin {
@Shadow
@Final
private ServerWorld world;
@Inject(method = "save(Lnet/minecraft/world/chunk/Chunk;)Z", at = @At("RETURN"))
private void save(Chunk chunk, CallbackInfoReturnable<Boolean> info) {
if (info.getReturnValueZ()) {
ChunkDataEvents.SAVE.invoker().onSave(this.world, chunk);
}
}
}

View File

@ -11,7 +11,6 @@
"ServerPlayerEntityMixin",
"ServerPlayNetworkHandlerMixin",
"ThreadedAnvilChunkStorageAccessor",
"ThreadedAnvilChunkStorageMixin",
"WorldChunkMixin"
],
"injectors": {