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 4a49126..b098307 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 @@ -14,7 +14,7 @@ import net.minecraft.util.ParticleUtils; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -122,7 +122,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)) @@ -248,7 +248,7 @@ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos applyGrowth(level, pos, state); } - public InteractionResult useItemOn(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack itemStack = player.getItemInHand(hand); Item item = itemStack.getItem(); if (item instanceof ShearsItem) { @@ -263,9 +263,9 @@ public InteractionResult useItemOn(BlockState state, Level level, BlockPos pos, .setValue(PERSISTENT, state.getValue(PERSISTENT)) .setValue(WATERLOGGED, state.getValue(WATERLOGGED)) ); - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } else { - return InteractionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } } 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 56083ca..b5a1067 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 @@ -14,7 +14,7 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -125,7 +125,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)) @@ -255,7 +255,7 @@ public static void dropFruit(Level level, BlockPos pos, Item item, int bonus) { popResource(level, pos, new ItemStack(item, count)); } - public InteractionResult useItemOn(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack itemStack = player.getItemInHand(hand); if (isMaxAge(state)) { Item item = itemStack.getItem(); @@ -273,9 +273,9 @@ public InteractionResult useItemOn(BlockState state, Level level, BlockPos pos, .setValue(WATERLOGGED, state.getValue(WATERLOGGED)) ); } - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } else { - return InteractionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } } diff --git a/src/main/resources/blossom.mixins.json b/src/main/resources/blossom.mixins.json index 031ac65..aa466b9 100644 --- a/src/main/resources/blossom.mixins.json +++ b/src/main/resources/blossom.mixins.json @@ -3,7 +3,7 @@ "minVersion": "0.8", "package": "dev.yurisuika.blossom.mixin", "refmap": "blossom.refmap.json", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "world.entity.EntityAccessor", "world.entity.MobAccessor",