Jump to content

GooberGunter

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by GooberGunter

  1. I never thought I'd get it. So...one last question. How do I set up a packet to handle an entity since it's not a basic field
  2. Ok so since I had the server-sided LivingHurtEvent change a boolean, it only changed it on the server side, so I need to update the entire entity on the clientside through packets, right?
  3. So, is the entity class, by default run on the client or the server?
  4. So, like, have a getModel method in the entity class and then in render call said method and have the packet store the entity not the boolean? If so, then how would I go about that writing the entity to bytes? And wouldn't the entity be a lot to write back and forth?
  5. In the Render class And then in ClientProxy:
  6. So I have it all set up, but the boolean awake in the model class is Not being set to true for some reason PacketReturnAwaken: Model: Here is the method in the entity class: Everything Looks to be in good shape, i don't know what could be the problem on the flip side, I feel like I'm getting a better understanding of packets
  7. Then how should I initialize eb? Wait. I think I have an idea. Edit: Nope, no I don't
  8. Here's the error And I got rid of int id in processMessage and replaced it with message.entityid
  9. I pass the message. id to put in the entityid for the initialization of the eb variable so that I could use the getModel() method in my EntityBeelzebook class and have access from there. Without the id i can't initialize it. Why? is there a better way? Initialization is my weakness
  10. Wait, would I set the boolean in the model class to the packet boolean in the message handler? EDIT: I looked back at the forge documentation and I got an idea, I'm about to test this PacketReturnAwake: And the Method in EntityBeelzebook: it gave me an error about casting NetHandlerPlayClient to NetHanlderPlayServer at the declaration of eb
  11. So I figured it could find the entity via entityid through this line, EntityBeelzebook eb = (EntityBeelzebook) ctx.getServerHandler().playerEntity.getServerWorld().getEntityByID(id); so I created another variable int entityid and wrote the code to and from bytes, I just don't know where I should go from here What code belongs in the handler and how do I connect the variables in the constructor of the message to the variables in my entity class? EDIT: Ok so I think I'm good storing the boolean from the entity to the packet. I just don't know how to update the other boolean in my model class to the packet one Also I know that send to all is a very bad idea for this, but I can't get the entity tracker working right now and since I'm the only one testing, I'll just put it in for now and fix it later when the actual packet works
  12. Yeah...I had no idea what was going on in the tutorial. The class name and field name were supposed to be "java reflection" but I never saw the point in it. But considering the fact that I've never done this before, I figured, what do I know. I updated the code, it should be a little better but I still don't know when and where to call the sendTo part. NeemPacketHandler: PacketReturnAwaken: Also, I register the messages through the common proxy (which may or may not be a bad idea; which I don't doubt) in a method called preInit() which is called in the preInit message in the main core mod class. But naturally, when I ran that code, I forgot to call the proxy method.
  13. So I followed cjminecraft's tutorial, only understanding what I'm doing here and there, and I got myself a promising error: Model Code: Most of the important stuff is the AwakeAnimation Here's just the AwakeAnimation method: Packet Handler: PacketGetAwaken: PacketReturnAwaken: Now you'll probably see a lot of weird things, but, like I said, I kinda just tumbled through this. Usually, I'm able to figure it out, but Networking is something I have never worked with
  14. Thanks! I'll check them out and update if I found a fix
  15. Alright I've Been looking around for a while and I can't find any good tutorials on packets. I mean I understand the whole making a class for the message that has methods to send info to and from bits, but I don't know how it all fits together. Why do I need a message handler? How do I set information to the packet? How do I get the information? The forge documentation didn't give me much insight
  16. On second thought, I don't know how to do that
  17. Ah, that explains it. I'm very rough on serverside vs. clientside knowledge. Thanks!
  18. Update: So it looks like the boolean is set to true when the setter is called but doesn't remain true Unfortunately, this is as far as I can figure out. I can't think of a solution for this and I haven't really worked with triggered animations before
  19. Hey, I have an event where an animation is triggered after the player attacks or right clicks the entity. When the entity is attacked or right clicked, it is supposed to trigger new AI (which I got working with ease) and set an animation to open the entity's eyes (which I'm struggling with). I accomplished the AI part with a pair of setters and getters for a boolean which returns true when the event happens. I also got a pair of setters and getters for the model class and set the boolean to equal the boolean in the entity class, as well as an if statement in the livinganimations to trigger the animation, which right now is just a simple edit to the model rotations. Here is my model class And here is the Entity class Event class: EDIT: So i got the boolean in the model class to set to true, the if statement in setLivingAnimation just isn't working EDIT2: Yeah, the boolean is set to true and the AwakeAnimation IS being called, but for some reason, it isn't picking up the boolean as true
  20. Well yeah, but what I did is I had a new method that had a for loop to replace all blocks in the length width and height of the structure so I could just call a "setBlockState to air" method once. I call this method before I build anything. I just personally find it easier, but maybe this way has its problems
  21. So, I make a list of the chunkPos that the structure spawns in, and set up a boolean that returns false when it's too close to another structure?
  22. So you're still using world generator?
×
×
  • Create New...

Important Information

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