refactor: 优化代码结构和日志输出
- 注释掉未使用的 FabricLoader 和 EnvType导包 - 注释掉 PlayerTombstoneData 类的相关代码- 注释掉 TombstoneStorage 中的日志输出语句
This commit is contained in:
parent
dbe0c05a5f
commit
8d9a01d407
@ -2,8 +2,8 @@ package com.simpletombstone;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.loader.api.FabricLoader;
|
||||
//import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@ -30,7 +30,7 @@ public class SimpleTombstone implements ModInitializer {
|
||||
public void onInitialize() {
|
||||
if (
|
||||
true
|
||||
//FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER
|
||||
//FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER
|
||||
) {
|
||||
LOGGER.info("[SimpleTombstone] 服务器端初始化中...");
|
||||
|
||||
@ -184,15 +184,15 @@ public class SimpleTombstone implements ModInitializer {
|
||||
}
|
||||
|
||||
|
||||
public record PlayerTombstoneData(UUID playerId, List<ItemStack> items) {
|
||||
public PlayerTombstoneData(UUID playerId, List<ItemStack> items) {
|
||||
this.playerId = playerId;
|
||||
this.items = new ArrayList<>(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> items() {
|
||||
return Collections.unmodifiableList(items);
|
||||
}
|
||||
public record PlayerTombstoneData(UUID playerId, List<ItemStack> items) {
|
||||
public PlayerTombstoneData(UUID playerId, List<ItemStack> items) {
|
||||
this.playerId = playerId;
|
||||
this.items = new ArrayList<>(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> items() {
|
||||
return Collections.unmodifiableList(items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class TombstoneStorage extends PersistentState {
|
||||
private final Map<BlockPos, SimpleTombstone.PlayerTombstoneData> tombstoneData = new HashMap<>();
|
||||
|
||||
public static TombstoneStorage load(ServerWorld world) {
|
||||
LOGGER.info("[TombstoneStorage] 加载墓碑数据...");
|
||||
//LOGGER.info("[TombstoneStorage] 加载墓碑数据...");
|
||||
TombstoneStorage storage = world.getPersistentStateManager().getOrCreate(
|
||||
new PersistentState.Type<>(
|
||||
TombstoneStorage::new, // Supplier
|
||||
@ -29,7 +29,7 @@ public class TombstoneStorage extends PersistentState {
|
||||
),
|
||||
"simple_tombstone" // 存储名称
|
||||
);
|
||||
LOGGER.info("[TombstoneStorage] 成功加载墓碑数据.");
|
||||
//LOGGER.info("[TombstoneStorage] 成功加载墓碑数据.");
|
||||
return storage;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user