本文整理汇总了Java中net.minecraftforge.registries.ForgeRegistry类的典型用法代码示例。如果您正苦于以下问题:Java ForgeRegistry类的具体用法?Java ForgeRegistry怎么用?Java ForgeRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ForgeRegistry类属于net.minecraftforge.registries包,在下文中一共展示了ForgeRegistry类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import net.minecraftforge.registries.ForgeRegistry; //导入依赖的package包/类
@Override
public final void init(InitPhase phase, ContentHelper helper)
{
if (phase == InitPhase.PRE_INIT)
{
item = createItem();
item.setUnlocalizedName(helper.getModId() + "." + id);
item.setRegistryName(id);
item.setMaxDamage(maxDamage);
initItem();
} else if (phase == InitPhase.REGISTER_ITEMS)
{
ForgeRegistry<Item> registry = RegistryManager.ACTIVE.getRegistry(GameData.ITEMS);
registry.register(item);
} else if (phase == InitPhase.REGISTER_MODELS)
{
registerModels();
} else if (phase == InitPhase.INIT)
{
if (tint != null)
{
if (item.getHasSubtypes())
CustomStuff4.proxy.setItemTint(item, meta -> tint.get(meta).orElse(new ColorImpl(0xffffffff)).getRGB());
else
CustomStuff4.proxy.setItemTint(item, meta -> tint.get(0).orElse(new ColorImpl(0xffffffff)).getRGB());
}
}
}
开发者ID:cubex2,项目名称:customstuff4,代码行数:30,代码来源:ContentItemBase.java
示例2: getForgeRegistry
import net.minecraftforge.registries.ForgeRegistry; //导入依赖的package包/类
@Nullable
static <T extends IForgeRegistryEntry<T>> ForgeRegistry<T> getForgeRegistry(Class<T> type) {
IForgeRegistry<T> result = GameRegistry.findRegistry(type);
if (result instanceof ForgeRegistry)
return (ForgeRegistry<T>) result;
else
AlchemyRuntimeException.onException(new RuntimeException(
new ClassCastException(result.getClass().getName() + " cannot be cast to " + ForgeRegistry.class.getName())));
return null;
}
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:11,代码来源:ForgeHelper.java
示例3: newRegistries
import net.minecraftforge.registries.ForgeRegistry; //导入依赖的package包/类
@SubscribeEvent
public static void newRegistries(RegistryEvent.NewRegistry event)
{
// connectionRegistry = (ForgeRegistry<Connection>) new RegistryBuilder<Connection>()
// .setName(new ResourceLocation(HardScience.MODID, "connections"))
// .setIDRange(0, Short.MAX_VALUE)
// .setType(Connection.class)
// .create();
// connectorRegistry = (ForgeRegistry<Connector>) new RegistryBuilder<Connector>()
// .setName(new ResourceLocation(HardScience.MODID, "connectors"))
// .setIDRange(0, Short.MAX_VALUE)
// .setType(Connector.class)
// .create();
portRegistry = (ForgeRegistry<Port>) new RegistryBuilder<Port>()
.setName(new ResourceLocation(HardScience.MODID, "ports"))
.setIDRange(0, Short.MAX_VALUE)
.setType(Port.class)
.create();
bulkResourceRegistry = (ForgeRegistry<BulkResource>) new RegistryBuilder<BulkResource>()
.setName(new ResourceLocation(HardScience.MODID, "bulk_resources"))
.setIDRange(0, Short.MAX_VALUE)
.setType(BulkResource.class)
.setDefaultKey(new ResourceLocation(ModBulkResources.EMPTY_BULK_RESOURCE))
.create();
}
开发者ID:grondag,项目名称:Hard-Science,代码行数:29,代码来源:ModRegistries.java
示例4: getEntityName
import net.minecraftforge.registries.ForgeRegistry; //导入依赖的package包/类
/**
* @return The entity name from its id
*/
public static ResourceLocation getEntityName(int id) {
EntityEntry entry = ((ForgeRegistry<EntityEntry>) ForgeRegistries.ENTITIES).getValue(id);
return entry == null ? null : entry.getRegistryName();
}
开发者ID:MrNobody98,项目名称:morecommands,代码行数:8,代码来源:EntityUtils.java
注:本文中的net.minecraftforge.registries.ForgeRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论