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

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

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

Block.getUnlocalizedName介绍

暂无

代码示例

代码示例来源: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 ITextComponent getDisplayName()
{
  if( this.hasCustomInventoryName() )
  {
    return new TextComponentString( this.getCustomInventoryName() );
  }
  return new TextComponentTranslation( this.getBlockType().getUnlocalizedName() );
}

代码示例来源:origin: McJtyMods/XNet

private static String getBlockUnlocalizedName(Block block) {
    return STARTLOC + block.getUnlocalizedName() + ".name" + ENDLOC;
  }
}

代码示例来源:origin: McJtyMods/TheOneProbe

private static String getBlockUnlocalizedName(Block block) {
    return STARTLOC + block.getUnlocalizedName() + ".name" + ENDLOC;
  }
}

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

@Override
public String getUnlocalizedName() {
  return super.getUnlocalizedName().replaceFirst("tile.", "");
}

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

@Override
public @Nonnull String getMachineName() {
 return getBlockType().getUnlocalizedName();
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

public MOGuideEntryBlock(Block block) {
  super(block.getUnlocalizedName());
  setStackIcons(block);
}

代码示例来源:origin: ExtraCells/ExtraCells2

public String getStatName() {
  return I18n.translateToLocal(this.block.getUnlocalizedName() + ".name");
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

public static void registerBlockRenderer(Block block) {
  registerBlockRenderer(block, block.getUnlocalizedName().substring("tile.".length()));
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private boolean shouldGenerate(Block block, ConfigurationHandler config) {
  Property p = config.config.get(ConfigurationHandler.CATEGORY_WORLD_GEN, ConfigurationHandler.CATEGORY_WORLD_SPAWN + "." + block.getUnlocalizedName(), true);
  p.setLanguageKey(block.getUnlocalizedName() + ".name");
  return p.getBoolean(true);
}

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

@Override
public @Nonnull String getUnlocalizedName(int meta) {
 return FusedQuartzType.getTypeFromMeta(meta).getBlock().getUnlocalizedName();
}

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

if( item == Items.AIR )
  return directedBlock.getUnlocalizedName();

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

public static String getBlockkDisplayNameSafe(IBlockState blockState) {
  // Certain mods may call client-side only methods,
  // so call a server-side-safe fallback method if that fails.
  try {
    return getBlockDisplayNameUsSafe(blockState);
  } catch (NoSuchMethodException e) {
    return L10NHelpers.localize(blockState.getBlock().getUnlocalizedName() + ".name");
  }
}

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

@Override
  public String pathFor(final World world, final BlockPos pos) {
    if (!world.isBlockLoaded(pos)) {
      return null;
    }
    final Block block = world.getBlockState(pos).getBlock();
    final String modId = Block.REGISTRY.getNameForObject(block).getResourceDomain();
    if (API.MOD_ID.equals(modId)) {
      return "%LANGUAGE%/block/" + block.getUnlocalizedName().replaceFirst("^tile\\.tis3d\\.", "") + ".md";
    }
    return null;
  }
}

代码示例来源:origin: jabelar/ExampleMod-1.12

/**
   * Register block model.
   *
   * @param parBlock the par block
   * @param parMetaData the par meta data
   */
  @SideOnly(Side.CLIENT)
  public static void registerBlockModel(Block parBlock, int parMetaData)
  {
//        // DEBUG
//        System.out.println("Registering block model for"
//                + ": " + parBlock.getRegistryName());

    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(parBlock), parMetaData,
        new ModelResourceLocation(MainMod.MODID + ":" + parBlock.getUnlocalizedName().substring(5), "inventory"));
  }

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

@Override
public String pathFor(final ItemStack stack) {
  if (stack.isEmpty()) {
    return null;
  }
  final Item item = stack.getItem();
  final Block block = Block.getBlockFromItem(item);
  if (block != Blocks.AIR) {
    final String modId = Block.REGISTRY.getNameForObject(block).getResourceDomain();
    if (API.MOD_ID.equals(modId)) {
      return "%LANGUAGE%/block/" + block.getUnlocalizedName().replaceFirst("^tile\\.tis3d\\.", "") + ".md";
    }
  } else {
    final ResourceLocation name = Item.REGISTRY.getNameForObject(item);
    if (name != null) {
      final String modId = name.getResourceDomain();
      if (API.MOD_ID.equals(modId)) {
        return "%LANGUAGE%/item/" + item.getUnlocalizedName().replaceFirst("^item\\.tis3d\\.", "") + ".md";
      }
    }
  }
  return null;
}

代码示例来源:origin: McJtyMods/TheOneProbe

private void showDebugInfo(IProbeInfo probeInfo, World world, IBlockState blockState, BlockPos pos, Block block, EnumFacing side) {
    String simpleName = block.getClass().getSimpleName();
    IProbeInfo vertical = probeInfo.vertical(new LayoutStyle().borderColor(0xffff4444).spacing(2))
        .text(LABEL + "Reg Name: " + INFO + block.getRegistryName().toString())
        .text(LABEL + "Unlocname: " + INFO + block.getUnlocalizedName())
        .text(LABEL + "Meta: " + INFO + blockState.getBlock().getMetaFromState(blockState))
        .text(LABEL + "Class: " + INFO + simpleName)
        .text(LABEL + "Hardness: " + INFO + block.getBlockHardness(blockState, world, pos))
        .text(LABEL + "Power W: " + INFO + block.getWeakPower(blockState, world, pos, side.getOpposite())
            + LABEL + ", S: " + INFO + block.getStrongPower(blockState, world, pos, side.getOpposite()))
        .text(LABEL + "Light: " + INFO + block.getLightValue(blockState, world, pos));
    TileEntity te = world.getTileEntity(pos);
    if (te != null) {
      vertical.text(LABEL + "TE: " + INFO + te.getClass().getSimpleName());
    }
  }
}

