Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created October 1, 2015 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/147cbc22c6346a0e21fa to your computer and use it in GitHub Desktop.
Save anonymous/147cbc22c6346a0e21fa to your computer and use it in GitHub Desktop.
package com.myfirst.myfirstmod.eventhandler;
import java.util.Random;
import com.myfirst.myfirstmod.init.MyFirstItems;
import net.minecraft.block.BlockObsidian;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class GokuGavsObsidianEventHandler {
@SubscribeEvent
public void onDrops(BlockEvent.HarvestDropsEvent event, Random random) {
if (event.state instanceof BlockObsidian){
event.drops.add(new ItemStack(MyFirstItems.obsidianrubble_item, 3 + random.nextInt(6)));
}
}
}
package com.myfirst.myfirstmod.init;
import com.myfirst.myfirstmod.Reference;
import com.myfirst.myfirstmod.eventhandler.GokuGavsObsidianEventHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class MyBlocks {
public static void init(){
MinecraftForge.EVENT_BUS.register(new GokuGavsObsidianEventHandler());
}
public static void register(){
}
public static void registerRenders(){
}
public static void registerRender(Block block){
Item item = Item.getItemFromBlock(block);
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment