当前位置: 首页>>代码示例>>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;未经允许,请勿转载。