代码示例来源:origin: squeek502/VeganOption

@Override
public void create()
{
  fluidPlantMilk = new Fluid("plant_milk", new ResourceLocation(ModInfo.MODID_LOWER, "blocks/plant_milk_still"), new
    ResourceLocation(ModInfo.MODID_LOWER, "blocks/plant_milk_flow"));
  FluidRegistry.registerFluid(fluidPlantMilk);
  plantMilk = new BlockFluidClassic(fluidPlantMilk, Material.WATER)
    .setUnlocalizedName(ModInfo.MODID + ".plantMilk")
    .setRegistryName(ModInfo.MODID_LOWER, "plantMilk");
  fluidPlantMilk.setBlock(plantMilk);
  fluidPlantMilk.setUnlocalizedName(plantMilk.getUnlocalizedName());
  GameRegistry.register(plantMilk);
  GameRegistry.register(new ItemBlock(plantMilk).setRegistryName(plantMilk.getRegistryName()));
  FluidRegistry.addBucketForFluid(fluidPlantMilk);
  bucketPlantMilk = new ItemStack(Items.MILK_BUCKET);
  bucketPlantMilk.setStackDisplayName("Plant Milk Bucket");
}

代码示例来源:origin: squeek502/VeganOption

@Override
public void create()
{
  fluidLyeWater = new Fluid("lye_water", new ResourceLocation(ModInfo.MODID_LOWER, "blocks/lye_water_still"), new ResourceLocation(ModInfo.MODID_LOWER, "blocks/lye_water_flow"));
  FluidRegistry.registerFluid(fluidLyeWater);
  lyeWater = new BlockLyeWater(fluidLyeWater)
    .setUnlocalizedName(ModInfo.MODID + ".lyeWater")
    .setRegistryName(ModInfo.MODID_LOWER, "lyeWater");
  fluidLyeWater.setBlock(lyeWater);
  fluidLyeWater.setUnlocalizedName(lyeWater.getUnlocalizedName());
  GameRegistry.register(lyeWater);
  GameRegistry.register(new ItemBlock(lyeWater).setRegistryName(lyeWater.getRegistryName()));
  FluidRegistry.addBucketForFluid(fluidLyeWater);
  soap = new ItemSoap()
    .setUnlocalizedName(ModInfo.MODID + ".soap")
    .setCreativeTab(VeganOption.creativeTab)
    .setRegistryName(ModInfo.MODID_LOWER + ":soap");
  GameRegistry.register(soap);
  UniversalBucket bucket = ForgeModContainer.getInstance().universalBucket;
  bucketLyeWater = new ItemStack(bucket);
  bucket.fill(bucketLyeWater, new FluidStack(fluidLyeWater, Fluid.BUCKET_VOLUME), true);
}

代码示例来源:origin: squeek502/VeganOption

@Override
public void create()
{
  fluidSoapSolution = new Fluid("fluid_soap_solution", new ResourceLocation(ModInfo.MODID_LOWER, "blocks/soap_solution_still"), new ResourceLocation(ModInfo.MODID_LOWER, "blocks/soap_solution_flow"));
  FluidRegistry.registerFluid(fluidSoapSolution);
  blockFluidSoapSolution = new BlockFluidClassic(fluidSoapSolution, Material.WATER)
    .setUnlocalizedName(ModInfo.MODID + ".fluidSoapSolution")
    .setRegistryName(ModInfo.MODID_LOWER, "fluidSoapSolution");
  fluidSoapSolution.setBlock(blockFluidSoapSolution);
  fluidSoapSolution.setUnlocalizedName(blockFluidSoapSolution.getUnlocalizedName());
  GameRegistry.register(blockFluidSoapSolution);
  GameRegistry.register(new ItemBlock(blockFluidSoapSolution).setRegistryName(blockFluidSoapSolution.getRegistryName()));
  soapSolution = new ItemSoapSolution()
    .setUnlocalizedName(ModInfo.MODID + ".soapSolution")
    .setCreativeTab(VeganOption.creativeTab)
    .setRegistryName(ModInfo.MODID_LOWER, "soapSolution")
    .setContainerItem(Items.GLASS_BOTTLE);
  GameRegistry.register(soapSolution);
  FluidContainerRegistry.registerFluidContainer(new FluidStack(fluidSoapSolution, Fluid.BUCKET_VOLUME), new ItemStack(soapSolution), new ItemStack(soapSolution.getContainerItem()));
  frozenBubble = new ItemFrozenBubble()
    .setUnlocalizedName(ModInfo.MODID + ".frozenBubble")
    .setCreativeTab(VeganOption.creativeTab)
    .setRegistryName(ModInfo.MODID_LOWER, "frozenBubble");
  GameRegistry.register(frozenBubble);
  EntityRegistry.registerModEntity(EntityBubble.class, "bubble", ContentHelper.ENTITYID_BUBBLE, ModInfo.MODID, 80, 1, true);
}

相关文章

Block类方法