Exemple #1
0
  @Override
  public void onEntityCollidedWithBlock(
      World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
    if (!worldIn.isRemote && entityIn instanceof EntityArrow) {
      EntityArrow entityarrow = (EntityArrow) entityIn;

      if (entityarrow.isBurning()) {
        this.explode(
            worldIn,
            pos,
            worldIn.getBlockState(pos).withProperty(EXPLODE, Boolean.valueOf(true)),
            entityarrow.shootingEntity instanceof EntityLivingBase
                ? (EntityLivingBase) entityarrow.shootingEntity
                : null);
        worldIn.setBlockToAir(pos);
      }
    }
  }
  /**
   * Triggered whenever an entity collides with this block (enters into the block). Args: world, x,
   * y, z, entity
   */
  public void onEntityCollidedWithBlock(
      World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) {
    if (p_149670_5_ instanceof EntityArrow && !p_149670_1_.isRemote) {
      EntityArrow entityarrow = (EntityArrow) p_149670_5_;

      if (entityarrow.isBurning()) {
        this.func_150114_a(
            p_149670_1_,
            p_149670_2_,
            p_149670_3_,
            p_149670_4_,
            1,
            entityarrow.shootingEntity instanceof EntityLivingBase
                ? (EntityLivingBase) entityarrow.shootingEntity
                : null);
        p_149670_1_.setBlockToAir(p_149670_2_, p_149670_3_, p_149670_4_);
      }
    }
  }