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


Java GameData类代码示例

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


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

示例1: registerRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
@Load(LoaderState.INITIALIZATION)
public void registerRecipe(){
    itemSet.forEach(item -> {
        if (item.getItem() instanceof IRecipeProvider) {
            // check is a provider
            IRecipeProvider provider = (IRecipeProvider) item.getItem();
            Arrays.stream(provider.createRecipes()).forEach(GameData::register_impl);
        } else if (item.getItem() instanceof IRecipe){
            // check if is a recipe
            registerRecipe(item.getAnnotation().value(), (IRecipe) item.getItem());
        }
    });
}
 
开发者ID:MinecraftPangu,项目名称:Pangu,代码行数:14,代码来源:RecipeRegister.java

示例2: init

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

示例3: preInit

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	ModMetadata meta = event.getModMetadata();

	meta.authorList = Arrays.asList(new String[]{"bl4ckscor3"});
	meta.autogenerated = false;
	meta.description = "Adds a fast way to store XP and share it with your friends!";
	meta.modId = MOD_ID;
	meta.name = NAME;
	meta.version = VERSION;
	MinecraftForge.EVENT_BUS.register(new bl4ckscor3.mod.globalxp.handlers.EventHandler());
	config = new Config(event.getSuggestedConfigurationFile());
	network = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
	network.registerMessage(new SPacketUpdateXPBlock.Handler(), SPacketUpdateXPBlock.class, 0, Side.CLIENT);
	network.registerMessage(new CPacketRequestXPBlockUpdate.Handler(), CPacketRequestXPBlockUpdate.class, 1, Side.SERVER);
	xp_block = new XPBlock(Material.IRON);
	GameData.register_impl(xp_block);
	GameData.register_impl(new ItemBlock(xp_block).setRegistryName(xp_block.getRegistryName().toString()));
	GameRegistry.registerTileEntity(TileEntityXPBlock.class, xp_block.getRegistryName().toString());
	serverProxy.loadModels();
	serverProxy.registerRenderers();
}
 
开发者ID:bl4ckscor3,项目名称:GlobalXP,代码行数:24,代码来源:GlobalXP.java

示例4: addShapedOreRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Adds a shaped recipe that supports string inputparamers corisponding to an oredict entry, can also be used for recipes without ore dict ingredients
 *
 * @param output The stack that should be produced
 */
