net.minecraft.block.Block.getActualState()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中net.minecraft.block.Block.getActualState()方法的一些代码示例,展示了Block.getActualState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getActualState()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:getActualState

Block.getActualState介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
  state = state.getBlock().getActualState(state, world, pos);
  PropertyEnum<EnumDyeColor> prop = second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1;
  return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0));
}

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public IBlockState getActualState(IBlockAccess blockAccess, BlockPos pos) {
  return block.getActualState(this, blockAccess, pos);
}

代码示例来源:origin: Vazkii/Botania

IBlockState actual = heldState.getBlock().getActualState(heldState, new FakeBlockAccess(heldWorld), heldPos);

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public IBlockState getActualState(IBlockAccess blockAccess, BlockPos pos) {
  return normalState.getBlock().getActualState(this, blockAccess, pos);
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) {
  if (world instanceof World) {
    IBlockState state = world.getBlockState(pos);
    state = state.getBlock().getActualState(state, world, pos);
    state = state.withProperty(OCCUPIED, occupied);//In forge 12.16.0.1859-1.9 the vanilla method of this is even wrong, setting it always to true
    ((World) world).setBlockState(pos, state, 2);
  }
}

代码示例来源:origin: TehNut/HWYLA

@Nonnull
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
  if (config.getConfig("general.showstates")) {
    IBlockState actualState = accessor.getBlockState().getBlock().getActualState(accessor.getBlockState(), accessor.getWorld(), accessor.getPosition());
    BlockStateContainer container = accessor.getBlock().getBlockState();
    for (IProperty<?> property : container.getProperties()) {
      Comparable<?> value = actualState.getValue(property);
      tooltip.add(property.getName() + ": " + (property instanceof PropertyBool ? value == Boolean.TRUE ? TextFormatting.GREEN : TextFormatting.RED : "") + value.toString());
    }
  }
  return tooltip;
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
  public boolean test(World world, BlockPos blockPos) {
    if (world.isBlockLoaded(blockPos)) {
      IBlockState blockState = world.getBlockState(blockPos);
      blockState = blockState.getBlock().getActualState(blockState, world, blockPos);
      if (!blockState.getBlock().isAir(blockState, world, blockPos)) {
        for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
          if (acceptableRule.isAcceptableFlower(blockState, world, blockPos, flowerType)) {
            return true;
          }
        }
        return isAcceptedFlower(blockState, acceptedBlocks, acceptedBlockStates);
      }
    }
    return false;
  }
}

代码示例来源:origin: ForestryMC/ForestryMC

@SideOnly(Side.CLIENT)
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
  TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
  if (cocoon != null) {
    state = state.withProperty(COCOON, cocoon.getCaterpillar().getGenome().getCocoon())
      .withProperty(AlleleButterflyCocoon.AGE, cocoon.getAge());
  }
  return super.getActualState(state, world, pos);
}

代码示例来源:origin: blay09/CookingForBlockheads

public void setActive(boolean active) {
  this.active = active;
  if (active) {
    toastTicks = TOAST_TICKS;
    world.addBlockEvent(pos, ModBlocks.toaster, 0, 0);
  } else {
    toastTicks = 0;
    world.addBlockEvent(pos, ModBlocks.toaster, 1, 0);
  }
  IBlockState state = world.getBlockState(pos);
  world.addBlockEvent(pos, ModBlocks.toaster, 2, 0);
  world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), state, ModBlocks.toaster.getActualState(state, world, pos), 3);
  markDirty();
}

代码示例来源:origin: ForestryMC/ForestryMC

