Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

HappleAcks

Members
  • Content Count

    124
  • Joined

  • Last visited

Everything posted by HappleAcks

  1. The reason you don't do that is because that variable will be the same for every single instance of the Item, making it incompatible in multiplayer for sure, and possibly in single player as well if you have two or more of the item in question. @OP Your code is close, but when you right click, you forgot to set the time at which it was fired, meaning that every click will allow it to fire as world time > 0 is always true Add this to your right-click method after determining that you should fire a shot: stack.getTagCompound().setLong("lastShotTime", world.getWorldTime() + del
  2. Reversing it literally changes nothing. The exact same problem occurs, except it counts down. It starts at 4 (or X) and then counts down to 0 WHEN USING IT (because it's in the UsingItem method, which only is called when it's in use). This means that when you are not using it, the countdown stops. That's why I'm using the method CoolAlias provided, because it doesn't do that and will work at all times, except when spam right clicking (however he provided a solution to this, but I needed clarification for slowing down the speed, as I mentioned earlier).
  3. Earlier in the thread I mentioned this method is ineffective because then you can't just right click and shoot after X ticks, it'll require you hold it for X ticks first, since it only counts ticks up when in use, not while not in use. This is why the other method is used, which also works. The only thing I'm wondering how I do is change the speed, and if I know that it works 100%.
  4. That's literally what this whole thread has been about how to go about doing. "-.-" CoolAlias has gotten me really close, but I don't know how to slow it down with his method.
  5. My only problem is I don't know how to slow down the onItemRightClick (the speed it takes is a string?). current code: Does anybody know about how to slow this down, after implementation it still fires at a very rapid speed when tapping (probably because I don't know how to slow down the speed from onItemRightClick). I should also mention that the onItemRightClick has also sped up the holding-down speed (once again, probably because it is too fast). Also, I've tried adding a large number after the stack.getTagCompound().getLong("lastShotTime") but it doesn't seem to affect anyt
  6. It extends item sword because I made it so you can add melee attachments to the guns. As for implementation, I do have both methods there, and I get that one is for holding right clicking (onUsingTick) and the onItemRightClick is for the rapid tapping. My only problem is I don't know how to slow down the onItemRightClick (the speed it takes is a string?). current code:
  7. No, it is in addition to the onUsingTick method. Then in the case I'm a bit puzzled. I know I'm sound really cruddy here, but I don't know how to go about merging these methods.
  8. Here is a good introduction. You will need to override the onItemRightClick method Would this be instead of my onUsingTick method of changing the fire rate, so I'll completely remove the old method and use the new one? Or should this be merged into it (in this case I don't really know where to go with it).
  9. This method turned out to be really buggy. The gun will keep firing as soon as you click once and never stop, as well as it looks weird. I'm not quite sure how to implement this along with my existing code. I've never worked with NBT before, so I don't really know how to go about implementing this. My current code:
  10. Not sure how this would fix the fact you can get around slower firing by tapping rapidly.
  11. So everything is working now except for the fact that if you rapidly right click, it ignores the firing speed (if you set it to slower, for example (ticksInUse % 40 == 0) ).
  12. How would I do the max stack of 127 though? Just set the max stack to that and it'll work?
  13. So since there isn't a way to stack above 127, how would one go about having an item that can hold certain items in it, separate from the inventory, as sort of a portable chest / pouch?
  14. This worked! - ALMOST, the only problem is that now the gun is still held on a funny angle when shooting. Is there a way to make it so it doesn't visually change when shooting? It didn't with my old method, but this new method allows me to make it shoot faster.
  15. ^^ Exactly what Sequituri said. The method I posted is the 1.7.2 version; since I have not seen anywhere that you specify for which version you are coding, I assume you are coding for 1.7.2. If that's not the case, you should either say so in your topic title or first post, and learn to use your IDE and Java to find what the method might be called in whatever version you happen to be using. I am using 1.7.2. As I mentioned though, to keep the Override I must retain the original parameters which don't include the World, but I don't know how to spawn an entity without the world parame
  16. That was the entire implementation, aside from consuming the bullet and spawning the entity; what more do you need? It's a method in the Item class, just put it in your rifle class and add what you need. 20 ticks is roughly one second. Well I tried implementing according to the comments left, and when I right click while holding the rifle it just holds it on a weird angle and doesn't fire anything. The code - @Override had to be removed to allow me to use the World parameter to create the entity.
  17. This confused me a little bit when it came to the implementation, since I haven't worked with ticks much. Could you clarify how to implement this code? Still waiting on this, since I don't really know how to implement it along with my current weapon code.
  18. This confused me a little bit when it came to the implementation, since I haven't worked with ticks much. Could you clarify how to implement this code?
  19. An example of a weapon firing default speed that I want to make fire faster: An example of my method for making a weapon fire slower:
  20. Oh, is that how long a tick is? My current fire rate is like 1 shot every half second.
  21. It's a singular item that is consuming a different item. Also, it currently seems to be once/tick, but I've seen mods where mobs can shoot like an arrow every 1/4 of a tick just at ridiculous rates so I was wondering if that is possible to transfer to a weapon.
  22. More frequently, I already have them moving fast/not affected by gravity. - I do have a problem with slower firing weapons though, where you need to hold down the right mouse button for a second before it fires. I think this is because I set it so that it reduces the cool-down on right click, but not while just sitting there.
  23. So I know how to make my guns fire at a slower speed than the default, but I don't know how to make it faster than default "throwing" speed.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.