当前位置: 首页>>代码示例>>Java>>正文


Java IForgeRegistryEntry类代码示例

本文整理汇总了Java中net.minecraftforge.registries.IForgeRegistryEntry的典型用法代码示例。如果您正苦于以下问题:Java IForgeRegistryEntry类的具体用法?Java IForgeRegistryEntry怎么用?Java IForgeRegistryEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IForgeRegistryEntry类属于net.minecraftforge.registries包,在下文中一共展示了IForgeRegistryEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genShaped

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
 * Same thing as genShaped above, but uses a specific group.
 */
private static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input)
{
	if (input[0] instanceof List)
		input = ((List<?>) input[0]).toArray();
	if (l * w != input.length)
		throw new UnsupportedOperationException(
				"Attempted to add invalid shaped recipe.  Complain to the author of " + MODNAME);
	NonNullList<Ingredient> inputL = NonNullList.create();
	for (int i = 0; i < input.length; i++)
	{
		Object k = input[i];
		if (k instanceof String)
			inputL.add(i, new OreIngredient((String) k));
		else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
			inputL.add(i, Ingredient.fromStacks((ItemStack) k));
		else if (k instanceof IForgeRegistryEntry)
			inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
		else
			inputL.add(i, Ingredient.EMPTY);
	}

	return new ShapedRecipes(group, l, w, inputL, output);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:27,代码来源:RecipeHelper.java

示例2: createInput

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
 * Creates a list of ingredients based on an Object[].  Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
 * Used for shapeless recipes.
 */
private static NonNullList<Ingredient> createInput(Object[] input)
{
	if (input[0] instanceof List)
		input = ((List<?>) input[0]).toArray();
	else if (input[0] instanceof Object[])
		input = (Object[]) input[0];
	NonNullList<Ingredient> inputL = NonNullList.create();
	for (int i = 0; i < input.length; i++)
	{
		Object k = input[i];
		if (k instanceof String)
			inputL.add(i, new OreIngredient((String) k));
		else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
			inputL.add(i, Ingredient.fromStacks((ItemStack) k));
		else if (k instanceof IForgeRegistryEntry)
			inputL.add(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
		else
			throw new UnsupportedOperationException(
					"Attempted to add invalid shapeless recipe.  Complain to the author of " + MODNAME);
	}
	return inputL;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:27,代码来源:RecipeHelper.java

示例3: createElementalInput

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
 * Creates a list of ingredients based on an Object[].  Valid types are {@link String}, {@link ItemStack}, {@link Item}, and {@link Block}.
 * Used for elemental recipes.
 */
private static NonNullList<Ingredient> createElementalInput(Object[] input)
{
	if (input[0] instanceof List)
		input = ((List<?>) input[0]).toArray();
	else if (input[0] instanceof Object[])
		input = (Object[]) input[0];
	NonNullList<Ingredient> inputL = NonNullList.withSize(9, Ingredient.EMPTY);
	for (int i = 0; i < input.length; i++)
	{
		Object k = input[i];
		if (k instanceof String)
			inputL.set(i, new OreIngredient((String) k));
		else if (k instanceof ItemStack && !((ItemStack) k).isEmpty())
			inputL.set(i, Ingredient.fromStacks((ItemStack) k));
		else if (k instanceof IForgeRegistryEntry)
			inputL.set(i, Ingredient.fromStacks(makeStack((IForgeRegistryEntry<?>) k)));
	}
	return inputL;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:24,代码来源:RecipeHelper.java

示例4: register

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
     * Attempt to register all entries from {@link #enumInstanceMap} to {@link ForgeRegistries}.
     * @see ForgeRegistries
     */
    public void register() {
        enumInstanceMap.forEach((instanceClass, enumMap) -> {
            if (IForgeRegistryEntry.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (IForgeRegistryEntry<? extends IForgeRegistryEntry<?>>) o)
//                    .map(o -> new RegisterHandler(o))
                    .forEach(o -> {
//                    TODO RegisterManager.getInstance().putRegister(o);
                        if (o instanceof Item) {
                            ForgeRegistries.ITEMS.register((Item) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Item) o));
                        }
                        else if (o instanceof Block) {
                            ForgeRegistries.BLOCKS.register((Block) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Block) o));
                        }
                    });
            else if (Fluid.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (Fluid) o).forEach(fluid -> {
                    FluidRegistry.registerFluid(fluid);
                    FluidRegistry.addBucketForFluid(fluid);
                });
        });
    }
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:30,代码来源:EnumLoader.java

示例5: overrideRegistryLocation

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
public static void overrideRegistryLocation(IForgeRegistryEntry.Impl forgeRegistryEntry, String name) {
    try {
        ReflectionHelper.findField(IForgeRegistryEntry.Impl.class,"registryName").set(forgeRegistryEntry,new ResourceLocation(Soot.MODID,name));
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:8,代码来源:EmberUtil.java

示例6: initModels

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
default public void initModels(ModelRegistryEvent e)
{
	if (this instanceof Item)
		sMRL("items", (Item) this, 0, "item=" + ((Item) this).getRegistryName().getResourcePath());
	else if (this instanceof Block)
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0,
				new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
	else
		throw new IllegalStateException("wat are u doin");
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:12,代码来源:IHasModel.java

示例7: makeStack

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
 * Helper method to make an {@link ItemStack} from a block or item.
 */
public static <T extends IForgeRegistryEntry<?>> ItemStack makeStack(T thing, int size, int meta)
{
	if (thing instanceof Item)
		return new ItemStack((Item) thing, size, meta);
	return new ItemStack((Block) thing, size, meta);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:10,代码来源:RecipeHelper.java

示例8: initModel

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
default public void initModel(ModelRegistryEvent e) 
{
	System.out.println(((IForgeRegistryEntry<?>) this).getRegistryName());
	if (this instanceof Item)
		ModelLoader.setCustomModelResourceLocation((Item) this, 0,
				new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
	else if (this instanceof Block)
	{
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0,
				new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
		System.out.println("block");
	}
	else
		throw new IllegalArgumentException("No/invalid object for model");
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:16,代码来源:IHasModel.java

示例9: putRegister

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
public <T extends IForgeRegistryEntry<T>> void putRegister(RegisterHandler<T> value) {
    Set<RegisterHandler<? extends IForgeRegistryEntry<?>>> handlerSet;
    Type valueType = value.getType();
    if (registerMap.containsKey(valueType))
        handlerSet = registerMap.get(valueType);
    else
        handlerSet = new HashSet<>();
    handlerSet.add(value);
    registerMap.put(valueType, handlerSet);
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:11,代码来源:RegisterManager.java

示例10: getForgeRegistry

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的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

示例11: getUnregister

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
static <T extends IForgeRegistryEntry<T>> IUnregister<ResourceLocation, T> getUnregister(Class<T> type) {
	IForgeRegistry<T> result = GameRegistry.findRegistry(type);
	if (result instanceof IUnregister)
		return (IUnregister<ResourceLocation, T>) result;
	else
		AlchemyRuntimeException.onException(new RuntimeException(
				new ClassCastException(result.getClass().getName() + " cannot be cast to " + IForgeRegistry.class.getName())));
	return null;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:10,代码来源:ForgeHelper.java

示例12: getRegistryId

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
/**
 * Gets a registry name from a forge registerable object. The object can not be null. If
 * the registry name is null or empty an error will be reported.
 *
 * @param registerable The registerable object.
 * @return The id for the object.
 */
public static String getRegistryId (@Nonnull IForgeRegistryEntry.Impl<?> registerable) {

    if (registerable.getRegistryName() == null || registerable.getRegistryName().toString().isEmpty()) {

        Constants.LOG.warn("Attempted to get ID for invalid registerable object. " + registerable.getClass().getName());
        return "";
    }

    return registerable.getRegistryName().toString();
}
 
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:18,代码来源:RegistryUtils.java

示例13: mapObjectToId

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
public static <T, E extends IForgeRegistryEntry<E>> Integer mapObjectToId(IForgeRegistry<E> registry, T object) {
	final Map<T, E> objectToEntryMap = CommonRegistryCallbacks.getObjectToEntryMap(registry);
	final E entry = objectToEntryMap.get(object);

	final BiMap<E, Integer> entryIdMap = CommonRegistryCallbacks.getEntryIdMap(registry);
	return entryIdMap.get(entry);
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:8,代码来源:CommonRegistryCallbacks.java

示例14: registerRenderOverride

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
@Override
public void registerRenderOverride(@Nonnull IForgeRegistryEntry<?> entry, @Nonnull IAssemblyRenderOverriding renderOverride) {
    renderOverrides.put(entry.getRegistryName(), renderOverride);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:5,代码来源:GuiRegistry.java

示例15: addShapeless

import net.minecraftforge.registries.IForgeRegistryEntry; //导入依赖的package包/类
public static <T extends IForgeRegistryEntry<?>> IRecipe addShapeless(T output, Object... inputs)
{
	return addShapeless(makeStack(output), inputs);
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:5,代码来源:RecipeHelper.java


注:本文中的net.minecraftforge.registries.IForgeRegistryEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。