[Change] Helper for underwater survival hints
This commit is contained in:
parent
4f934cdaf0
commit
07f8bce1dc
4 changed files with 23 additions and 0 deletions
|
@ -59,6 +59,18 @@ public interface SurvivesOnSpecialGround extends SurvivesOn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public static void appendHoverTextUnderwater(List<Component> list) {
|
||||||
|
list.add(Component.translatable("tooltip.bclib.place_underwater")
|
||||||
|
.withStyle(ChatFormatting.GREEN));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public static void appendHoverTextUnderwaterInDepth(List<Component> list, int depth) {
|
||||||
|
list.add(Component.translatable("tooltip.bclib.place_underwater_depth", depth)
|
||||||
|
.withStyle(ChatFormatting.GREEN));
|
||||||
|
}
|
||||||
|
|
||||||
default boolean canSurviveOnTop(LevelReader world, BlockPos pos) {
|
default boolean canSurviveOnTop(LevelReader world, BlockPos pos) {
|
||||||
return isSurvivable(world.getBlockState(pos.below()));
|
return isSurvivable(world.getBlockState(pos.below()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package org.betterx.bclib.interfaces;
|
package org.betterx.bclib.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,4 +15,8 @@ public interface SurvivesOnWater extends SurvivesOnBlocks {
|
||||||
default List<Block> getSurvivableBlocks() {
|
default List<Block> getSurvivableBlocks() {
|
||||||
return BLOCKS;
|
return BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||||
|
return world.getBlockState(pos).isAir() && isTerrain(world.getBlockState(pos.below()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,8 @@
|
||||||
"title.screen.bclib.worldgen.void_biome_size": "Kleine Inseln",
|
"title.screen.bclib.worldgen.void_biome_size": "Kleine Inseln",
|
||||||
"tooltip.bclib.place_on": "Lebt auf: %s",
|
"tooltip.bclib.place_on": "Lebt auf: %s",
|
||||||
"tooltip.bclib.place_underwater_on": "Lebt unter Wasser auf: %s",
|
"tooltip.bclib.place_underwater_on": "Lebt unter Wasser auf: %s",
|
||||||
|
"tooltip.bclib.place_underwater": "Lebt unter Wasser",
|
||||||
|
"tooltip.bclib.place_underwater_depth": "min. Tiefe: %d",
|
||||||
"tooltip.bclib.pottable_on": "Eintopfen auf: %s",
|
"tooltip.bclib.pottable_on": "Eintopfen auf: %s",
|
||||||
"warning.config.bclib.client.ui.forceBetterXPreset": "IN DEN MEISTEN FÄLLEN SOLLTE DIESE OPTION AKTIVIERT BLEIBEN.\n"
|
"warning.config.bclib.client.ui.forceBetterXPreset": "IN DEN MEISTEN FÄLLEN SOLLTE DIESE OPTION AKTIVIERT BLEIBEN.\n"
|
||||||
}
|
}
|
|
@ -110,6 +110,8 @@
|
||||||
"title.screen.bclib.worldgen.void_biome_size": "Small Island Biomes",
|
"title.screen.bclib.worldgen.void_biome_size": "Small Island Biomes",
|
||||||
"tooltip.bclib.place_on": "Survives on: %s",
|
"tooltip.bclib.place_on": "Survives on: %s",
|
||||||
"tooltip.bclib.place_underwater_on": "Survives under water on: %s",
|
"tooltip.bclib.place_underwater_on": "Survives under water on: %s",
|
||||||
|
"tooltip.bclib.place_underwater": "Survives under water",
|
||||||
|
"tooltip.bclib.place_underwater_depth": "min. depth: %d",
|
||||||
"tooltip.bclib.pottable_on": "Pottable on: %s",
|
"tooltip.bclib.pottable_on": "Pottable on: %s",
|
||||||
"warning.config.bclib.client.ui.forceBetterXPreset": "MOST LIKELY YOU WILL WANT TO KEEP THIS OPTION ENABLED.\n"
|
"warning.config.bclib.client.ui.forceBetterXPreset": "MOST LIKELY YOU WILL WANT TO KEEP THIS OPTION ENABLED.\n"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue