Jump to content

Turtledove

Members
  • Posts

    167
  • Joined

  • Last visited

Everything posted by Turtledove

  1. Haha nah I was in survival. Just one of those times where you can't figure out why something finally works, so you just accept it and move on lol.
  2. ...huh, rebuilding the project got it to work. The heck?
  3. I have a very basic AI class where if the player gets within a certain area of the entity, then the player takes damage. So I did the usual; get the bounding box, scale it, offset it, and iterate the list for valid entities. The thing is, it works, other mobs take damage without any issue. However, I can't seem to get hit. It's in the AI class so it's not a server-client issue, plus when I print the list of entities in the AABB it does detect the server's player class. What am I missing here? This is all there is in my update method: List<LivingEntity> swipeEnemies = this.entity.world.getEntitiesWithinAABBExcludingEntity(entity, entity.getEntityBoundingBox().expand(5.0,1.0,5.0).offset(-2.5D,0D,-2.5D)); if (!swipeEnemies.isEmpty()) { for (LivingEntity targ : swipeEnemies) { targ.attackEntityFrom(DamageSource.causeMobDamage(entity),12.0F); }
  4. ....just go to their Github or even CurseForge page or something
  5. It looks like the attribute speed is set to 1 but you pass 0.5 to your wandering AI, for reference the vanilla skeleton has a default speed attribute of 0.25 and passes in 1.0 to its wandering AI
  6. and 1.12 isn't supported on this forum anymore, use 1.15
  7. Thanks all, got it resolved. I used both AABB and basic linear algebra to check for intersections.
  8. I already have a function that does line segment-plane intersections for an entity's location and height, but it's moreso for my AOE attacks, not for precise single-entity-hits.
  9. I'm overhauling combat, and part of that, I've cancelled all the vanilla events related to that (left click, left click on block, left click on entity, etc) and am now sending packets back and forth from server/client to determine when and how a player should attack. However, an element I'm missing server-side is the ability to get the entity currently being looked at. So when an entity is struck, the event is canceled and a packet is sent to server, to my capability class where the rest of the logic is done. I've sent over that entity's position but I've two questions: 1) Is raycasting based on the player's look vector unreliable server-side? 2) If I just do a basic AABB bound check, do you think it's too imprecise? For both cases, I'm thinking of situations where an entity is flailing about, or shares similar coordinates with another mob (say, a Villager and a jumping chicken) that shares the same coordinates, but not necessarily the same boundary spaces. Should I be doing something else?
  10. Got it working flawlessly on the first try, thanks.
  11. I already have the cooldown set up as a capability serverside with IPlayerData, which is also where it's incremented every tick. In my server to client message handler, do I just set that variable in the same class (but on the client) and access it as normal in the event handling method? So I guess in that case there'd be a server and client version of my IPlayerData running at the same time, correct?
  12. I'm overriding vanilla sword behavior, such that the player cannot swing their sword unless a certain amount of ticks have passed, which is determined by logic done on the server. I've got everything already setup, and the packets are successfully sent to client. However, I'm not sure how to retrieve this information within my input handler class's static mouse event, from my message handler. Is there a better way of doing this than creating a static member variable inside the event handler class?
  13. You know, you could just look at his github yourself, just googled it for you: https://github.com/Ckathode/archimedes-ships it's very outdated but the idea wouldn't have changed much.
  14. One last question, how would I get the current attack cooldown value? Is that on the server or both?
  15. Apologies, I was out and about when I posted that Anyhow, the more i think about it I think it's best if I do more of the logic server-side instead, with what I'm trying to do. I need to prevent the player from swinging the sword until a certain number of ticks pass, so I'll probably just attach a value to the player whether they can swing by incrementing a tick counter on the server. Then send a packet to the client when they can swing again, and either let it happen or cancel swinghand like you said.
  16. Hm right now I've something like: public static void onMouseEvent(InputEvent.ClickInputEvent event) { if (player is holding sword) { if (player attacks) return; } } And the sword doesn't swing.
  17. I see, it's better to be more direct. But cancelling the input event prevents the sword swing from activating, the render hand event relies on the sword swing progress values to animate properly. In that case how would I manually initialize the swing progress counter?
  18. I don't cancel anything related to attack logic clientside, I only cancel the render event there. I cancel the event that attackentity calls, on the server. So the results should be something like: Player left clicks -> Cancel render event, render my own weapon animation -> send packet to server -> Cancel the attack event if the source is from a player holding a sword, otherwise leave it alone -> call attackentity manually, but change damage source to custom, that way it can pass through the previous step when it's called a second time. And I'm not sure if there's a better way to do this
  19. I wonder if it'll work if I do something stupid like: if damage source is player { if damage source's main hand is sword { cancel event //call replacement logic call attackEntityFrom(CUSTOM DAMAGE SOURCE, 100.0F) } } else //let the event happen Is there a better way to do this?
  20. Based on the default player inputs (left click with WASD), I'm trying to change the behavior of sword attacks, however I've run into a problem. 1. Server-side, I've gone and cancelled the event whenever the player is attacking an entity with a sword, this is the event thats called whenever attackEntityFrom is called. 2. Client-side, when the player presses the left key and strike, I cancel the vanilla sword animations + rendering, and do my own. Then I send a packet to server to let it know to do my logic there. 3.???? Step 3 is the problem, I then need to be able to call attackEntityFrom, but it would get cancelled because of #1, correct? What do I need to do to circumvent this?
  21. I want to detect whether an entity is in a NON-axis aligned plane boundary in front of the player, that rotates with the player's pitch and yaw. I've done the linear algebra and it works. The plane is directly in front of the player, with width 0.6, length 2, and it is 1.6 units above the player's world coordinates and this is my implementation of that. Graphed, this is when I'm directly facing a testificate, in the plane's coordinates. A,B,C are the 3 corners of the plane, and E and D is the coordinates of the bottom and top of the villager, respectively. Another view, from the XY plane: As you can see, it clearly intersects, and graphing where t=1.3 corresponds to in the parametric equation results in the correct intersection (it's F): That said, when I then cancel the vanilla event, and cause damage to the entity in code, nothing happens. Is it possible that when I make that damage call, it calls the same attack event method again, which is then canceled? Disregard, I figured it out the second after I posted it. There was a typecast to int that shouldn't have been there that was setting the flag to false. Also the event is only called for the client.
  22. Have you tried reading the docs or googling? Extend an existing item class of whatever category your custom item pertains to.
  23. Ah that's just what I was looking for, thanks.
  24. How do I get keybinds from an event that doesn't use them for its event?
×
×
  • Create New...

Important Information

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