|
@@ -0,0 +1,49 @@
|
|
|
+/*
|
|
|
+ * This file is part of architectury.
|
|
|
+ * Copyright (C) 2020, 2021 architectury
|
|
|
+ *
|
|
|
+ * This program is free software; you can redistribute it and/or
|
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
+ * License as published by the Free Software Foundation; either
|
|
|
+ * version 3 of the License, or (at your option) any later version.
|
|
|
+ *
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
+ * Lesser General Public License for more details.
|
|
|
+ *
|
|
|
+ * You should have received a copy of the GNU Lesser General Public License
|
|
|
+ * along with this program; if not, write to the Free Software Foundation,
|
|
|
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
+ */
|
|
|
+
|
|
|
+package me.shedaniel.architectury.mixin.fabric;
|
|
|
+
|
|
|
+import me.shedaniel.architectury.event.events.ChunkEvent;
|
|
|
+import net.minecraft.nbt.CompoundTag;
|
|
|
+import net.minecraft.nbt.ListTag;
|
|
|
+import net.minecraft.server.level.ServerLevel;
|
|
|
+import net.minecraft.world.entity.ai.village.poi.PoiManager;
|
|
|
+import net.minecraft.world.level.ChunkPos;
|
|
|
+import net.minecraft.world.level.biome.BiomeSource;
|
|
|
+import net.minecraft.world.level.chunk.*;
|
|
|
+import net.minecraft.world.level.chunk.storage.ChunkSerializer;
|
|
|
+import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
|
|
+import net.minecraft.world.level.lighting.LevelLightEngine;
|
|
|
+import org.spongepowered.asm.mixin.Mixin;
|
|
|
+import org.spongepowered.asm.mixin.injection.At;
|
|
|
+import org.spongepowered.asm.mixin.injection.Inject;
|
|
|
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
|
+
|
|
|
+@Mixin(ChunkSerializer.class)
|
|
|
+public class MixinChunkSerializer {
|
|
|
+ @Inject(method = "read", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD)
|
|
|
+ private static void load(ServerLevel serverLevel, StructureManager structureManager, PoiManager poiManager, ChunkPos chunkPos, CompoundTag compoundTag,
|
|
|
+ CallbackInfoReturnable<ProtoChunk> cir, ChunkGenerator chunkGenerator, BiomeSource biomeSource, CompoundTag compoundTagLevelData,
|
|
|
+ ChunkBiomeContainer chunkBiomeContainer, UpgradeData upgradeData, ProtoTickList<?> protoTickList, ProtoTickList<?> protoTickList2,
|
|
|
+ boolean bl, ListTag listTag, int i, LevelChunkSection[] levelChunkSections, boolean bl2, ChunkSource chunkSource,
|
|
|
+ LevelLightEngine levelLightEngine, long l, ChunkStatus.ChunkType chunkType, ChunkAccess chunk) {
|
|
|
+ ChunkEvent.LOAD_DATA.invoker().load(chunk, serverLevel, compoundTag);
|
|
|
+ }
|
|
|
+}
|