Skip to content

Instantly share code, notes, and snippets.

@IQAndreas
Created May 2, 2012 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IQAndreas/2580769 to your computer and use it in GitHub Desktop.
Save IQAndreas/2580769 to your computer and use it in GitHub Desktop.
MineCraft BlockReed.java snippet
// Snippet from class BlockReed.java
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (par1World.isAirBlock(par2, par3 + 1, par4))
{
int i;
for (i = 1; par1World.getBlockId(par2, par3 - i, par4) == blockID; i++) { }
if (i < 3)
{
int j = par1World.getBlockMetadata(par2, par3, par4);
if (j == 15)
{
par1World.setBlockWithNotify(par2, par3 + 1, par4, blockID);
par1World.setBlockMetadataWithNotify(par2, par3, par4, 0);
}
else
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, j + 1);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment