Added Tooltips that tell players what type of ground they can place vegetation on.
This commit is contained in:
parent
a9c9a7359b
commit
5a30e60d31
7 changed files with 158 additions and 3 deletions
27
src/main/java/ru/bclib/interfaces/SurvivesOnBlocks.java
Normal file
27
src/main/java/ru/bclib/interfaces/SurvivesOnBlocks.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package ru.bclib.interfaces;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface SurvivesOnBlocks extends SurvivesOnSpecialGround{
|
||||
List<Block> getSurvivableBlocks();
|
||||
|
||||
@Override
|
||||
default String getSurvivableBlocksString(){
|
||||
return getSurvivableBlocks()
|
||||
.stream()
|
||||
.filter(block -> block!= Blocks.AIR)
|
||||
.map(block ->new ItemStack(block).getHoverName().getString())
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean isSurvivable(BlockState state){
|
||||
return getSurvivableBlocks().contains(state.getBlock());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue