From 0c6f6e6c665fd44c80c8b2019b9de002f7da65b5 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 11 Apr 2014 16:37:41 +0100 Subject: [PATCH] Added the dirt rod, or Rod of the Lands. --- .../common/block/tile/TileEnchanter.java | 1 - .../common/item/magic/ItemDirtRod.java | 26 +++++++++++++++++++ .../common/item/magic/ItemTimeRod.java | 1 + resources/assets/botania/lang/en_US.lang | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java b/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java index 9c5c25702..4cf2d7090 100644 --- a/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java +++ b/MODSRC/vazkii/botania/common/block/tile/TileEnchanter.java @@ -123,7 +123,6 @@ public class TileEnchanter extends TileMod implements IManaReceiver { for(EntityItem entity : items) { ItemStack item = entity.getEntityItem(); if(item.getItem() == Items.enchanted_book) { - // XXX - This needs to be rewritten for the new book enchanting in 1.7 NBTTagList enchants = Items.enchanted_book.func_92110_g(item); if(enchants != null && enchants.tagCount() > 0) { NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0); diff --git a/MODSRC/vazkii/botania/common/item/magic/ItemDirtRod.java b/MODSRC/vazkii/botania/common/item/magic/ItemDirtRod.java index c20061d36..c9fa68db9 100644 --- a/MODSRC/vazkii/botania/common/item/magic/ItemDirtRod.java +++ b/MODSRC/vazkii/botania/common/item/magic/ItemDirtRod.java @@ -11,15 +11,41 @@ */ package vazkii.botania.common.item.magic; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import vazkii.botania.api.mana.ManaItemHandler; +import vazkii.botania.common.Botania; import vazkii.botania.common.item.ItemMod; import vazkii.botania.common.lib.LibItemNames; public class ItemDirtRod extends ItemMod { + private static final int COST = 75; + public ItemDirtRod() { super(); setMaxStackSize(1); setUnlocalizedName(LibItemNames.DIRT_ROD); } + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { + if(ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, false)) { + ItemStack stackToPlace = new ItemStack(Blocks.dirt); + stackToPlace.tryPlaceItemIntoWorld(par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + + if(stackToPlace.stackSize == 0) { + ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, true); + ForgeDirection dir = ForgeDirection.getOrientation(par7); + for(int i = 0; i < 6; i++) + Botania.proxy.sparkleFX(par3World, par4 + dir.offsetX + Math.random(), par5 + dir.offsetY + Math.random(), par6 + dir.offsetZ + Math.random(), 0.35F, 0.2F, 0.05F, 1F, 5); + } + } + return true; + } + } diff --git a/MODSRC/vazkii/botania/common/item/magic/ItemTimeRod.java b/MODSRC/vazkii/botania/common/item/magic/ItemTimeRod.java index 74eca7891..1433c0e2a 100644 --- a/MODSRC/vazkii/botania/common/item/magic/ItemTimeRod.java +++ b/MODSRC/vazkii/botania/common/item/magic/ItemTimeRod.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import vazkii.botania.common.item.ItemMod; import vazkii.botania.common.lib.LibItemNames; +// TODO public class ItemTimeRod extends ItemMod { public ItemTimeRod() { diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 8f43fb2f0..a8e31a4f8 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -257,6 +257,7 @@ item.botania:grassSeeds1.name=Boreal Seeds item.botania:grassSeeds2.name=Infection Seeds item.botania:livingwoodTwig.name=Livingwood Twig item.botania:timeRod.name=Rod of Flowing Time +item.botania:dirtRod.name=Rod of the Lands # GUI TEXT botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study: