0
0
mirror of https://github.com/PaperMC/Paper.git synced 2024-11-22 04:56:29 +00:00
Paper/patches/server/1013-Remove-set-damage-lootable-item-function-from-compas.patch
Spottedleaf 8c5b837e05 Rework async chunk api implementation
Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.

Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.

Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.

Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.

Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
2024-11-18 23:00:59 -08:00

42 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Newwind <support@newwindserver.com>
Date: Thu, 22 Aug 2024 22:55:37 +0200
Subject: [PATCH] Remove set damage lootable item function from compasses
In VanillaChestLoot, compasses accidentally have a setdamage loot
function on them, but compasses don't take durability, resulting in a warning.
This patch simply removes attempting to add damage to the compass item.
diff --git a/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java b/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java
index 096899338640bb8a7052db06bf55e9fe33bf1cbe..cff6b265622701266349b6cf68eb874aa6fb6321 100644
--- a/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java
+++ b/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java
@@ -946,7 +946,6 @@ public record VanillaChestLoot(HolderLookup.Provider registries) implements Loot
.add(
LootItem.lootTableItem(Items.COMPASS)
.apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F)))
- .apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.15F, 0.8F)))
.setWeight(1)
)
.add(LootItem.lootTableItem(Items.BUCKET).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))).setWeight(1))
diff --git a/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json b/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json
index b5f5415a9f8bbb9d59926dc6c09e4a12dce2e9b9..fea6273ab4fe2383101f351a13d127e615b81d71 100644
--- a/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json
+++ b/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json
@@ -70,15 +70,6 @@
"add": false,
"count": 1.0,
"function": "minecraft:set_count"
- },
- {
- "add": false,
- "damage": {
- "type": "minecraft:uniform",
- "max": 0.8,
- "min": 0.15
- },
- "function": "minecraft:set_damage"
}
],
"name": "minecraft:compass"