1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
package net.minecraft.server;
import java.io.File;
import java.util.*;
import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockPhysicsEvent;
public class WorldServer extends World {
public ChunkProviderServer A;
public boolean B;
public boolean C;
private MinecraftServer D;
private MCHashTable E;
private final CraftWorld world; // CraftBukkit
private final CraftServer server; // CraftBukkit
public WorldServer(MinecraftServer minecraftserver, File file, String s, int i) {
super(file, s, (new Random()).nextLong(), WorldProvider.a(i));
B = false;
E = new MCHashTable();
D = minecraftserver;
world = new CraftWorld(this); // CraftBukkit
server = minecraftserver.server; // CraftBukkit
}
// CraftBukkit start
@Override
public boolean c(int i1, int j1, int k1, int l1) {
boolean result = super.c(i1, j1, k1, l1);
world.updateBlock(i1, j1, k1);
return result;
}
@Override
public boolean d(int i1, int j1, int k1, int l1) {
boolean result = super.d(i1, j1, k1, l1);
world.updateBlock(i1, j1, k1);
return result;
}
public CraftWorld getWorld() {
return world;
}
public void callHook(Event event) {
server.getPluginManager().callEvent(event);
}
// CraftBukkit stop
// CraftBukkit start - note: the following methods are straight from the
// World.java with tweaks as noted. KEEP THEM UPDATED!
@Override
public void g(int i1, int j1, int k1, int l1) {
k(i1 - 1, j1, k1, l1);
k(i1 + 1, j1, k1, l1);
k(i1, j1 - 1, k1, l1);
k(i1, j1 + 1, k1, l1);
k(i1, j1, k1 - 1, l1);
k(i1, j1, k1 + 1, l1);
}
private void k(int i1, int j1, int k1, int l1) {
if (i || z) {
return;
}
Block block = Block.m[a(i1, j1, k1)];
if (block != null) {
// CraftBukkit start
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i1, j1, k1), l1);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// CraftBukkit stop
block.b(this, i1, j1, k1, l1);
}
}
// CraftBukkit stop
public void f() {
super.f();
}
public void a(Entity entity, boolean flag) {
if (!D.m && (entity instanceof EntityAnimals)) {
entity.l();
}
if (entity.j == null || !(entity.j instanceof EntityPlayer)) {
super.a(entity, flag);
}
}
public void b(Entity entity, boolean flag) {
super.a(entity, flag);
}
protected IChunkProvider a(File file) {
A = new ChunkProviderServer(this, q.a(file), q.c());
return A;
}
public List d(int i, int j, int k, int l, int i1, int j1) {
ArrayList arraylist = new ArrayList();
for (int k1 = 0; k1 < c.size(); k1++) {
TileEntity tileentity = (TileEntity) c.get(k1);
if (tileentity.b >= i && tileentity.c >= j && tileentity.d >= k && tileentity.b < l && tileentity.c < i1 && tileentity.d < j1) {
arraylist.add(tileentity);
}
}
return arraylist;
}
public boolean a(EntityPlayer entityplayer, int i, int j, int k) {
int l = (int) MathHelper.e(i - m);
int i1 = (int) MathHelper.e(k - o);
if (l > i1) {
i1 = l;
}
return i1 > 16 || D.f.g(entityplayer.aw);
}
protected void b(Entity entity) {
super.b(entity);
E.a(entity.g, entity);
}
protected void c(Entity entity) {
super.c(entity);
E.d(entity.g);
}
public Entity a(int i) {
return (Entity) E.a(i);
}
public void a(Entity entity, byte byte0) {
Packet38 packet38 = new Packet38(entity.g, byte0);
D.k.b(entity, packet38);
}
public Explosion a(Entity entity, double d1, double d2, double d3,
float f1, boolean flag) {
Explosion explosion = super.a(entity, d1, d2, d3, f1, flag);
D.f.a(d1, d2, d3, 64D, new Packet60(d1, d2, d3, f1, explosion.g));
return explosion;
}
}
|