Copy item in Particle#copy (#4130)

This commit is contained in:
RK_01 2024-08-29 23:28:39 +02:00 committed by GitHub
parent 7cd5514b90
commit 0b2dac9056
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,7 @@
*/ */
package com.viaversion.viaversion.api.minecraft; package com.viaversion.viaversion.api.minecraft;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.util.IdHolder; import com.viaversion.viaversion.util.IdHolder;
@ -118,7 +119,11 @@ public final class Particle implements IdHolder {
} }
public ParticleData<T> copy() { public ParticleData<T> copy() {
return new ParticleData<>(type, value); if (value instanceof Item item) {
return new ParticleData<>(type, (T) item.copy());
} else {
return new ParticleData<>(type, value);
}
} }
@Override @Override