本文整理汇总了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());
}
});
}
示例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());
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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";
}
示例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"));
}
示例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));
}
示例11: registerItem
import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public static Item registerItem(Item item) {
GameData.register_impl(item);
return item;
}
示例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;
}
示例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()));
}
示例14: ItemSignals
import net.minecraftforge.registries.GameData; //导入依赖的package包/类
public ItemSignals(String name){
setUnlocalizedName(name);
setRegistryName(name);
GameData.register_impl(this);
setCreativeTab(CreativeTabSignals.getInstance());
}
示例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"));
}