From 1281427a5fe4eb70949f3db66ceeaf8353f828c4 Mon Sep 17 00:00:00 2001 From: Jeremy Diamond Date: Fri, 14 Mar 2014 19:18:36 -0700 Subject: [PATCH] Adding the Riding Crop --- assets/forbidden/lang/en_US.lang | 5 + assets/forbidden/textures/items/crop.png | Bin 0 -> 290 bytes src/com/spiteful/forbidden/DarkAspects.java | 21 ++- .../spiteful/forbidden/ForbiddenRecipes.java | 3 +- .../spiteful/forbidden/ForbiddenResearch.java | 6 +- .../forbidden/items/ForbiddenItems.java | 5 + .../forbidden/items/ItemRidingCrop.java | 142 ++++++++++++++++++ 7 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 assets/forbidden/textures/items/crop.png create mode 100644 src/com/spiteful/forbidden/items/ItemRidingCrop.java diff --git a/assets/forbidden/lang/en_US.lang b/assets/forbidden/lang/en_US.lang index d9de5bd..62eba51 100644 --- a/assets/forbidden/lang/en_US.lang +++ b/assets/forbidden/lang/en_US.lang @@ -35,6 +35,7 @@ item.DiabolistSpork.name=Spork of Doom item.GluttonyShard.name=Gluttony Shard item.Bloodwell.name=Bloody Scrivener's Tools item.Crystalwell.name=Crystal Scribing Tools +item.RidingCrop.name=Riding Crop # # Wand components item.Wand.tainted.rod=Tainted @@ -192,4 +193,8 @@ forbidden.research_page.BLOODWELL.1=There's nothing more frustrating than having forbidden.research_name.CRYSTALWELL=Crystal Scribing Tools forbidden.research_text.CRYSTALWELL=Arcane Research Grant forbidden.research_page.CRYSTALWELL.1=Combining elemental shards with your inkwell results in some interesting effects. The Crystal Scribing Tools seem to absorb knowledge as you use them to write. Once the well is empty of ink, you can absorb this knowledge for a small burst of research points by holding the tools in your hand and right clicking. Unfortunately, this burns the tool out and turns it back into a mundane Scribing Tool again. +# +forbidden.research_name.RIDINGCROP=Riding Crop +forbidden.research_text.RIDINGCROP=Motivating Pain +forbidden.research_page.RIDINGCROP.1=A riding crop is, as its name suggests, a tool used to motivate mounts to move faster. Right clicking with it in your hand while riding a horse or other mount will give the mount a quick lash of pain and cause it to move faster for a little while.

