Advertisement
Guest User

Untitled

a guest
Aug 27th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. @Override
  2. public void onEmblemTick(ItemStack stack, PlayerEntity player, Entity entity) {
  3. if (!isEmblemEnabled(stack) || player.isRidingOrBeingRiddenBy(entity)) return;
  4.  
  5. POS.setPos(player.posX, player.posY - 1, player.posZ);
  6. BlockPos min = POS.subtract(new Vec3i(1, 0, 1));
  7. BlockPos max = POS.add(new Vec3i(1, 0, 1));
  8. boolean hasPlacedBlocks = false;
  9.  
  10. for (BlockPos target : BlockPos.getAllInBoxMutable(min, max)) {
  11. BlockState stateAt = player.world.getBlockState(target);
  12. if (stateAt.getBlock().isReplaceable(player.world, target)) {
  13. hasPlacedBlocks = true;
  14. if (!player.world.isRemote) {
  15. player.world.setBlockState(target, MATERIAL);
  16. stack.damageItem(1, player,l ->l.sendBreakAnimation(EquipmentSlotType.MAINHAND));
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement