Mosses, fixes

This commit is contained in:
paulevsGitch 2020-10-01 01:39:06 +03:00
parent 4eb7105e33
commit 72b173a9e3
28 changed files with 354 additions and 53 deletions

View file

@ -2,23 +2,15 @@ package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.BlockDoublePlant;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.util.BlocksHelper;
public class BlockUmbrellaMossTall extends BlockDoublePlant {
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public BlockUmbrellaMossTall() {
super(12);
}
@ -30,15 +22,7 @@ public class BlockUmbrellaMossTall extends BlockDoublePlant {
}
@Override
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
int rot = world.random.nextInt(4);
BlocksHelper.setWithoutUpdate(world, pos, this.getDefaultState().with(ROTATION, rot));
BlocksHelper.setWithoutUpdate(world, pos.up(), this.getDefaultState().with(ROTATION, rot).with(TOP, true));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
super.appendProperties(stateManager);
stateManager.add(ROTATION);
protected boolean isTerrain(BlockState state) {
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
}
}