    001    package net.minecraft.src;
    002
    003    import java.util.Iterator;
    004    import net.minecraft.server.MinecraftServer;
    005
    006    public class WorldManager implements IWorldAccess
    007    {
    008        /** Reference to the MinecraftServer object. */
    009        private MinecraftServer mcServer;
    010
    011        /** The WorldServer object. */
    012        private WorldServer theWorldServer;
    013
    014        public WorldManager(MinecraftServer par1MinecraftServer, WorldServer par2WorldServer)
    015        {
    016            this.mcServer = par1MinecraftServer;
    017            this.theWorldServer = par2WorldServer;
    018        }
    019
    020        /**
    021         * Spawns a particle. Arg: particleType, x, y, z, velX, velY, velZ
    022         */
    023        public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12) {}
    024
    025        /**
    026         * Start the skin for this entity downloading, if necessary, and increment its reference counter
    027         */
    028        public void obtainEntitySkin(Entity par1Entity)
    029        {
    030            this.theWorldServer.getEntityTracker().addEntityToTracker(par1Entity);
    031        }
    032
    033        /**
    034         * Decrement the reference counter for this entity's skin image data
    035         */
    036        public void releaseEntitySkin(Entity par1Entity)
    037        {
    038            this.theWorldServer.getEntityTracker().removeEntityFromAllTrackingPlayers(par1Entity);
    039        }
    040
    041        /**
    042         * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch
    043         */
    044        public void playSound(String par1Str, double par2, double par4, double par6, float par8, float par9)
    045        {
    046            this.mcServer.getConfigurationManager().sendToAllNear(par2, par4, par6, par8 > 1.0F ? (double)(16.0F * par8) : 16.0D, this.theWorldServer.provider.dimensionId, new Packet62LevelSound(par1Str, par2, par4, par6, par8, par9));
    047        }
    048
    049        /**
    050         * Called across all registered IWorldAccess instances when a block range is invalidated. Args: minX, minY, minZ,
    051         * maxX, maxY, maxZ
    052         */
    053        public void markBlockRangeNeedsUpdate(int par1, int par2, int par3, int par4, int par5, int par6) {}
    054
    055        /**
    056         * Will mark the block and neighbors that their renderers need an update (could be all the same renderer
    057         * potentially) Args: x, y, z
    058         */
    059        public void markBlockNeedsUpdate(int par1, int par2, int par3)
    060        {
    061            this.theWorldServer.getPlayerManager().flagChunkForUpdate(par1, par2, par3);
    062        }
    063
    064        /**
    065         * As of mc 1.2.3 this method has exactly the same signature and does exactly the same as markBlockNeedsUpdate
    066         */
    067        public void markBlockNeedsUpdate2(int par1, int par2, int par3) {}
    068
    069        /**
    070         * Plays the specified record. Arg: recordName, x, y, z
    071         */
    072        public void playRecord(String par1Str, int par2, int par3, int par4) {}
    073
    074        /**
    075         * Plays a pre-canned sound effect along with potentially auxiliary data-driven one-shot behaviour (particles, etc).
    076         */
    077        public void playAuxSFX(EntityPlayer par1EntityPlayer, int par2, int par3, int par4, int par5, int par6)
    078        {
    079            this.mcServer.getConfigurationManager().sendToAllNearExcept(par1EntityPlayer, (double)par3, (double)par4, (double)par5, 64.0D, this.theWorldServer.provider.dimensionId, new Packet61DoorChange(par2, par3, par4, par5, par6));
    080        }
    081
    082        /**
    083         * Starts (or continues) destroying a block with given ID at the given coordinates for the given partially destroyed
    084         * value
    085         */
    086        public void destroyBlockPartially(int par1, int par2, int par3, int par4, int par5)
    087        {
    088            Iterator var6 = this.mcServer.getConfigurationManager().playerEntityList.iterator();
    089
    090            while (var6.hasNext())
    091            {
    092                EntityPlayerMP var7 = (EntityPlayerMP)var6.next();
    093
    094                if (var7 != null && var7.worldObj == this.theWorldServer && var7.entityId != par1)
    095                {
    096                    double var8 = (double)par2 - var7.posX;
    097                    double var10 = (double)par3 - var7.posY;
    098                    double var12 = (double)par4 - var7.posZ;
    099
    100                    if (var8 * var8 + var10 * var10 + var12 * var12 < 1024.0D)
    101                    {
    102                        var7.playerNetServerHandler.sendPacketToPlayer(new Packet55BlockDestroy(par1, par2, par3, par4, par5));
    103                    }
    104                }
    105            }
    106        }
    107    }