From 7fc1c96a2b6fbb607341bf16f8a517f4cadda245 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 17 Jun 2023 20:14:08 +0200 Subject: [PATCH] [Fix] Hydralux Sapling is missing survival description (#228) --- .../betterend/blocks/HydraluxSaplingBlock.java | 11 ++++++++--- .../survives/SurvivesOnSulphuricRock.java | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/betterx/betterend/interfaces/survives/SurvivesOnSulphuricRock.java diff --git a/src/main/java/org/betterx/betterend/blocks/HydraluxSaplingBlock.java b/src/main/java/org/betterx/betterend/blocks/HydraluxSaplingBlock.java index 31410f4a..2afaddef 100644 --- a/src/main/java/org/betterx/betterend/blocks/HydraluxSaplingBlock.java +++ b/src/main/java/org/betterx/betterend/blocks/HydraluxSaplingBlock.java @@ -4,6 +4,7 @@ import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSapling; import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock; import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.MHelper; +import org.betterx.betterend.interfaces.survives.SurvivesOnSulphuricRock; import org.betterx.betterend.registry.EndBlocks; import net.minecraft.core.BlockPos; @@ -13,7 +14,7 @@ import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling { +public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling, SurvivesOnSulphuricRock { @Override public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) { @@ -70,7 +71,11 @@ public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements } @Override - protected boolean isTerrain(BlockState state) { - return state.is(EndBlocks.SULPHURIC_ROCK.stone); + public boolean isTerrain(BlockState state) { + return SurvivesOnSulphuricRock.super.isTerrain(state); + } + + public String prefixComponent() { + return "tooltip.bclib.place_underwater_on"; } } diff --git a/src/main/java/org/betterx/betterend/interfaces/survives/SurvivesOnSulphuricRock.java b/src/main/java/org/betterx/betterend/interfaces/survives/SurvivesOnSulphuricRock.java new file mode 100644 index 00000000..5c301b46 --- /dev/null +++ b/src/main/java/org/betterx/betterend/interfaces/survives/SurvivesOnSulphuricRock.java @@ -0,0 +1,17 @@ +package org.betterx.betterend.interfaces.survives; + +import org.betterx.bclib.interfaces.SurvivesOnBlocks; +import org.betterx.betterend.registry.EndBlocks; + +import net.minecraft.world.level.block.Block; + +import java.util.List; + +public interface SurvivesOnSulphuricRock extends SurvivesOnBlocks { + List BLOCKS = List.of(EndBlocks.SULPHURIC_ROCK.stone); + + @Override + default List getSurvivableBlocks() { + return BLOCKS; + } +}