mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-23 17:08:00 +01:00
Fix ghost items
This commit is contained in:
parent
004d0d2b23
commit
ee86b109b2
@ -47,7 +47,6 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
||||
|
||||
registerOutgoing(State.PLAY, 0x15, 0x16);
|
||||
registerOutgoing(State.PLAY, 0x18, 0x19);
|
||||
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
||||
registerOutgoing(State.PLAY, 0x54, 0x1D);
|
||||
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
||||
registerOutgoing(State.PLAY, 0x20, 0x21);
|
||||
|
@ -4,6 +4,7 @@ import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.entities.meta.MetaHandler;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityData;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityPositionHandler;
|
||||
import nl.matsv.viabackwards.api.entities.storage.EntityTracker;
|
||||
import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
|
||||
import nl.matsv.viabackwards.api.rewriters.LegacyEntityRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
|
||||
@ -54,6 +55,32 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<Protocol1_13_2To1_14
|
||||
protected void registerPackets() {
|
||||
positionHandler = new EntityPositionHandler(this, EntityPositionStorage1_14.class, EntityPositionStorage1_14::new);
|
||||
|
||||
// Entity status
|
||||
protocol.registerOutgoing(State.PLAY, 0x1B, 0x1C, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
int entityId = wrapper.passthrough(Type.INT);
|
||||
byte status = wrapper.passthrough(Type.BYTE);
|
||||
// Check for death status
|
||||
if (status != 3) return;
|
||||
|
||||
EntityTracker.ProtocolEntityTracker tracker = getEntityTracker(wrapper.user());
|
||||
EntityType entityType = tracker.getEntityType(entityId);
|
||||
if (entityType != Entity1_14Types.EntityType.PLAYER) return;
|
||||
|
||||
// Remove equipment, else the client will see ghost items
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
PacketWrapper equipmentPacket = wrapper.create(0x42);
|
||||
equipmentPacket.write(Type.VAR_INT, entityId);
|
||||
equipmentPacket.write(Type.VAR_INT, i);
|
||||
equipmentPacket.write(Type.FLAT_VAR_INT_ITEM, null);
|
||||
equipmentPacket.send(Protocol1_13_2To1_14.class, true, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Entity teleport
|
||||
protocol.registerOutgoing(State.PLAY, 0x56, 0x50, new PacketRemapper() {
|
||||
@Override
|
||||
|
@ -133,10 +133,8 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
||||
|
||||
registerOutgoing(State.PLAY, 0x43, 0x4E);
|
||||
registerOutgoing(State.PLAY, 0x44, 0x43);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x46, 0x45);
|
||||
registerOutgoing(State.PLAY, 0x47, 0x46);
|
||||
|
||||
registerOutgoing(State.PLAY, 0x49, 0x48);
|
||||
registerOutgoing(State.PLAY, 0x4A, 0x49);
|
||||
registerOutgoing(State.PLAY, 0x4B, 0x4A);
|
||||
@ -144,7 +142,6 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
||||
registerOutgoing(State.PLAY, 0x4D, 0x4C);
|
||||
registerOutgoing(State.PLAY, 0x4E, 0x4D);
|
||||
|
||||
|
||||
cancelIncoming(State.PLAY, 0x27); // Set jigsaw
|
||||
registerIncoming(State.PLAY, 0x10, 0x0F);
|
||||
registerIncoming(State.PLAY, 0x11, 0x10);
|
||||
@ -169,7 +166,6 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol {
|
||||
registerIncoming(State.PLAY, 0x24, 0x23);
|
||||
registerIncoming(State.PLAY, 0x25, 0x24);
|
||||
registerIncoming(State.PLAY, 0x26, 0x25);
|
||||
|
||||
registerIncoming(State.PLAY, 0x29, 0x28);
|
||||
registerIncoming(State.PLAY, 0x2A, 0x29);
|
||||
registerIncoming(State.PLAY, 0x2B, 0x2A);
|
||||
|
@ -149,19 +149,14 @@ public class BlockItemPackets1_16 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
if (chunk.isBiomeData()) {
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
int biome = chunk.getBiomeData()[i];
|
||||
int newId = -1;
|
||||
switch (biome) {
|
||||
case 170: // new nether biomes
|
||||
case 171:
|
||||
case 172:
|
||||
case 173:
|
||||
newId = 8;
|
||||
chunk.getBiomeData()[i] = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
if (newId != -1) {
|
||||
chunk.getBiomeData()[i] = newId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user