Jump to content

GravityWolf

Members
  • Posts

    98
  • Joined

  • Last visited

Everything posted by GravityWolf

  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.
  15. Yes, I know that, I was just testing it out. I should have changed that Even when I do return an ItemStack, it does...nothing.
  16. Try using onItemRightClick() method... And also, why are you returning true in both statements? I am thinking you might want to make on e false This doesn't work at all: public ItemStack onItemRightClick(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10) { if (!par3World.isRemote) { return null; } else { par2EntityPlayer.displayGUIWorkbench(x, y, z); return null; } } }
  17. Alrighty. I got this far: @Override public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10) { if (!par3World.isRemote) { return true; } else { par2EntityPlayer.displayGUIWorkbench(x, y, z); return true; } } } It only works whilst right clicking on the ground, though. Any ideas?
  18. Hello! I am trying to get an item to get items to open chests, furnaces, and crafting tables. I can't seem to get it to work. Here is the code I am trying to use: public boolean onItemUse(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { par5EntityPlayer.displayGUIWorkbench(par2, par3, par4); return true; } } I'm pretty sure it's not working cause this never gets called, but I can't put this in onItemRightClick()...anyone have any ideas?
  19. OH, I see now. So, I assume this would be sending a packet from client->server?
  20. So, sending a packet would be like a parameter, wouldn't it? for ex. public void onUpdate(lalalalal EntityLivingBase entityLiving) Then, I would...um...hehe I have noooo idea...so I need help with that xP Lol, I should have read this: http://www.minecraftforge.net/wiki/Packet_Handling
  21. OH! Now I see what you did. Ok. So I tried this: public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isCurrentItem) { if(entity instanceof EntityPlayer && isCurrentItem) { EntityPlayer player = (EntityPlayer)entity; if(player.isSwingInProgress) { player.isSwingInProgress = false; Minecraft.getMinecraft().thePlayer.swingItem(); } } } But this still didn't show any graphical swing. Do you know any way I could show the graphical swing?
  22. Cancel the swing? No, let me explain this again. I want it so that when you left click when there is already a click in progress, it starts a new swing, so you can swing faster. I am trying to make a dagger xP
  23. Doesn't work, the swing happens(I tested with hitting an entity) but it doesn't show the swing.
×
×
  • Create New...

Important Information

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