mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 14:38:50 +00:00
Add workaround for mods that use non-standard entity spawn packets
This commit is contained in:
1 parent
193b6ef058
commit
fe33b55fc2
5 files changed
+62
-5
No files matched your search
@@ -959,7 +959,12 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
@Override
|
||||
public void handleRotateMob(ClientboundRotateHeadPacket clientboundRotateHeadPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundRotateHeadPacket.entityId);
|
||||
if (entity == null || entity.getId() == this.localPlayerId) {
|
||||
if (entity == null) {
|
||||
forward(clientboundRotateHeadPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.getId() == this.localPlayerId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1002,6 +1007,7 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
public void handleSetEntityData(ClientboundSetEntityDataPacket clientboundSetEntityDataPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundSetEntityDataPacket.id());
|
||||
if (entity == null) {
|
||||
forward(clientboundSetEntityDataPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1022,6 +1028,7 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
public void handleSetEntityMotion(ClientboundSetEntityMotionPacket clientboundSetEntityMotionPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundSetEntityMotionPacket.getId());
|
||||
if (entity == null) {
|
||||
forward(clientboundSetEntityMotionPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1035,6 +1042,10 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
@Override
|
||||
public void handleSetEquipment(ClientboundSetEquipmentPacket clientboundSetEquipmentPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundSetEquipmentPacket.getEntity());
|
||||
if (entity == null) {
|
||||
forward(clientboundSetEquipmentPacket);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof LivingEntity livingEntity) {
|
||||
clientboundSetEquipmentPacket.getSlots().forEach((pair) -> {
|
||||
livingEntity.setItemSlot(pair.getFirst(), pair.getSecond());
|
||||
@@ -1189,6 +1200,7 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
public void handleTeleportEntity(ClientboundTeleportEntityPacket clientboundTeleportEntityPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundTeleportEntityPacket.id());
|
||||
if (entity == null) {
|
||||
forward(clientboundTeleportEntityPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1217,6 +1229,10 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
@Override
|
||||
public void handleUpdateAttributes(ClientboundUpdateAttributesPacket clientboundUpdateAttributesPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundUpdateAttributesPacket.getEntityId());
|
||||
if (entity == null) {
|
||||
forward(clientboundUpdateAttributesPacket);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof LivingEntity livingEntity) {
|
||||
AttributeMap attributeMap = livingEntity.getAttributes();
|
||||
for (ClientboundUpdateAttributesPacket.AttributeSnapshot snapshot : clientboundUpdateAttributesPacket.getValues()) {
|
||||
@@ -1237,6 +1253,10 @@ public class ReplayGamePacketHandler implements ClientGamePacketListener {
|
||||
@Override
|
||||
public void handleUpdateMobEffect(ClientboundUpdateMobEffectPacket clientboundUpdateMobEffectPacket) {
|
||||
Entity entity = this.getEntityOrPending(clientboundUpdateMobEffectPacket.getEntityId());
|
||||
if (entity == null) {
|
||||
forward(clientboundUpdateMobEffectPacket);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof LivingEntity livingEntity) {
|
||||
Holder<MobEffect> holder = clientboundUpdateMobEffectPacket.getEffect();
|
||||
MobEffectInstance mobEffectInstance = new MobEffectInstance(holder, clientboundUpdateMobEffectPacket.getEffectDurationTicks(), clientboundUpdateMobEffectPacket.getEffectAmplifier(),
|
||||
|
||||
Reference in new issue
Block a user