當前位置: 首頁>>代碼示例>>Java>>正文


Java IStringSerializable.getName方法代碼示例

本文整理匯總了Java中net.minecraft.util.IStringSerializable.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java IStringSerializable.getName方法的具體用法?Java IStringSerializable.getName怎麽用?Java IStringSerializable.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.IStringSerializable的用法示例。


在下文中一共展示了IStringSerializable.getName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerVariantBlocks

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
private void registerVariantBlocks(ProxyModBase proxy) {
	for (InfoBlock block : proxy.blocks) {
		if (!(block instanceof InfoBlockVariant))
			continue;
		InfoBlockVariant blockVar = (InfoBlockVariant) block;
		List<String> variants = Lists.newArrayList();
		for (Object metalObj : blockVar.getVariantProp().getAllowedValues()) {
			IStringSerializable value = (IStringSerializable) metalObj;
			String name = proxy.getModId() + ":" + value.getName() + blockVar.getVariantSuffix();
			variants.add(name);
		}
		ModelBakery.registerItemVariants(Item.getItemFromBlock(block.getBlock()),
				variants.stream().map(ResourceLocation::new).toArray(ResourceLocation[]::new));

		ModelLoader.setCustomStateMapper(block.getBlock(),
				(new StateMap.Builder()).withName(blockVar.getVariantProp())
						.withSuffix(blockVar.getVariantSuffix())
						.build());
	}
}
 
開發者ID:hea3ven,項目名稱:CommonUtils,代碼行數:21,代碼來源:ModInitializerClient.java

示例2: PropertyClass

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
protected PropertyClass(String name, Class valueClass, Collection allowedValues) 
{
	super(name, valueClass);
	this.allowedValues = ImmutableSet.copyOf(allowedValues);
	Iterator iterator = allowedValues.iterator();

	while (iterator.hasNext())
	{
		IStringSerializable oenum = (IStringSerializable)iterator.next();
		String s1 = oenum.getName();

		if (this.nameToValue.containsKey(s1))
		{
			throw new IllegalArgumentException("Multiple values have the same name \'" + s1 + "\'");
		}

		this.nameToValue.put(s1, oenum);
	}
}
 
開發者ID:Deadrik,項目名稱:TFC2,代碼行數:20,代碼來源:PropertyClass.java

示例3: getValueName

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
private static Object getValueName(Comparable p_getValueName_0_)
{
    if (p_getValueName_0_ instanceof IStringSerializable)
    {
        IStringSerializable istringserializable = (IStringSerializable)p_getValueName_0_;
        return istringserializable.getName();
    }
    else
    {
        return p_getValueName_0_.toString();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:ConnectedParser.java

示例4: toLua

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
public static Object toLua(Comparable<?> obj) {
  if (obj instanceof IStringSerializable) {
    IStringSerializable s = (IStringSerializable) obj;
    return s.getName();
  }
  if (obj instanceof Enum) {
    Enum<?> e = (Enum<?>) obj;
    return e.name();
  }
  if (obj instanceof String) {
    String str = (String) obj;
    if ("true".equals(obj)) {
      return true;
    }
    if ("false".equals(obj)) {
      return false;
    }
    Object result = Ints.tryParse(str);
    if (result != null) {
      return result;
    }
    result = Doubles.tryParse(str);
    if (result != null) {
      return result;
    }
  }
  return Conversions.canonicalRepresentationOf(obj);
}
 
開發者ID:wizards-of-lua,項目名稱:wizards-of-lua,代碼行數:29,代碼來源:BlockPropertyConverter.java

示例5: registerBlocksItemModels

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
private void registerBlocksItemModels(ProxyModBase proxy) {
	for (InfoBlock block : proxy.blocks) {
		if (block instanceof InfoBlockVariant) {
			InfoBlockVariant blockVar = (InfoBlockVariant) block;
			for (Object valueObj : blockVar.getVariantProp().getAllowedValues()) {
				IStringSerializable value = (IStringSerializable) valueObj;
				String name = proxy.getModId() + ":" + value.getName() + blockVar.getVariantSuffix();
				ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block.getBlock()),
						blockVar.getMeta(value), new ModelResourceLocation(name, "inventory"));
			}
		} else {
			ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(block.getBlock()),
					new SimpleItemMeshDefinition(proxy.getModId() + ":" + block.getName()));
		}
	}
	for (InfoItem item : proxy.items) {
		if (item.getVariants() == null) {
			ModelLoader.setCustomMeshDefinition(item.getItem(),
					new SimpleItemMeshDefinition(item.getDomain() + ":" + item.getName()));
		} else {
			int i = 0;
			for (String variant : item.getVariants()) {
				ModelLoader.setCustomModelResourceLocation(item.getItem(), i++,
						new ModelResourceLocation(item.getDomain() + ":" + variant, "inventory"));
			}
		}
	}
}
 
開發者ID:hea3ven,項目名稱:CommonUtils,代碼行數:29,代碼來源:ModInitializerClient.java

示例6: getVariantName

import net.minecraft.util.IStringSerializable; //導入方法依賴的package包/類
public static String getVariantName(IStringSerializable variant) {
	return "variant=" + variant.getName();
}
 
開發者ID:T145,項目名稱:magistics,代碼行數:4,代碼來源:IModelProvider.java


注:本文中的net.minecraft.util.IStringSerializable.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。