diff options
author | Spottedleaf <[email protected]> | 2024-07-17 10:24:53 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-07-17 10:28:32 -0700 |
commit | 00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6 (patch) | |
tree | 82639515bc5e9ae00c1e639e72137ed51e1ac688 /patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch | |
parent | 967f98aa81da851740aeb429778e46159fd188df (diff) | |
download | Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.tar.gz Paper-00b949f1bbbf444e2b5e7b8de7c9b14fbd2133c6.zip |
Remove Moonrise utils to MCUtils, remove duplicated/unused utils
Diffstat (limited to 'patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch')
-rw-r--r-- | patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch new file mode 100644 index 0000000000..85321a4a5b --- /dev/null +++ b/patches/server/0803-Add-CompostItemEvent-and-EntityCompostItemEvent.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Noah van der Aa <[email protected]> +Date: Sun, 8 Aug 2021 19:56:02 +0200 +Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +index 19fa8a9f935e9063497f8c0bd7909036fa0af2b7..d3d12f9114173f4971f95d7ef895a4374705bd3f 100644 +--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +@@ -336,7 +336,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL); + float f = ComposterBlock.COMPOSTABLES.getFloat(itemstack.getItem()); + +- if ((i != 0 || f <= 0.0F) && rand >= (double) f) { ++ // Paper start - Add CompostItemEvent and EntityCompostItemEvent ++ boolean willRaiseLevel = !((i != 0 || f <= 0.0F) && rand >= (double) f); ++ final io.papermc.paper.event.block.CompostItemEvent event; ++ if (entity == null) { ++ event = new io.papermc.paper.event.block.CompostItemEvent(org.bukkit.craftbukkit.block.CraftBlock.at(generatoraccess, blockposition), itemstack.getBukkitStack(), willRaiseLevel); ++ } else { ++ event = new io.papermc.paper.event.entity.EntityCompostItemEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(generatoraccess, blockposition), itemstack.getBukkitStack(), willRaiseLevel); ++ } ++ if (!event.callEvent()) { // check for cancellation of entity event (non entity event can't be cancelled cause of hoppers) ++ return null; ++ } ++ willRaiseLevel = event.willRaiseLevel(); ++ ++ if (!willRaiseLevel) { ++ // Paper end - Add CompostItemEvent and EntityCompostItemEvent + return iblockdata; + } else { + int j = i + 1; +@@ -485,6 +499,11 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { + if (!itemstack.isEmpty()) { + this.changed = true; + BlockState iblockdata = ComposterBlock.addItem((Entity) null, this.state, this.level, this.pos, itemstack); ++ // Paper start - Add CompostItemEvent and EntityCompostItemEvent ++ if (iblockdata == null) { ++ return; ++ } ++ // Paper end - Add CompostItemEvent and EntityCompostItemEvent + + this.level.levelEvent(1500, this.pos, iblockdata != this.state ? 1 : 0); + this.removeItemNoUpdate(0); |