Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tutorial.generic;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.renderer.entity.RenderItem;
- import net.minecraft.client.resources.model.ModelResourceLocation;
- import net.minecraft.item.Item;
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.init.Items;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.ItemStack;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraftforge.fml.common.registry.GameRegistry;
- import net.minecraftforge.client.model.ModelLoader;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.common.Mod.EventHandler;
- import net.minecraftforge.fml.common.Mod.Instance;
- import net.minecraftforge.fml.common.event.FMLInitializationEvent;
- import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
- import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
- @Mod(modid=Generic.MODID, name=Generic.MODNAME, version=Generic.MODVER)
- public class Generic {
- // Set the ID of the mod (should be lowercase).
- public static final String MODID = "generic";
- // Set the "name" of the mod.
- public static final String MODNAME = "Generic Mod";
- // Set the version of the mod.
- public static final String MODVER = "1.0.0";
- @Instance(Generic.MODID)
- public static Generic instance;
- public final static Block soilClay = new GenericBlock(Material.ground)
- .setHardness(0.7f).setStepSound(Block.soundTypeGravel)
- .setUnlocalizedName("soil_clay").setCreativeTab(CreativeTabs.tabBlock);
- @EventHandler
- public void preInit(FMLPreInitializationEvent event) {
- // register blocks
- GameRegistry.registerBlock(soilClay, "soil_clay");
- // render blocks when they're in inventory and dropped
- RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
- renderItem.getItemModelMesher().register(
- Item.getItemFromBlock(soilClay),
- 0, new ModelResourceLocation("generic:soil_clay", "inventory")
- );
- }
- @EventHandler
- public void load(FMLInitializationEvent event) {
- }
- @EventHandler
- public void postInit(FMLPostInitializationEvent event) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement