diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 73c656f2f..706dd7079 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -6,6 +6,7 @@
+
diff --git a/Allay-API/src/main/java/org/allaymc/api/world/Dimension.java b/Allay-API/src/main/java/org/allaymc/api/world/Dimension.java
index c9f00759b..ade4283f7 100644
--- a/Allay-API/src/main/java/org/allaymc/api/world/Dimension.java
+++ b/Allay-API/src/main/java/org/allaymc/api/world/Dimension.java
@@ -442,11 +442,12 @@ default void breakBlock(Vector3ic pos, ItemStack usedItem, EntityPlayer player)
/**
* Break a block at the specified position
- * @param x The x coordinate of the block
- * @param y The y coordinate of the block
- * @param z The z coordinate of the block
+ *
+ * @param x The x coordinate of the block
+ * @param y The y coordinate of the block
+ * @param z The z coordinate of the block
* @param usedItem The item used to break the block, can be null
- * @param player The player who breaks the block, can be null
+ * @param player The player who breaks the block, can be null
*/
void breakBlock(int x, int y, int z, ItemStack usedItem, EntityPlayer player);
}
diff --git a/Allay-API/src/main/java/org/allaymc/api/world/WorldData.java b/Allay-API/src/main/java/org/allaymc/api/world/WorldData.java
index d38421127..a6eebbbbd 100644
--- a/Allay-API/src/main/java/org/allaymc/api/world/WorldData.java
+++ b/Allay-API/src/main/java/org/allaymc/api/world/WorldData.java
@@ -7,6 +7,7 @@
import org.allaymc.api.world.gamerule.GameRule;
import org.allaymc.api.world.gamerule.GameRules;
import org.cloudburstmc.protocol.bedrock.data.GameType;
+import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Vector3i;
import org.joml.Vector3ic;
@@ -21,6 +22,7 @@ public class WorldData {
public static final long TIME_MIDNIGHT = 18000;
public static final long TIME_SUNRISE = 23000;
public static final long TIME_FULL = 24000;
+
@Builder.Default
String biomeOverride = "";
@Builder.Default
@@ -30,8 +32,28 @@ public class WorldData {
@Builder.Default
Difficulty difficulty = Difficulty.from(1);
@Builder.Default
+ @Language("JSON")
String flatWorldLayers = """
- {"biome_id":1,"block_layers":[{"block_name":"minecraft:bedrock","count":1},{"block_name":"minecraft:dirt","count":2},{"block_name":"minecraft:grass","count":1}],"encoding_version":6,"structure_options":null,"world_version":"version.post_1_18"}
+ {
+ "biome_id": 1,
+ "block_layers": [
+ {
+ "block_name": "minecraft:bedrock",
+ "count": 1
+ },
+ {
+ "block_name": "minecraft:dirt",
+ "count": 2
+ },
+ {
+ "block_name": "minecraft:grass",
+ "count": 1
+ }
+ ],
+ "encoding_version": 6,
+ "structure_options": null,
+ "world_version": "version.post_1_18"
+ }
""";
@Builder.Default
boolean forceGameType = false;
diff --git a/Allay-Server/src/main/java/org/allaymc/server/Allay.java b/Allay-Server/src/main/java/org/allaymc/server/Allay.java
index 4a9e85d65..ac4996e11 100644
--- a/Allay-Server/src/main/java/org/allaymc/server/Allay.java
+++ b/Allay-Server/src/main/java/org/allaymc/server/Allay.java
@@ -116,7 +116,7 @@ private static boolean isHeadless() {
Class> graphicsEnv = Class.forName("java.awt.GraphicsEnvironment");
Method isHeadless = graphicsEnv.getDeclaredMethod("isHeadless");
return (boolean) isHeadless.invoke(null);
- } catch (Exception ignore) { }
+ } catch (Exception ignore) {}
return true;
}
diff --git a/Allay-Server/src/main/java/org/allaymc/server/world/AllayDimension.java b/Allay-Server/src/main/java/org/allaymc/server/world/AllayDimension.java
index cc3d4fd60..a50093a37 100644
--- a/Allay-Server/src/main/java/org/allaymc/server/world/AllayDimension.java
+++ b/Allay-Server/src/main/java/org/allaymc/server/world/AllayDimension.java
@@ -10,7 +10,6 @@
import org.allaymc.api.world.DimensionInfo;
import org.allaymc.api.world.World;
import org.allaymc.api.world.generator.WorldGenerator;
-import org.allaymc.server.world.generator.AllayWorldGenerator;
import org.allaymc.api.world.service.BlockUpdateService;
import org.allaymc.api.world.service.ChunkService;
import org.allaymc.api.world.service.EntityPhysicsService;
@@ -114,7 +113,7 @@ public void breakBlock(int x, int y, int z, ItemStack usedItem, EntityPlayer pla
pk.setType(LevelEvent.PARTICLE_DESTROY_BLOCK);
pk.setPosition(Vector3f.from(x + 0.5f, y + 0.5f, z + 0.5f));
pk.setData(block.blockStateHash());
- getChunkService().getChunkByLevelPos(x ,z).addChunkPacket(pk);
+ getChunkService().getChunkByLevelPos(x, z).addChunkPacket(pk);
block.getBehavior().onBreak(
new BlockStateWithPos(block, new Position3i(x, y, z, this), 0),
usedItem,
diff --git a/Allay-Server/src/main/java/org/allaymc/server/world/AllayWorldPool.java b/Allay-Server/src/main/java/org/allaymc/server/world/AllayWorldPool.java
index 612d97415..adef5ec49 100644
--- a/Allay-Server/src/main/java/org/allaymc/server/world/AllayWorldPool.java
+++ b/Allay-Server/src/main/java/org/allaymc/server/world/AllayWorldPool.java
@@ -53,7 +53,7 @@ public void loadWorlds() {
@Override
public void close() {
- worlds.values().forEach(org.allaymc.api.world.World::close);
+ worlds.values().forEach(World::close);
}
@Override
diff --git a/Allay-Server/src/test/java/org/allaymc/server/block/BlockAttributesTest.java b/Allay-Server/src/test/java/org/allaymc/server/block/BlockAttributesTest.java
index 2c867a593..d12c2d396 100644
--- a/Allay-Server/src/test/java/org/allaymc/server/block/BlockAttributesTest.java
+++ b/Allay-Server/src/test/java/org/allaymc/server/block/BlockAttributesTest.java
@@ -7,15 +7,13 @@
import org.allaymc.api.block.type.BlockType;
import org.allaymc.api.data.VanillaBlockId;
import org.allaymc.testutils.AllayTestExtension;
+import org.intellij.lang.annotations.Language;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import java.awt.*;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* Allay Project 2023/3/25
@@ -25,54 +23,54 @@
@ExtendWith(AllayTestExtension.class)
@Slf4j
class BlockAttributesTest {
+ @Language("JSON")
private static final String json = """
{
- "aabbCollision": "0.0005,0.0005,0.0005,0.9995,0.1825,0.9995",
- "burnAbility": 0,
- "burnChance": 0,
- "canContainLiquid": true,
- "color": {
- "a": 255,
- "b": 178,
- "g": 76,
- "hexString": "#ff334cb2",
- "nearestColorCode": "§9",
- "r": 51
- },
- "explosionResistance": 15,
- "friction": 0.6,
- "hardness": 3,
- "hasBlockEntity": false,
- "hasComparatorSignal": false,
- "hasCollision": true,
- "name": "minecraft:trapdoor",
- "isAlwaysDestroyable": true,
- "isContainerBlock": false,
- "isLiquid": false,
- "isMotionBlockingBlock": false,
- "isPowerSource": false,
- "isSolid": false,
- "isUnbreakable": false,
- "isWaterBlocking": true,
- "isLavaFlammable": true,
- "lightDampening": 0,
- "lightEmission": 0,
- "pushesUpFallingBlocks": false,
- "superHot": false,
- "thickness": 0,
- "translucency": 0,
- "isAir": true,
- "isBounceBlock": true,
- "isButtonBlock": true,
- "isCropBlock": true,
- "isDoorBlock": true,
- "isFallingBlock": true,
- "isFenceBlock": true,
- "isFenceGateBlock": true,
- "isLavaFlammable": true,
- "isSlabBlock": true,
- "isStemBlock": true,
- "isThinFenceBlock": true
+ "aabbCollision": "0.0005,0.0005,0.0005,0.9995,0.1825,0.9995",
+ "burnAbility": 0,
+ "burnChance": 0,
+ "canContainLiquid": true,
+ "color": {
+ "a": 255,
+ "b": 178,
+ "g": 76,
+ "hexString": "#ff334cb2",
+ "nearestColorCode": "§9",
+ "r": 51
+ },
+ "explosionResistance": 15,
+ "friction": 0.6,
+ "hardness": 3,
+ "hasBlockEntity": false,
+ "hasComparatorSignal": false,
+ "hasCollision": true,
+ "name": "minecraft:trapdoor",
+ "isAlwaysDestroyable": true,
+ "isContainerBlock": false,
+ "isLiquid": false,
+ "isMotionBlockingBlock": false,
+ "isPowerSource": false,
+ "isSolid": false,
+ "isUnbreakable": false,
+ "isWaterBlocking": true,
+ "lightDampening": 0,
+ "lightEmission": 0,
+ "pushesUpFallingBlocks": false,
+ "superHot": false,
+ "thickness": 0,
+ "translucency": 0,
+ "isAir": true,
+ "isBounceBlock": true,
+ "isButtonBlock": true,
+ "isCropBlock": true,
+ "isDoorBlock": true,
+ "isFallingBlock": true,
+ "isFenceBlock": true,
+ "isFenceGateBlock": true,
+ "isLavaFlammable": true,
+ "isSlabBlock": true,
+ "isStemBlock": true,
+ "isThinFenceBlock": true
}
""";
@@ -115,8 +113,8 @@ void testVanillaBlockAttributes() {
for (var state : type.getBlockStateHashMap().values()) {
var expected = attributeMap.get(state.blockStateHash());
if (expected == null) {
- log.error("Missing block attributes for state: " + state + ", Block: " + type.getIdentifier());
- log.info("expected blockhash: " + state.blockStateHash());
+ log.error("Missing block attributes for state: {}, Block: {}", state, type.getIdentifier());
+ log.info("expected blockhash: {}", state.blockStateHash());
error++;
}
}