Search in sources :

Example 6 with SectionTypeArray

use of thpmc.engine.util.SectionTypeArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method setBlockData.

@Override
public void setBlockData(int blockX, int blockY, int blockZ, BlockData blockData) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionTypeArray sectionTypeArray = sectionTypeArrays[sectionIndex];
    if (sectionTypeArray == null) {
        sectionTypeArray = new SectionTypeArray();
        sectionTypeArrays[sectionIndex] = sectionTypeArray;
    }
    Object iBlockData = NMSManager.getNMSHandler().getIBlockData(blockData);
    sectionTypeArray.setType(blockX & 0xF, blockY & 0xF, blockZ & 0xF, iBlockData);
    mapChunkPacketCache = null;
}
Also used : SectionTypeArray(thpmc.engine.util.SectionTypeArray)

Example 7 with SectionTypeArray

use of thpmc.engine.util.SectionTypeArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method getNMSBlockData.

@Override
@Nullable
public Object getNMSBlockData(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionTypeArray sectionTypeArray = sectionTypeArrays[sectionIndex];
    if (sectionTypeArray == null)
        return null;
    return sectionTypeArray.getType(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
}
Also used : SectionTypeArray(thpmc.engine.util.SectionTypeArray) Nullable(org.jetbrains.annotations.Nullable)

Example 8 with SectionTypeArray

use of thpmc.engine.util.SectionTypeArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method setNMSBlockData.

@Override
public void setNMSBlockData(int blockX, int blockY, int blockZ, Object blockData) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionTypeArray sectionTypeArray = sectionTypeArrays[sectionIndex];
    if (sectionTypeArray == null) {
        sectionTypeArray = new SectionTypeArray();
        sectionTypeArrays[sectionIndex] = sectionTypeArray;
    }
    sectionTypeArray.setType(blockX & 0xF, blockY & 0xF, blockZ & 0xF, blockData);
    mapChunkPacketCache = null;
}
Also used : SectionTypeArray(thpmc.engine.util.SectionTypeArray)

Example 9 with SectionTypeArray

use of thpmc.engine.util.SectionTypeArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method hasBlockData.

@Override
public boolean hasBlockData(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionTypeArray sectionTypeArray = sectionTypeArrays[sectionIndex];
    if (sectionTypeArray == null)
        return false;
    return sectionTypeArray.contains(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
}
Also used : SectionTypeArray(thpmc.engine.util.SectionTypeArray)

Example 10 with SectionTypeArray

use of thpmc.engine.util.SectionTypeArray in project THP-Engine by TheHollowPlanetMC.

the class ImplParallelChunk method getBlockData.

@Override
@Nullable
public BlockData getBlockData(int blockX, int blockY, int blockZ) {
    int sectionIndex = ChunkUtil.getSectionIndex(blockY);
    SectionTypeArray sectionTypeArray = sectionTypeArrays[sectionIndex];
    if (sectionTypeArray == null)
        return null;
    Object iBlockData = sectionTypeArray.getType(blockX & 0xF, blockY & 0xF, blockZ & 0xF);
    if (iBlockData == null)
        return null;
    return NMSManager.getNMSHandler().getBukkitBlockData(iBlockData);
}
Also used : SectionTypeArray(thpmc.engine.util.SectionTypeArray) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

SectionTypeArray (thpmc.engine.util.SectionTypeArray)18 ParallelChunk (thpmc.engine.api.world.parallel.ParallelChunk)5 ParallelWorld (thpmc.engine.api.world.parallel.ParallelWorld)5 Nullable (org.jetbrains.annotations.Nullable)4 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)3 List (java.util.List)2 net.minecraft.server.v1_16_R3 (net.minecraft.server.v1_16_R3)2 ChunkSnapshot (org.bukkit.ChunkSnapshot)2 World (org.bukkit.World)2 CraftChunk (org.bukkit.craftbukkit.v1_16_R3.CraftChunk)2 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)2 CraftBlockData (org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData)2 SectionLevelArray (thpmc.engine.util.SectionLevelArray)2 java.util (java.util)1 net.minecraft.server.v1_15_R1 (net.minecraft.server.v1_15_R1)1 IBlockData (net.minecraft.server.v1_16_R3.IBlockData)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_16_R3.PacketPlayOutMultiBlockChange)1 SectionPosition (net.minecraft.server.v1_16_R3.SectionPosition)1 Bukkit (org.bukkit.Bukkit)1 BlockData (org.bukkit.block.data.BlockData)1