Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
- {
- if (!world.isRemote)
- {
- TEBase TE = getTileEntity(world, x, y, z);
- if (TE != null)
- {
- if (PlayerPermissions.canPlayerEdit(TE, TE.xCoord, TE.yCoord, TE.zCoord, entityPlayer))
- {
- ActionResult actionResult = new ActionResult();
- ItemStack itemStack = entityPlayer.getCurrentEquippedItem();
- if (itemStack != null) {
- int effectiveSide = TE.hasAttribute(TE.ATTR_COVER[EventHandler.eventFace]) ? EventHandler.eventFace : 6;
- Item item = itemStack.getItem();
- if (item instanceof ICarpentersHammer && ((ICarpentersHammer)item).canUseHammer(world, entityPlayer)) {
- preOnBlockClicked(TE, world, x, y, z, entityPlayer, actionResult);
- if (!actionResult.altered) {
- if (entityPlayer.isSneaking()) {
- if (TE.hasAttribute(TE.ATTR_ILLUMINATOR)) {
- TE.removeAttribute(TE.ATTR_ILLUMINATOR);
- actionResult.setAltered();
- } else if (TE.hasAttribute(TE.ATTR_OVERLAY[effectiveSide])) {
- TE.removeAttribute(TE.ATTR_OVERLAY[effectiveSide]);
- actionResult.setAltered();
- } else if (TE.hasAttribute(TE.ATTR_DYE[effectiveSide])) {
- TE.removeAttribute(TE.ATTR_DYE[effectiveSide]);
- actionResult.setAltered();
- } else if (TE.hasAttribute(TE.ATTR_COVER[effectiveSide])) {
- TE.removeAttribute(TE.ATTR_COVER[effectiveSide]);
- TE.removeChiselDesign(effectiveSide);
- actionResult.setAltered();
- }
- } else {
- onHammerLeftClick(TE, entityPlayer);
- actionResult.setAltered();
- }
- }
- if (actionResult.altered) {
- onNeighborBlockChange(world, x, y, z, this);
- world.notifyBlocksOfNeighborChange(x, y, z, this);
- }
- } else if (item instanceof ICarpentersChisel && ((ICarpentersChisel)item).canUseChisel(world, entityPlayer)) {
- if (entityPlayer.isSneaking()) {
- if (TE.hasChiselDesign(effectiveSide)) {
- TE.removeChiselDesign(effectiveSide);
- }
- } else if (TE.hasAttribute(TE.ATTR_COVER[effectiveSide])) {
- onChiselClick(TE, effectiveSide, true);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement