Checks if the current block the entity is within of the specified material type
(Material materialIn)
| 1213 | * Checks if the current block the entity is within of the specified material type |
| 1214 | */ |
| 1215 | public boolean isInsideOfMaterial(Material materialIn) |
| 1216 | { |
| 1217 | double d0 = this.posY + (double)this.getEyeHeight(); |
| 1218 | BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); |
| 1219 | IBlockState iblockstate = this.worldObj.getBlockState(blockpos); |
| 1220 | Block block = iblockstate.getBlock(); |
| 1221 | |
| 1222 | if (block.getMaterial() == materialIn) |
| 1223 | { |
| 1224 | float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; |
| 1225 | float f1 = (float)(blockpos.getY() + 1) - f; |
| 1226 | boolean flag = d0 < (double)f1; |
| 1227 | return !flag && this instanceof EntityPlayer ? false : flag; |
| 1228 | } |
| 1229 | else |
| 1230 | { |
| 1231 | return false; |
| 1232 | } |
| 1233 | } |
| 1234 | |
| 1235 | public boolean isInLava() |
| 1236 | { |
no test coverage detected