Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Move patch to update health so it works better and is applied upon login.
Dieser Commit ist enthalten in:
Ursprung
68973fd136
Commit
93755c6732
@ -1,7 +1,6 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.packets;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.spacehq.opennbt.tag.builtin.CompoundTag;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.ViaVersion;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
@ -247,6 +246,7 @@ public class EntityPackets {
|
||||
/* Packets which do not have any field remapping or handlers */
|
||||
|
||||
protocol.registerOutgoing(State.PLAY, 0x20, 0x4B); // Entity Properties Packet
|
||||
|
||||
protocol.registerOutgoing(State.PLAY, 0x1A, 0x1B); // Entity Status Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x16, 0x27); // Entity Look Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x14, 0x28); // Entity Packet
|
||||
|
@ -222,6 +222,7 @@ public class PlayerPackets {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Packet Plugin Message Outgoing
|
||||
protocol.registerOutgoing(State.PLAY, 0x3F, 0x18, new PacketRemapper() {
|
||||
@Override
|
||||
@ -240,6 +241,26 @@ public class PlayerPackets {
|
||||
}
|
||||
});
|
||||
|
||||
// Update Health Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x06, 0x3E, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.FLOAT); // 0 - Health
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
float health = wrapper.get(Type.FLOAT, 0);
|
||||
if (health <= 0) {
|
||||
// Client unloads chunks on respawn, take note
|
||||
ClientChunks cc = wrapper.user().get(ClientChunks.class);
|
||||
cc.getBulkChunks().clear();
|
||||
cc.getLoadedChunks().clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/* Removed packets */
|
||||
|
||||
// Map Bulk
|
||||
@ -287,7 +308,6 @@ public class PlayerPackets {
|
||||
|
||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x43); // Spawn Position Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x1F, 0x3D); // Set XP Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x06, 0x3E); // Update Health Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x0D, 0x49); // Collect Item Packet
|
||||
|
||||
/* Incoming Packets */
|
||||
@ -403,12 +423,6 @@ public class PlayerPackets {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int action = wrapper.get(Type.VAR_INT, 0);
|
||||
if (action == 0) {
|
||||
// Client unloads chunks on respawn, take note
|
||||
ClientChunks cc = wrapper.user().get(ClientChunks.class);
|
||||
cc.getBulkChunks().clear();
|
||||
cc.getLoadedChunks().clear();
|
||||
}
|
||||
if (action == 2) {
|
||||
// cancel any blocking >.>
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren