docs: format javadoc

This commit is contained in:
daoge_cmd
2024-09-18 13:02:16 +08:00
parent 76f12e0cb8
commit 4bad8f702c
19 changed files with 1 additions and 87 deletions
@@ -20,8 +20,6 @@ import com.dfsek.terra.api.world.biome.PlatformBiome;
/** /**
* Terra Project 2024/6/15
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public class AllayPlatform extends AbstractPlatform { public class AllayPlatform extends AbstractPlatform {
@@ -6,14 +6,12 @@ import java.util.TreeMap;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public class JeBlockState { public class JeBlockState {
protected final String identifier; protected final String identifier;
protected final TreeMap<String, String> properties; protected final TreeMap<String, String> properties;
protected int hash = Integer.MAX_VALUE; // 懒加载 protected int hash = Integer.MAX_VALUE;
public static JeBlockState fromString(String data) { public static JeBlockState fromString(String data) {
return new JeBlockState(data); return new JeBlockState(data);
@@ -63,7 +61,6 @@ public class JeBlockState {
properties.forEach((k, v) -> builder.append(k).append("=").append(v).append(";")); properties.forEach((k, v) -> builder.append(k).append("=").append(v).append(";"));
var str = builder.toString(); var str = builder.toString();
if (hash == Integer.MAX_VALUE) { if (hash == Integer.MAX_VALUE) {
// 顺便算一下hash
hash = HashUtils.fnv1a_32(str.getBytes()); hash = HashUtils.fnv1a_32(str.getBytes());
} }
return str; return str;
@@ -21,8 +21,6 @@ import java.util.TreeMap;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
@Slf4j @Slf4j
@@ -124,37 +122,6 @@ public final class Mapping {
return true; return true;
} }
// private static BlockState createBeBlockState(Map<String, Object> data) {
// var identifier = new Identifier((String) data.get("bedrock_identifier"));
// // 方块类型
// var blockType = Registries.BLOCKS.get(identifier);
// if (blockType == null) {
// log.error("Cannot find bedrock block type: {}", identifier);
// return BE_AIR_STATE;
// }
// // 方块属性
// Map<String, Object> state = (Map<String, Object>) data.get("state");
// if (state == null) return blockType.getDefaultState();
// var propertyValues = new BlockPropertyValue<?, ?, ?>[state.size()];
// int index = -1;
// for(var entry : state.entrySet()) {
// index++;
// var propertyName = entry.getKey();
// var propertyType = blockType.getProperties().get(propertyName);
// if (propertyType == null) {
// log.warn("Unknown property type: {}", propertyName);
// return BlockTypes.AIR.getDefaultState();
// }
// try {
// propertyValues[index] = propertyType.tryCreateValue(entry.getValue());
// } catch (IllegalArgumentException e) {
// log.warn("Failed to create property value for {}: {}", propertyName, entry.getValue());
// return BE_AIR_STATE;
// }
// }
// return blockType.ofState(propertyValues);
// }
private static BlockState createBeBlockState(Map<String, Object> data) { private static BlockState createBeBlockState(Map<String, Object> data) {
var builder = NbtMap.builder(); var builder = NbtMap.builder();
builder.putString("name", "minecraft:" + data.get("bedrock_identifier")); builder.putString("name", "minecraft:" + data.get("bedrock_identifier"));
@@ -8,8 +8,6 @@ import org.allaymc.terra.allay.generator.AllayGeneratorWrapper;
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent; import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
/** /**
* Terra Project 2024/6/15
*
* @author daoge_cmd * @author daoge_cmd
*/ */
@Slf4j @Slf4j
@@ -4,10 +4,7 @@ import org.allaymc.api.world.biome.BiomeType;
import com.dfsek.terra.api.world.biome.PlatformBiome; import com.dfsek.terra.api.world.biome.PlatformBiome;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayBiome(BiomeType allayBiome) implements PlatformBiome { public record AllayBiome(BiomeType allayBiome) implements PlatformBiome {
@@ -9,10 +9,7 @@ import com.dfsek.terra.api.block.state.properties.Property;
import java.util.Objects; import java.util.Objects;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public final class AllayBlockState implements com.dfsek.terra.api.block.state.BlockState { public final class AllayBlockState implements com.dfsek.terra.api.block.state.BlockState {
@@ -6,10 +6,7 @@ import org.allaymc.terra.allay.Mapping;
import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.block.state.BlockState;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayBlockType(BlockType<?> allayBlockType) implements com.dfsek.terra.api.block.BlockType { public record AllayBlockType(BlockType<?> allayBlockType) implements com.dfsek.terra.api.block.BlockType {
@@ -9,10 +9,7 @@ import org.jetbrains.annotations.NotNull;
import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.world.ServerWorld; import com.dfsek.terra.api.world.ServerWorld;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfsek.terra.api.world.chunk.Chunk { public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfsek.terra.api.world.chunk.Chunk {
@@ -6,10 +6,7 @@ import org.allaymc.terra.allay.Mapping;
import com.dfsek.terra.api.inventory.ItemStack; import com.dfsek.terra.api.inventory.ItemStack;
import com.dfsek.terra.api.inventory.item.Enchantment; import com.dfsek.terra.api.inventory.item.Enchantment;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayEnchantment(EnchantmentType allayEnchantment) implements Enchantment { public record AllayEnchantment(EnchantmentType allayEnchantment) implements Enchantment {
@@ -4,10 +4,7 @@ import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.api.world.ServerWorld; import com.dfsek.terra.api.world.ServerWorld;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public final class AllayFakeEntity implements Entity { public final class AllayFakeEntity implements Entity {
@@ -8,12 +8,7 @@ import java.util.Map;
import com.dfsek.terra.api.inventory.item.Enchantment; import com.dfsek.terra.api.inventory.item.Enchantment;
import com.dfsek.terra.api.inventory.item.ItemMeta; import com.dfsek.terra.api.inventory.item.ItemMeta;
/** /**
* Terra Project 2024/6/16
*
* 物品元数据。在allay中物品元数据没有单独的类,故直接使用ItemStack代替
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayItemMeta(ItemStack allayItemStack) implements ItemMeta { public record AllayItemMeta(ItemStack allayItemStack) implements ItemMeta {
@@ -5,10 +5,7 @@ import org.allaymc.api.item.ItemStack;
import com.dfsek.terra.api.inventory.Item; import com.dfsek.terra.api.inventory.Item;
import com.dfsek.terra.api.inventory.item.ItemMeta; import com.dfsek.terra.api.inventory.item.ItemMeta;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayItemStack(ItemStack allayItemStack) implements com.dfsek.terra.api.inventory.ItemStack{ public record AllayItemStack(ItemStack allayItemStack) implements com.dfsek.terra.api.inventory.ItemStack{
@@ -4,10 +4,7 @@ import org.allaymc.api.item.type.ItemType;
import com.dfsek.terra.api.inventory.Item; import com.dfsek.terra.api.inventory.Item;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public final class AllayItemType implements Item { public final class AllayItemType implements Item {
@@ -9,10 +9,7 @@ import org.jetbrains.annotations.NotNull;
import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.world.chunk.generation.ProtoChunk; import com.dfsek.terra.api.world.chunk.generation.ProtoChunk;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk { public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk {
@@ -18,8 +18,6 @@ import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld; import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAccessibleContext context) implements ProtoWorld { public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAccessibleContext context) implements ProtoWorld {
@@ -18,10 +18,7 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.chunk.Chunk; import com.dfsek.terra.api.world.chunk.Chunk;
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator; import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dimension allayDimension) implements ServerWorld { public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dimension allayDimension) implements ServerWorld {
@@ -23,10 +23,7 @@ import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
import com.dfsek.terra.api.world.chunk.generation.util.GeneratorWrapper; import com.dfsek.terra.api.world.chunk.generation.util.GeneratorWrapper;
import com.dfsek.terra.api.world.info.WorldProperties; import com.dfsek.terra.api.world.info.WorldProperties;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
@Slf4j @Slf4j
@@ -13,10 +13,7 @@ import com.dfsek.terra.api.handle.ItemHandle;
import com.dfsek.terra.api.inventory.Item; import com.dfsek.terra.api.inventory.Item;
import com.dfsek.terra.api.inventory.item.Enchantment; import com.dfsek.terra.api.inventory.item.Enchantment;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public class AllayItemHandle implements ItemHandle { public class AllayItemHandle implements ItemHandle {
@@ -9,10 +9,7 @@ import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.entity.EntityType; import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.handle.WorldHandle; import com.dfsek.terra.api.handle.WorldHandle;
/** /**
* Terra Project 2024/6/16
*
* @author daoge_cmd * @author daoge_cmd
*/ */
public class AllayWorldHandle implements WorldHandle { public class AllayWorldHandle implements WorldHandle {