Jump to content

dfmsguitar

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

dfmsguitar's Achievements

Tree Puncher

Tree Puncher (2/8)

-1

Reputation

  1. Apologies for replying to a post that's 2 years old, but I ran into this same error earlier using the SimpleNetworkWrapper method, and somebody else might stumble across this thread who's trying to debug this issue. If you attempt to send Packets to Client Side from the server, but your PacketHandler class calls registerMessage with the wrong Handler side, you will also see this error without much of a helpful explanation. // below is wrong and will cause this Packet Leak error. // PacketHandler class this.INSTANCE.registerMessage(PacketAddCraftingSkill.Handler.class, PacketAddCraftingSkill.class, 6, Side.SERVER); // Sending function ModName.INSTANCE.sendTo(new PacketAddCraftingSkill(1), (EntityPlayerMP)this.player);
  2. That looks pretty awesome, Thank you. I will review the dragon code as well since that's probably a good start on multi-part mobs. Much appreciated
  3. this is the code that makes the EntityLeader just drift away (EntityLeader is the class this code is in). if you comment out this line: this.body[i].setPosition(leaderX, leaderY, leaderZ); he just sits still or follows whatever AI is assigned. protected void spawnBodySegments() { if (!this.worldObj.isRemote) { if (this.body == null) { this.body = new EntitySegment[MAX_SEGMENTS]; } for (int i = 0; i < MAX_SEGMENTS; i++) { if ((this.body[i] == null) || (this.body[i].isDead)) { this.body[i] = new EntitySegment(this, i); this.body[i].setLocationAndAngles(this.posX + 0.1D * i, this.posY, this.posZ + 0.1D * i, this.rand.nextFloat() * 360.0F, 0.0F); this.worldObj.spawnEntityInWorld(this.body[i]); } } } } public void onUpdate() { super.onUpdate(); moveSegments(); } protected void moveSegments() { if(!this.isDead && this.body == null) { spawnBodySegments(); } if(this.body != null) { for (int i = 0; i < MAX_SEGMENTS; i++) { Entity leader; if (i == 0) { leader = this; } else { leader = this.body[i - 1]; } double leaderX = leader.posX - 0.5D; double leaderY = leader.posY; double leaderZ = leader.posZ - 0.5D; this.body[i].setPosition(leaderX, leaderY, leaderZ); }
  4. Hello, I'm working on creating a Living Entity that's composed of multiple entity segments. I've created two Entities, an EntityLeader and an EntitySegment. inside the EntityLeader, I created an Array of EntitySegment and added a method called spawnBodySegments that initializes the array at MAX_SEGMENTS, then for each segment in that array it creates a new EntitySegment, calls setLocationAndAngles, then spawns it into the world. The problem I'm having is, (I guess) I'm not sure where to call this method (spawnBodySegments). If I call spawnBodySegments from the Constructor or from entityInit(), then when it uses "this.posX" as the base X position for setLocationAndAngles, at this point this.posX = 0.0. The same with Y and Z obviously. I tried changing onUpdate to check if(this.body == null) at the start of the function then call spawnBodySegments so that it should theoretically only spawn them when onUpdate is first called with a valid set of coordinates. This seemed to work sort of (based on printing the positions and adding breakpoints to view the position values), except when I iterate through the body segments in onUpdate and call leader = this.body[i - 1]; this.body[ i ].setPosition(leader.posX - 0.5D, leader.posY, leader.posZ - 0.5D); -- just testing to try to get an understanding of the math I need to implement. When I call that function, for some strange reason it just keeps changing the position of the EntityLead segment. so even without any AI, with all super functions disabled, whenever I spawn one and let that function do its thing, it just drifts away in the -X and -Z direction and doesn't spawn any visible body segments. I'm sure it's something stupid I'm overlooking, but I've pulled out some hair over this. Any help would be greatly appreciated.
×
×
  • Create New...

Important Information

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