Package rakama.worldtools.data

Examples of rakama.worldtools.data.Section


    }
   
    public void setLight(int x, int y, int z, byte val)
    {
        int sindex = toSectionIndex(x >> 4, y >> 4, z >> 4);
        Section sec = sections[sindex];

        if(sec == null)
            return;

        int eindex = toElementIndex(x & 0xF, y & 0xF, z & 0xF);

        if(mode == Mode.BLOCKLIGHT)
            sec.setBlockLight(eindex, val);
        else
            sec.setSkyLight(eindex, val);
    }
View Full Code Here


    }

    public int getLight(int x, int y, int z)
    {
        int sindex = toSectionIndex(x >> 4, y >> 4, z >> 4);
        Section sec = sections[sindex];

        if(sec == null)
            return 15;

        int eindex = toElementIndex(x & 0xF, y & 0xF, z & 0xF);

        if(mode == Mode.BLOCKLIGHT)
            return sec.getBlockLight(eindex);
        else
            return sec.getSkyLight(eindex);
    }
View Full Code Here

    }

    public int getBlockID(int x, int y, int z)
    {
        int sindex = toSectionIndex(x >> 4, y >> 4, z >> 4);
        Section sec = sections[sindex];

        if(sec == null)
            return 0;

        int eindex = toElementIndex(x & 0xF, y & 0xF, z & 0xF);
        return sec.getBlockID(eindex);
    }
View Full Code Here

   
    public void enqueueBlockLights(CircularBuffer queue)
    {
        for(int sindex = 0; sindex < sections.length; sindex++)
        {
            Section sec = sections[sindex];

            if(sec == null)
                continue;

            for(int eindex = 0; eindex < Section.volume; eindex++)
            {
                int light = Block.getLuminance(sec.getBlockID(eindex));

                if(light > 0)
                {
                    sec.setBlockLight(eindex, light);
                    enqueueBlock(queue, sindex, eindex, light);
                }
            }
        }
    }
View Full Code Here

    private Section cloneSection(int y, Section sec)
    {
        if(sec == null)
            return null;
       
        return new Section(y, sec.getBlockIDs(), sec.getMetaData(),
                tempLights[y], tempLights[y]);
    }
View Full Code Here

TOP

Related Classes of rakama.worldtools.data.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.