-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
PatchTileEntity.java
52 lines (47 loc) · 1.5 KB
/
PatchTileEntity.java
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
package me.nallar.patched;
import me.nallar.tickthreading.patcher.Declare;
import me.nallar.tickthreading.util.concurrent.NativeMutex;
import net.minecraft.server.management.PlayerInstance;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
public abstract class PatchTileEntity extends TileEntity {
@Declare
public int lastTTX_;
@Declare
public int lastTTY_;
@Declare
public int lastTTZ_;
@Declare
public me.nallar.tickthreading.minecraft.tickregion.TileEntityTickRegion tickRegion_;
@Declare
public java.util.concurrent.locks.Lock thisLock_;
@Declare
public java.util.concurrent.locks.Lock xMinusLock_;
@Declare
public java.util.concurrent.locks.Lock zMinusLock_;
@Declare
public java.util.concurrent.locks.Lock xPlusLock_;
@Declare
public java.util.concurrent.locks.Lock zPlusLock_;
public void construct() {
thisLock = new NativeMutex();
}
@Override
@Declare
public void sendTileWithNotify() {
WorldServer worldServer = ((WorldServer) worldObj);
worldServer.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType().blockID);
PlayerInstance p = worldServer.getPlayerManager().getOrCreateChunkWatcher(xCoord >> 4, zCoord >> 4, false);
if (p != null) {
p.updateTile(this);
}
}
@Override
@Declare
public void sendTile() {
PlayerInstance p = ((WorldServer) worldObj).getPlayerManager().getOrCreateChunkWatcher(xCoord >> 4, zCoord >> 4, false);
if (p != null) {
p.updateTile(this);
}
}
}