From 13cb57a87dbf46e24ce4bfe751c47cb4cc8ea3d8 Mon Sep 17 00:00:00 2001 From: yurisuika Date: Sun, 27 Oct 2024 22:26:51 -0700 Subject: [PATCH] change filewriter --- src/main/java/dev/yurisuika/blossom/util/config/Config.java | 3 ++- .../blossom/world/level/block/FloweringLeavesBlock.java | 2 +- .../blossom/world/level/block/FruitingLeavesBlock.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/yurisuika/blossom/util/config/Config.java b/src/main/java/dev/yurisuika/blossom/util/config/Config.java index a165a86..b0b7f74 100644 --- a/src/main/java/dev/yurisuika/blossom/util/config/Config.java +++ b/src/main/java/dev/yurisuika/blossom/util/config/Config.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.FileWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; public class Config { @@ -25,7 +26,7 @@ public static void setOptions(Options options) { public static void saveConfig() { try { - FileWriter fileWriter = new FileWriter(file); + FileWriter fileWriter = new FileWriter(file, StandardCharsets.UTF_8); fileWriter.write(gson.toJson(getOptions())); fileWriter.close(); } catch (Exception e) { diff --git a/src/main/java/dev/yurisuika/blossom/world/level/block/FloweringLeavesBlock.java b/src/main/java/dev/yurisuika/blossom/world/level/block/FloweringLeavesBlock.java index 645ff65..e583575 100644 --- a/src/main/java/dev/yurisuika/blossom/world/level/block/FloweringLeavesBlock.java +++ b/src/main/java/dev/yurisuika/blossom/world/level/block/FloweringLeavesBlock.java @@ -121,7 +121,7 @@ public void randomTick(BlockState state, ServerLevel level, BlockPos pos, Random if (level.isRaining() && precipitation == Precipitation.RAIN) { f = 5.0F; } - if (random.nextInt((int)(25.0F / f) + 1) == 0) { + if (random.nextInt((int) (25.0F / f) + 1) == 0) { level.setBlock(pos, defaultBlockState().setValue(AGE, i + 1) .setValue(DISTANCE, state.getValue(DISTANCE)) .setValue(PERSISTENT, state.getValue(PERSISTENT)) diff --git a/src/main/java/dev/yurisuika/blossom/world/level/block/FruitingLeavesBlock.java b/src/main/java/dev/yurisuika/blossom/world/level/block/FruitingLeavesBlock.java index 90e74ff..176bbfe 100644 --- a/src/main/java/dev/yurisuika/blossom/world/level/block/FruitingLeavesBlock.java +++ b/src/main/java/dev/yurisuika/blossom/world/level/block/FruitingLeavesBlock.java @@ -123,7 +123,7 @@ public void randomTick(BlockState state, ServerLevel level, BlockPos pos, Random if (level.isRaining() && precipitation == Precipitation.RAIN) { f = 5.0F; } - if (random.nextInt((int)(25.0F / f) + 1) == 0) { + if (random.nextInt((int) (25.0F / f) + 1) == 0) { level.setBlock(pos, defaultBlockState().setValue(AGE, i + 1) .setValue(DISTANCE, state.getValue(DISTANCE)) .setValue(PERSISTENT, state.getValue(PERSISTENT))