鬼人正邪.
如题
开发mod时需要获取指定坐标的方块朝向用于实现功能,但是找不到获取方块朝向的方法
求大佬解答

hans0000
本帖最后由 hans0000 于 2022-11-4 19:57 编辑



无敌三脚猫
  1. ImmutableMap<IProperty<?>, Comparable<?>> properties=某个world.getBlockState(某个BlockPos).getProperties();
  2.                 for(IProperty<?> prop:properties.keySet()) {
  3.                         if(prop.getValueClass()==EnumFacing.class&&(prop.getName().equals("facing")||prop.getName().equals("rotation"))) {
  4.                                 if(properties.get(prop)==EnumFacing.UP) {
  5.                                         //呐,比如说这时候就代表方块是朝上的
  6.                                 }
  7.                         }
  8.                 }
复制代码