mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-12 18:56:04 +00:00
Reformat
This commit is contained in:
@@ -19,7 +19,7 @@ public class JeBlockState {
|
||||
private JeBlockState(String data) {
|
||||
// TODO: support block state with nbt (identifier[properties]{nbt}), for now we just ignore it
|
||||
int braceIndex = data.indexOf('{');
|
||||
if (braceIndex != -1) {
|
||||
if(braceIndex != -1) {
|
||||
data = data.substring(0, braceIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.allaymc.api.block.type.BlockStateGetter;
|
||||
import org.allaymc.api.block.type.BlockTypes;
|
||||
import org.allaymc.api.item.type.ItemType;
|
||||
import org.allaymc.api.item.type.ItemTypeGetter;
|
||||
import org.allaymc.api.world.data.DimensionInfo;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -83,7 +82,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static String dimensionIdBeToJe(String beDimensionId) {
|
||||
return switch (beDimensionId) {
|
||||
return switch(beDimensionId) {
|
||||
case "overworld" -> "minecraft:overworld";
|
||||
case "nether" -> "minecraft:the_nether";
|
||||
case "the_end" -> "minecraft:the_end";
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.dfsek.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import org.allaymc.api.blockentity.BlockEntity;
|
||||
|
||||
import com.dfsek.terra.allay.Mapping;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
|
||||
import org.allaymc.api.blockentity.BlockEntity;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
|
||||
@@ -22,9 +22,9 @@ public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfs
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayChunk.getDimensionInfo();
|
||||
if (x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
if(x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.allay.delegate;
|
||||
|
||||
import org.allaymc.api.block.property.type.BlockPropertyTypes;
|
||||
import org.allaymc.api.block.data.BlockTags;
|
||||
import org.allaymc.api.block.property.type.BlockPropertyTypes;
|
||||
import org.allaymc.api.block.type.BlockTypes;
|
||||
import org.allaymc.api.world.chunk.UnsafeChunk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,9 +27,9 @@ public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk {
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
var dimensionInfo = allayChunk.getDimensionInfo();
|
||||
if (x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
if(x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import org.allaymc.api.block.property.type.BlockPropertyTypes;
|
||||
import org.allaymc.api.block.data.BlockTags;
|
||||
import org.allaymc.api.block.property.type.BlockPropertyTypes;
|
||||
import org.allaymc.api.block.type.BlockTypes;
|
||||
import org.allaymc.api.world.generator.context.OtherChunkAccessibleContext;
|
||||
|
||||
@@ -26,6 +26,23 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAcces
|
||||
private static final org.allaymc.api.block.type.BlockState WATER = BlockTypes.WATER.ofState(
|
||||
BlockPropertyTypes.LIQUID_DEPTH.createValue(0));
|
||||
|
||||
// TODO: use method in OtherChunkAccessibleContext directly after bumped allay-api version to 0.14.0
|
||||
private static org.allaymc.api.blockentity.BlockEntity getBlockEntity(OtherChunkAccessibleContext context, int x, int y, int z) {
|
||||
var currentChunk = context.getCurrentChunk();
|
||||
var currentChunkX = currentChunk.getX();
|
||||
var currentChunkZ = currentChunk.getZ();
|
||||
var dimInfo = currentChunk.getDimensionInfo();
|
||||
|
||||
if(x >= currentChunkX * 16 && x < currentChunkX * 16 + 16 &&
|
||||
z >= currentChunkZ * 16 && z < currentChunkZ * 16 + 16 &&
|
||||
y >= dimInfo.minHeight() && y <= dimInfo.maxHeight()) {
|
||||
return currentChunk.getBlockEntity(x & 15, y, z & 15);
|
||||
} else {
|
||||
var chunk = context.getChunkSource().getChunk(x >> 4, z >> 4);
|
||||
return chunk == null ? null : chunk.getBlockEntity(x & 15, y, z & 15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int centerChunkX() {
|
||||
return context.getCurrentChunk().getX();
|
||||
@@ -44,7 +61,7 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAcces
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayServerWorld.allayDimension().getDimensionInfo();
|
||||
if (y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
if(y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,23 +88,6 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAcces
|
||||
return new AllayBlockEntity(getBlockEntity(context, x, y, z));
|
||||
}
|
||||
|
||||
// TODO: use method in OtherChunkAccessibleContext directly after bumped allay-api version to 0.14.0
|
||||
private static org.allaymc.api.blockentity.BlockEntity getBlockEntity(OtherChunkAccessibleContext context, int x, int y, int z) {
|
||||
var currentChunk = context.getCurrentChunk();
|
||||
var currentChunkX = currentChunk.getX();
|
||||
var currentChunkZ = currentChunk.getZ();
|
||||
var dimInfo = currentChunk.getDimensionInfo();
|
||||
|
||||
if (x >= currentChunkX * 16 && x < currentChunkX * 16 + 16 &&
|
||||
z >= currentChunkZ * 16 && z < currentChunkZ * 16 + 16 &&
|
||||
y >= dimInfo.minHeight() && y <= dimInfo.maxHeight()) {
|
||||
return currentChunk.getBlockEntity(x & 15, y, z & 15);
|
||||
} else {
|
||||
var chunk = context.getChunkSource().getChunk(x >> 4, z >> 4);
|
||||
return chunk == null ? null : chunk.getBlockEntity(x & 15, y, z & 15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getGenerator() {
|
||||
return allayServerWorld.getGenerator();
|
||||
|
||||
@@ -28,7 +28,7 @@ public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dime
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayDimension.getDimensionInfo();
|
||||
if (y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
if(y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.dfsek.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
|
||||
import org.allaymc.api.world.data.DimensionInfo;
|
||||
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.dfsek.terra.allay.generator;
|
||||
|
||||
import com.dfsek.terra.allay.Mapping;
|
||||
import com.dfsek.terra.allay.delegate.AllayWorldProperties;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.allaymc.api.utils.AllayStringUtils;
|
||||
import org.allaymc.api.world.biome.BiomeType;
|
||||
@@ -14,10 +11,12 @@ import org.allaymc.api.world.generator.context.PopulateContext;
|
||||
import org.allaymc.api.world.generator.function.Noiser;
|
||||
import org.allaymc.api.world.generator.function.Populator;
|
||||
|
||||
import com.dfsek.terra.allay.Mapping;
|
||||
import com.dfsek.terra.allay.TerraAllayPlugin;
|
||||
import com.dfsek.terra.allay.delegate.AllayProtoChunk;
|
||||
import com.dfsek.terra.allay.delegate.AllayProtoWorld;
|
||||
import com.dfsek.terra.allay.delegate.AllayServerWorld;
|
||||
import com.dfsek.terra.allay.delegate.AllayWorldProperties;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
|
||||
@@ -59,7 +58,7 @@ public class AllayGeneratorWrapper implements GeneratorWrapper {
|
||||
this.worldProperties = new AllayWorldProperties(this.seed, dimension.getDimensionInfo());
|
||||
|
||||
var metaPackName = options.get(OPTION_META_PACK_NAME);
|
||||
if (metaPackName != null) {
|
||||
if(metaPackName != null) {
|
||||
setConfigPack(getConfigPackByMeta(metaPackName, dimension.getDimensionInfo()));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.dfsek.terra.allay.handle;
|
||||
|
||||
import org.allaymc.api.registry.Registries;
|
||||
import org.allaymc.api.utils.identifier.Identifier;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -12,8 +13,6 @@ import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.inventory.Item;
|
||||
import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
|
||||
import org.allaymc.api.utils.identifier.Identifier;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
|
||||
Reference in New Issue
Block a user