Jump to content

GravityWolf

Members
  • Posts

    98
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

GravityWolf's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  1. Hello! I'm working on a melee/ranged weapon, but I want it so you only have to use left click, as I am using dual wielding. So I'm going to try to set it up so if you hold down left click for about 1 second and let go, it shoots an entity. (Don't worry, I don't need help with that ) So here's my code so far to stop the swing: if (weaponAbility == "chakram") { if (player.isSwingInProgress) { player.isSwingInProgress = false; } } This is in onUpdate, just by the way. So, anyone have any ideas? Thanks!
  2. Toolset: http://www.youtube.com/watch?v=kSoSQ5gbmZA Armorset: http://www.youtube.com/watch?v=xgAjEy7kVXA It's not that hard to find them
  3. Got it to work using this: public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; ItemStack equipped = player.getCurrentEquippedItem(); if(equipped == stack) { if(player.isSwingInProgress) { if(swingSpeed == 0) { } else if (swingSpeed == 1) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 0)); } else if (swingSpeed == 2) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 1)); } else if (swingSpeed == 3) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 2)); } else if (swingSpeed == -1) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 0)); } else if (swingSpeed == -2) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); } else if (swingSpeed == -3) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2)); } else if (swingSpeed == -4) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 3)); } } } } } SwingSpeed is my own custom variable, just btw
  4. It worked! Thanks! And I didn't know you moved here from MCForums
  5. I can't figure this out...here's my code: public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); return par1ItemStack; } It does nothing on right click...
  6. Hello! I know this is a very noob question, but getEnumAction() doesn't work...it doesn't do the action I set it to do. Here is my code: package MysticRealms.Items; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import MysticRealms.MysticRealms; public class ItemWeapon extends Item { int swingSpeed; public ItemWeapon(int id, EnumToolMaterial material, int speed, String name /*String ability*/) { super(id); this.setCreativeTab(MysticRealms.mysticTab); this.setUnlocalizedName(name); swingSpeed = speed; } public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; ItemStack equipped = player.getCurrentEquippedItem(); if(equipped == stack) { if(swingSpeed == 0) { } else if (swingSpeed == 1) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 0)); } else if (swingSpeed == 2) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 1)); } else if (swingSpeed == 3) { player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 1, 2)); } else if (swingSpeed == -1) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 0)); } else if (swingSpeed == -2) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); } else if (swingSpeed == -3) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 2)); } else if (swingSpeed == -4) { player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 3)); } } } } public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } } Thanks!
  7. I will use that when that comes out, but for now I think I can utilize the haste effect code.
  8. I would do that, but it swings too fast too quickly. What I mean is Haste 1 gives you increased swing speed, but Haste 2 gives you almost double speed of Haste 1. I'm looking for sword swing speed.
  9. Hope this doesn't count as spam, but I think I made some progress: I found this: if (this.isPotionActive(Potion.digSpeed)) { f *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; } and this: private int getArmSwingAnimationEnd() { return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); } I think these are important, the second one probably more so. They seem to require potion effects, and like I said in the OP, I don't really want to use potion effects. If you have any ideas, let me know! Thanks! ~GravityWolf
  10. This is my third time doing this, and I hope I get a response this time So, basically, I want it so I could change the swing speed, like if you were using a Haste potion effect. (I don't want to do that though, it doesn't give me enough speed options that way) I tried looking in the Potions class, and I found public static final Potion digSpeed = (new Potion(3, false, 14270531)).setPotionName("potion.digSpeed").setIconIndex(2, 0).setEffectiveness(1.5D); There was nothing else in the code about it, so I took it that 142703531 had something to do with it. If you know anything about it, or have any ideas on it, it would be great if you could let me know! Thanks! ~GravityWolf
  11. Hello! I'm trying to make an RPG-ish mod, and I need to find a way to add new armor slots and remove the crafting table in the inventory. Here is a picture of what I have in mind: So, what I need to do is, like I said, remove the crafting table and add new armors slots. Anyone have any ideas? Obviously remove the crafting table from the inventory first
  12. Hello! I need help with increasing a player's swing speed. Basically, when you click with a certain item, the swing is faster. Anyone know how to do this? This is quite important. Thanks!
  13. Thanks, it brings up the GUI, but now I have another problem =/ When I click on the item, it moves right back to the slot it was on previously. Any ideas?
  14. onItemUse is just when you right click a block with an item, so that's not really what I want. I am using onItemRightClick, but onItemUse did work when I tried it. Just wasn't right, though.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.