Added "event" if the boss is killed

This commit is contained in:
makeo committed 2015-11-10 16:48:24 +01:00
1 parent 7b4bb0a501
commit 99b3084a56
2 files changed
+38 -2

No files matched your search

@@ -1,6 +1,8 @@
package makeo.gadomancy.common.blocks.tiles;
import makeo.gadomancy.common.utils.world.TCMazeHandler;
import makeo.gadomancy.common.utils.world.TCMazeSession;
import net.minecraft.entity.Entity;
import thaumcraft.common.lib.world.dim.CellLoc;
import thaumcraft.common.lib.world.dim.MazeHandler;
import thaumcraft.common.tiles.TileEldritchLock;
@@ -16,19 +18,49 @@ import java.util.concurrent.ConcurrentHashMap;
* Created by makeo @ 09.11.2015 21:20
*/
public class TileOverrideEldritchLock extends TileEldritchLock {
private int count = 0;
private Entity[] bosses = null;
@Override
public void updateEntity() {
if (!this.worldObj.isRemote) {
if (this.count != -1) {
if (this.count + 1 > 100) {
if (super.count != -1) {
if (super.count + 1 > 100) {
ConcurrentHashMap<CellLoc, Short> old = MazeHandler.labyrinth;
MazeHandler.labyrinth = TCMazeHandler.labyrinthCopy;
int nextEntityId = Entity.nextEntityID;
super.updateEntity();
int count = Entity.nextEntityID - nextEntityId;
bosses = new Entity[count];
for(int i = 0; i < count; i++) {
bosses[i] = worldObj.getEntityByID(nextEntityId + i);
}
MazeHandler.labyrinth = old;
return;
}
}
}
super.updateEntity();
if(bosses != null && ++count % 20 == 0) {
for(Entity entity : bosses) {
if(entity != null && !entity.isDead) {
return;
}
}
for(TCMazeSession session : TCMazeHandler.getSessions().values()) {
if(session.chunksAffected != null && session.chunksAffected.containsKey(new CellLoc(xCoord >> 4, zCoord >> 4))) {
TCMazeHandler.handleBossFinish(session);
break;
}
}
bosses = null;
}
}
}
@@ -176,6 +176,10 @@ public class TCMazeHandler {
}
}
public static Map<EntityPlayer, TCMazeSession> getSessions() {
return runningSessions;
}
public static void free(Map<CellLoc, Short> locations) {
if (locations == null) return;
for (CellLoc loc : locations.keySet()) {