Fix IDs of Multi-part entities being desynced across client and server. (#8576)

This commit is contained in:
Meldexun authored and GitHub committed 2022-05-03 18:29:21 +01:00
1 parent 168a3bc6fc
commit aafa34439a
2 files changed
+26 -7

No files matched your search

@@ -1,5 +1,20 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -107,6 +_,14 @@
}
this.f_31074_ = new EnderDragonPhaseManager(this);
+ this.m_20234_(f_19843_.getAndAdd(this.f_31089_.length + 1) + 1); // Forge: Fix MC-158205: Make sure part ids are successors of parent mob id
+ }
+
+ @Override
+ public void m_20234_(int p_20235_) {
+ super.m_20234_(p_20235_);
+ for (int i = 0; i < this.f_31089_.length; i++) // Forge: Fix MC-158205: Set part ids to successors of parent mob id
+ this.f_31089_[i].m_20234_(p_20235_ + i + 1);
}
public static AttributeSupplier.Builder m_31167_() {
@@ -150,7 +_,11 @@
return adouble;
}
@@ -41,12 +56,10 @@
}
if (this.f_31073_ != null) {
@@ -847,6 +_,16 @@
public boolean m_6072_() {
@@ -849,8 +_,19 @@
return false;
+ }
+
}
+ @Override
+ public boolean isMultipartEntity() {
+ return true;
@@ -55,6 +68,11 @@
+ @Override
+ public net.minecraftforge.entity.PartEntity<?>[] getParts() {
+ return this.f_31089_;
}
+ }
+
public void m_142223_(ClientboundAddMobPacket p_149572_) {
super.m_142223_(p_149572_);
+ if (true) return; // Forge: Fix MC-158205: Moved into setId()
EnderDragonPart[] aenderdragonpart = this.m_31156_();
for(int i = 0; i < aenderdragonpart.length; ++i) {
@@ -288,6 +288,7 @@ public net.minecraft.world.damagesource.DamageSource m_19381_()Lnet/minecraft/wo
public net.minecraft.world.damagesource.DamageSource m_19382_()Lnet/minecraft/world/damagesource/DamageSource; # bypassMagic
public net.minecraft.world.damagesource.DamageSource m_19383_()Lnet/minecraft/world/damagesource/DamageSource; # setIsFire
#endgroup
protected net.minecraft.world.entity.Entity f_19843_ # ENTITY_COUNTER
public net.minecraft.world.entity.Entity m_20078_()Ljava/lang/String; # getEncodeId
public net.minecraft.world.entity.ExperienceOrb f_20770_ # value
public net.minecraft.world.entity.Mob f_21345_ # goalSelector