Advertisement
jayhillx

strippedlogs test#10,000

Aug 21st, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. public class ModStrippedLogsBlock extends LogBlock {
  2. public static final Map<Block, Block> BLOCK_STRIPPING_MAP = (new Builder<Block, Block>()).put
  3. (ModBlock.DANDELION_LOG.get(), ModBlock.STRIPPED_DANDELION_LOG.get()).put
  4. (ModBlock.LEMON_LIME_LOG.get(), ModBlock.STRIPPED_LEMON_LIME_LOG.get()).put
  5. (ModBlock.SEAFOAM_LOG.get(), ModBlock.STRIPPED_SEAFOAM_LOG.get()).put
  6. (ModBlock.TROPICAL_LOG.get(), ModBlock.STRIPPED_TROPICAL_LOG.get()).put
  7. (ModBlock.STRAWBERRRY_LOG.get(), ModBlock.STRIPPED_STRAWBERRY_LOG.get()).put
  8. (ModBlock.SWEET_STRAWBERRY_LOG.get(), ModBlock.STRIPPED_SWEET_STRAWBERRY_LOG.get()).put
  9. (ModBlock.LAVENDER_LOG.get(), ModBlock.STRIPPED_LAVENDER_LOG.get()).put
  10. (ModBlock.MYSTIC_LOG.get(), ModBlock.STRIPPED_MYSTIC_LOG.get()).build();
  11.  
  12. public ModStrippedLogsBlock(MaterialColor verticalColorIn, Properties properties) {
  13. super(verticalColorIn, properties);
  14. }
  15.  
  16. public ActionResultType onBlockActivated(ItemUseContext context) {
  17. World world = context.getWorld();
  18. BlockPos blockpos = context.getPos();
  19. BlockState blockstate = world.getBlockState(blockpos);
  20. Block block = BLOCK_STRIPPING_MAP.get(blockstate.getBlock());
  21. if (block != null) {
  22. PlayerEntity playerentity = context.getPlayer();
  23. world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F);
  24. if (!world.isRemote) {
  25. world.setBlockState(blockpos, block.getDefaultState().with(RotatedPillarBlock.AXIS, blockstate.get(RotatedPillarBlock.AXIS)), 11);
  26. if (playerentity != null) {
  27. context.getItem().damageItem(1, playerentity, (p_220040_1_) -> {
  28. p_220040_1_.sendBreakAnimation(context.getHand());
  29. });
  30. }
  31. }
  32.  
  33. return ActionResultType.SUCCESS;
  34. } else {
  35. return ActionResultType.PASS;
  36. }
  37. }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement