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

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

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

Block.getExtendedState介绍

暂无

代码示例

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

IBlockState state = world.getBlockState(pos);
state = state.getActualState(world, pos);
state = state.getBlock().getExtendedState(state, world, pos);
if (state instanceof IExtendedBlockState) {
  try {

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

@Override
public void render(@Nonnull TileEntity tile, double d0, double d1, double d2, float t, int digProgress, float unused) {
  if(ConfigHandler.staticFloaters)
    return;
  if (tile != null)
    if (!tile.getWorld().isBlockLoaded(tile.getPos(), false))
      return;
  BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
  GlStateManager.pushMatrix();
  GlStateManager.color(1F, 1F, 1F, 1F);
  GlStateManager.translate(d0, d1, d2);
  double worldTime = ClientTickHandler.ticksInGame + t;
  if(tile.getWorld() != null)
    worldTime += new Random(tile.getPos().hashCode()).nextInt(1000);
  GlStateManager.translate(0.5F, 0, 0.5F);
  GlStateManager.rotate(-((float) worldTime * 0.5F), 0F, 1F, 0F);
  GlStateManager.translate(-0.5, (float) Math.sin(worldTime * 0.05F) * 0.1F, 0.5);
  GlStateManager.rotate(4F * (float) Math.sin(worldTime * 0.04F), 1F, 0F, 0F);
  Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
  IBlockState state = tile.getWorld().getBlockState(tile.getPos());
  state = state.getBlock().getExtendedState(state, tile.getWorld(), tile.getPos());
  IBakedModel model = brd.getBlockModelShapes().getModelManager().getModel(new ModelResourceLocation("botania:floatingSpecialFlower", "inventory"));
  brd.getBlockModelRenderer().renderModelBrightness(model, state, 1.0F, true);
  GlStateManager.popMatrix();
}

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

IBlockState extended = heldState.getBlock().getExtendedState(actual, new FakeBlockAccess(heldWorld), heldPos);
return model.getQuads(extended, side, rand);

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

try
  blockState = blockState.getBlock().getExtendedState( blockState, facadeAccess, pos );

代码示例来源:origin: amadornes/MCMultiPart

@Override
public IBlockState getExtendedState(IBlockAccess world, BlockPos pos, IBlockState state) {
  return state.getBlock().getExtendedState(state, world, pos);
}

代码示例来源:origin: amadornes/MCMultiPart

public default IBlockState getExtendedState(IBlockAccess world, BlockPos pos, IPartInfo part, IBlockState state) {
  return state.getBlock().getExtendedState(state, world, pos);
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
  List<PartInfo.ClientInfo> info = getTile(world, pos).map(c -> c.getParts().values()//
      .stream()//
      .map(i -> i.getInfo(world, pos))//
      .collect(Collectors.toList())).orElse(Collections.emptyList());
  return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(PROPERTY_INFO, info);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

IExtendedBlockState exState = (IExtendedBlockState) state.getBlock().getExtendedState( state, world, pos );

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

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
  return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos).withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
}

代码示例来源:origin: CyclopsMC/IntegratedDynamics

@Nullable
@Override
@SideOnly(Side.CLIENT)
public IBakedModel getBreakingBaseModel(World world, BlockPos pos, EnumFacing position) {
  IBlockState blockState = world.getBlockState(pos);
  IExtendedBlockState state = (IExtendedBlockState) blockState.getBlock().getExtendedState(blockState, world, pos);
  Optional<IBlockState> blockStateOptional = BlockHelpers.getSafeBlockStateProperty(state, BlockCable.FACADE, Optional.absent());
  if(!blockStateOptional.isPresent()) return null;
  return RenderHelpers.getBakedModel(blockStateOptional.get());
}

代码示例来源:origin: Direwolf20-MC/BuildingGadgets

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
  IExtendedBlockState extendedBlockState = (IExtendedBlockState) super.getExtendedState(state, world, pos);
  IBlockState mimicBlock = getActualMimicBlock(world, pos);
  if (mimicBlock != null) {
    FakeRenderWorld fakeRenderWorld = new FakeRenderWorld();
    fakeRenderWorld.setState(world, mimicBlock, pos);
    IBlockState extState = mimicBlock.getBlock().getExtendedState(mimicBlock, fakeRenderWorld, pos);
    //ConstructionID mimicID = new ConstructionID(mimicBlock);
    return extendedBlockState.withProperty(FACADE_ID, mimicBlock).withProperty(FACADE_EXT_STATE, extState);
  }
  return extendedBlockState;
}

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

