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

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

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

Block.getTranslationKey介绍

暂无

代码示例

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

private static String getMagnetKey(Block block, int meta) {
  return "bm_" + block.getTranslationKey() + "@" + meta;
}

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

@Nonnull
@Override
public String getTranslationKey(ItemStack stack) {
  return block.getTranslationKey().replaceAll("tile.", "tile.botania:");
}

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

public BlockLivingStairs(IBlockState state) {
  super(state, state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Stairs");
}

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

public BlockModWall(Block block, int meta) {
  super(block);
  // For backward compat don't kill me
  String name = block.getTranslationKey().replaceAll("tile.", "") + meta + "Wall";
  setRegistryName(name);
  setTranslationKey(name);
  setDefaultState(pickDefaultState());
  setCreativeTab(BotaniaCreativeTab.INSTANCE);
}

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

public BlockLivingSlab(boolean full, IBlockState state) {
  super(full, state.getMaterial(), state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Slab" + (full ? "Full" : ""));
  setSoundType(state.getBlock().getSoundType());
  sourceState = state;
}

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

public BlockModPane(Block source) {
  super(Material.GLASS, false);
  // Backward compat don't kill me
  String name = source.getTranslationKey().replaceAll("tile.", "") + "Pane";
  setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
  setTranslationKey(name);
  setCreativeTab(BotaniaCreativeTab.INSTANCE);
  setHardness(0.3F);
  setSoundType(SoundType.GLASS);
  setLightLevel(1.0F);
  useNeighborBrightness = true;
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

@Override
  public String getTranslationKey(ItemStack stack){
    return InitBlocks.blockColoredLamp.getTranslationKey()+"_"+ALL_LAMP_TYPES[stack.getItemDamage()].regName;
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static GuideItem register(GuideCategory cat, Block block, @Nullable IRecipe recipe, @Nullable List<String> args) {
 String pageTitle = block.getTranslationKey() + ".name";
 String text = block.getTranslationKey() + SUFFIX;
 return register(cat, Item.getItemFromBlock(block), pageTitle, text, recipe, args);
}

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

@Override
public String getTranslationKey(ItemStack itemstack) {
  Block block = getBlock();
  if (block instanceof IBlockWithMeta) {
    IBlockWithMeta blockMeta = (IBlockWithMeta) block;
    int meta = itemstack.getMetadata();
    return block.getTranslationKey() + "." + blockMeta.getNameFromMeta(meta);
  }
  return block.getTranslationKey();
}

代码示例来源:origin: SquidDev-CC/plethora

public static Map<Object, Object> getBasicMeta(@Nonnull Block block) {
  HashMap<Object, Object> data = Maps.newHashMap();
  ResourceLocation name = block.getRegistryName();
  data.put("name", name == null ? "unknown" : name.toString());
  data.put("displayName", block.getLocalizedName());
  data.put("TranslationKey", block.getTranslationKey());
  return data;
}

代码示例来源:origin: thraaawn/CompactMachines

public ItemBlockMachine(Block block) {
  super(block);
  if (!(block instanceof IMetaBlockName)) {
    throw new IllegalArgumentException(String.format("The given block %s is not an instance of IMetaBlockName!", block.getTranslationKey()));
  }
  this.setMaxDamage(0);
  this.setHasSubtypes(true);
}

代码示例来源:origin: SquidDev-CC/plethora

@Nonnull
  @Override
  public String getTranslationKey(ItemStack stack) {
    if (block instanceof BlockBase) {
      return ((BlockBase) block).getTranslationKey(stack.getItemDamage());
    } else {
      return block.getTranslationKey();
    }
  }
}

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

/**
 * Gets the tile's unlocalized name, based on the block at the location of this entity (client-only).
 */
@Override
public String getUnlocalizedTitle() {
  String blockUnlocalizedName = getBlockType().getTranslationKey();
  return blockUnlocalizedName + '.' + getBlockMetadata() + ".name";
}

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

@Override
public String getUnlocalizedTitle() {
  Block block = getBlockType();
  if (block instanceof BlockBase) {
    return block.getTranslationKey() + ".name";
  }
  return super.getUnlocalizedTitle();
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
public String getName() {
 if (this.getBlockType() == null) {
  ModCyclic.logger.error(" null blockType:" + this.getClass().getName());
  return "";
 }
 return this.getBlockType().getTranslationKey() + ".name";
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static boolean isAirOrWater(World world, BlockPos pos) {
 ArrayList<Block> waterBoth = new ArrayList<Block>();
 waterBoth.add(Blocks.FLOWING_WATER);
 waterBoth.add(Blocks.WATER);
 if (pos == null) {
  return false;
 }
 return world.isAirBlock(pos) || world.getBlockState(pos).getBlock().getTranslationKey().equalsIgnoreCase("tile.water") || (world.getBlockState(pos) != null
   && waterBoth.contains(world.getBlockState(pos).getBlock()));
}

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

@Override
public ITextComponent getDisplayName()
{
  if (blockType == null)
  {
    return super.getDisplayName();
  }
  return new TextComponentString(LanguageHandler.format(blockType.getTranslationKey() + ".name"));
}

代码示例来源:origin: PrinceOfAmber/Cyclic

private void verifyFakePlayer(WorldServer w) {
 if (fakePlayer == null) {
  fakePlayer = UtilFakePlayer.initFakePlayer(w, this.uuid, this.getBlockType().getTranslationKey());
  if (fakePlayer == null) {
   ModCyclic.logger.error("Fake player failed to init ");
  }
 }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public String getName() {
  Block block = world.getBlockState(this.pos).getBlock();
  return this.hasCustomName() ? this.customName : block.getTranslationKey() + ".name";
}

代码示例来源:origin: PrinceOfAmber/Cyclic

private void verifyFakePlayer(WorldServer w) {
 if (fakePlayer == null) {
  fakePlayer = UtilFakePlayer.initFakePlayer(w, this.uuid, this.getBlockType().getTranslationKey());
  if (fakePlayer == null) {
   ModCyclic.logger.error("Fake player failed to init ");
  }
 }
}

相关文章

Block类方法