Upstream has released updates that appear to apply and compile correctly PaperMC/Paper@42a9c37 Move Adventure patch up PaperMC/Paper@1d7a6a0 Add missing glow_item_frame walkers PaperMC/Paper@f9b05cc Expose furnace minecart push property. (#7548) PaperMC/Paper@9351513 Fix handling message in PlayerHandshakeEvent (#7542) PaperMC/Paper@6564f70 Fix cancelling ProjectileHitEvent for piercing arrows (#7492) PaperMC/Paper@196271d Fix save problems on shutdown PaperMC/Paper@1e12cf8 Add more to the save fixes PaperMC/Paper@a36d7f6 Updated Upstream (CraftBukkit) PaperMC/Paper@7b9c30f Fix scoreboard objective name length limit PaperMC/Paper@d9bf5e7 Add method to set noclip on arrows (#7263) PaperMC/Paper@c34fb09 Add ghast api (#7554) PaperMC/Paper@e0b3f3f Adventure 4.10.1 PaperMC/Paper@718fab1 Add CPU name and JVM vendor info in timings (#7490) PaperMC/Paper@7a21333 Fix setting the view distance to 32 (#7503) PaperMC/Paper@4423e12 Update docs link in paper.yml (#7562) PaperMC/Paper@b55ba19 Update README for new docs (#7561) PaperMC/Paper@657d163 Prevent despawned navigators being readded (#7574) PaperMC/Paper@d714682 Add more entity api (#7564) PaperMC/Paper@1790528 More projectile API (#5731) PaperMC/Paper@ea1efef Remove Patches (#7541) PaperMC/Paper@aab1f8a Fix swamp hut cat generation deadlock PaperMC/Paper@dc96bba Ensure the item sent isn't air (#7584) PaperMC/Paper@bfa33d9 Various improvements to console color formatting (#7560) PaperMC/Paper@87927e1 Fix CreativeCategory API (#7586) PaperMC/Paper@ab03538 Fix colors in some console messages PaperMC/Paper@1358d1e Updated Upstream (CraftBukkit/Spigot) (#7580) PaperMC/Paper@b65b48f [ci skip] Update gradle wrapper PaperMC/Paper@1ce3555 [ci-skip] Fix typo in feature request issue template (#7593) PaperMC/Paper@c8e49cc Add get/set wait time for fish hooks. (#5595) PaperMC/Paper@a5be178 Use correct toX/Y/Z in player move packet handling PaperMC/Paper@0ca80c7 Add getComputedBiome API (#5668) PaperMC/Paper@2d3e8f7 Properly lookup random-ticked precipitation blocks (#7606) PaperMC/Paper@f35a0ce Remove Java version check once and for all (#7612) PaperMC/Paper@1c5f8b0 Updated Upstream (Bukkit/CraftBukkit) (#7604) PaperMC/Paper@f0d0078 Add debug for invalid GameProfiles on skull blocks/items (#7512) PaperMC/Paper@8788bf7 fix datapacks not being able to modify nether/end (#7588) PaperMC/Paper@b8c90d2 Added method to check snapshot state of TileStates (#7325) PaperMC/Paper@8897cea Add enchantWithLevels API (#7615) PaperMC/Paper@2eeca6f Fix world saving in unloadWorld PaperMC/Paper@319d5fa Fix state locking for getTopMRUProfiles & getProfileIfCached PaperMC/Paper@bc68ee0 Remove redundant GameProfileCache diff PaperMC/Paper@855637f Updated Upstream (CraftBukkit) (#7624) PaperMC/Paper@5eb61dd Buffer OOB setBlock calls PaperMC/Paper@7b46444 Properly create profiles with custom name/uuid (#7558) PaperMC/Paper@a686ff5 Add more missing entity API (#7592) PaperMC/Paper@993f828 Add TameableDeathMessageEvent (#5392) PaperMC/Paper@a939d6e Fix generator settings string for flat-type worlds (#7568) PaperMC/Paper@ab666a4 Deprecating remaining blockkey methods (#7638) PaperMC/Paper@e7d928a Fix EntityChangeBlockEvent#getBlockData for when sheep eats grass block (#7646) PaperMC/Paper@e2f743d Fix PalettedContainer synchronization (#7663) PaperMC/Paper@7fa8870 Updated Upstream (Bukkit/CraftBukkit) (#7672) PaperMC/Paper@fa68bb1 Fix entity position desync for hanging entities (#7659) PaperMC/Paper@d3c1023 fix player loottables running when mob loot gamerule is false (#7651) PaperMC/Paper@7f47b9b Remove KeyedObject interface (#7680) PaperMC/Paper@7bf9446 Add per player chunk loading limits PaperMC/Paper@04c7b16 Undeprecate Material#isLegacy (#7679) PaperMC/Paper@443c506 Fix Nullability Annotations for PrepareItemEnchantEvent (#7681) PaperMC/Paper@ea2c81e Fix lectern quick move PaperMC/Paper@87e11bf Cache resource keys instead of trying to create them (#7643) PaperMC/Paper@820e9ca Update decompiler & param mappings PaperMC/Paper@92426e3 Update Gradle wrapper PaperMC/Paper@62dcff3 Update actions PaperMC/Paper@2914457 Allow seting custom podium location for ender dragon (#7695) PaperMC/Paper@11e0dcd Fix NBT pieces overriding a block entity during worldgen deadlock (#7692) PaperMC/Paper@2f16393 Updated Upstream (CraftBukkit) PaperMC/Paper@4322c05 Use patched spigot decompiler (#7706) PaperMC/Paper@f8e8d6c Strip enderpearl owners when they are no longer ticked (#7559) PaperMC/Paper@e42d683 Fix StructureGrowEvent species for RED_MUSHROOM PaperMC/Paper@a9ee104 Prevent tile entity copies loading chunks PaperMC/Paper@d4a712d [CI-SKIP] Remove unused import from last patch PaperMC/Paper@a9f252e Replace third party repos with Paper repo (#7733) PaperMC/Paper@b8fa41e [ci skip] Remove Mojang repo from test-plugin PaperMC/Paper@c6e631a Use username instead of display name in PlayerList#getPlayerStats (#7740) PaperMC/Paper@1cfd363 Updated Upstream (Bukkit/CraftBukkit/Spigot) PaperMC/Paper@af94364 Fix slime spawners not spawning outside slime chunks (#7741) PaperMC/Paper@6b9f7a0 Don't fire worldborder events for virtual borders (#7749) PaperMC/Paper@8bfb1d2 Pass ServerLevel for gamerule callbacks (#7668) PaperMC/Paper@c66b0f9 Add pre-unbreaking amount to PlayerItemDamageEvent (#7724) PaperMC/Paper@86fb3d2 Don't send itemmeta for books with the hide option enabled (#7734) PaperMC/Paper@c642d25 Improve update folder behavior (#7687) PaperMC/Paper@c7d4c01 Ignore invalid jars inside of the updates folder (Fixes #7751) PaperMC/Paper@4ecc338 WorldCreator#keepSpawnLoaded (#7673) PaperMC/Paper@873bfa6 Remove World#refreshChunk deprecation (#7684) PaperMC/Paper@76ed156 Grant temporary immunity from EAR to moving entities (Fixes #7637) (#7644) PaperMC/Paper@567fce6 Don't apply previous potion when item is potion (fixes #7756) (#7757) PaperMC/Paper@c449f6a Build updates PaperMC/Paper@ef6a1a5 Revert to old createProfile(UUID, String) logic (#7723) PaperMC/Paper@0f8aa4e Fix NPE for BlockDataMeta#getBlockData (#7670) PaperMC/Paper@16f224a Trigger bee_nest_destroyed trigger in the correct place (#7436) PaperMC/Paper@caf4a6f Remove or replace a few dumb deprecations (#7760) PaperMC/Paper@47f43da Add missing javadoc deprecation msgs for PlayerProfile (#7688) PaperMC/Paper@fbbc03a Add EntityDyeEvent and CollarColorable interface (#7625) PaperMC/Paper@5b85ee3 Fire CauldronLevelChange on initial fill (#7678) PaperMC/Paper@4dc78ae Fix some team color docs and added hasColor (#7602) PaperMC/Paper@0bf7c95 Fix opening inv in PlayerRecipeBookClickEvent handler (#7552) PaperMC/Paper@d70ac03 fix powder snow cauldrons not turning to water (#7229) PaperMC/Paper@ce059b4 Fix V1451 dataconverter stat types PaperMC/Paper@6f5e6c6 Use setMessage instead of arraycopy PaperMC/Paper@608482d cleanup filtered sign text (#7777) PaperMC/Paper@4166632 Updated Upstream (Bukkit/CraftBukkit) (#7776) PaperMC/Paper@e564110 Couple fixes/improvements to PlayerSetSpawnEvent (#6754) PaperMC/Paper@e5da93a Deprecate duplicate SoundGroup API (#7509) PaperMC/Paper@2ab0258 Use mojang item ids for alternative item despawn rate (#6997) PaperMC/Paper@f6a69de Undeprecate getOfflinePlayer (#7773) PaperMC/Paper@a117da6 Add PlayerStopUsingItemEvent (#7787) PaperMC/Paper@f3a8a0b FallingBlock auto expire setting (#7037) PaperMC/Paper@4219389 Don't tick markers (#7299) PaperMC/Paper@2515bc4 Improve configurable door difficulty (#6985) PaperMC/Paper@8c9d98e Clean unused field for Configurable door breaking difficulty (#7793) PaperMC/Paper@b831784 Only log for passenger / vehicle world mismatch PaperMC/Paper@7a6163b Add Alternate Current's redstone implementation as an alternative to Vanilla and Eigencraft's. (#7701) PaperMC/Paper@1a17a83 Move redstone config changes to Eigencraft patch PaperMC/Paper@87d2eb2 Fix door breaking difficulty defaults for vindicator (#7795) PaperMC/Paper@e399754 Do not accept invalid client settings PaperMC/Paper@268476b Fix whitespace error in Alternate Current patch PaperMC/Paper@18f0f8d Updated Upstream (Bukkit/CraftBukkit/Spigot) PaperMC/Paper@5928327 Remove unneeded patch (#7806) PaperMC/Paper@9fd870d Fix cancelling PlayerItemFrameChangeEvent (#7761) PaperMC/Paper@8d1de8d deprecate old MaterialData api (#7585) PaperMC/Paper@0116751 List world on tile entity placement exception (#7709) PaperMC/Paper@73bd35d Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@7045f18 Change link to screamingsandals PaperMC/Paper@ca62386 Hide ores with deepslate at Y=4 and below (#7792) PaperMC/Paper@9b492cf Deprecate set/doesBounce from Projectile (#7800) PaperMC/Paper@ed4e916 [ci-skip] Update repository and API urls (#7835) PaperMC/Paper@fc1752f Fix more upstream javadocs (#7837) PaperMC/Paper@123cad5 Remove incorrect parent perm from debugstick.always (#7846) PaperMC/Paper@d8108b5 team color parameter may be null, causing NPE PaperMC/Paper@31ccc57 Add support for Proxy Protocol (#7710) PaperMC/Paper@a90092e Updated Upstream (CraftBukkit/Spigot) (#7848) PaperMC/Paper@79e07f3 Fix addPassenger for Marker (#7762) PaperMC/Paper@182a609 Fix duplicate world keys via createWorld (#7614) PaperMC/Paper@b6a6544 Provide ComponentSerializer services (#7527) PaperMC/Paper@3f7fbe3 Fix cb's janky level name in WorldCreator (#7851) PaperMC/Paper@af3b377 Update ForgeFlower (#7857) PaperMC/Paper@9667181 Fix OfflinePlayer#getBedSpawnLocation (#7861) PaperMC/Paper@c123915 Fix FurnaceInventory for smokers and blast furnaces (#7249) PaperMC/Paper@f7382f5 Remove unneeded UOE when copying biome sources (#7629) PaperMC/Paper@6b035fd Update default vanilla command perms (#7386) PaperMC/Paper@f210f67 Update the rewriteForIde for new cb package version (#7242) PaperMC/Paper@3f7111d Fix EntityEquipment and related javadocs (#7380) PaperMC/Paper@78e6431 Add default kick msg component (#6886) PaperMC/Paper@04e1b07 Check HAProxyMessage type is PROXY (#7864) PaperMC/Paper@00c6ae8 Implement Translatable on CreativeCategory (#7587) PaperMC/Paper@7602dd2 Sanitize Sent BlockEntity NBT (#7010) PaperMC/Paper@2d17a50 Add translation keys to GameMode enum (#7081) PaperMC/Paper@c5caee3 Prevent entity loading causing async lookups (#7553) PaperMC/Paper@71fe3c6 Add numeric string completion suggestions as int suggestions (#6360) PaperMC/Paper@b1ac25f Respect x-ray permission in World#refreshChunk (#7214) PaperMC/Paper@1d08ce8 Disable book selector resolving by default PaperMC/Paper@80d5e71 Updated Upstream (Bukkit) PaperMC/Paper@2033dba Updated Upstream (CraftBukkit) PaperMC/Paper@a3ad720 Remove ChatColor usages (#7543) PaperMC/Paper@8fc0999 Fix some nullability things (#7275) PaperMC/Paper@fd069dd Remove incorrect throws javadoc in Team (#7869) PaperMC/Paper@bed5cb2 Limit resolved selectors when enabled PaperMC/Paper@4d83ed0 [ci skip] Changing the order of the rebase with autosquash command in the contributing.md (#6974) PaperMC/Paper@071a4a2 throw exception if worlds are created while being ticked (#7653) PaperMC/Paper@5b6397a Make leave messages for kicks the same as for quitting (#7874) PaperMC/Paper@5befb55 Updated Upstream (Bukkit/CraftBukkit) (#7875) PaperMC/Paper@b3deb25 Move some methods to RegionAccessor (#7635) PaperMC/Paper@d8ef841 [DataConverter] Fix generator options parsing PaperMC/Paper@4b27254 Fix treasure maps discovered settings (#7627) PaperMC/Paper@276d830 Fix campfire walker in V1920 PaperMC/Paper@3925a53 Make timings link clickable (#7944)
76 lines
4.1 KiB
Diff
76 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: lexikiq <noellekiq@gmail.com>
|
|
Date: Sat, 19 Jun 2021 01:14:13 -0400
|
|
Subject: [PATCH] Add PlayerUseRespawnAnchorEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
|
index 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c22e3f515 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
|
@@ -51,23 +51,48 @@ public class RespawnAnchorBlock extends Block {
|
|
@Override
|
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
|
ItemStack itemStack = player.getItemInHand(hand);
|
|
+
|
|
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
|
+ org.bukkit.entity.Player bukkitPlayer = player.getBukkitEntity() instanceof org.bukkit.entity.Player ? (org.bukkit.entity.Player) player.getBukkitEntity() : null;
|
|
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
|
|
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult result;
|
|
+ // Parchment end
|
|
if (hand == InteractionHand.MAIN_HAND && !isRespawnFuel(itemStack) && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) {
|
|
return InteractionResult.PASS;
|
|
} else if (isRespawnFuel(itemStack) && canBeCharged(state)) {
|
|
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
|
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE;
|
|
+ } else if (state.getValue(CHARGE) == 0) {
|
|
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING;
|
|
+ } else if (!canSetSpawn(world) && !world.isClientSide) {
|
|
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.EXPLODE;
|
|
+ } else if (!world.isClientSide) {
|
|
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.SET_SPAWN;
|
|
+ } else {
|
|
+ return InteractionResult.SUCCESS;
|
|
+ }
|
|
+
|
|
+ if (bukkitPlayer != null) {
|
|
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent event = new gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent(bukkitPlayer, block, result);
|
|
+ event.callEvent();
|
|
+ result = event.getResult();
|
|
+ }
|
|
+
|
|
+ if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING) {
|
|
+ return InteractionResult.PASS;
|
|
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE) {
|
|
+ // Parchment end
|
|
charge(world, pos, state);
|
|
if (!player.getAbilities().instabuild) {
|
|
itemStack.shrink(1);
|
|
}
|
|
|
|
return InteractionResult.sidedSuccess(world.isClientSide);
|
|
- } else if (state.getValue(CHARGE) == 0) {
|
|
- return InteractionResult.PASS;
|
|
- } else if (!canSetSpawn(world)) {
|
|
- if (!world.isClientSide) {
|
|
- this.explode(state, world, pos);
|
|
- }
|
|
-
|
|
- return InteractionResult.sidedSuccess(world.isClientSide);
|
|
+ // Parchment start -- PlayerUseRespawnAnchorEvent
|
|
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.EXPLODE) {
|
|
+ this.explode(state, world, pos);
|
|
+ return InteractionResult.CONSUME;
|
|
+ // Parchment end
|
|
} else {
|
|
if (!world.isClientSide) {
|
|
ServerPlayer serverPlayer = (ServerPlayer)player;
|
|
@@ -82,7 +107,6 @@ public class RespawnAnchorBlock extends Block {
|
|
// Paper end
|
|
}
|
|
}
|
|
-
|
|
return InteractionResult.CONSUME;
|
|
}
|
|
}
|