Items added and crafting handler
This commit is contained in:
@@ -2,6 +2,8 @@ package nmd.primal.energy;
|
|||||||
|
|
||||||
import nmd.primal.energy.common.CommonProxy;
|
import nmd.primal.energy.common.CommonProxy;
|
||||||
import nmd.primal.energy.common.ModInfo;
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import nmd.primal.energy.crafting.CraftingHandler;
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
@@ -11,34 +13,35 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION)
|
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION)
|
||||||
public class Energy
|
public class Energy {
|
||||||
{
|
|
||||||
|
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.COMMON_PROXY)
|
||||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY, serverSide = ModInfo.COMMON_PROXY)
|
public static CommonProxy proxy;
|
||||||
public static CommonProxy proxy;
|
|
||||||
|
@Instance
|
||||||
@Instance
|
public static Energy instance = new Energy();
|
||||||
public static Energy instance = new Energy();
|
|
||||||
|
@EventHandler
|
||||||
@EventHandler
|
public void preinit(FMLPreInitializationEvent event) {
|
||||||
public void preinit(FMLPreInitializationEvent event)
|
Energy.proxy.preInit(event);
|
||||||
{
|
|
||||||
Energy.proxy.preInit(event);
|
|
||||||
// some example code
|
// some example code
|
||||||
//System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
|
// System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event)
|
public void init(FMLInitializationEvent event) {
|
||||||
{
|
|
||||||
|
FMLCommonHandler.instance().bus().register(new CraftingHandler());
|
||||||
|
|
||||||
// some example code
|
// some example code
|
||||||
//System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
|
// System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent e) {
|
public void postInit(FMLPostInitializationEvent e) {
|
||||||
|
|
||||||
System.out.println("U want some Body Massage?");
|
System.out.println("U want some Body Massage?");
|
||||||
//RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit));
|
// RenderingRegistry.registerEntityRenderingHandler(EntityShit.class,
|
||||||
|
// new RenderSnowball(ModItems.itemShit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
package nmd.primal.energy.block;
|
package nmd.primal.energy.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModBlocks {
|
public class ModBlocks {
|
||||||
|
|
||||||
|
public static Block SMBBlock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final void init() {
|
||||||
|
|
||||||
|
GameRegistry.registerBlock(SMBBlock = new SMBBlock("SMBBlock", Material.iron), "SMBBlock");
|
||||||
|
|
||||||
|
//GameRegistry.registerBlock(mineralBlock = new MineralBlock("mineralBlock", Material.rock), "mineralBlock");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
src/main/java/nmd/primal/energy/block/SMBBlock.java
Normal file
19
src/main/java/nmd/primal/energy/block/SMBBlock.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package nmd.primal.energy.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import nmd.primal.energy.util.CustomTab;
|
||||||
|
|
||||||
|
public class SMBBlock extends Block{
|
||||||
|
|
||||||
|
protected SMBBlock(String unlocalizedName, Material material) {
|
||||||
|
super(material);
|
||||||
|
this.setBlockName(unlocalizedName);
|
||||||
|
this.setBlockTextureName(ModInfo.MOD_ID + ":" + unlocalizedName);
|
||||||
|
this.setCreativeTab(CustomTab.NMDEnergyTab);
|
||||||
|
this.setHardness(1.0F);
|
||||||
|
this.setResistance(6.0F);
|
||||||
|
this.setStepSound(soundTypeStone);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
|
|
||||||
public class ClientProxy extends CommonProxy{
|
public class ClientProxy extends CommonProxy{
|
||||||
|
|
||||||
|
@Override
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
super.preInit(event);
|
super.preInit(event);
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package nmd.primal.energy.common;
|
package nmd.primal.energy.common;
|
||||||
|
|
||||||
import nmd.primal.energy.util.CustomTab;
|
import nmd.primal.energy.block.ModBlocks;
|
||||||
|
import nmd.primal.energy.crafting.ModCrafting;
|
||||||
|
import nmd.primal.energy.item.ModItems;
|
||||||
import nmd.primal.energy.tileents.TileRegistry;
|
import nmd.primal.energy.tileents.TileRegistry;
|
||||||
|
import nmd.primal.energy.util.CustomTab;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
@@ -11,7 +14,9 @@ public class CommonProxy {
|
|||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
CustomTab.NMDEnergyTab();
|
CustomTab.NMDEnergyTab();
|
||||||
|
ModItems.registerItems();
|
||||||
|
ModBlocks.init();
|
||||||
|
ModCrafting.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FMLInitializationEvent event)
|
public void init(FMLInitializationEvent event)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package nmd.primal.energy.common;
|
|||||||
|
|
||||||
public class ModInfo {
|
public class ModInfo {
|
||||||
|
|
||||||
public static final String MOD_ID = "NMDEnergy";
|
public static final String MOD_ID = "energy";
|
||||||
public static final String MOD_NAME = "NMD Energy";
|
public static final String MOD_NAME = "NMD Energy";
|
||||||
public static final String MOD_PREFIX = "nmd";
|
public static final String MOD_PREFIX = "nmd";
|
||||||
public static final String MOD_CHANNEL = "nmd-energy";
|
public static final String MOD_CHANNEL = "nmd-energy";
|
||||||
@@ -10,4 +10,6 @@ public class ModInfo {
|
|||||||
|
|
||||||
public static final String COMMON_PROXY = "nmd.primal.energy.common.CommonProxy";
|
public static final String COMMON_PROXY = "nmd.primal.energy.common.CommonProxy";
|
||||||
public static final String CLIENT_PROXY = "nmd.primal.energy.client.ClientProxy";
|
public static final String CLIENT_PROXY = "nmd.primal.energy.client.ClientProxy";
|
||||||
|
|
||||||
|
public static final int SMBBlock_ID = 201;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package nmd.primal.energy.crafting;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import nmd.primal.energy.item.ModItems;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
|
|
||||||
|
public class CraftingHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onItemCrafting(PlayerEvent.ItemCraftedEvent event){
|
||||||
|
|
||||||
|
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) { // Checks all the slots
|
||||||
|
|
||||||
|
if (event.craftMatrix.getStackInSlot(i) != null) {
|
||||||
|
ItemStack j = event.craftMatrix.getStackInSlot(i);
|
||||||
|
|
||||||
|
if (j.getItem() != null && j.getItem() == ModItems.schiselItem) {
|
||||||
|
ItemStack k = new ItemStack(ModItems.schiselItem, 2, (j.getItemDamage() + 1));
|
||||||
|
if (k.getItemDamage() >= k.getMaxDamage()) {
|
||||||
|
k.stackSize--;
|
||||||
|
}
|
||||||
|
event.craftMatrix.setInventorySlotContents(i, k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,39 @@
|
|||||||
package nmd.primal.energy.crafting;
|
package nmd.primal.energy.crafting;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import nmd.primal.energy.block.ModBlocks;
|
||||||
|
import nmd.primal.energy.item.ModItems;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
|
||||||
public class ModCrafting {
|
public class ModCrafting {
|
||||||
|
|
||||||
|
public static final void init()
|
||||||
|
{
|
||||||
|
//GameRegistry.addRecipe(new ItemStack(ModBlocks.mineralBlock), new Object[] {"aa", "aa" , 'a', ModItems.mineraldustItem});
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ItemStack(ModItems.schiselItem), new Object[]{
|
||||||
|
" f",
|
||||||
|
" t ",
|
||||||
|
"s ",
|
||||||
|
'f', Items.flint, 't', Items.string, 's', Items.stick});
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ItemStack(ModItems.sgearItem), new Object[]{
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
'x', new ItemStack(ModItems.schiselItem, 1, OreDictionary.WILDCARD_VALUE), 'y', ModItems.swheelItem});
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(
|
||||||
|
new ItemStack(ModBlocks.SMBBlock), new Object[]{
|
||||||
|
"sss",
|
||||||
|
"s s",
|
||||||
|
"sss",
|
||||||
|
's', Blocks.wooden_slab});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
package nmd.primal.energy.item;
|
package nmd.primal.energy.item;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import nmd.primal.energy.util.CustomTab;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModItems {
|
public class ModItems {
|
||||||
|
|
||||||
|
public static Item schiselItem;
|
||||||
|
public static Item swheelItem;
|
||||||
|
public static Item sgearItem;
|
||||||
|
public static Item saxleItem;
|
||||||
|
|
||||||
|
|
||||||
|
public static void registerItems(){
|
||||||
|
|
||||||
|
schiselItem = new SChiselItem();
|
||||||
|
|
||||||
|
swheelItem = new Item().setUnlocalizedName("swheelItem").setCreativeTab(CustomTab.NMDEnergyTab).setTextureName(ModInfo.MOD_ID + ":swheelItem");
|
||||||
|
GameRegistry.registerItem(swheelItem, "swheelItem");
|
||||||
|
|
||||||
|
sgearItem = new Item().setUnlocalizedName("sgearItem").setCreativeTab(CustomTab.NMDEnergyTab).setTextureName(ModInfo.MOD_ID + ":sgearItem");
|
||||||
|
GameRegistry.registerItem(sgearItem, "sgearItem");
|
||||||
|
|
||||||
|
saxleItem = new Item().setUnlocalizedName("saxleItem").setCreativeTab(CustomTab.NMDEnergyTab).setTextureName(ModInfo.MOD_ID + ":saxleItem");
|
||||||
|
GameRegistry.registerItem(saxleItem, "saxleItem");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/main/java/nmd/primal/energy/item/SChiselItem.java
Normal file
37
src/main/java/nmd/primal/energy/item/SChiselItem.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package nmd.primal.energy.item;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import nmd.primal.energy.common.ModInfo;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
public class SChiselItem extends Item{
|
||||||
|
|
||||||
|
private String name = "schiselItem";
|
||||||
|
private Item item;
|
||||||
|
|
||||||
|
public SChiselItem(){
|
||||||
|
setMaxStackSize(1);
|
||||||
|
setUnlocalizedName(name);
|
||||||
|
setTextureName(ModInfo.MOD_ID + ":" + name);
|
||||||
|
setMaxDamage(100);
|
||||||
|
setNoRepair();
|
||||||
|
|
||||||
|
item = this;
|
||||||
|
|
||||||
|
GameRegistry.registerItem(this, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item getContainerItem()
|
||||||
|
{
|
||||||
|
item.setDamage(new ItemStack(item), +1);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,13 +6,14 @@ import net.minecraft.item.Item;
|
|||||||
|
|
||||||
public class CustomTab {
|
public class CustomTab {
|
||||||
|
|
||||||
public static CreativeTabs NMDEnergyTab = new CreativeTabs("NMDEnergyTab")
|
public static CreativeTabs NMDEnergyTab = new CreativeTabs("NMDEnergyTab") {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem() {return Items.blaze_powder;}};
|
public Item getTabIconItem() {
|
||||||
|
return Items.blaze_powder;
|
||||||
public static void NMDEnergyTab()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void NMDEnergyTab() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
itemGroup.NMDEnergyTab=NMD Energy
|
itemGroup.NMDEnergyTab=NMD Energy
|
||||||
|
|
||||||
|
item.schiselItem.name=Standard Chisel
|
||||||
|
item.swheelItem.name=Standard Wheel
|
||||||
|
item.sgearItem.name=Standard Gear
|
||||||
|
item.saxleItem.name=Standard Axle
|
||||||
|
|
||||||
|
tile.SMBBlock.name=Standard Machine Box
|
||||||
BIN
src/main/resources/assets/energy/textures/blocks/SMBBlock.png
Normal file
BIN
src/main/resources/assets/energy/textures/blocks/SMBBlock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 868 B |
BIN
src/main/resources/assets/energy/textures/items/saxleItem.png
Normal file
BIN
src/main/resources/assets/energy/textures/items/saxleItem.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 290 B |
BIN
src/main/resources/assets/energy/textures/items/schiselItem.png
Normal file
BIN
src/main/resources/assets/energy/textures/items/schiselItem.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 319 B |
BIN
src/main/resources/assets/energy/textures/items/sgearItem.png
Normal file
BIN
src/main/resources/assets/energy/textures/items/sgearItem.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 518 B |
BIN
src/main/resources/assets/energy/textures/items/swheelItem.png
Normal file
BIN
src/main/resources/assets/energy/textures/items/swheelItem.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 530 B |
Reference in New Issue
Block a user