BetterSMP

Update: This fix (Amaranth's CraftBukkit implementation) is now part of CraftBukkit. So if you're on a Bukkit server with version 1.2.5-R0.1 (Build #02136) or later, you don't need BetterSMP at all - you can still use SMPSlimeFix (Client Mod) to further improve slime behaviour though.

Corrects mob positions sent to clients to (mostly) prevent mobs from glitching through blocks. Also prevents them from permanently glitching through blocks on the server side. Note that these issues are said to be gone by 1.3.

Video Demo: http:www.youtube.com/watch?v=oksq4S5ESTI

How it works

Every few ticks (depending on the entity movement and position) the positions of entities are sent to clients. However, three concerning things happen at the process:

  • Positions are sent inaccurately (as multiples of 1/32, for performance reasons) and always rounded down towards negative infinity. Consequently, the client may think that the entity is in a different block than it really is. Example: A villager is enclosed in a 1 wide, 1 long cell, ranging from (x=0,z=0) to (1,1). Villagers have a bounding box of 0.6x0.6, so a villager could be at x = 0.3, barely touching the block at -1 < x < 0. When multiplying 0.3 with 32, rounding it down, and dividing it with 32 again, you end up with x = 0.28125. The new minimal x coordinate of the villager's bounding box is now -0,01875 (as opposed to 0.0). This is the cause for many visual (temporary, client-side) glitches.
  • These accurate positions are being applied server-side (for synchronization reasons, I guess), which sometimes leads to entities glitching permanently (server-side) through blocks
  • Sometimes (every few seconds, or if the entity teleported, i.e. moved a great distance), the server sends a different packet with absolute positions (as opposed to positions relative to the previously sent ones). The client (for some reason) adds 1/64 to the y coordinate, which may cause additional client-side glitches

To fix these issues, the plugin does the following: whenever the positions are about to be sent, it

  1. stores the original positions of the entities
  2. lowers the Y-position by 1/32 (fix for last-mentioned issue)
  3. finds proper inaccurate coordinates to be sent by iterating through possible positions (either rounding down or up) to find a position which would result in the same colliding bounding boxes as the real position
  4. applies those corrected positions to the entities
  5. has the positions sent as usual only now
  6. resets the positions using the previously stored ones

Compatibility

Tested with 1.2.5-R0.1 (older builds) and 1.2.4-R1.0. May also work with older versions. The plugin has become redundant as of 1.2.5-R0.1 (Build #02136) (see note at the top).

Installation

Put into plugins folder of Bukkit and restart your server. No configuration, and no commands are required. To further improve the behavior of slimes, a client side mod (SMPSlimeFix) can be used. You can download it here

Source Code

Link to github: https:github.com/taurose/BetterSMP


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files