Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3// CraftBukkit start
4
5import org.bukkit.craftbukkit.block.CraftBlock;
6import org.bukkit.entity.Player;
7import org.bukkit.event.painting.PaintingPlaceEvent;
8// CraftBukkit end
9
10public class ItemPainting extends Item {
11
12 public ItemPainting(int i) {
13 super(i);
14 }
15
16 public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
17 if (l == 0) {
18 return false;
19 } else if (l == 1) {
20 return false;
21 } else {
22 byte b0 = 0;
23
24 if (l == 4) {
25 b0 = 1;
26 }
27
28 if (l == 3) {
29 b0 = 2;
30 }
31
32 if (l == 5) {
33 b0 = 3;
34 }
35
36 EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0);
37
38 if (entitypainting.h()) {
39 if (!world.isStatic) {
40 // CraftBukkit start
41 Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
42
43 org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
44 org.bukkit.block.BlockFace blockFace = CraftBlock.notchToBlockFace(l);
45
46 PaintingPlaceEvent event = new PaintingPlaceEvent((org.bukkit.entity.Painting) entitypainting.getBukkitEntity(), who, blockClicked, blockFace);
47 world.getServer().getPluginManager().callEvent(event);
48
49 if (event.isCancelled()) {
50 return false;
51 }
52 // CraftBukkit end
53 world.addEntity(entitypainting);
54 }
55
56 --itemstack.count;
57 }
58
59 return true;
60 }
61 }
62}