Bug fixes
- Ports fabric disconnect fix to neoforge - Fixes console error when trying to pickup non owned tamable mobs.
This commit is contained in:
parent
5cf2e87fe8
commit
d35cb4ed72
|
|
@ -32,6 +32,8 @@ import net.minecraft.world.effect.MobEffects;
|
|||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.Entity.RemovalReason;
|
||||
import net.minecraft.world.entity.EntityReference;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.TamableAnimal;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
|
|
@ -172,10 +174,13 @@ public class PickupHandler {
|
|||
|
||||
if (entity instanceof TamableAnimal tame)
|
||||
{
|
||||
UUID owner = tame.getOwnerReference().getUUID();
|
||||
UUID playerID = player.getGameProfile().id();
|
||||
if (owner != null && !owner.equals(playerID))
|
||||
return false;
|
||||
EntityReference<LivingEntity> ref = tame.getOwnerReference();
|
||||
if (ref != null) {
|
||||
UUID owner = tame.getOwnerReference().getUUID();
|
||||
UUID playerID = player.getGameProfile().id();
|
||||
if (!owner.equals(playerID))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!ListHandler.isPermitted(entity))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@ public class CarryOnDataSyncHandler implements AttachmentSyncHandler<CarryOnData
|
|||
|
||||
@Override
|
||||
public boolean sendToPlayer(IAttachmentHolder holder, ServerPlayer to) {
|
||||
if (to.connection == null || to.isRemoved())
|
||||
ServerPlayer player = (ServerPlayer) holder;
|
||||
// the isAlive check avoids us syncing attachment data about dead players. Which causes a disconnect
|
||||
// player.tickCount <= 0 avoids us syncing attachment data about players the instant they spawn.
|
||||
// Which also causes a disconnect as the player entity may not be synced yet.
|
||||
if (to.connection == null || !player.isAlive() || player.tickCount <= 0)
|
||||
return false;
|
||||
return AttachmentSyncHandler.super.sendToPlayer(holder, to);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user