mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-06-08 05:53:37 +02:00
70 lines
2.4 KiB
Java
70 lines
2.4 KiB
Java
package de.ellpeck.naturesaura.blocks;
|
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
|
import de.ellpeck.naturesaura.reg.*;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockState;
|
|
import net.minecraft.block.BushBlock;
|
|
import net.minecraft.block.SoundType;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.RenderType;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.Vec3d;
|
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
|
import net.minecraft.util.math.shapes.VoxelShape;
|
|
import net.minecraft.world.IBlockReader;
|
|
|
|
import javax.annotation.Nullable;
|
|
import java.util.function.Supplier;
|
|
|
|
public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockState, ICustomItemModel, ICustomRenderType {
|
|
|
|
protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
|
|
|
public BlockAuraBloom() {
|
|
super(ModBlocks.prop(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
|
|
ModRegistry.add(this);
|
|
ModRegistry.add(new ModTileType<>(TileEntityAuraBloom::new, this));
|
|
}
|
|
|
|
@Override
|
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
|
Vec3d vec3d = state.getOffset(worldIn, pos);
|
|
return SHAPE.withOffset(vec3d.x, vec3d.y, vec3d.z);
|
|
}
|
|
|
|
@Override
|
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
|
generator.simpleBlock(this, generator.models().cross(this.getBaseName(), generator.modLoc("block/" + this.getBaseName())));
|
|
}
|
|
|
|
@Override
|
|
public void generateCustomItemModel(ItemModelGenerator generator) {
|
|
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
|
|
}
|
|
|
|
@Override
|
|
public Supplier<RenderType> getRenderType() {
|
|
return RenderType::cutout;
|
|
}
|
|
|
|
@Override
|
|
public String getBaseName() {
|
|
return "aura_bloom";
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
|
return new TileEntityAuraBloom();
|
|
}
|
|
|
|
@Override
|
|
public boolean hasTileEntity(BlockState state) {
|
|
return true;
|
|
}
|
|
}
|