public void renderBlock(@Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull Multiblock mb, @Nonnull BufferBuilder worldRendererIn) {
  try {
    BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
    EnumBlockRenderType type = state.getRenderType();
    if (type != EnumBlockRenderType.MODEL) {
      blockrendererdispatcher.renderBlock(state, pos, mb, worldRendererIn);
      return;
    }
    // We only want to change one param here, the check sides
    IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
    state = state.getBlock().getExtendedState(state, mb, pos);
    blockrendererdispatcher.getBlockModelRenderer().renderModel(mb, ibakedmodel, state, pos, worldRendererIn, false);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

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

public void renderBlock(@Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull IBlockAccess blockAccess, @Nonnull BufferBuilder worldRendererIn) {
 try {
  BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
  EnumBlockRenderType type = state.getRenderType();
  if (type != EnumBlockRenderType.MODEL) {
   blockrendererdispatcher.renderBlock(state, pos, blockAccess, worldRendererIn);
   return;
  }
  // We only want to change one param here, the check sides
  IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
  state = state.getBlock().getExtendedState(state, world, pos);
  blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn, false);
 } catch (Throwable throwable) {
  // Just bury a render issue here, it is only the IO screen
 }
}

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

@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager) {
  TileEntity tile = world.getTileEntity(pos);
  Optional<Boolean> result = Optional.empty();
  if (tile instanceof LogisticsTileGenericSubMultiBlock) {
    IBlockState state = tile.getBlockType().getExtendedState(tile.getBlockType().getDefaultState(), world, pos);
    List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
    result = mainPipeList.stream()
        .filter(Objects::nonNull)
        .filter(LogisticsTileGenericPipe::isMultiBlock)
        .filter(mainPipe -> Objects.nonNull(pipe.doRayTrace(world, mainPipe.getPos(), Minecraft.getMinecraft().player)))
        .map(mainPipe -> pipe.addDestroyEffects(world, mainPipe.getPos(), manager))
        .findFirst();
  }
  return result.orElse(super.addDestroyEffects(world, pos, manager));
}

代码示例来源:origin: ldtteam/minecolonies

private static void renderModel(final World world, final IBakedModel model, final BlockPos pos, final int alpha)
{
  final IBlockState state = world.getBlockState(pos);
  final IBlockState actualState = state.getBlock().getExtendedState(state, world, pos);
  final IBlockState iBlockExtendedState = state.getBlock().getExtendedState(state, world, pos);
  for (final EnumFacing facing : EnumFacing.values())
  {
    renderQuads(world, actualState, pos, model.getQuads(actualState, facing, 0), alpha);
  }
  renderQuads(world, actualState, pos, model.getQuads(iBlockExtendedState, null, 0), alpha);
}

代码示例来源:origin: Chisel-Team/Chisel

private static IBlockState getBlockStateLooking() {
  Minecraft mc = Minecraft.getMinecraft();
  if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == Type.BLOCK && mc.objectMouseOver.getBlockPos() != null) {
    BlockPos pos = mc.objectMouseOver.getBlockPos();
    return mc.world.getBlockState(pos).getBlock().getExtendedState(mc.world.getBlockState(pos), mc.world, pos);
  }
  return null;
}

代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets

@Override
public void onLoad() {
  super.onLoad();
  if (camoBlockStateTemp instanceof IExtendedBlockState) {
    this.camoSettings.setCamoBlockState(camoBlockStateTemp);
  } else {
    this.setCamoState(camoBlockStateTemp.getBlock().getExtendedState(camoBlockStateTemp, this.getWorld(), this.getPos()));
  }
  this.updateNBT = true;
}

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

public void renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
  try {
    BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
    EnumBlockRenderType type = state.getRenderType();
    if (type != EnumBlockRenderType.MODEL) {
      blockrendererdispatcher.renderBlock(state, pos, blockAccess, worldRendererIn);
      return;
    }
    IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
    state = state.getBlock().getExtendedState(state, world, pos);
    blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn, false);
  } catch (Throwable throwable) {
  }
}
private void setGlStateForPass(BlockRenderLayer layer, boolean isNeighbour) {

代码示例来源: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: OpenModularTurretsTeam/OpenModularTurrets

@Nonnull
@Override
public IBlockState getCamoState() {
  return this.getCamoSettings().getCamoBlockState() != null
      && this.getCamoSettings().getCamoBlockState() instanceof IExtendedBlockState
      ? (IExtendedBlockState) this.getCamoSettings().getCamoBlockState()
      : this.getCamoSettings().getCamoBlockState() != null
      ? this.getCamoSettings().getCamoBlockState().getBlock()
      .getExtendedState(this.getCamoSettings().getCamoBlockState(), this.getWorld(), this.getPos())
      : this.getDefaultCamoState();
}

相关文章

Block类方法