Search in sources :

Example 6 with EntityAstroMiner

use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner in project Galacticraft by micdoodle8.

the class AsteroidsTickHandlerServer method onWorldTick.

@SubscribeEvent
public void onWorldTick(WorldTickEvent event) {
    if (event.phase == Phase.END) {
        int index = -1;
        for (EntityAstroMiner miner : activeMiners) {
            index++;
            if (miner.isDead) {
                // minerIt.remove();  Don't remove it, we want the index number to be static for the others
                continue;
            }
            if (miner.playerMP != null && miner.worldObj == event.world) {
                try {
                    if (droppedChunks == null) {
                        Class clazz = ((WorldServer) miner.worldObj).theChunkProviderServer.getClass();
                        droppedChunks = clazz.getDeclaredField(GCCoreUtil.isDeobfuscated() ? "droppedChunksSet" : "field_73248_b");
                    }
                    Set<Long> undrop = (Set<Long>) droppedChunks.get(((WorldServer) miner.worldObj).theChunkProviderServer);
                    undrop.remove(ChunkCoordIntPair.chunkXZ2Int(miner.chunkCoordX, miner.chunkCoordZ));
                } catch (Exception ignore) {
                }
            }
        }
    }
}
Also used : Set(java.util.Set) EntityAstroMiner(micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner) WorldServer(net.minecraft.world.WorldServer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityAstroMiner (micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner)4 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 ArrayList (java.util.ArrayList)1 Set (java.util.Set)1 UUID (java.util.UUID)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 PacketDynamic (micdoodle8.mods.galacticraft.core.network.PacketDynamic)1 ShortRangeTelepadHandler (micdoodle8.mods.galacticraft.planets.asteroids.dimension.ShortRangeTelepadHandler)1 WorldProviderAsteroids (micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids)1 TileEntityMinerBase (micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityMinerBase)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 TileEntity (net.minecraft.tileentity.TileEntity)1 World (net.minecraft.world.World)1 WorldServer (net.minecraft.world.WorldServer)1