Jump to content

Melonslise

Members
  • Posts

    183
  • Joined

  • Last visited

Everything posted by Melonslise

  1. Why would it if I made it static? How do I fix that?
  2. Right, so how do I do that? Through packets? Then why don't the vanilla mobs use packets?
  3. So does this mean I'll need to spawn the entity on both sides?
  4. I used the debugger to check the entries in the entity's DataManager and it looks like my integer id value is not on the list. I saw six entries each corresponding to each DataParameter declared in in the Entity base class. I don't understand why mine isn't there though.
  5. I'm getting a ticking entity: nullpointer error and the compiler is pointing at my getCaster() method at line 220 where I get the key from DataManager.
  6. Well the DataManager#register method takes a value param, so I thought that's what would be stored.
  7. I thought that when I register it I set the value to the key as well.
  8. I did everything except I didn't create an owner field.
  9. I did what you told me to (I was going to anyway) and I'm now getting an error when retrieving the int entity id from the DataManager. So basically the same problem again.
  10. Ow sorry I forgot to add the pastebin link.
  11. The compiler is pointing at the getCasterUUID() method. I am going to add the ID to the DataManager once I get this fixed. I don't understand why you're recommending to use regular ID, though, since it's quite unreliable afaik. Can't the client get an entity's UUID?
  12. I'm getting a nullpointer error when trying to retrieve an optional uuid from the DataManager. Do you have any ideas?
  13. So to pass the entity's id I'll need yet another DataManager or is there an easier way? Here's the method code:
  14. Is there any way to get the list of all players on the server? Since servers can have different worlds afaik.
  15. Ok, how do I get entity by UUID?
  16. The DataParameter cannot store Entities so I'll have to store player by either name or UUID. I'm going to use UUID, but I'd like to know how to obtain a player's UUID and if I can compare an EntityLiving's UUID with a player's.
  17. So I'm going to need to create a new DataParameter, register it and then get/set the player using the entity DataManager? Does that mean I don't need to create variables in the entity class and instead just use DataManager.get/set? Also why don't the vanilla classes like EntityFireball/EntityThrowable use DataManager?
  18. Alright, how do I pass the value to the client then?
  19. EDIT: Actually no, it looks like my client side entity isn't receiving the player who cast the spell.
  20. So you think that vanilla code is broken? Anyway, I think I understand what the problem is. It looks like I'm killing off the entity only on the server side so the client entity keeps moving. But in the vanilla code entities are always killed on the server side. Is vanilla broken or am I missing something? I thought the server would update the client automatically.
  21. Well the thing is that I do not spawn the entity on the client, so it doesn't need to know those values. Also I have no idea why there are 2 client entities. I use usernames because I just copied the code from EntityThrowable.
  22. Take a look at the EntityFirebolt class and it's onImpact() method. The sysout gets printed 3 times when I right click with my item, 2 times on the client and once on the server. Its seems that the first print on the client gives me a correct ray trace entity, however the second print on the client tells me that it collided with the player, which I specified no to happen in the base EntityProjectile class.
  23. Sorry I created the thread by accident before I could finish writing. The code is in the first post.
  24. I made sure my item spawns my entity only on the server side, however when testing I see the impact method ran 3 times, 2 times for the client and 1 time on the server. Note that the one of the client methods returns the correct value, while the other collides with the player, which I specified not to. I'm pretty sure the collision happens because the caster variable is null, however I don't know why. Here's the base class: https://pastebin.com/9ezYndWt The entity I'm spawning: https://pastebin.com/7PsYLHxx And the item that spawns the entity: https://pastebin.com/muPFHwMu
  25. Alright, looks like the problem was caused because I was using my own variables for speed instead of the predefined motion variables. Can anyone explain to me why this happens? I looked around the Entity code and found nothing that could cause this. Also could anyone tell me what's the best frequency to set when registering my entity. What is it measured in? (e.g. updates/tick)
×
×
  • Create New...

Important Information

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