Java 类net.minecraft.block.BlockObserver 实例源码

项目:Backmemed    文件:World.java   
public void func_190529_b(BlockPos p_190529_1_, final Block p_190529_2_, BlockPos p_190529_3_)
{
    if (!this.isRemote)
    {
        IBlockState iblockstate = this.getBlockState(p_190529_1_);

        if (iblockstate.getBlock() == Blocks.field_190976_dk)
        {
            try
            {
                ((BlockObserver)iblockstate.getBlock()).func_190962_b(iblockstate, this, p_190529_1_, p_190529_2_, p_190529_3_);
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while updating neighbours");
                CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being updated");
                crashreportcategory.setDetail("Source block type", new ICrashReportDetail<String>()
                {
                    public String call() throws Exception
                    {
                        try
                        {
                            return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(Block.getIdFromBlock(p_190529_2_)), p_190529_2_.getUnlocalizedName(), p_190529_2_.getClass().getCanonicalName()});
                        }
                        catch (Throwable var2)
                        {
                            return "ID #" + Block.getIdFromBlock(p_190529_2_);
                        }
                    }
                });
                CrashReportCategory.addBlockInfo(crashreportcategory, p_190529_1_, iblockstate);
                throw new ReportedException(crashreport);
            }
        }
    }
}
项目:Cyclic    文件:EntityMinecartTurret.java   
/**
 * pulled from BlockDispenser
 * 
 * @param worldIn
 * @param pos
 */
protected void dispense(BlockPos pos) {
  if (this.timeSinceDropped > 0) {
    this.timeSinceDropped--;
    return;
  }
  this.timeSinceDropped = TIME_BTW_DROPS;
  EnumFacing enumfacing = this.getDisplayTile().getValue(BlockObserver.FACING);
  shootThisDirection(enumfacing);
  shootThisDirection(enumfacing.getOpposite());
}
项目:Cyclic    文件:EntityMinecartTurret.java   
@Override
protected void moveAlongTrack(BlockPos pos, IBlockState state) {
  BlockRailBase blockrailbase = (BlockRailBase) state.getBlock();
  if (blockrailbase != Blocks.ACTIVATOR_RAIL) {
    this.timeSinceDropped = 0;
  }
  //force DISPENSER to face sime direction as my movemene
  //      double slopeAdjustment = getSlopeAdjustment();
  BlockRailBase.EnumRailDirection raildirection = blockrailbase.getRailDirection(world, pos, state, this);
  EnumFacing fac = null;
  switch (raildirection) {
    case ASCENDING_EAST:
      fac = EnumFacing.EAST;
    break;
    case ASCENDING_WEST:
      fac = EnumFacing.WEST;
    break;
    case ASCENDING_NORTH:
      fac = EnumFacing.NORTH;
    break;
    case ASCENDING_SOUTH:
      fac = EnumFacing.SOUTH;
    case EAST_WEST:
      fac = (this.motionX > 0) ? EnumFacing.SOUTH : EnumFacing.NORTH;
    break;
    case NORTH_SOUTH:
      fac = (this.motionZ < 0) ? EnumFacing.WEST : EnumFacing.EAST;
    break;
    default:
    break;
  }
  super.moveAlongTrack(pos, state);
  if (fac != null) {
    this.setDisplayTile(getDefaultDisplayTile().withProperty(BlockObserver.FACING, fac));
  }
}