Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z,
- * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
- */
- public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
- {
- return this.isProvidingWeakPower(par1IBlockAccess, par2, par3, par4, par5);
- }
- /**
- * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube
- * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X,
- * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block.
- */
- public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- int var6 = getOrientation(var5);
- {
- if (!this.func_96470_c(var5))
- {
- return 0;
- }
- if (var6 == 0 && par5 == 1) return 15;
- if (var6 == 1 && par5 == 0) return 15;
- if (var6 == 2 && par5 == 3) return 15;
- if (var6 == 3 && par5 == 2) return 15;
- if (var6 == 4 && par5 == 5) return 15;
- if (var6 == 5 && par5 == 4) return 15;
- else return 0;
- }
- }
- /**
- * Returns the signal strength at one input of the block. Args: world, X, Y, Z, side
- */
- protected int getInputStrength(World par1World, IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- int var6 = getOrientation(var5);
- boolean var7 = this.isIndirectlyPowered(par1World, par2, par3, par4, var6);
- int power = 0;
- if (var7 && par5 == 0 || var7 && par5 == 1 || var7 && par5 == 2 || var7 && par5 == 3 || var7 && par5 == 4 || var7 && par5 == 5) return power = 15;
- return power;
- //return var9 >= 15 ? var9 : Math.max(var9, par1World.getBlockId(var7, par3, var8) == Block.redstoneWire.blockID ? par1World.getBlockMetadata(var7, par3, var8) : 0);
- }
- //Determins how many blocks away from side the power source needs to be.
- //0 bottom, 1 top, 2 south, 3 north, 4 east, 5 west
- public int offsetX (World par1World, IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- int var6 = getOrientation(var5);
- if (var6 == 0) return 0; if (var6 == 1) return 0; if (var6 == 2) return 0; if (var6 == 3) return 0; if (var6 == 4) return 1; if (var6 == 5) return -1;
- else return 0;
- }
- //Determins how many blocks away from side the power source needs to be.
- //0 bottom, 1 top, 2 south, 3 north, 4 east, 5 west
- public int offsetY (World par1World, IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- int var6 = getOrientation(var5);
- if (var6 == 0) return 1; if (var6 == 1) return -1; if (var6 == 2) return 0; if (var6 == 3) return 0; if (var6 == 4) return 0; if (var6 == 5) return 0;
- else return 0;
- }
- //Determins how many blocks away from side the power source needs to be.
- //0 bottom, 1 top, 2 south, 3 north, 4 east, 5 west
- public int offsetZ (World par1World, IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
- {
- int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
- int var6 = getOrientation(var5);
- if (var6 == 0) return 0; if (var6 == 1) return 0; if (var6 == 2) return 1; if (var6 == 3) return -1; if (var6 == 4) return 0; if (var6 == 5) return 0;
- else return 0;
- }
- /**
- * checks the block to that side to see if it is indirectly powered.
- */
- private boolean isIndirectlyPowered(World par1World, int par2, int par3, int par4, int par5)
- {
- int var7 = par2 + this.offsetX(par1World, par1World, par2, par3, par4);
- int var8 = par3 + this.offsetY(par1World, par1World, par2, par3, par4);
- int var9 = par4 + this.offsetZ(par1World, par1World, par2, par3, par4);
- return par5 != 0 && par1World.getIndirectPowerOutput(var7, var8, var9, 0) ?
- true : (par5 != 1 && par1World.getIndirectPowerOutput(var7, var8, var9, 1) ?
- true : (par5 != 0 && par1World.getIndirectPowerOutput(par2, par3 - 1, par4, 0) ?
- true : (par5 != 1 && par1World.getIndirectPowerOutput(par2, par3 + 1, par4, 1) ?
- true : (par5 != 2 && par1World.getIndirectPowerOutput(par2, par3, par4 - 1, 2) ?
- true : (par5 != 3 && par1World.getIndirectPowerOutput(par2, par3, par4 + 1, 3) ?
- true : (par5 != 5 && par1World.getIndirectPowerOutput(par2 + 1, par3, par4, 5) ?
- true : (par5 != 4 && par1World.getIndirectPowerOutput(par2 - 1, par3, par4, 4))))))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement