Sapling drops
This commit is contained in:
parent
22d34e3334
commit
3facb23d0b
1 changed files with 16 additions and 7 deletions
|
@ -1,6 +1,8 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -9,6 +11,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
@ -20,6 +23,7 @@ import net.minecraft.world.level.block.SoundType;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
|
@ -30,7 +34,7 @@ import ru.betterend.registry.EndTags;
|
|||
|
||||
public abstract class FeatureSaplingBlock extends SaplingBlock implements IRenderTypeable, BlockPatterned {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12);
|
||||
|
||||
|
||||
public FeatureSaplingBlock() {
|
||||
super(null, FabricBlockSettings.of(Material.PLANT)
|
||||
.breakByHand(true)
|
||||
|
@ -39,7 +43,7 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
.sound(SoundType.GRASS)
|
||||
.randomTicks());
|
||||
}
|
||||
|
||||
|
||||
public FeatureSaplingBlock(int light) {
|
||||
super(null, FabricBlockSettings.of(Material.PLANT)
|
||||
.breakByHand(true)
|
||||
|
@ -49,8 +53,13 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
.sound(SoundType.GRASS)
|
||||
.randomTicks());
|
||||
}
|
||||
|
||||
|
||||
protected abstract Feature<?> getFeature();
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
|
@ -92,18 +101,18 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
performBonemeal(world, random, pos, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
if (block.contains("item")) {
|
||||
|
@ -112,7 +121,7 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_CROSS, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SAPLING;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue