Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Called when the block is placed in the world.
- */
- public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
- {
- int var7 = determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
- par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2);
- boolean var8 = this.isGettingInput(par1World, par2, par3, par4, var7);
- if (var8)
- {
- par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 2);
- }
- par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2);
- }
- /**
- * Ticks the block if it's been scheduled
- */
- public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
- {
- int var6 = par1World.getBlockMetadata(par2, par3, par4);
- if (!this.func_94476_e(par1World, par2, par3, par4, var6))
- {
- boolean var7 = this.isGettingInput(par1World, par2, par3, par4, var6);
- if (this.isPowered && !var7)
- {
- par1World.setBlock(par2, par3, par4, Block.directionalIdle.blockID, var6, 2);
- }
- else if (!this.isPowered && var7)
- {
- par1World.setBlock(par2, par3, par4, Block.directionalActive.blockID, var6, 2);
- }
- par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID);
- par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID);
- }
- }
- /**
- * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
- * their own) Args: x, y, z, neighbor blockID
- */
- public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
- {
- this.func_94479_f(par1World, par2, par3, par4, par5);
- }
- protected void func_94479_f(World par1World, int par2, int par3, int par4, int par5)
- {
- int var6 = par1World.getBlockMetadata(par2, par3, par4);
- if (!this.func_94476_e(par1World, par2, par3, par4, var6))
- {
- boolean var7 = this.isGettingInput(par1World, par2, par3, par4, var6);
- if ((this.isPowered && !var7 || !this.isPowered && var7) && !par1World.isBlockTickScheduledThisTick(par2, par3, par4, this.blockID))
- {
- byte var8 = -1;
- if (this.func_83011_d(par1World, par2, par3, par4, var6))
- {
- var8 = -3;
- }
- else if (this.isPowered)
- {
- var8 = -2;
- }
- par1World.scheduleBlockUpdateWithPriority(par2, par3, par4, this.blockID, this.func_94481_j_(var6), var8);
- }
- }
- }
- public boolean func_83011_d(World par1World, int par2, int par3, int par4, int par5)
- {
- int var6 = getDirection(par5);
- if (isDirectionalBlockID(par1World.getBlockId(par2 - Direction.offsetX[var6], par3, par4 - Direction.offsetZ[var6])))
- {
- int var7 = par1World.getBlockMetadata(par2 - Direction.offsetX[var6], par3, par4 - Direction.offsetZ[var6]);
- int var8 = getDirection(var7);
- return var8 != var6;
- }
- else
- {
- return false;
- }
- }
- public boolean func_94476_e(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
- {
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement