-
Notifications
You must be signed in to change notification settings - Fork 497
/
TilePollution.java
54 lines (46 loc) · 1.46 KB
/
TilePollution.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
53
54
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy;
import buildcraft.BuildCraftEnergy;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.core.BlockIndex;
import net.minecraft.tileentity.TileEntity;
public class TilePollution extends TileEntity {
public boolean init = false;
public SafeTimeTracker timeTracker = new SafeTimeTracker();
public int saturation = 0; /* from 0 to 100 */
@Override
public void updateEntity() {
if (!init) {
init = true;
timeTracker.markTime(worldObj);
BlockIndex index = new BlockIndex(xCoord, yCoord, zCoord);
if (BuildCraftEnergy.saturationStored.containsKey(index)) {
saturation = BuildCraftEnergy.saturationStored.remove(index);
} else {
saturation = 1;
}
} else {
if (timeTracker.markTimeIfDelay(worldObj, 20)) {
// int remaining = BuildCraftEnergy.createPollution(worldObj,
// xCoord, yCoord, zCoord, saturation);
//
// saturation = remaining;
//
// if (remaining == 0) {
// worldObj.setBlockWithNotify(xCoord, yCoord, zCoord, 0);
// } else {
// worldObj.setBlockMetadata(xCoord, yCoord, zCoord,
// saturation * 16 / 100);
// worldObj.markBlockNeedsUpdate(zCoord, yCoord, zCoord);
// }
}
}
}
}