Additional plants

This commit is contained in:
paulevsGitch 2021-03-17 14:26:39 +03:00
parent 37b24bfcaf
commit c3ce436fe0
59 changed files with 1468 additions and 5 deletions

View file

@ -0,0 +1,57 @@
package ru.betterend.blocks;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks;
public class BoluxMushroomBlock extends EndPlantBlock {
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 0, 1, 15, 9, 15);
public BoluxMushroomBlock() {
super(10);
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.RUTISCUS);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
}
@Override
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}
@Override
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
return false;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this));
}
}

View file

@ -0,0 +1,63 @@
package ru.betterend.blocks;
import java.util.List;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.interfaces.ISpetialItem;
public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
private static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 1, 16);
public FlamaeaBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.WET_GRASS)
.breakByHand(true));
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(Blocks.WATER);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this));
}
@Override
public int getStackSize() {
return 64;
}
@Override
public boolean canPlaceOnWater() {
return true;
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
@ -38,11 +39,12 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.entities.ESignBlockEntity;
import ru.betterend.interfaces.ISpetialItem;
import ru.betterend.patterns.BlockPatterned;
import ru.betterend.patterns.Patterns;
import ru.betterend.util.BlocksHelper;
public class EndSignBlock extends AbstractSignBlock implements BlockPatterned {
public class EndSignBlock extends AbstractSignBlock implements BlockPatterned, ISpetialItem {
public static final IntProperty ROTATION = Properties.ROTATION;
public static final BooleanProperty FLOOR = BooleanProperty.of("floor");
private static final VoxelShape[] WALL_SHAPES = new VoxelShape[] {
@ -177,4 +179,32 @@ public class EndSignBlock extends AbstractSignBlock implements BlockPatterned {
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
@Override
public Fluid tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
// TODO Auto-generated method stub
return false;
}
@Override
public int getStackSize() {
return 16;
}
@Override
public boolean canPlaceOnWater() {
return false;
}
}