Added Tooltips that tell players what type of ground they can place vegetation on.

This commit is contained in:
Frank 2022-03-18 19:18:09 +01:00
parent a9c9a7359b
commit 5a30e60d31
7 changed files with 158 additions and 3 deletions

View 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());
}
}