mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
062733b903
Doesn't compile yet. CraftBukkit Changes: 90d6905b Repackage NMS 69cf961d Repackage patches Spigot Changes: 79d53c28 Repackage NMS
47 lines
2.5 KiB
Diff
47 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MisterVector <whizkid3000@hotmail.com>
|
|
Date: Tue, 13 Aug 2019 19:45:06 -0700
|
|
Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.MovingObjectPositionBlock;
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
|
|
+import io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent; // Paper
|
|
+
|
|
public class BlockFlowerPot extends Block {
|
|
|
|
private static final Map<Block, Block> b = Maps.newHashMap();
|
|
@@ -0,0 +0,0 @@ public class BlockFlowerPot extends Block {
|
|
boolean flag1 = this.c == Blocks.AIR;
|
|
|
|
if (flag != flag1) {
|
|
+ // Paper start
|
|
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) entityhuman.getBukkitEntity();
|
|
+ boolean placing = flag1;
|
|
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition);
|
|
+ org.bukkit.inventory.ItemStack bukkititemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack);
|
|
+ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(c);
|
|
+ org.bukkit.inventory.ItemStack bukkititemstack1 = new org.bukkit.inventory.ItemStack(mat, 1);
|
|
+ org.bukkit.inventory.ItemStack whichitem = placing ? bukkititemstack : bukkititemstack1;
|
|
+
|
|
+ PlayerFlowerPotManipulateEvent event = new PlayerFlowerPotManipulateEvent(player, bukkitblock, whichitem, placing);
|
|
+ player.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ // Update client
|
|
+ player.sendBlockChange(bukkitblock.getLocation(), bukkitblock.getBlockData());
|
|
+ player.updateInventory();
|
|
+
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (flag1) {
|
|
world.setTypeAndData(blockposition, block.getBlockData(), 3);
|
|
entityhuman.a(StatisticList.POT_FLOWER);
|