mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-19 19:49:55 +00:00
Carvers!
This commit is contained in:
1 parent
2a14a4f1d1
commit
caafc88021
7 files changed
+97
-1
No files matched your search
@@ -9,6 +9,7 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import tombenpotter.emt.ModInformation;
|
||||
import tombenpotter.emt.common.module.vanilla.items.ItemCraftingComponent;
|
||||
import tombenpotter.emt.common.module.vanilla.items.ItemShardCaver;
|
||||
import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaChainsaw;
|
||||
import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaDrill;
|
||||
import tombenpotter.emt.common.module.vanilla.items.tools.ItemVanillaOmnitool;
|
||||
@@ -44,6 +45,7 @@ public class VanillaItemsRegistry {
|
||||
public static Item bronzeOmnitool;
|
||||
|
||||
public static Item craftingComponent;
|
||||
public static Item woodCarver, stoneCarver, ironCarver, obsidianCarver, diamondCarver;
|
||||
|
||||
public static Item.ToolMaterial copperMaterial = EnumHelper.addToolMaterial("copperToolMaterial", 2, 300, 6.0F, 2.0F, 14);
|
||||
public static Item.ToolMaterial tinMaterial = EnumHelper.addToolMaterial("tinToolMatierial", 2, 200, 8.0F, 4F, 18);
|
||||
@@ -54,6 +56,17 @@ public class VanillaItemsRegistry {
|
||||
craftingComponent = new ItemCraftingComponent().setUnlocalizedName(ModInformation.modid + ".material");
|
||||
GameRegistry.registerItem(craftingComponent, "craftingComponents");
|
||||
|
||||
woodCarver = new ItemShardCaver(8).setUnlocalizedName(ModInformation.modid + ".carver.wood");
|
||||
GameRegistry.registerItem(woodCarver, "woodCarver");
|
||||
stoneCarver = new ItemShardCaver(32).setUnlocalizedName(ModInformation.modid + ".carver.stone");
|
||||
GameRegistry.registerItem(stoneCarver, "stoneCarver");
|
||||
ironCarver = new ItemShardCaver(128).setUnlocalizedName(ModInformation.modid + ".carver.iron");
|
||||
GameRegistry.registerItem(ironCarver, "ironCarver");
|
||||
obsidianCarver = new ItemShardCaver(256).setUnlocalizedName(ModInformation.modid + ".carver.obsidian");
|
||||
GameRegistry.registerItem(obsidianCarver, "obsidianCarver");
|
||||
diamondCarver = new ItemShardCaver(1204).setUnlocalizedName(ModInformation.modid + ".carver.diamond");
|
||||
GameRegistry.registerItem(diamondCarver, "diamondCarver");
|
||||
|
||||
woodenDrill = new ItemVanillaDrill(Item.ToolMaterial.WOOD, 75, ":drill_wood", new ItemStack(Item.getItemFromBlock(Blocks.planks))).setUnlocalizedName(ModInformation.modid + ".drill.wood");
|
||||
GameRegistry.registerItem(woodenDrill, "woodenDrill");
|
||||
stoneDrill = new ItemVanillaDrill(Item.ToolMaterial.STONE, 165, ":drill_stone", new ItemStack(Item.getItemFromBlock(Blocks.cobblestone))).setUnlocalizedName(ModInformation.modid + ".drill.stone");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tombenpotter.emt.common.module.vanilla;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class VanillaItemstacks {
|
||||
public static ItemStack woodenDrill = new ItemStack(VanillaItemsRegistry.woodenDrill);
|
||||
@@ -68,4 +69,10 @@ public class VanillaItemstacks {
|
||||
public static ItemStack tinShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 31);
|
||||
public static ItemStack leadShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 32);
|
||||
public static ItemStack bronzeShard = new ItemStack(VanillaItemsRegistry.craftingComponent, 1, 33);
|
||||
|
||||
public static ItemStack woodenCarver = new ItemStack(VanillaItemsRegistry.woodCarver, 1, OreDictionary.WILDCARD_VALUE);
|
||||
public static ItemStack stoneCarver = new ItemStack(VanillaItemsRegistry.stoneCarver, 1, OreDictionary.WILDCARD_VALUE);
|
||||
public static ItemStack ironCarver = new ItemStack(VanillaItemsRegistry.ironCarver, 1, OreDictionary.WILDCARD_VALUE);
|
||||
public static ItemStack obsidianCarver = new ItemStack(VanillaItemsRegistry.obsidianCarver, 1, OreDictionary.WILDCARD_VALUE);
|
||||
public static ItemStack diamondCarver = new ItemStack(VanillaItemsRegistry.obsidianCarver, 1, OreDictionary.WILDCARD_VALUE);
|
||||
}
|
||||
@@ -14,9 +14,12 @@ public class VanillaRecipesRegistry {
|
||||
public static IRecipe ironOmnitool, goldenOmnitool, diamondOmnitool, copperOmnitool, tinOmnitool, leadOmnitool, bronzeOmnitool;
|
||||
public static IRecipe woodenDrillTop, stoneDrillTop, ironDrillTop, goldenDrillTop, diamondDrillTop, copperDrillTop, tinDrillTop, leadDrillTop, bronzeDrillTop;
|
||||
public static IRecipe woodenChainsawTop, stoneChainsawTop, ironChainsawTop, goldenChainsawTop, diamondChainsawTop, copperChainsawTop, tinChainsawTop, leadChainsawTop, bronzeChainsawTop;
|
||||
public static IRecipe woodenCarver, stoneCarver, ironCarver, obsidianCarver, diamondCarver;
|
||||
|
||||
public static void registerRecipes() {
|
||||
addMiscRecipes();
|
||||
addCarversRecipes();
|
||||
addShardsRecipes();
|
||||
addDrillTopRecipes();
|
||||
addDrillRecipe();
|
||||
addChainsawTopRecipes();
|
||||
@@ -26,6 +29,28 @@ public class VanillaRecipesRegistry {
|
||||
public static void addMiscRecipes() {
|
||||
}
|
||||
|
||||
public static void addCarversRecipes() {
|
||||
for (int i = 0; i < OreDictionary.getOres("logWood").size(); i++) {
|
||||
woodenCarver = GameRegistry.addShapedRecipe(VanillaItemstacks.woodenCarver, " X ", "YYY", 'X', Items.flint, 'Y', OreDictionary.getOres("logWood").get(i));
|
||||
}
|
||||
stoneCarver = GameRegistry.addShapedRecipe(VanillaItemstacks.stoneCarver, " X ", "YYY", 'X', Items.flint, 'Y', Blocks.stone);
|
||||
ironCarver = GameRegistry.addShapedRecipe(VanillaItemstacks.ironCarver, " X ", "YYY", 'X', VanillaItemstacks.ironShard, 'Y', Blocks.stone);
|
||||
obsidianCarver = GameRegistry.addShapedRecipe(VanillaItemstacks.obsidianCarver, " X ", "YYY", 'X', VanillaItemstacks.ironShard, 'Y', Blocks.obsidian);
|
||||
diamondCarver = GameRegistry.addShapedRecipe(VanillaItemstacks.ironCarver, " X ", "YYY", "ZZZ", 'X', VanillaItemstacks.obsidianShard, 'Y', Items.diamond, 'Z', Blocks.obsidian);
|
||||
}
|
||||
|
||||
public static void addShardsRecipes() {
|
||||
addCarverRecipe(VanillaItemstacks.woodenShard, "logWood");
|
||||
addCarverRecipe(VanillaItemstacks.stoneShard, "stone");
|
||||
addCarverRecipe(VanillaItemstacks.ironShard, "ingotIron");
|
||||
addCarverRecipe(VanillaItemstacks.goldenShard, "ingotGold");
|
||||
addCarverRecipe(VanillaItemstacks.obsidianShard, new ItemStack(Blocks.obsidian));
|
||||
addCarverRecipe(VanillaItemstacks.copperShard, "ingotCopper");
|
||||
addCarverRecipe(VanillaItemstacks.tinShard, "ingotTin");
|
||||
addCarverRecipe(VanillaItemstacks.leadShard, "ingotLead");
|
||||
addCarverRecipe(VanillaItemstacks.bronzeShard, "ingotBronze");
|
||||
}
|
||||
|
||||
public static void addDrillTopRecipes() {
|
||||
woodenDrillTop = drillTopRecipe(VanillaItemstacks.woodenDrillTop, "plankWood", VanillaItemstacks.woodenShard);
|
||||
stoneDrillTop = drillTopRecipe(VanillaItemstacks.stoneDrillTop, "stone", VanillaItemstacks.stoneShard);
|
||||
@@ -47,7 +72,7 @@ public class VanillaRecipesRegistry {
|
||||
copperChainsawTop = chainsawTopRecipe(VanillaItemstacks.copperChainsawTop, "ingotCopper", VanillaItemstacks.copperShard);
|
||||
tinChainsawTop = chainsawTopRecipe(VanillaItemstacks.tinChainsawTop, "ingotTin", VanillaItemstacks.tinShard);
|
||||
leadChainsawTop = chainsawTopRecipe(VanillaItemstacks.leadChainsawTop, "ingotLead", VanillaItemstacks.leadShard);
|
||||
bronzeDrill = chainsawTopRecipe(VanillaItemstacks.bronzeChainsawTop, "ingotBronze", VanillaItemstacks.bronzeShard);
|
||||
bronzeChainsawTop = chainsawTopRecipe(VanillaItemstacks.bronzeChainsawTop, "ingotBronze", VanillaItemstacks.bronzeShard);
|
||||
}
|
||||
|
||||
public static void addDrillRecipe() {
|
||||
@@ -103,4 +128,22 @@ public class VanillaRecipesRegistry {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addCarverRecipe(ItemStack output, ItemStack input) {
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.woodenCarver, input);
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.stoneCarver, input);
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.ironCarver, input);
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.obsidianCarver, input);
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.diamondCarver, input);
|
||||
}
|
||||
|
||||
public static void addCarverRecipe(ItemStack output, String input) {
|
||||
for (int i = 0; i < OreDictionary.getOres(input).size(); i++) {
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.woodenCarver, OreDictionary.getOres(input).get(i));
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.stoneCarver, OreDictionary.getOres(input).get(i));
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.ironCarver, OreDictionary.getOres(input).get(i));
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.obsidianCarver, OreDictionary.getOres(input).get(i));
|
||||
GameRegistry.addShapelessRecipe(output, VanillaItemstacks.diamondCarver, OreDictionary.getOres(input).get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package tombenpotter.emt.common.module.vanilla.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import tombenpotter.emt.ElectroMagicTools;
|
||||
|
||||
public class ItemShardCaver extends Item {
|
||||
|
||||
public ItemShardCaver(int maxDamage) {
|
||||
this.setCreativeTab(ElectroMagicTools.tabEMT);
|
||||
this.setMaxDamage(maxDamage);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ package tombenpotter.emt.common.util;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -23,6 +24,7 @@ import thaumcraft.common.entities.monster.EntityTaintChicken;
|
||||
import tombenpotter.emt.ElectroMagicTools;
|
||||
import tombenpotter.emt.ModInformation;
|
||||
import tombenpotter.emt.common.module.ic2.IC2ModuleItemRegistry;
|
||||
import tombenpotter.emt.common.module.vanilla.items.ItemShardCaver;
|
||||
|
||||
public class EventHandlerEMT {
|
||||
|
||||
@@ -55,4 +57,14 @@ public class EventHandlerEMT {
|
||||
ElectroMagicTools.logger.info(TextHelper.localize("console.EMT.config.refresh"));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event) {
|
||||
for (int i = 0; i < event.craftMatrix.getSizeInventory(); i++) {
|
||||
if (event.craftMatrix.getStackInSlot(i) != null && event.craftMatrix.getStackInSlot(i).getItem() instanceof ItemShardCaver && event.player != null) {
|
||||
event.craftMatrix.getStackInSlot(i).stackSize = 2;
|
||||
event.craftMatrix.getStackInSlot(i).damageItem(1, event.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user