Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/03/17 in all areas

  1. You're right that the code is a bit convoluted. You'll notice that it only checks for < 0 health if the guiScreenIn parameter is null. It seems that the screen passed in is null when "escaping" from some GUIs and so then this section of code will check if the death GUI should be shown. I guess they do this instead of going back to the parent GUI (the normal thing you do when exiting a GUI) because there is a chance that you died while you had the other inventory up on the screen. The Minecraft#displayGuiScreen() method with GuiGameOver is also called from the NetHandlerPlayClient when it receives a SPacketCombatEvent for ENTITY_DIED in the case where the entity is the player. So I suppose there could be a "race" condition that causes the event to fire twice -- once when client decides player health is < 0 and also when it receives packet from server notifying of the death. However, it is not clear to me that this would happen after pressing the respawn button.
    1 point
  2. I have made a mod that adds a horse cart to minecraft, everything but this works great; For handling the carts movement, I made the cart always face the horse and move it for the distance inbetween on every update like so; Vec3d moveVec = new Vec3d(this.pulling.posX-this.posX-this.getLookVec().x*offset, this.pulling.posY-this.posY, this.pulling.posZ-this.posZ-this.getLookVec().z*offset); moveVec.x, moveVec.y and moveVec.z are then used in Entity#move. I do this on both client and server, yet the cart stutters on every update tick (every 20 ticks in this case). You can experience this by yourself by attaching a horse to a cart and letting it wander around.
    1 point
×
×
  • Create New...

Important Information

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