Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ModStrippedLogsBlock extends LogBlock {
- public static final Map<Block, Block> BLOCK_STRIPPING_MAP = (new Builder<Block, Block>()).put
- (ModBlock.DANDELION_LOG.get(), ModBlock.STRIPPED_DANDELION_LOG.get()).put
- (ModBlock.LEMON_LIME_LOG.get(), ModBlock.STRIPPED_LEMON_LIME_LOG.get()).put
- (ModBlock.SEAFOAM_LOG.get(), ModBlock.STRIPPED_SEAFOAM_LOG.get()).put
- (ModBlock.TROPICAL_LOG.get(), ModBlock.STRIPPED_TROPICAL_LOG.get()).put
- (ModBlock.STRAWBERRRY_LOG.get(), ModBlock.STRIPPED_STRAWBERRY_LOG.get()).put
- (ModBlock.SWEET_STRAWBERRY_LOG.get(), ModBlock.STRIPPED_SWEET_STRAWBERRY_LOG.get()).put
- (ModBlock.LAVENDER_LOG.get(), ModBlock.STRIPPED_LAVENDER_LOG.get()).put
- (ModBlock.MYSTIC_LOG.get(), ModBlock.STRIPPED_MYSTIC_LOG.get()).build();
- public ModStrippedLogsBlock(MaterialColor verticalColorIn, Properties properties) {
- super(verticalColorIn, properties);
- }
- public ActionResultType onBlockActivated(ItemUseContext context) {
- World world = context.getWorld();
- BlockPos blockpos = context.getPos();
- BlockState blockstate = world.getBlockState(blockpos);
- Block block = BLOCK_STRIPPING_MAP.get(blockstate.getBlock());
- if (block != null) {
- PlayerEntity playerentity = context.getPlayer();
- world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F);
- if (!world.isRemote) {
- world.setBlockState(blockpos, block.getDefaultState().with(RotatedPillarBlock.AXIS, blockstate.get(RotatedPillarBlock.AXIS)), 11);
- if (playerentity != null) {
- context.getItem().damageItem(1, playerentity, (p_220040_1_) -> {
- p_220040_1_.sendBreakAnimation(context.getHand());
- });
- }
- }
- return ActionResultType.SUCCESS;
- } else {
- return ActionResultType.PASS;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement