aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0955-Broadcast-take-item-packets-with-collector-as-source.patch
blob: ad908f281cc569705841db3af8e056ce8d3ae8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: booky10 <boooky10@gmail.com>
Date: Sun, 29 Oct 2023 02:36:10 +0100
Subject: [PATCH] Broadcast take item packets with collector as source

This fixes players (which can't view the collector) seeing item pickups with themselves as the target.

diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cc82b269d422f6cd720021ba009606cab1b90590..d4fb052996d05668f1749d19b91e27044166f819 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3724,7 +3724,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
 
     public void take(Entity item, int count) {
         if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) {
-            ((ServerLevel) this.level()).getChunkSource().broadcast(item, new ClientboundTakeItemEntityPacket(item.getId(), this.getId(), count));
+            ((ServerLevel) this.level()).getChunkSource().broadcastAndSend(this, new ClientboundTakeItemEntityPacket(item.getId(), this.getId(), count)); // Paper - broadcast with collector as source
         }
 
     }