Jump to content

Dandrel

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Dandrel

  1. Thanks Elyon, my code is much more cleaner and easier to understand and works much better! As for the removeBlockByPlayer, I have never used this method before. Is this method called just like destroyedByPlayer as in it is called once it is destroyed?
  2. This is what the run code is Random rnd = new Random(); int num = rnd.nextInt(4); if(num ==0){ world.setBlock(x,y+1,z,this,0,3); } if(num == 1){ world.setBlock(x, y, z +1, this, 0, 3); } if(num ==2){ world.setBlock(x, y, z -1, this, 0, 3); } if(num ==3){ world.setBlock(x+1, y, z , this, 0, 3); } if(num ==4){ world.setBlock(x-1, y, z , this, 0, 3); } //Second block Random rnd2 = new Random(); int num2 = rnd.nextInt(4); while (num2==num){ num2 = rnd.nextInt(4); } if(num2 ==0){ world.setBlock(x,y+1,z,this,0,3); } if(num2 == 1){ world.setBlock(x, y, z +1, this, 0, 3); } if(num2 ==2){ world.setBlock(x, y, z -1, this, 0, 3); } if(num2 ==3){ world.setBlock(x+1, y, z , this, 0, 3); } if(num2 ==4){ world.setBlock(x-1, y, z , this, 0, 3); }
  3. Basically, I have code in the onBlockDestroyedByPlayer that I want to run each time the block is destroyed. However, I want the code to be in an if statement for example if("toolusedtodestroyblock" != DiamondPickaxe) { Run Code } So what i need is to get whatever tool is used to destroy the block. I am assuming I need access to the player class
  4. Hi Does anybody know how I would go about gaining access the instance of entity player that destroyed a block? My overall aim is to detect what tool was used to destroy the block in the onBlockDestroyedByPlayer Thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.