aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0482-Fix-item-locations-dropped-from-campfires.patch
blob: b69c3396976340e6012fc9cd5f4d888d7059b539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 3 Oct 2020 20:32:25 -0500
Subject: [PATCH] Fix item locations dropped from campfires

Fixes #4259 by not flooring the blockposition among other weirdness

diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index ba4ce804d1d239ca842b06b3599605847effc35b..ca995270c9b8d7024504a9ba885b1c0214b33a8b 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -81,7 +81,11 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
                         result = blockCookEvent.getResult();
                         itemstack1 = CraftItemStack.asNMSCopy(result);
                         // CraftBukkit end
-                        Containers.dropItemStack(world, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), itemstack1);
+                    // Paper start
+                    net.minecraft.world.entity.item.ItemEntity droppedItem = new net.minecraft.world.entity.item.ItemEntity(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, itemstack1.split(world.random.nextInt(21) + 10));
+                    droppedItem.setDeltaMovement(world.random.nextGaussian() * 0.05D, world.random.nextGaussian() * 0.05D + 0.2D, world.random.nextGaussian() * 0.05D);
+                    world.addFreshEntity(droppedItem);
+                    // Paper end
                         campfire.items.set(i, ItemStack.EMPTY);
                         world.sendBlockUpdated(pos, state, state, 3);
                         world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(state));