Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ModStrippedLogsBlock {
- public static Map<Block, Block> BLOCK_STRIPPING_MAP = new HashMap<>();
- static {
- BLOCK_STRIPPING_MAP.put(ModBlock.DANDELION_LOG.get(), ModBlock.STRIPPED_DANDELION_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.LEMON_LIME_LOG.get(), ModBlock.STRIPPED_LEMON_LIME_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.SEAFOAM_LOG.get(), ModBlock.STRIPPED_SEAFOAM_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.TROPICAL_LOG.get(), ModBlock.STRIPPED_TROPICAL_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.STRAWBERRRY_LOG.get(), ModBlock.STRIPPED_STRAWBERRY_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.SWEET_STRAWBERRY_LOG.get(), ModBlock.STRIPPED_SWEET_STRAWBERRY_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.LAVENDER_LOG.get(), ModBlock.STRIPPED_LAVENDER_LOG.get());
- BLOCK_STRIPPING_MAP.put(ModBlock.MYSTIC_LOG.get(), ModBlock.STRIPPED_MYSTIC_LOG.get());
- }
- @SubscribeEvent
- public static void onBlockClicked(PlayerInteractEvent.RightClickBlock event) {
- if (event.getItemStack().getItem() instanceof AxeItem) {
- World world = event.getWorld();
- BlockPos blockpos = event.getPos();
- BlockState blockstate = world.getBlockState(blockpos);
- Block block = BLOCK_STRIPPING_MAP.get(blockstate.getBlock());
- if (block != null) {
- PlayerEntity playerentity = event.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) {
- event.getItemStack().damageItem(1, playerentity, (p_220040_1_) -> p_220040_1_.sendBreakAnimation(event.getHand()));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement