    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        public void func_85102_a(EntityPlayer par1EntityPlayer, String par2Str, double par3, double par5, double par7, float par9, float par10)
    050        {
    051            this.mcServer.getConfigurationManager().sendToAllNearExcept(par1EntityPlayer, par3, par5, par7, par9 > 1.0F ? (double)(16.0F * par9) : 16.0D, this.theWorldServer.provider.dimensionId, new Packet62LevelSound(par2Str, par3, par5, par7, par9, par10));
    052        }
    053
    054        /**
    055         * Called across all registered IWorldAccess instances when a block range is invalidated. Args: minX, minY, minZ,
    056         * maxX, maxY, maxZ
    057         */
    058        public void markBlockRangeNeedsUpdate(int par1, int par2, int par3, int par4, int par5, int par6) {}
    059
    060        /**
    061         * Will mark the block and neighbors that their renderers need an update (could be all the same renderer
    062         * potentially) Args: x, y, z
    063         */
    064        public void markBlockNeedsUpdate(int par1, int par2, int par3)
    065        {
    066            this.theWorldServer.getPlayerManager().flagChunkForUpdate(par1, par2, par3);
    067        }
    068
    069        /**
    070         * As of mc 1.2.3 this method has exactly the same signature and does exactly the same as markBlockNeedsUpdate
    071         */
    072        public void markBlockNeedsUpdate2(int par1, int par2, int par3) {}
    073
    074        /**
    075         * Plays the specified record. Arg: recordName, x, y, z
    076         */
    077        public void playRecord(String par1Str, int par2, int par3, int par4) {}
    078
    079        /**
    080         * Plays a pre-canned sound effect along with potentially auxiliary data-driven one-shot behaviour (particles, etc).
    081         */
    082        public void playAuxSFX(EntityPlayer par1EntityPlayer, int par2, int par3, int par4, int par5, int par6)
    083        {
    084            this.mcServer.getConfigurationManager().sendToAllNearExcept(par1EntityPlayer, (double)par3, (double)par4, (double)par5, 64.0D, this.theWorldServer.provider.dimensionId, new Packet61DoorChange(par2, par3, par4, par5, par6, false));
    085        }
    086
    087        public void func_82746_a(int par1, int par2, int par3, int par4, int par5)
    088        {
    089            this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet61DoorChange(par1, par2, par3, par4, par5, true));
    090        }
    091
    092        /**
    093         * Starts (or continues) destroying a block with given ID at the given coordinates for the given partially destroyed
    094         * value
    095         */
    096        public void destroyBlockPartially(int par1, int par2, int par3, int par4, int par5)
    097        {
    098            Iterator var6 = this.mcServer.getConfigurationManager().playerEntityList.iterator();
    099
    100            while (var6.hasNext())
    101            {
    102                EntityPlayerMP var7 = (EntityPlayerMP)var6.next();
    103
    104                if (var7 != null && var7.worldObj == this.theWorldServer && var7.entityId != par1)
    105                {
    106                    double var8 = (double)par2 - var7.posX;
    107                    double var10 = (double)par3 - var7.posY;
    108                    double var12 = (double)par4 - var7.posZ;
    109
    110                    if (var8 * var8 + var10 * var10 + var12 * var12 < 1024.0D)
    111                    {
    112                        var7.playerNetServerHandler.sendPacketToPlayer(new Packet55BlockDestroy(par1, par2, par3, par4, par5));
    113                    }
    114                }
    115            }
    116        }
    117    }