public static void addShapedOreRecipe(ItemStack output, Object... params) {
	ResourceLocation location = getNameForRecipe(output);
	ShapedOreRecipe recipe = new ShapedOreRecipe(location, output, params);
	recipe.setRegistryName(location);
       GameData.register_impl(recipe);
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:12,代码来源:CraftingRegistry.java

示例5: addShapedRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Adds a basic shaped recipe
 *
 * @param output The stack that should be produced
 */
public static void addShapedRecipe(ItemStack output, Object... params) {
	ResourceLocation location = getNameForRecipe(output);
	CraftingHelper.ShapedPrimer primer = CraftingHelper.parseShaped(params);
	ShapedRecipes recipe = new ShapedRecipes(output.getItem().getRegistryName().toString(), primer.width, primer.height, primer.input, output);
	recipe.setRegistryName(location);
       GameData.register_impl(recipe);
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:13,代码来源:CraftingRegistry.java

示例6: addShapelessOreRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Adds a shapeless ore recipe
 *
 * @param output The stack that should be produced
 */
public static void addShapelessOreRecipe(ItemStack output, Object... input) {
	ResourceLocation location = getNameForRecipe(output);
	ShapelessOreRecipe recipe = new ShapelessOreRecipe(location, output, input);
	recipe.setRegistryName(location);
       GameData.register_impl(recipe);
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:12,代码来源:CraftingRegistry.java

示例7: addShapelessRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Adds a basic shapeless recipe
 *
 * @param output The stack that should be produced
 */
public static void addShapelessRecipe(ItemStack output, Object... input) {
	ResourceLocation location = getNameForRecipe(output);
	ShapelessRecipes recipe = new ShapelessRecipes(location.getResourceDomain(), output, buildInput(input));
	recipe.setRegistryName(location);
       GameData.register_impl(recipe);
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:12,代码来源:CraftingRegistry.java

示例8: preInit

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event){
	log("Starting to load....");
	log("Loading config file....");
	log(SecurityCraft.VERSION + " of SecurityCraft is for a post MC-1.6.4 version! Configuration files are useless for setting anything besides options.");
	SecurityCraft.configFile = new Configuration(event.getSuggestedConfigurationFile());
	SecurityCraft.config.setupConfiguration();
	log("Config file loaded.");
	log("Setting up network....");
	SecurityCraft.network = NetworkRegistry.INSTANCE.newSimpleChannel(SecurityCraft.MODID);
	RegistrationHandler.registerPackets(SecurityCraft.network);
	log("Network setup.");

	log("Loading mod content....");
	SetupHandler.setupBlocks();
	SetupHandler.setupMines();
	SetupHandler.setupItems();
	log("Finished loading mod content.");
	log("Regisering mod content... (PT 1/2)");
	RegistrationHandler.registerContent();
	RegistrationHandler.registerTileEntities();
	SecurityCraft.serverProxy.registerResourceLocations();
	serverProxy.registerTextureFiles();

	for(int i = 0; i < SCSounds.values().length; i++)
	{
		SCSounds.values()[i].event.setRegistryName(SCSounds.values()[i].path);
		GameData.register_impl(SCSounds.values()[i].event);
	}

	ModMetadata modMeta = event.getModMetadata();
	modMeta.authorList = Arrays.asList(new String[] {
			"Geforce, bl4ckscor3"
	});
	modMeta.autogenerated = false;
	modMeta.credits = "Thanks to all of you guys for your support!";
	modMeta.description = "Adds a load of things to keep your house safe with.\nIf you like this mod, hit the green arrow\nin the corner of the forum thread!\nPlease visit the URL above for help. \n \nMessage of the update: \n" + MOTU;
	modMeta.url = "http://geforcemods.net";
	modMeta.logoFile = "/scLogo.png";
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:41,代码来源:SecurityCraft.java

示例9: registerBlock

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Registers a block with a custom ItemBlock
 * @param block The Block to register
 * @param itemBlock The ItemBlock to register
 * @param initPage Wether a SecurityCraft Manual page should be added for the block
 */
private static void registerBlock(Block block, ItemBlock itemBlock, boolean initPage)
{
	GameData.register_impl(block);
	GameData.register_impl(itemBlock.setRegistryName(block.getRegistryName().toString()));

	if(initPage)
		if(initPage)
			if(block == SCContent.reinforcedStone)
				SecurityCraft.instance.manualPages.add(new SCManualPage(Item.getItemFromBlock(block), "help.reinforced.info"));
			else
				SecurityCraft.instance.manualPages.add(new SCManualPage(Item.getItemFromBlock(block), "help." + block.getUnlocalizedName().substring(5) + ".info"));
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:19,代码来源:RegistrationHandler.java

示例10: registerItemWithCustomRecipe

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Registers the given item with GameData.register_implItem(), and adds the help info for the item to the SecurityCraft manual item.
 * Also overrides the default recipe that would've been drawn in the manual with a new recipe.
 */
private static void registerItemWithCustomRecipe(Item item, ItemStack... customRecipe)
{
	GameData.register_impl(item);

	NonNullList<Ingredient> recipeItems = NonNullList.<Ingredient>withSize(customRecipe.length, Ingredient.EMPTY);

	for(int i = 0; i < recipeItems.size(); i++)
		recipeItems.set(i, Ingredient.fromStacks(customRecipe[i]));

	SecurityCraft.instance.manualPages.add(new SCManualPage(item, "help." + item.getUnlocalizedName().substring(5) + ".info", recipeItems));
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:16,代码来源:RegistrationHandler.java

示例11: registerItem

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public static Item registerItem(Item item) {
	GameData.register_impl(item);
	return item;
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:5,代码来源:ModItems.java

示例12: registerBlock

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public static Block registerBlock(Block block) {
	GameData.register_impl(block);
	GameData.register_impl(new ItemBlock(block).setRegistryName(block.getRegistryName()));
	return block;
}
 
开发者ID:Bartz24,项目名称:UsefulNullifiers,代码行数:6,代码来源:ModBlocks.java

示例13: registerBlock

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public static void registerBlock(Block block){
    GameData.register_impl(block.setRegistryName(block.getUnlocalizedName().substring(5)));
    GameData.register_impl(new ItemBlock(block).setRegistryName(block.getRegistryName()));

}
 
开发者ID:MineMaarten,项目名称:Signals,代码行数:6,代码来源:ModBlocks.java

示例14: ItemSignals

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public ItemSignals(String name){
    setUnlocalizedName(name);
    setRegistryName(name);
    GameData.register_impl(this);
    setCreativeTab(CreativeTabSignals.getInstance());
}
 
开发者ID:MineMaarten,项目名称:Signals,代码行数:7,代码来源:ItemSignals.java

示例15: registerItem

import net.minecraftforge.registries.GameData; //导入依赖的package包/类
/**
 * Registers the given item with GameData.register_implItem(), and adds the help info for the item to the SecurityCraft manual item.
 */
private static void registerItem(Item item)
{
	GameData.register_impl(item);
	SecurityCraft.instance.manualPages.add(new SCManualPage(item, "help." + item.getUnlocalizedName().substring(5) + ".info"));
}
 
开发者ID:Geforce132,项目名称:SecurityCraft,代码行数:9,代码来源:RegistrationHandler.java


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