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

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

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

Block.getDefaultState介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

@Override
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
  Map<String, Property<?>> map = new TreeMap<>();
  Collection<IProperty<?>> propertyKeys = Block.getBlockFromName(blockType.getId())
      .getDefaultState()
      .getPropertyKeys();
  for (IProperty<?> key : propertyKeys) {
    map.put(key.getName(), ForgeAdapter.adaptProperty(key));
  }
  return map;
}

代码示例来源:origin: EngineHub/WorldEdit

@Override
public BlockMaterial getMaterial(BlockType blockType) {
  return materialMap.computeIfAbsent(Block.getBlockFromName(blockType.getId()).getDefaultState().getMaterial(),
      m -> new ForgeBlockMaterial(m, super.getMaterial(blockType)));
}

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

public InWorldToolOperationIngredient( final Block blk, final boolean b )
{
  this.state = blk.getDefaultState();
  this.blockOnly = b;
}

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

@Nonnull
@Override
public IBlockState getDisplayTile() {
  return ModBlocks.pool.getDefaultState();
}

代码示例来源:origin: EngineHub/WorldEdit

IBlockState old = chunk.getBlockState(pos);
Block mcBlock = Block.getBlockFromName(block.getBlockType().getId());
IBlockState newState = mcBlock.getDefaultState();
Map<Property<?>, Object> states = block.getStates();
newState = applyProperties(mcBlock.getBlockState(), newState, states);

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

public static void init() {
  BotaniaAPI.registerPureDaisyRecipe("stone", ModBlocks.livingrock.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe("logWood", ModBlocks.livingwood.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe("netherrack", Blocks.COBBLESTONE.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe("soulSand", Blocks.SAND.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe("ice", Blocks.PACKED_ICE.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe(LibOreDict.BLAZE_BLOCK, Blocks.OBSIDIAN.getDefaultState());
  BotaniaAPI.registerPureDaisyRecipe(Blocks.WATER, Blocks.SNOW.getDefaultState());
}

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

protected AEBaseStairBlock( final Block block, final String type )
{
  super( block.getDefaultState() );
  Preconditions.checkNotNull( block );
  Preconditions.checkNotNull( block.getUnlocalizedName() );
  Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );
  this.setUnlocalizedName( "stair." + type );
  this.setLightOpacity( 0 );
}

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

@Override
public IBlockState getBlockState()
{
  final Item maybeFacade = this.facade.getItem();
  // AE Facade
  if( maybeFacade instanceof IFacadeItem )
  {
    final IFacadeItem facade = (IFacadeItem) maybeFacade;
    return facade.getTextureBlockState( this.facade );
  }
  return Blocks.GLASS.getDefaultState();
}

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

@Nonnull
@Override
public IBlockState getBlockState(@Nonnull BlockPos pos) {
  IBlockState state = compose.getBlockState(pos);
  if(state.getBlock() instanceof BlockCamo) {
    state = ((TileCamo) compose.getTileEntity(pos)).camoState;
  }
  return state == null ? Blocks.AIR.getDefaultState() : state;
}

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

public static MultiblockSet makeMultiblockSet() {
  Multiblock mb = new Multiblock();
  for(BlockPos relativePos : LAPIS_BLOCKS)
    mb.addComponent(relativePos, Blocks.LAPIS_BLOCK.getDefaultState());
  for(BlockPos relativePos : LIVINGROCK_BLOCKS)
    mb.addComponent(relativePos, ModBlocks.livingrock.getDefaultState());
  mb.addComponent(new BlockPos(0, 1, 0), ModBlocks.terraPlate.getDefaultState());
  mb.setRenderOffset(new BlockPos(0, 1, 0));
  return mb.makeSet();
}

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

public BlockLivingrockSlab(boolean full) {
  super(full, ModBlocks.livingrock.getDefaultState());
  setHardness(2.0F);
  setResistance(10.0F);
  setSoundType(SoundType.STONE);
}

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

private void setBlockIDWithMetadata( final int y, BlockStorageData data )
{
  if( data.state == CachedPlane.this.matrixBlockState )
  {
    data.state = Platform.AIR_BLOCK.getDefaultState();
  }
  final ExtendedBlockStorage[] storage = this.c.getBlockStorageArray();
  final ExtendedBlockStorage extendedBlockStorage = storage[y >> 4];
  extendedBlockStorage.set( this.x, y & 15, this.z, data.state );
  extendedBlockStorage.setBlockLight( this.x, y & 15, this.z, data.light );
}

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

@Override
  public IBlockState getBlockState( final int x, final int y, final int z )
  {
    if( this.range( x, y, z ) )
    {
      return this.w.getBlockState( new BlockPos( x, y, z ) );
    }
    return Blocks.AIR.getDefaultState();
  }
}

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

public BlockShimmerrockSlab(boolean full) {
  super(full, ModBlocks.shimmerrock.getDefaultState());
  setHardness(2.0F);
  setResistance(10.0F);
  setSoundType(SoundType.STONE);
}

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

public BlockLivingrockBrickSlab(boolean full) {
  super(full, ModBlocks.livingrock.getDefaultState().withProperty(BotaniaStateProps.LIVINGROCK_VARIANT, LivingRockVariant.BRICK));
  setHardness(2.0F);
  setResistance(10.0F);
  setSoundType(SoundType.STONE);
}

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

@Override
public void setBlock( final int x, final int y, final int z, final Block blk )
{
  if( this.range( x, y, z ) )
  {
    this.verticalBits |= 1 << ( y >> 4 );
    this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() );
  }
}

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

public static void placeDoubleFlower(World world, BlockPos pos, EnumDyeColor color, int flags) {
  Block flower = color.getMetadata() >= 8 ? ModBlocks.doubleFlower2 : ModBlocks.doubleFlower1;
  world.setBlockState(pos, flower.getDefaultState().withProperty(color.getMetadata() >= 8 ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, color).withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags);
  world.setBlockState(pos.up(), flower.getDefaultState().withProperty(color.getMetadata() >= 8 ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, color).withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
}

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

private void renderBlock(Block block) {
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(block.getDefaultState(), 1.0F);
  }
}

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

@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
  if(type == RenderType.HEAD) {
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    GlStateManager.translate(0, -1.5F, 0.5F);
    Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(ModBlocks.tinyPlanet.getDefaultState(), 1.0F);
  }
}

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

public static MultiblockSet makeMultiblockSet() {
  Multiblock mb = new Multiblock();
  for(BlockPos p : PYLON_LOCATIONS)
    mb.addComponent(p.up(), ModBlocks.pylon.getDefaultState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.GAIA));
  for(int i = 0; i < 3; i++)
    for(int j = 0; j < 3; j++)
      mb.addComponent(new BeaconComponent(new BlockPos(i - 1, 0, j - 1)));
  mb.addComponent(new BeaconBeamComponent(new BlockPos(0, 1, 0)));
  mb.setRenderOffset(new BlockPos(0, -1, 0));
  return mb.makeSet();
}

相关文章

Block类方法