Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Fix #80
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer committed Feb 7, 2016
1 parent a3b27c8 commit 22b6f7e
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,18 @@
public class ItemInWorldManager
{
/** Forge reach distance */
@@ -135,15 +155,29 @@
@@ -135,15 +155,28 @@

public void onBlockClicked(int p_73074_1_, int p_73074_2_, int p_73074_3_, int p_73074_4_)
{
+ // CraftBukkit start
+ //org.bukkit.event.player.PlayerInteractEvent cbEvent = CraftEventFactory.callPlayerInteractEvent(this.thisPlayerMP, Action.LEFT_CLICK_BLOCK, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_, this.thisPlayerMP.inventory.getCurrentItem());
+
if (!this.gameType.isAdventure() || this.thisPlayerMP.isCurrentToolAdventureModeExempt(p_73074_1_, p_73074_2_, p_73074_3_))
{
- PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(thisPlayerMP, Action.LEFT_CLICK_BLOCK, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_, theWorld);
- if (event.isCanceled())
+ org.bukkit.event.player.PlayerInteractEvent cbEvent = CraftEventFactory.callPlayerInteractEvent(this.thisPlayerMP, Action.LEFT_CLICK_BLOCK, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_, this.thisPlayerMP.inventory.getCurrentItem());
+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(this.thisPlayerMP, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_, theWorld); // Forge
+ org.bukkit.event.player.PlayerInteractEvent cbEvent = event.cb;
+ //org.bukkit.event.player.PlayerInteractEvent cbEvent = event.cb;
+ if (event.isCanceled())
{
- thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(p_73074_1_, p_73074_2_, p_73074_3_, theWorld));
Expand All @@ -77,7 +76,7 @@
if (this.isCreative())
{
if (!this.theWorld.extinguishFire((EntityPlayer)null, p_73074_1_, p_73074_2_, p_73074_3_, p_73074_4_))
@@ -157,30 +191,56 @@
@@ -157,30 +190,56 @@
float f = 1.0F;
Block block = this.theWorld.getBlock(p_73074_1_, p_73074_2_, p_73074_3_);

Expand Down Expand Up @@ -146,7 +145,7 @@
if (!block.isAir(theWorld, p_73074_1_, p_73074_2_, p_73074_3_) && f >= 1.0F)
{
this.tryHarvestBlock(p_73074_1_, p_73074_2_, p_73074_3_);
@@ -197,6 +257,10 @@
@@ -197,6 +256,10 @@
}
}
}
Expand All @@ -157,7 +156,7 @@
}

public void uncheckedTryHarvestBlock(int p_73082_1_, int p_73082_2_, int p_73082_3_)
@@ -269,6 +333,12 @@
@@ -269,6 +332,12 @@
return false;
}
Block block = this.theWorld.getBlock(p_73084_1_, p_73084_2_, p_73084_3_);
Expand All @@ -170,15 +169,15 @@
int l = this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_);
this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, p_73084_1_, p_73084_2_, p_73084_3_, Block.getIdFromBlock(block) + (this.theWorld.getBlockMetadata(p_73084_1_, p_73084_2_, p_73084_3_) << 12));
boolean flag = false;
@@ -312,6 +382,7 @@
@@ -312,6 +381,7 @@
public boolean tryUseItem(EntityPlayer p_73085_1_, World p_73085_2_, ItemStack p_73085_3_)
{
int i = p_73085_3_.stackSize;
+ if (i <= 0) return false;
int j = p_73085_3_.getItemDamage();
ItemStack itemstack1 = p_73085_3_.useItemRightClick(p_73085_2_, p_73085_1_);

@@ -350,57 +421,106 @@
@@ -350,57 +420,106 @@

public boolean activateBlockOrUseItem(EntityPlayer p_73078_1_, World p_73078_2_, ItemStack p_73078_3_, int p_73078_4_, int p_73078_5_, int p_73078_6_, int p_73078_7_, float p_73078_8_, float p_73078_9_, float p_73078_10_)
{
Expand Down

0 comments on commit 22b6f7e

Please sign in to comment.