Start migration
This commit is contained in:
parent
6630ce0cab
commit
47ed597358
491 changed files with 12045 additions and 11953 deletions
|
@ -5,53 +5,53 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.loot.context.LootContextParameters;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.Registry;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndBookshelfBlock extends BlockBase {
|
||||
public EndBookshelfBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.get(LootContextParameters.TOOL);
|
||||
if (tool != null && tool.isEffectiveOn(state)) {
|
||||
int silk = EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, tool);
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.isCorrectToolForDrops(state)) {
|
||||
int silk = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool);
|
||||
if (silk > 0) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
}
|
||||
return Collections.singletonList(new ItemStack(Items.BOOK, 3));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_BOOKSHELF, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
private String getName(Identifier blockId) {
|
||||
|
||||
private String getName(ResourceLocation blockId) {
|
||||
String name = blockId.getPath();
|
||||
return name.replace("_bookshelf", "");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue