Created
October 1, 2015 02:22
-
-
Save anonymous/147cbc22c6346a0e21fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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