mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 14:38:50 +00:00
Send entity metadata immediately, don't wait for ServerEntity
This commit is contained in:
1 parent
e31de4bed7
commit
a503db81ea
1 file changed
+12
-28
@@ -1051,51 +1051,35 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
|||||||
@Override
|
@Override
|
||||||
public void handleSetEntityData(ClientboundSetEntityDataPacket clientboundSetEntityDataPacket) {
|
public void handleSetEntityData(ClientboundSetEntityDataPacket clientboundSetEntityDataPacket) {
|
||||||
Entity entity = this.getEntityOrPending(clientboundSetEntityDataPacket.id());
|
Entity entity = this.getEntityOrPending(clientboundSetEntityDataPacket.id());
|
||||||
if (entity == null) {
|
forward(entity, clientboundSetEntityDataPacket);
|
||||||
forward(clientboundSetEntityDataPacket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: SynchedEntityData#assignValues isn't used because it doesn't mark the value as dirty
|
if (entity != null) {
|
||||||
|
entity.getEntityData().assignValues(clientboundSetEntityDataPacket.packedItems());
|
||||||
SynchedEntityData entityData = entity.getEntityData();
|
|
||||||
for (SynchedEntityData.DataValue<?> dataValue : clientboundSetEntityDataPacket.packedItems()) {
|
|
||||||
if (dataValue.id() >= entityData.itemsById.length) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SynchedEntityData.DataItem<?> dataItem = entityData.itemsById[dataValue.id()];
|
|
||||||
entityData.set((EntityDataAccessor) dataItem.getAccessor(), dataValue.value(), true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleSetEntityMotion(ClientboundSetEntityMotionPacket clientboundSetEntityMotionPacket) {
|
public void handleSetEntityMotion(ClientboundSetEntityMotionPacket clientboundSetEntityMotionPacket) {
|
||||||
Entity entity = this.getEntityOrPending(clientboundSetEntityMotionPacket.getId());
|
Entity entity = this.getEntityOrPending(clientboundSetEntityMotionPacket.getId());
|
||||||
if (entity == null) {
|
forward(entity, clientboundSetEntityMotionPacket);
|
||||||
forward(clientboundSetEntityMotionPacket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double motionX = clientboundSetEntityMotionPacket.getXa();
|
if (entity != null) {
|
||||||
double motionY = clientboundSetEntityMotionPacket.getYa();
|
double motionX = clientboundSetEntityMotionPacket.getXa();
|
||||||
double motionZ = clientboundSetEntityMotionPacket.getZa();
|
double motionY = clientboundSetEntityMotionPacket.getYa();
|
||||||
entity.setDeltaMovement(motionX, motionY, motionZ);
|
double motionZ = clientboundSetEntityMotionPacket.getZa();
|
||||||
entity.hasImpulse = true;
|
entity.setDeltaMovement(motionX, motionY, motionZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleSetEquipment(ClientboundSetEquipmentPacket clientboundSetEquipmentPacket) {
|
public void handleSetEquipment(ClientboundSetEquipmentPacket clientboundSetEquipmentPacket) {
|
||||||
Entity entity = this.getEntityOrPending(clientboundSetEquipmentPacket.getEntity());
|
Entity entity = this.getEntityOrPending(clientboundSetEquipmentPacket.getEntity());
|
||||||
if (entity == null) {
|
forward(entity, clientboundSetEquipmentPacket);
|
||||||
forward(clientboundSetEquipmentPacket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (entity instanceof LivingEntity livingEntity) {
|
if (entity instanceof LivingEntity livingEntity) {
|
||||||
clientboundSetEquipmentPacket.getSlots().forEach((pair) -> {
|
clientboundSetEquipmentPacket.getSlots().forEach((pair) -> {
|
||||||
livingEntity.setItemSlot(pair.getFirst(), pair.getSecond());
|
livingEntity.setItemSlot(pair.getFirst(), pair.getSecond());
|
||||||
});
|
});
|
||||||
forward(entity, clientboundSetEquipmentPacket);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user