|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package net.minecraft.src;
|
|
|
|
|
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
public class BlockVine extends Block
|
|
|
|
@ -47,7 +48,7 @@ public class BlockVine extends Block
|
|
|
|
|
/**
|
|
|
|
|
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
|
|
|
|
*/
|
|
|
|
|
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
|
|
|
|
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, BigInteger par2, int par3, BigInteger par4)
|
|
|
|
|
{
|
|
|
|
|
int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
|
|
|
|
|
float var7 = 1.0F;
|
|
|
|
@ -127,7 +128,7 @@ public class BlockVine extends Block
|
|
|
|
|
/**
|
|
|
|
|
* checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
|
|
|
|
|
*/
|
|
|
|
|
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
|
|
|
|
|
public boolean canPlaceBlockOnSide(World par1World, BigInteger par2, int par3, BigInteger par4, int par5)
|
|
|
|
|
{
|
|
|
|
|
switch (par5)
|
|
|
|
|
{
|
|
|
|
@ -135,16 +136,16 @@ public class BlockVine extends Block
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2, par3 + 1, par4));
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4 + 1));
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4.add(BigInteger.ONE)));
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4 - 1));
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4.subtract(BigInteger.ONE)));
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2 + 1, par3, par4));
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.ONE), par3, par4));
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2 - 1, par3, par4));
|
|
|
|
|
return this.canBePlacedOn(par1World.getBlockId(par2.subtract(BigInteger.ONE), par3, par4));
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
@ -170,7 +171,7 @@ public class BlockVine extends Block
|
|
|
|
|
/**
|
|
|
|
|
* Returns if the vine can stay in the world. It also changes the metadata according to neighboring blocks.
|
|
|
|
|
*/
|
|
|
|
|
private boolean canVineStay(World par1World, int par2, int par3, int par4)
|
|
|
|
|
private boolean canVineStay(World par1World, BigInteger par2, int par3, BigInteger par4)
|
|
|
|
|
{
|
|
|
|
|
int var5 = par1World.getBlockMetadata(par2, par3, par4);
|
|
|
|
|
int var6 = var5;
|
|
|
|
@ -181,7 +182,7 @@ public class BlockVine extends Block
|
|
|
|
|
{
|
|
|
|
|
int var8 = 1 << var7;
|
|
|
|
|
|
|
|
|
|
if ((var5 & var8) != 0 && !this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var7], par3, par4 + Direction.offsetZ[var7])) && (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID || (par1World.getBlockMetadata(par2, par3 + 1, par4) & var8) == 0))
|
|
|
|
|
if ((var5 & var8) != 0 && !this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var7])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var7])))) && (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID || (par1World.getBlockMetadata(par2, par3 + 1, par4) & var8) == 0))
|
|
|
|
|
{
|
|
|
|
|
var6 &= ~var8;
|
|
|
|
|
}
|
|
|
|
@ -220,7 +221,7 @@ public class BlockVine extends Block
|
|
|
|
|
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
|
|
|
|
|
* when first determining what to render.
|
|
|
|
|
*/
|
|
|
|
|
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
|
|
|
|
public int colorMultiplier(IBlockAccess par1IBlockAccess, BigInteger par2, int par3, BigInteger par4)
|
|
|
|
|
{
|
|
|
|
|
return par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeFoliageColor();
|
|
|
|
|
}
|
|
|
|
@ -229,7 +230,7 @@ public class BlockVine extends Block
|
|
|
|
|
* 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)
|
|
|
|
|
public void onNeighborBlockChange(World par1World, BigInteger par2, int par3, BigInteger par4, int par5)
|
|
|
|
|
{
|
|
|
|
|
if (!par1World.isRemote && !this.canVineStay(par1World, par2, par3, par4))
|
|
|
|
|
{
|
|
|
|
@ -241,7 +242,7 @@ public class BlockVine extends Block
|
|
|
|
|
/**
|
|
|
|
|
* Ticks the block if it's been scheduled
|
|
|
|
|
*/
|
|
|
|
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
|
|
|
public void updateTick(World par1World, BigInteger par2, int par3, BigInteger par4, Random par5Random)
|
|
|
|
|
{
|
|
|
|
|
if (!par1World.isRemote && par1World.rand.nextInt(4) == 0)
|
|
|
|
|
{
|
|
|
|
@ -253,13 +254,13 @@ public class BlockVine extends Block
|
|
|
|
|
int var11;
|
|
|
|
|
label138:
|
|
|
|
|
|
|
|
|
|
for (var9 = par2 - var6; var9 <= par2 + var6; ++var9)
|
|
|
|
|
for (var9 = -var6; var9 <= +var6; ++var9)
|
|
|
|
|
{
|
|
|
|
|
for (var10 = par4 - var6; var10 <= par4 + var6; ++var10)
|
|
|
|
|
for (var10 = -var6; var10 <= +var6; ++var10)
|
|
|
|
|
{
|
|
|
|
|
for (var11 = par3 - 1; var11 <= par3 + 1; ++var11)
|
|
|
|
|
{
|
|
|
|
|
if (par1World.getBlockId(var9, var11, var10) == this.blockID)
|
|
|
|
|
if (par1World.getBlockId(par2.add(BigInteger.valueOf(var9)), var11, par4.add(BigInteger.valueOf(var10))) == this.blockID)
|
|
|
|
|
{
|
|
|
|
|
--var7;
|
|
|
|
|
|
|
|
|
@ -292,7 +293,7 @@ public class BlockVine extends Block
|
|
|
|
|
{
|
|
|
|
|
for (var13 = 0; var13 <= 3; ++var13)
|
|
|
|
|
{
|
|
|
|
|
if (!this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var13], par3 + 1, par4 + Direction.offsetZ[var13])))
|
|
|
|
|
if (!this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var13])), par3 + 1, par4.add(BigInteger.valueOf(Direction.offsetZ[var13])))))
|
|
|
|
|
{
|
|
|
|
|
var12 &= ~(1 << var13);
|
|
|
|
|
}
|
|
|
|
@ -315,7 +316,7 @@ public class BlockVine extends Block
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var12 = par1World.getBlockId(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11]);
|
|
|
|
|
var12 = par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var11])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])));
|
|
|
|
|
|
|
|
|
|
if (var12 != 0 && Block.blocksList[var12] != null)
|
|
|
|
|
{
|
|
|
|
@ -329,25 +330,25 @@ public class BlockVine extends Block
|
|
|
|
|
var13 = var11 + 1 & 3;
|
|
|
|
|
var14 = var11 + 3 & 3;
|
|
|
|
|
|
|
|
|
|
if ((var9 & 1 << var13) != 0 && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13])))
|
|
|
|
|
if ((var9 & 1 << var13) != 0 && this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var13])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var13])))))
|
|
|
|
|
{
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 1 << var13);
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2.add(BigInteger.valueOf(Direction.offsetX[var11])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])), this.blockID, 1 << var13);
|
|
|
|
|
}
|
|
|
|
|
else if ((var9 & 1 << var14) != 0 && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14])))
|
|
|
|
|
else if ((var9 & 1 << var14) != 0 && this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var14])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var14])))))
|
|
|
|
|
{
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 1 << var14);
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2.add(BigInteger.valueOf(Direction.offsetX[var11])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])), this.blockID, 1 << var14);
|
|
|
|
|
}
|
|
|
|
|
else if ((var9 & 1 << var13) != 0 && par1World.isAirBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13]) && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var13])))
|
|
|
|
|
else if ((var9 & 1 << var13) != 0 && par1World.isAirBlock(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var13])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var13]))) && this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var13])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var13])))))
|
|
|
|
|
{
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13], this.blockID, 1 << (var11 + 2 & 3));
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var13])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var13])), this.blockID, 1 << (var11 + 2 & 3));
|
|
|
|
|
}
|
|
|
|
|
else if ((var9 & 1 << var14) != 0 && par1World.isAirBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14]) && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var14])))
|
|
|
|
|
else if ((var9 & 1 << var14) != 0 && par1World.isAirBlock(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var14])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var14]))) && this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var14])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var14])))))
|
|
|
|
|
{
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14], this.blockID, 1 << (var11 + 2 & 3));
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2.add(BigInteger.valueOf(Direction.offsetX[var11])).add(BigInteger.valueOf(Direction.offsetX[var14])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])).add(BigInteger.valueOf(Direction.offsetZ[var14])), this.blockID, 1 << (var11 + 2 & 3));
|
|
|
|
|
}
|
|
|
|
|
else if (this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11], par3 + 1, par4 + Direction.offsetZ[var11])))
|
|
|
|
|
else if (this.canBePlacedOn(par1World.getBlockId(par2.add(BigInteger.valueOf(Direction.offsetX[var11])), par3 + 1, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])))))
|
|
|
|
|
{
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 0);
|
|
|
|
|
par1World.setBlockAndMetadataWithNotify(par2.add(BigInteger.valueOf(Direction.offsetX[var11])), par3, par4.add(BigInteger.valueOf(Direction.offsetZ[var11])), this.blockID, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -382,7 +383,7 @@ public class BlockVine extends Block
|
|
|
|
|
/**
|
|
|
|
|
* called before onBlockPlacedBy by ItemBlock and ItemReed
|
|
|
|
|
*/
|
|
|
|
|
public void updateBlockMetadata(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8)
|
|
|
|
|
public void updateBlockMetadata(World par1World, BigInteger par2, int par3, BigInteger par4, int par5, float par6, float par7, float par8)
|
|
|
|
|
{
|
|
|
|
|
byte var9 = 0;
|
|
|
|
|
|
|
|
|
@ -430,7 +431,7 @@ public class BlockVine extends Block
|
|
|
|
|
* Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
|
|
|
|
|
* block and l is the block's subtype/damage.
|
|
|
|
|
*/
|
|
|
|
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
|
|
|
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, BigInteger par3, int par4, BigInteger par5, int par6)
|
|
|
|
|
{
|
|
|
|
|
if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
|
|
|
|
|
{
|
|
|
|
|