You could hit other creatures with the crop too, but what would possess you to do something like that? # \ No newline at end of file diff --git a/assets/forbidden/textures/items/crop.png b/assets/forbidden/textures/items/crop.png new file mode 100644 index 0000000000000000000000000000000000000000..e75816b7574b35cc2362369db02cb19a61d2b400 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3 zQ$0gN_s>q|KvfexT^vI!{F4(TI0P2yeVeaQ{r~^}^9_BDv-*$D_{V-x!Ez77^t1_# z2F@L33~9!j(k8_)7$wYGF4py#Q;MN@-tw6mH_jXMyfJNR 0) - (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -2, 0, 6, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe)recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.2"), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe)recipes.get("MobCrystal"))}).setParents(new String[]{"INFAUXSION"}).setParentsHidden(new String[]{"THAUMIUM", "DISTILESSENTIA"}).setSiblings(new String[]{"FORK"}).registerResearchItem(); + (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -2, 0, 6, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe)recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.2"), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe)recipes.get("MobCrystal"))}).setParents(new String[]{"INFAUXSION"}).setParentsHidden(new String[]{"THAUMIUM", "DISTILESSENTIA"}).setConcealed().setSiblings(new String[]{"FORK"}).registerResearchItem(); else - (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -2, 0, 6, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe)recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe)recipes.get("MobCrystal"))}).setParents(new String[]{"INFAUXSION"}).setParentsHidden(new String[]{"THAUMIUM", "DISTILESSENTIA"}).setSiblings(new String[]{"FORK"}).registerResearchItem(); + (new DarkResearchItem("WRATHCAGE", "FORBIDDEN", (new AspectList()).add(DarkAspects.WRATH, 5).add(Aspect.MECHANISM, 3).add(Aspect.BEAST, 2), -2, 0, 6, new ItemStack(ForbiddenBlocks.wrathCage))).setPages(new ResearchPage[]{new ResearchPage("forbidden.research_page.WRATHCAGE.1"), new ResearchPage((InfusionRecipe)recipes.get("WrathCage")), new ResearchPage("forbidden.research_page.WRATHCAGE.3"), new ResearchPage((CrucibleRecipe)recipes.get("MobCrystal"))}).setParents(new String[]{"INFAUXSION"}).setParentsHidden(new String[]{"THAUMIUM", "DISTILESSENTIA"}).setConcealed().setSiblings(new String[]{"FORK"}).registerResearchItem(); } diff --git a/src/com/spiteful/forbidden/items/ForbiddenItems.java b/src/com/spiteful/forbidden/items/ForbiddenItems.java index ef8d0d6..6c471e5 100644 --- a/src/com/spiteful/forbidden/items/ForbiddenItems.java +++ b/src/com/spiteful/forbidden/items/ForbiddenItems.java @@ -5,6 +5,7 @@ import com.spiteful.forbidden.*; import cpw.mods.fml.common.registry.GameRegistry; import java.util.Arrays; import net.minecraft.block.Block; +import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; @@ -34,6 +35,7 @@ public class ForbiddenItems public static Item morphAxe; public static Item bloodwell; public static Item crystalwell; + public static Item ridingCrop; public static WandRod WAND_ROD_TAINTED; public static WandRod WAND_ROD_INFERNAL; @@ -135,5 +137,8 @@ public class ForbiddenItems crystalwell = new ItemCrystalwell(Config.crystalwellID).setUnlocalizedName("Crystalwell"); GameRegistry.registerItem(crystalwell, "Crystalwell"); + ridingCrop = new ItemRidingCrop(Config.ridingCropID, EnumToolMaterial.WOOD).setUnlocalizedName("RidingCrop"); + GameRegistry.registerItem(ridingCrop, "RidingCrop"); + } } \ No newline at end of file diff --git a/src/com/spiteful/forbidden/items/ItemRidingCrop.java b/src/com/spiteful/forbidden/items/ItemRidingCrop.java new file mode 100644 index 0000000..fcc5905 --- /dev/null +++ b/src/com/spiteful/forbidden/items/ItemRidingCrop.java @@ -0,0 +1,142 @@ +package com.spiteful.forbidden.items; + +import com.spiteful.forbidden.Forbidden; +import com.spiteful.forbidden.Config; + +import com.google.common.collect.Multimap; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.Icon; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import thaumcraft.api.IRepairable; + +public class ItemRidingCrop extends ItemSword { + + public Icon icon; + + public ItemRidingCrop(int id, EnumToolMaterial mat){ + super(id, mat); + this.setCreativeTab(Forbidden.tab); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister ir) + { + this.icon = ir.registerIcon("forbidden:crop"); + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) + { + stack.damageItem(1, player); + if(victim instanceof EntityHorse || victim instanceof EntityPig) + victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 175, 5)); + else if(victim instanceof EntityPlayer) + { + victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 75, 1)); + victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 75, 1)); + } + if(!player.worldObj.isRemote && !Config.noLust && !Config.noHell && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(30) == 1) + { + EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F); + ent.motionY += player.worldObj.rand.nextFloat() * 0.05F; + ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F; + ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F; + } + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getIconFromDamage(int par1) + { + return this.icon; + } + + @Override + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + return 1.0F; + } + + @Override + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.none; + } + + @Override + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 0; + } + + @Override + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if(player.ridingEntity != null && player.ridingEntity instanceof EntityLivingBase) + { + EntityLivingBase mount = (EntityLivingBase)player.ridingEntity; + stack.damageItem(1, player); + player.swingItem(); + //mount.attackEntityFrom(DamageSource.causePlayerDamage(player), 4.0F); + mount.attackEntityFrom(DamageSource.generic, 1.0F); + mount.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 175, 5)); + } + return stack; + } + + @Override + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return par2ItemStack.itemID == Item.leather.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); + } + + @Override + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return false; + } +} \ No newline at end of file