提供: Minecraft Modding Wiki
(ページの作成:「{{前提MOD|reqmod="Minecraft Forge Universal 14.21.0.xxx~"}} {{チュートリアル難易度|difficulty=0}} このチュートリアルでは、バニラの基本...」) |
(→RecipeSample.java) |
||
6行目: | 6行目: | ||
===RecipeSample.java=== | ===RecipeSample.java=== | ||
<source lang="java"> | <source lang="java"> | ||
+ | package com.test.testmod; | ||
+ | |||
+ | import net.minecraft.init.Items; | ||
+ | import net.minecraft.item.ItemStack; | ||
+ | import net.minecraft.util.ResourceLocation; | ||
+ | import net.minecraftforge.fml.common.Mod; | ||
+ | import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
+ | import net.minecraftforge.fml.common.registry.GameRegistry; | ||
+ | |||
+ | @Mod(modid = RecipeSample.MOD_ID, version = RecipeSample.MOD_VERSION) | ||
+ | public class RecipeSample{ | ||
+ | public static final String MOD_ID = "recipesample"; | ||
+ | public static final String MOD_VERSION = "1.0"; | ||
+ | @Mod.EventHandler | ||
+ | public void init(FMLInitializationEvent event) { | ||
+ | GameRegistry.addShapedRecipe(new ResourceLocation("addDiamond"), new ResourceLocation("addDefaultItemRecipe"), new ItemStack(Items.DIAMOND), new Object[] { | ||
+ | "###", | ||
+ | "# #", | ||
+ | "###", | ||
+ | '#', Items.DIAMOND}); | ||
+ | } | ||
+ | } | ||
</source> | </source> | ||
+ | |||
==解説== | ==解説== | ||
===レシピを作る=== | ===レシピを作る=== | ||
===不定形レシピを作る=== | ===不定形レシピを作る=== | ||
[[category:その他]] | [[category:その他]] |
2017年8月24日 (木) 21:39時点における版
この記事は"Minecraft Forge Universal 14.21.0.xxx~"を前提MODとしています。 |
このチュートリアルでは、バニラの基本的なレシピの追加方法について解説します。
ソース
RecipeSample.java
package com.test.testmod; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = RecipeSample.MOD_ID, version = RecipeSample.MOD_VERSION) public class RecipeSample{ public static final String MOD_ID = "recipesample"; public static final String MOD_VERSION = "1.0"; @Mod.EventHandler public void init(FMLInitializationEvent event) { GameRegistry.addShapedRecipe(new ResourceLocation("addDiamond"), new ResourceLocation("addDefaultItemRecipe"), new ItemStack(Items.DIAMOND), new Object[] { "###", "# #", "###", '#', Items.DIAMOND}); } }