Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
  2. {
  3. if (!world.isRemote)
  4. {
  5. TEBase TE = getTileEntity(world, x, y, z);
  6.  
  7. if (TE != null)
  8. {
  9. if (PlayerPermissions.canPlayerEdit(TE, TE.xCoord, TE.yCoord, TE.zCoord, entityPlayer))
  10. {
  11. ActionResult actionResult = new ActionResult();
  12. ItemStack itemStack = entityPlayer.getCurrentEquippedItem();
  13.  
  14. if (itemStack != null) {
  15.  
  16. int effectiveSide = TE.hasAttribute(TE.ATTR_COVER[EventHandler.eventFace]) ? EventHandler.eventFace : 6;
  17. Item item = itemStack.getItem();
  18.  
  19. if (item instanceof ICarpentersHammer && ((ICarpentersHammer)item).canUseHammer(world, entityPlayer)) {
  20.  
  21. preOnBlockClicked(TE, world, x, y, z, entityPlayer, actionResult);
  22.  
  23. if (!actionResult.altered) {
  24.  
  25. if (entityPlayer.isSneaking()) {
  26.  
  27. if (TE.hasAttribute(TE.ATTR_ILLUMINATOR)) {
  28. TE.removeAttribute(TE.ATTR_ILLUMINATOR);
  29. actionResult.setAltered();
  30. } else if (TE.hasAttribute(TE.ATTR_OVERLAY[effectiveSide])) {
  31. TE.removeAttribute(TE.ATTR_OVERLAY[effectiveSide]);
  32. actionResult.setAltered();
  33. } else if (TE.hasAttribute(TE.ATTR_DYE[effectiveSide])) {
  34. TE.removeAttribute(TE.ATTR_DYE[effectiveSide]);
  35. actionResult.setAltered();
  36. } else if (TE.hasAttribute(TE.ATTR_COVER[effectiveSide])) {
  37. TE.removeAttribute(TE.ATTR_COVER[effectiveSide]);
  38. TE.removeChiselDesign(effectiveSide);
  39. actionResult.setAltered();
  40. }
  41.  
  42. } else {
  43.  
  44. onHammerLeftClick(TE, entityPlayer);
  45. actionResult.setAltered();
  46.  
  47. }
  48.  
  49. }
  50.  
  51. if (actionResult.altered) {
  52. onNeighborBlockChange(world, x, y, z, this);
  53. world.notifyBlocksOfNeighborChange(x, y, z, this);
  54. }
  55.  
  56. } else if (item instanceof ICarpentersChisel && ((ICarpentersChisel)item).canUseChisel(world, entityPlayer)) {
  57.  
  58. if (entityPlayer.isSneaking()) {
  59.  
  60. if (TE.hasChiselDesign(effectiveSide)) {
  61. TE.removeChiselDesign(effectiveSide);
  62. }
  63.  
  64. } else if (TE.hasAttribute(TE.ATTR_COVER[effectiveSide])) {
  65.  
  66. onChiselClick(TE, effectiveSide, true);
  67.  
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement