Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
1358d1e914
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 881e06e5 PR-725: Add Item Unlimited Lifetime APIs CraftBukkit Changes: 74c08312 SPIGOT-6962: Call EntityChangeBlockEvent when when FallingBlockEntity starts to fall 64db5126 SPIGOT-6959: Make /loot command ignore empty items for spawn 2d760831 Increase outdated build delay 9ed7e4fb SPIGOT-6138, SPIGOT-6415: Don't call CreatureSpawnEvent after cross-dimensional travel fc4ad813 SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 59733a2e SPIGOT-6961: Actually return a copy of the ItemMeta Spigot Changes: ffceeae3 SPIGOT-6956: Drop unload queue patch as attempt at fixing stop issue e19ddabd PR-1011: Add Item Unlimited Lifetime APIs 34d40b0e SPIGOT-2942: give command fires PlayerDropItemEvent, cancelling it causes Item Duplication
42 Zeilen
3.1 KiB
Diff
42 Zeilen
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
Date: Thu, 12 Aug 2021 21:15:38 -0700
|
|
Subject: [PATCH] Fix block drops position losing precision millions of blocks
|
|
out
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
index 17c369b49272ac72119708b507e6fa119343706e..6b4cd795f23bd8d51dff5f2b72f588ca51404b99 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -344,9 +344,11 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
|
|
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
|
|
float f = EntityType.ITEM.getHeight() / 2.0F;
|
|
- double d0 = (double) ((float) pos.getX() + 0.5F) + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
|
- double d1 = (double) ((float) pos.getY() + 0.5F) + Mth.nextDouble(world.random, -0.25D, 0.25D) - (double) f;
|
|
- double d2 = (double) ((float) pos.getZ() + 0.5F) + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
|
+ // Paper start - don't convert potentially massive numbers to floats
|
|
+ double d0 = pos.getX() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
|
+ double d1 = pos.getY() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D) - (double) f;
|
|
+ double d2 = pos.getZ() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
|
|
+ // Paper end
|
|
|
|
Block.popResource(world, () -> {
|
|
return new ItemEntity(world, d0, d1, d2, stack);
|
|
@@ -359,9 +361,11 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
int k = direction.getStepZ();
|
|
float f = EntityType.ITEM.getWidth() / 2.0F;
|
|
float f1 = EntityType.ITEM.getHeight() / 2.0F;
|
|
- double d0 = (double) ((float) pos.getX() + 0.5F) + (i == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) i * (0.5F + f)));
|
|
- double d1 = (double) ((float) pos.getY() + 0.5F) + (j == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) j * (0.5F + f1))) - (double) f1;
|
|
- double d2 = (double) ((float) pos.getZ() + 0.5F) + (k == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) k * (0.5F + f)));
|
|
+ // Paper start - don't convert potentially massive numbers to floats
|
|
+ double d0 = pos.getX() + 0.5D + (i == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) i * (0.5F + f)));
|
|
+ double d1 = pos.getY() + 0.5D + (j == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) j * (0.5F + f1))) - (double) f1;
|
|
+ double d2 = pos.getZ() + 0.5D + (k == 0 ? Mth.nextDouble(world.random, -0.25D, 0.25D) : (double) ((float) k * (0.5F + f)));
|
|
+ // Paper end
|
|
double d3 = i == 0 ? Mth.nextDouble(world.random, -0.1D, 0.1D) : (double) i * 0.1D;
|
|
double d4 = j == 0 ? Mth.nextDouble(world.random, 0.0D, 0.1D) : (double) j * 0.1D + 0.1D;
|
|
double d5 = k == 0 ? Mth.nextDouble(world.random, -0.1D, 0.1D) : (double) k * 0.1D;
|