Location aware version og Block.lightOpacity for PR #169
This commit is contained in:
parent
6ec887b34f
commit
520550dab9
6 changed files with 145 additions and 38 deletions
|
@ -102,7 +102,7 @@
|
||||||
{
|
{
|
||||||
ItemStack var8 = this.createStackedBlock(par6);
|
ItemStack var8 = this.createStackedBlock(par6);
|
||||||
|
|
||||||
@@ -1249,4 +1255,797 @@
|
@@ -1249,4 +1255,816 @@
|
||||||
canBlockGrass[0] = true;
|
canBlockGrass[0] = true;
|
||||||
StatList.initBreakableStats();
|
StatList.initBreakableStats();
|
||||||
}
|
}
|
||||||
|
@ -898,5 +898,24 @@
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Location aware and overrideable version of the lightOpacity array,
|
||||||
|
+ * return the number to subtract from the light value when it passes through this block.
|
||||||
|
+ *
|
||||||
|
+ * This is not guaranteed to have the tile entity in place before this is called, so it is
|
||||||
|
+ * Recommended that you have your tile entity call relight after being placed if you
|
||||||
|
+ * rely on it for light info.
|
||||||
|
+ *
|
||||||
|
+ * @param world The current world
|
||||||
|
+ * @param x X Position
|
||||||
|
+ * @param y Y Position
|
||||||
|
+ * @param z Z position
|
||||||
|
+ * @return The amount of light to block, 0 for air, 255 for fully opaque.
|
||||||
|
+ */
|
||||||
|
+ public int getLightOpacity(World world, int x, int y, int z)
|
||||||
|
+ {
|
||||||
|
+ return lightOpacity[blockID];
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
|
|
20
patches/common/net/minecraft/src/BlockGrass.java.patch
Normal file
20
patches/common/net/minecraft/src/BlockGrass.java.patch
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--- ../src_base/common/net/minecraft/src/BlockGrass.java
|
||||||
|
+++ ../src_work/common/net/minecraft/src/BlockGrass.java
|
||||||
|
@@ -51,7 +51,7 @@
|
||||||
|
{
|
||||||
|
if (!par1World.isRemote)
|
||||||
|
{
|
||||||
|
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
|
||||||
|
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
|
||||||
|
{
|
||||||
|
par1World.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID);
|
||||||
|
}
|
||||||
|
@@ -64,7 +64,7 @@
|
||||||
|
int var9 = par4 + par5Random.nextInt(3) - 1;
|
||||||
|
int var10 = par1World.getBlockId(var7, var8 + 1, var9);
|
||||||
|
|
||||||
|
- if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2)
|
||||||
|
+ if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && par1World.getBlockLightOpacity(var7, var8 + 1, var9) <= 2)
|
||||||
|
{
|
||||||
|
par1World.setBlockWithNotify(var7, var8, var9, Block.grass.blockID);
|
||||||
|
}
|
20
patches/common/net/minecraft/src/BlockMycelium.java.patch
Normal file
20
patches/common/net/minecraft/src/BlockMycelium.java.patch
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--- ../src_base/common/net/minecraft/src/BlockMycelium.java
|
||||||
|
+++ ../src_work/common/net/minecraft/src/BlockMycelium.java
|
||||||
|
@@ -51,7 +51,7 @@
|
||||||
|
{
|
||||||
|
if (!par1World.isRemote)
|
||||||
|
{
|
||||||
|
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
|
||||||
|
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
|
||||||
|
{
|
||||||
|
par1World.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID);
|
||||||
|
}
|
||||||
|
@@ -64,7 +64,7 @@
|
||||||
|
int var9 = par4 + par5Random.nextInt(3) - 1;
|
||||||
|
int var10 = par1World.getBlockId(var7, var8 + 1, var9);
|
||||||
|
|
||||||
|
- if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2)
|
||||||
|
+ if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && par1World.getBlockLightOpacity(var7, var8 + 1, var9) <= 2)
|
||||||
|
{
|
||||||
|
par1World.setBlockWithNotify(var7, var8, var9, this.blockID);
|
||||||
|
}
|
|
@ -22,17 +22,10 @@
|
||||||
|
|
||||||
if (var9 != 0)
|
if (var9 != 0)
|
||||||
{
|
{
|
||||||
@@ -134,6 +140,48 @@
|
@@ -141,6 +147,48 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9);
|
/**
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that
|
+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that
|
||||||
+ * use metadata sensitive blocks during generation.
|
+ * use metadata sensitive blocks during generation.
|
||||||
+ *
|
+ *
|
||||||
|
@ -68,10 +61,38 @@
|
||||||
+
|
+
|
||||||
+ this.storageArrays[var10].setExtBlockID(x, y & 15, z, id);
|
+ this.storageArrays[var10].setExtBlockID(x, y & 15, z, id);
|
||||||
+ this.storageArrays[var10].setExtBlockMetadata(x, y & 15, z, meta);
|
+ this.storageArrays[var10].setExtBlockMetadata(x, y & 15, z, meta);
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
@@ -507,7 +555,7 @@
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
* Checks whether the chunk is at the X/Z location specified
|
||||||
|
*/
|
||||||
|
public boolean isAtLocation(int par1, int par2)
|
||||||
|
@@ -204,7 +252,7 @@
|
||||||
|
{
|
||||||
|
int var5 = this.getBlockID(var2, var4 - 1, var3);
|
||||||
|
|
||||||
|
- if (Block.lightOpacity[var5] == 0)
|
||||||
|
+ if (getBlockLightOpacity(var2, var4 - 1, var3) == 0)
|
||||||
|
{
|
||||||
|
--var4;
|
||||||
|
continue;
|
||||||
|
@@ -499,7 +547,10 @@
|
||||||
|
|
||||||
|
public int getBlockLightOpacity(int par1, int par2, int par3)
|
||||||
|
{
|
||||||
|
- return Block.lightOpacity[this.getBlockID(par1, par2, par3)];
|
||||||
|
+ int x = (xPosition << 4) + par1;
|
||||||
|
+ int z = (zPosition << 4) + par3;
|
||||||
|
+ Block block = Block.blocksList[getBlockID(par1, par2, par3)];
|
||||||
|
+ return (block == null ? 0 : block.getLightOpacity(worldObj, x, par2, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -507,7 +558,7 @@
|
||||||
*/
|
*/
|
||||||
public int getBlockID(int par1, int par2, int par3)
|
public int getBlockID(int par1, int par2, int par3)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +101,7 @@
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -523,7 +571,7 @@
|
@@ -523,7 +574,7 @@
|
||||||
*/
|
*/
|
||||||
public int getBlockMetadata(int par1, int par2, int par3)
|
public int getBlockMetadata(int par1, int par2, int par3)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +110,7 @@
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -564,6 +612,11 @@
|
@@ -564,6 +615,11 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -101,7 +122,7 @@
|
||||||
ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4];
|
ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4];
|
||||||
boolean var11 = false;
|
boolean var11 = false;
|
||||||
|
|
||||||
@@ -594,7 +647,7 @@
|
@@ -594,7 +650,7 @@
|
||||||
{
|
{
|
||||||
Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9);
|
Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +131,16 @@
|
||||||
{
|
{
|
||||||
this.worldObj.removeBlockTileEntity(var12, par2, var13);
|
this.worldObj.removeBlockTileEntity(var12, par2, var13);
|
||||||
}
|
}
|
||||||
@@ -638,29 +691,21 @@
|
@@ -614,7 +670,7 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- if (Block.lightOpacity[par4 & 4095] > 0)
|
||||||
|
+ if (getBlockLightOpacity(par1, par2 + 1, par3) > 0)
|
||||||
|
{
|
||||||
|
if (par2 >= var7)
|
||||||
|
{
|
||||||
|
@@ -638,29 +694,21 @@
|
||||||
Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13);
|
Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +173,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,7 +720,7 @@
|
@@ -675,7 +723,7 @@
|
||||||
*/
|
*/
|
||||||
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
|
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +182,7 @@
|
||||||
|
|
||||||
if (var5 == null)
|
if (var5 == null)
|
||||||
{
|
{
|
||||||
@@ -695,7 +740,7 @@
|
@@ -695,7 +743,7 @@
|
||||||
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
|
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
|
||||||
int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
|
int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
|
||||||
|
|
||||||
|
@ -161,7 +191,7 @@
|
||||||
{
|
{
|
||||||
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
|
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
|
||||||
|
|
||||||
@@ -716,7 +761,7 @@
|
@@ -716,7 +764,7 @@
|
||||||
*/
|
*/
|
||||||
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
|
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +200,7 @@
|
||||||
return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
|
return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,6 +771,11 @@
|
@@ -726,6 +774,11 @@
|
||||||
*/
|
*/
|
||||||
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
|
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
|
||||||
{
|
{
|
||||||
|
@ -182,7 +212,7 @@
|
||||||
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
|
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
|
||||||
|
|
||||||
if (var6 == null)
|
if (var6 == null)
|
||||||
@@ -754,7 +804,7 @@
|
@@ -754,7 +807,7 @@
|
||||||
*/
|
*/
|
||||||
public int getBlockLightValue(int par1, int par2, int par3, int par4)
|
public int getBlockLightValue(int par1, int par2, int par3, int par4)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +221,7 @@
|
||||||
|
|
||||||
if (var5 == null)
|
if (var5 == null)
|
||||||
{
|
{
|
||||||
@@ -807,7 +857,7 @@
|
@@ -807,7 +860,7 @@
|
||||||
{
|
{
|
||||||
var4 = this.entityLists.length - 1;
|
var4 = this.entityLists.length - 1;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +230,7 @@
|
||||||
par1Entity.addedToChunk = true;
|
par1Entity.addedToChunk = true;
|
||||||
par1Entity.chunkCoordX = this.xPosition;
|
par1Entity.chunkCoordX = this.xPosition;
|
||||||
par1Entity.chunkCoordY = var4;
|
par1Entity.chunkCoordY = var4;
|
||||||
@@ -857,33 +907,33 @@
|
@@ -857,33 +910,33 @@
|
||||||
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
|
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
|
||||||
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
|
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
|
||||||
|
|
||||||
|
@ -245,7 +275,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -898,7 +948,7 @@
|
@@ -898,7 +951,7 @@
|
||||||
|
|
||||||
if (this.isChunkLoaded)
|
if (this.isChunkLoaded)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +284,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,8 +963,14 @@
|
@@ -913,8 +966,14 @@
|
||||||
par4TileEntity.yCoord = par2;
|
par4TileEntity.yCoord = par2;
|
||||||
par4TileEntity.zCoord = this.zPosition * 16 + par3;
|
par4TileEntity.zCoord = this.zPosition * 16 + par3;
|
||||||
|
|
||||||
|
@ -271,7 +301,7 @@
|
||||||
par4TileEntity.validate();
|
par4TileEntity.validate();
|
||||||
this.chunkTileEntityMap.put(var5, par4TileEntity);
|
this.chunkTileEntityMap.put(var5, par4TileEntity);
|
||||||
}
|
}
|
||||||
@@ -953,6 +1009,7 @@
|
@@ -953,6 +1012,7 @@
|
||||||
List var4 = var1[var3];
|
List var4 = var1[var3];
|
||||||
this.worldObj.addLoadedEntities(var4);
|
this.worldObj.addLoadedEntities(var4);
|
||||||
}
|
}
|
||||||
|
@ -279,7 +309,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -977,6 +1034,7 @@
|
@@ -977,6 +1037,7 @@
|
||||||
List var4 = var5[var3];
|
List var4 = var5[var3];
|
||||||
this.worldObj.unloadEntities(var4);
|
this.worldObj.unloadEntities(var4);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +317,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -993,8 +1051,8 @@
|
@@ -993,8 +1054,8 @@
|
||||||
*/
|
*/
|
||||||
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
|
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
|
||||||
{
|
{
|
||||||
|
@ -298,7 +328,7 @@
|
||||||
|
|
||||||
if (var4 < 0)
|
if (var4 < 0)
|
||||||
{
|
{
|
||||||
@@ -1042,8 +1100,8 @@
|
@@ -1042,8 +1103,8 @@
|
||||||
*/
|
*/
|
||||||
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
|
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +339,7 @@
|
||||||
|
|
||||||
if (var4 < 0)
|
if (var4 < 0)
|
||||||
{
|
{
|
||||||
@@ -1227,6 +1285,15 @@
|
@@ -1227,6 +1288,15 @@
|
||||||
*/
|
*/
|
||||||
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
|
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +355,7 @@
|
||||||
int var5 = 0;
|
int var5 = 0;
|
||||||
int var6;
|
int var6;
|
||||||
|
|
||||||
@@ -1323,12 +1390,26 @@
|
@@ -1323,12 +1393,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generateHeightMap();
|
this.generateHeightMap();
|
||||||
|
@ -358,7 +388,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1437,4 +1518,18 @@
|
@@ -1437,4 +1521,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,6 +433,24 @@
|
||||||
int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6;
|
int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6;
|
||||||
int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
|
int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
|
||||||
int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
|
int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
|
||||||
|
@@ -3176,7 +3251,7 @@
|
||||||
|
int var21 = var24 + (var18 / 2 + 1) % 3 / 2 * var19;
|
||||||
|
int var22 = var12 + (var18 / 2 + 2) % 3 / 2 * var19;
|
||||||
|
var14 = this.getSavedLightValue(par1EnumSkyBlock, var20, var21, var22);
|
||||||
|
- int var23 = Block.lightOpacity[this.getBlockId(var20, var21, var22)];
|
||||||
|
+ int var23 = this.getBlockLightOpacity(var20, var21, var22);
|
||||||
|
|
||||||
|
if (var23 == 0)
|
||||||
|
{
|
||||||
|
@@ -3207,7 +3282,7 @@
|
||||||
|
var12 = (var9 >> 12 & 63) - 32 + par4;
|
||||||
|
var13 = this.getSavedLightValue(par1EnumSkyBlock, var10, var24, var12);
|
||||||
|
var14 = this.getBlockId(var10, var24, var12);
|
||||||
|
- var15 = Block.lightOpacity[var14];
|
||||||
|
+ var15 = this.getBlockLightOpacity(var10, var24, var12);
|
||||||
|
|
||||||
|
if (var15 == 0)
|
||||||
|
{
|
||||||
@@ -3309,10 +3384,10 @@
|
@@ -3309,10 +3384,10 @@
|
||||||
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
|
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
int var8 = var3 != null ? var3.stackSize : 0;
|
int var8 = var3 != null ? var3.stackSize : 0;
|
||||||
|
|
||||||
- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
||||||
+ boolean result = ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, var4, var5, var6, var7);
|
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, var4, var5, var6, var7).isCanceled();
|
||||||
+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
||||||
{
|
{
|
||||||
var2 = false;
|
var2 = false;
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
ItemStack var9 = this.thePlayer.inventory.getCurrentItem();
|
ItemStack var9 = this.thePlayer.inventory.getCurrentItem();
|
||||||
|
|
||||||
- if (var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
- if (var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
||||||
+ boolean result = ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1);
|
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled();
|
||||||
+ if (result && var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
+ if (result && var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
||||||
{
|
{
|
||||||
this.entityRenderer.itemRenderer.func_78445_c();
|
this.entityRenderer.itemRenderer.func_78445_c();
|
||||||
|
|
Loading…
Reference in a new issue