@SideOnly(Side.CLIENT)
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
  TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
  if (cocoon != null) {
    state = state.withProperty(COCOON, cocoon.getCaterpillar().getGenome().getCocoon())
      .withProperty(AlleleButterflyCocoon.AGE, cocoon.getAge());
  }
  return super.getActualState(state, world, pos);
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public void setBedOccupied(IBlockAccess blockAccess, BlockPos pos, EntityPlayer player, boolean occupied)
{
  if(blockAccess instanceof World)
  {
    World world = (World) blockAccess;
    TileEntity tileEntity = world.getTileEntity(pos);
    IBlockState state = world.getBlockState(pos);
    state = state.getBlock().getActualState(state, world, pos);
    state = state.withProperty(OCCUPIED, occupied);
    world.setBlockState(pos, state, 4);
    if(tileEntity != null)
    {
      tileEntity.validate();
      world.setTileEntity(pos, tileEntity);
    }
  }
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
  TileEntity tile = world.getTileEntity(pos);
  if (tile instanceof TileMimic) {
    TileMimic mimic = (TileMimic) tile;
    ItemStack stack = mimic.getStackInSlot(0);
    if (stack.getItem() instanceof ItemBlock) {
      Block block = ((ItemBlock) stack.getItem()).getBlock();
      IBlockState mimicState = mimic.getReplacedState();
      if (block != this) {
        if (block.getRenderType(mimicState) == EnumBlockRenderType.ENTITYBLOCK_ANIMATED) {
          return RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState(); //Small and invisible-ish, basically this is returned in order to not render over the animated block (TESR)
        }
        return block.getActualState(mimicState, world, pos);
      }
    }
  }
  return state;
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    state = super.getActualState(state, worldIn, pos);
    TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof LogisticsSolidTileEntity) {
      LogisticsSolidTileEntity ste = (LogisticsSolidTileEntity) tile;
      int rotation = ste.getRotation();
      state = state
        .withProperty(rotationProperty, rotation)
        .withProperty(active, ste.isActive());
    }

    if (tile != null) {
      for (EnumFacing side : EnumFacing.VALUES) {
        boolean render = true;
        TileEntity sideTile = worldIn.getTileEntity(pos.offset(side));
        if (sideTile instanceof LogisticsTileGenericPipe) {
          LogisticsTileGenericPipe tilePipe = (LogisticsTileGenericPipe) sideTile;
          if (tilePipe.renderState.pipeConnectionMatrix.isConnected(side.getOpposite())) {
            render = false;
          }
        }
        state = state.withProperty(connectionPropertys.get(side), render);
      }
    }

    return state;
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public void onUpdate() {
 if (world.isRemote && renderBS == null) {
  IBlockState blockState = world.getBlockState(getOrigin());
  if (blockState.getBlock() instanceof AbstractMachineBlock) {
   renderBS = blockState.getBlock().getExtendedState(blockState.getBlock().getActualState(world.getBlockState(getOrigin()), world, getOrigin()), world,
     getOrigin());
  }
 }
 if (super.getBlock() != null) {
  super.onUpdate();
 }
}

代码示例来源:origin: MightyPirates/TIS-3D

@SuppressWarnings("deprecation")
@Override
public IBlockState getActualState(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
  final TileEntity tileEntity = WorldUtils.getTileEntityThreadsafe(world, pos);
  if (!(tileEntity instanceof TileEntityCasing)) {
    return super.getActualState(state, world, pos);
  }
  final TileEntityCasing casing = (TileEntityCasing) tileEntity;
  return state.
    withProperty(MODULE_X_NEG, casing.getModule(Face.X_NEG) != null).
    withProperty(MODULE_X_POS, casing.getModule(Face.X_POS) != null).
    withProperty(MODULE_Y_NEG, casing.getModule(Face.Y_NEG) != null).
    withProperty(MODULE_Y_POS, casing.getModule(Face.Y_POS) != null).
    withProperty(MODULE_Z_NEG, casing.getModule(Face.Z_NEG) != null).
    withProperty(MODULE_Z_POS, casing.getModule(Face.Z_POS) != null);
}

代码示例来源:origin: raoulvdberge/refinedstorage

AdvancedRayTracer.getStart(player),
  AdvancedRayTracer.getEnd(player),
  ((BlockCable) block).getCollisions(tile, block.getActualState(state, world, pos))
);

代码示例来源:origin: MrCrayfish/MrCrayfishDeviceMod

GlStateManager.translate(-0.5, 0, -0.5);
IBlockState state = tempState.getBlock().getActualState(tempState, te.getWorld(), pos).withProperty(BlockOfficeChair.FACING, EnumFacing.NORTH).withProperty(BlockOfficeChair.TYPE, BlockOfficeChair.Type.SEAT);

代码示例来源:origin: blay09/CookingForBlockheads

state = state.getBlock().getActualState(state, tileEntity.getWorld(), tileEntity.getPos());
BlockFridge.FridgeType fridgeType = state.getValue(BlockFridge.TYPE);
if (fridgeType == BlockFridge.FridgeType.INVISIBLE) {

相关文章

Block类方法