Jump to content

wolfboyft

Members
  • Posts

    20
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://rollennia.uk
  • Location
    London
  • Personal Text
    "Eat my shorts!" —Bart Simpson

wolfboyft's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm aware, but the only events or methods within the Item class I can find are for when you attack an entity. If it helps understanding what I really need, read:
  2. I've seen them, but they're all for when the player clicks on different things (an entity, a block, etcetera)
  3. This is a more specific question that will help with my two handed weapons: I need a hook like LivingEntityUseItemEvent but for left click instead of right.
  4. I'll show you what I manage to make and i hope y'all can improve it ("lowkey" bump.)
  5. I see what you mean. I suppose that making a two-handed attack available for one-handed swords and forcing two-handed attacks for two-handed swords could be a good idea, but the extra controls needed would seem a bit heavy for the intended weight of this mod. It's about adding more weapons, not in-depth combat mechanics. So I guess that the answer is yeah, it's for a custom weapon. No, it's not a special move that you could do with a one-handed sword.
  6. My idea for a two-handed weapon is to make attack attempts-- left clicks when the item's in the main hand to most of us, including me-- turn into a bow-like hold-to-charge in terms of display (in first person any off-hand items go invisible, dynamic FOV kicks in if enabled and the arms in third person do what they do-- though getting the charge-up "animations" to align with any two handed weapon's speed might be tricky, so just snapping to full "charge" could be a good idea) Then, in terms of gameplay... a "psuedo-attack" is performed to do nothing but start the 1.9 cooldown. Upon releasing the attack button, an attack with the power of the current cooldown is performed. I think that the rest falls into place. So far I've got nothing except for the "pseudo-attack" idea, even though I have no idea how to implement that. Any help would be appreciated. EDIT: Less verbose, more readable version: When attack is held: On press: start the 1.9 cooldown, do a bow-drawing animation in terms of FOV and disappearance of the off-hand item On release: swing the sword with the strength of the current cooldown so ... a reverse cooldown?! A heatup!
  7. Thanks a lot! That technique actually taught me a lot about java and now my mod is released at 1.0 You're a lifesaver! (Figuratively.)
  8. In my mod, Chocolate Armoury (it's meant to be close to vanilla ,) I want to make my new type of sword, ChocolateSword, choose whether it can sweep attack. Here are my current paths: I can make ChocolateSword extend ItemSword. Con: sweep attack capability is judged on whether the item class instanceof ItemSword. Pro: It can be enchanted like a sword, won't break blocks in creative mode and all that stuff-- because those check whether it's instanceof ItemSword. Or... Make ChocolateSword be a copy of ItemSword. Pro: Sweep attack doesn't happen. Con: Some ChocolateSword child(?) classes will be intended to have sweep attacks. Con: Now it can't be enchanted like a sword and it breaks blocks in creative mode. I'm thinking that the extending of ItemSword seems a bit but it is still not right. Maybe if I change the if (itemStack.getItem() instanceof ItemSword) { flag3 = true; } in EntityPlayer's `attackTargetEntityWithCurrentItem(Entity targetEntity)` method to if ((itemStack.getItem() instanceof ItemSword && !(itemStack.getItem() instanceof ChocolateSword)) || (itemStack.getItem() instanceof ChocolateSword && itemStack.getItem().canSweep())) { flag3 = true; } I'm kinda dehydrated right now and amn't very good with Java yet so don't expect an intelligent idea, but I thought that if I give ChocolateSword a canSweep() method that returns, say, true by default, and my non-sweepin' child classes (still not sure if that's the right terminology) can return false with an @Override'd version of canSweep then that would work I'm pretty sure that with the && in the brackets to the right of the ||... if it's not an instance of ChocolateSword Java won't try and call the canSweep() that only instances of ChocolateSword have, therefore avoiding an error. Right? thank you for any help i'm gonna get some water.
  9. What do you mean by the whole "on click" thing, Ernio? So far I made myself public class BlamBlamEventHandler { @SideOnly(Side.CLIENT) static int Counter; @SubscribeEvent public void onClientTickEvent(ClientTickEvent event){ if (event.phase == Phase.START) { //What now? } } } plus the relevant imports and package, but I got kinda stuck. I hate to ask for spoon-fed information, but... I don't understand! Should I go away and learn some more Java, or... is this just a case of me not quite knowing the relevant Forge techniques?
  10. I understand that now, and as such, deleted the post as it was just clutter. I'll be sure to ask you any more necessary question on this matter
  11. This totally goes against your profile quote and also this whole forum. Anyway - attacking works like this: Client performs raytrace (on right click, honouring client-side attack speed), if it hits entity, a packet is sent, server then check if attack was valid/possible (checks distance to entity and probably also attack speed and other stuff) and if it was - entity gets damaged on server and whole hurting mechanisms are fired. Now - to make "attack-bot" you will need to 1st of all - fulfill same requirements as normal attacks and then basically just send attacking packet to server (yeah, vanilla one). To do all that there a quite few approaches (I will mention one, maybe two): 1. Do it from client input: @SubscribeEvent to ClientTickEvent. Check against event.phase (run only once). Make client-sided integer counter (can be static and @SideOnly(Side.CLIENT), since there is always only one client player). On click: (KeyInputEvent or KeyBindingEvent or something else, like mouse/keyboard event) set counter to 0. On hold: increment counter from ClientTickEvent (check if attack keybinding is pressed) and check if (counter % Minecraft#thePlayer#attackSpeed == 0). If passes - perform attack (simulate what vanilla does) - send attack packet. 2. Do it somehow from Item class - it has on start, tick, and finish using - you could utilize that to re-attack when item is being used. This is probably better approach but also needs some work. Note: Attacking can be simulated on client (point 1 or 2), or on server (only 2). Got any pseudo-code ideas for number 2? Not very good with certain types of logic. Lemme just look at those methods, tho
  12. I'll look through the documentation for those two "is-the-entity-targeted" methods, thanks. Also, how would this be implemented client-server wise? Packets? Y'see, I'm intending for [secondary action] (right click) to turn the chainsaw on and off, and [attack] (left click) to-- when it is on-- do the continuous attack thing, and when it's off act like a sword, and it would seem that should have a client-server "conversation" for each player. Correct me if I'm wrong on that, please. Or should I make a new thread for this...? ta muchly
  13. Hi! I'm fairly new to Java and Forge, but I've managed to make two simple mods-- so I'm not a TOTAL newbie. But, uh, I'm making a third one, and I'm wondering if there's a way to make an item not require the player to click repeatedly, instead just attacking for them when they hold the attack key. (And have it not create a 1.9 combat cool-down timer thing, but that's not the point of this thread.) Now I'd rather not be spoon-fed information/code just like that, and bear in mind that's definitely not what I'm asking for. But if any of you could... fairly vividly point me in the right direction, that'd be much appreciated. Thank you! PS: Yes, it's a chainsaw
  14. Now got all the source up for you to see! https://github.com/wolfboyft/Magical-Mages
  15. [sOLVED] How to stop the sender of a projectile from being hurt by it should it hit him All my question is... what should I use in an if statement, on my projectile entity's class, to say 'If the player was hit by the projectile, by all means, delete the projectile*, but don't hurt the player or give him any potion effects!' This is the method you'll want to be seeing. if(var1.entityHit != null) { var1.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), getDamage()); ((EntityLivingBase)var1.entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); } Of course, that's not the whole method. But still... I'm looking for something along the lines of this. if(var1.entityHit != null) { if(var1.entityHit == sender){ }else{ var1.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), getDamage()); ((EntityLivingBase)var1.entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); } Thanks in advance, -wolfboyft P.S. *Not 100% needed.
×
×
  • Create New...

Important Information

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