Amaranita mushroom blocks (WIP), Sagnum
This commit is contained in:
parent
81fe38ad8d
commit
5e3a3ef6cd
40 changed files with 478 additions and 4 deletions
44
src/main/java/ru/betterend/blocks/LargeAmaranitaBlock.java
Normal file
44
src/main/java/ru/betterend/blocks/LargeAmaranitaBlock.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.EndPlantBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class LargeAmaranitaBlock extends EndPlantBlock {
|
||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.getBlock() == EndBlocks.SANGNUM;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(SHAPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
TripleShape shape = state.get(SHAPE);
|
||||
if (shape == TripleShape.BOTTOM) {
|
||||
return isTerrain(world.getBlockState(pos.down())) && world.getBlockState(pos.up()).isOf(this);
|
||||
}
|
||||
else if (shape == TripleShape.TOP) {
|
||||
return world.getBlockState(pos.down()).isOf(this);
|
||||
}
|
||||
else {
|
||||
return world.getBlockState(pos.down()).isOf(this) && world.getBlockState(pos.up()).isOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OffsetType getOffsetType() {
|
||||
return OffsetType.NONE;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue