Added /slimechunk command

This commit is contained in:
2025-03-26 10:04:28 +01:00
parent 8856bec073
commit 645529a9f6
5 changed files with 49 additions and 4 deletions

View File

@ -28,6 +28,7 @@ import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import static wtf.hak.survivalfabric.SurvivalFabric.LOGGER;
import static wtf.hak.survivalfabric.config.ConfigManager.getConfig;
public class SharedEnderChest implements ServerLifecycleEvents.ServerStopping, ServerLifecycleEvents.ServerStarted, ServerTickEvents.EndTick {
@ -46,7 +47,7 @@ public class SharedEnderChest implements ServerLifecycleEvents.ServerStopping, S
Inventories.readNbt(nbt, inventoryItemStacks, server.getRegistryManager());
sharedInventory = new SharedInventory(inventoryItemStacks);
} catch (Exception e) {
System.out.println("[ShareEnderChest] Error while loading inventory: " + e);
LOGGER.error("Error while loading Shared Ender Chest: " + e);
sharedInventory = new SharedInventory(getConfig().sharedEnderChestRows);
}
} else {
@ -64,10 +65,9 @@ public class SharedEnderChest implements ServerLifecycleEvents.ServerStopping, S
inventoryFile.createNewFile();
NbtIo.writeCompressed(nbt, inventoryFileDataOutput);
} catch (Exception e) {
System.out.println("[ShareEnderChest] Error while saving inventory: " + e);
LOGGER.error("Error while saving Shared Ender Chest: " + e);
}
}
public void onServerStopping(MinecraftServer server) {
saveInventory(server);
}