Reorganized Imports/Packages
This commit is contained in:
parent
cb9459f176
commit
3ee10482ab
721 changed files with 34873 additions and 33558 deletions
|
@ -0,0 +1,33 @@
|
|||
package org.betterx.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.Comparator;
|
||||
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 && block != null)
|
||||
.map(block -> {
|
||||
ItemStack stack = new ItemStack(block);
|
||||
if (stack.hasCustomHoverName()) return stack.getHoverName().getString();
|
||||
else return block.getName().getString();
|
||||
})
|
||||
.sorted(Comparator.naturalOrder())
|
||||
.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