Search in sources :

Example 6 with ChunkProviderClient

use of net.minecraft.client.multiplayer.ChunkProviderClient in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PhysicsObject method unload.

void unload() {
    watchingPlayers.clear();
    if (!getWorld().isRemote) {
        ChunkProviderServer provider = (ChunkProviderServer) getWorld().getChunkProvider();
        for (ChunkPos chunkPos : getChunkClaim()) {
            provider.queueUnload(claimedChunkCache.getChunkAt(chunkPos.x, chunkPos.z));
        }
    } else {
        ChunkProviderClient provider = (ChunkProviderClient) getWorld().getChunkProvider();
        for (ChunkPos chunkPos : getChunkClaim()) {
            provider.unloadChunk(chunkPos.x, chunkPos.z);
        }
        getShipRenderer().killRenderers();
    }
}
Also used : ChunkProviderClient(net.minecraft.client.multiplayer.ChunkProviderClient) ChunkProviderServer(net.minecraft.world.gen.ChunkProviderServer) ChunkPos(net.minecraft.util.math.ChunkPos)

Example 7 with ChunkProviderClient

use of net.minecraft.client.multiplayer.ChunkProviderClient in project blockbuster by mchorse.

the class ClientHandlerStructure method createListFromTemplate.

/**
 * This method creates a renderable display list which allows
 * rendering fully baked into a display list.
 *
 * This was harder than I thought...
 */
@SideOnly(Side.CLIENT)
private StructureRenderer createListFromTemplate(PacketStructure message) {
    Profiler profiler = new Profiler();
    Template template = new Template();
    PlacementSettings placement = new PlacementSettings();
    WorldSettings settings = new WorldSettings(0, GameType.CREATIVE, true, false, WorldType.DEFAULT);
    WorldInfo info = new WorldInfo(settings, message.name);
    WorldProvider provider = new WorldProviderSurface();
    FakeWorld world = new FakeWorld(null, info, provider, profiler, true);
    provider.setWorld(world);
    template.read(message.tag);
    BlockPos origin = new BlockPos(1, 1, 1);
    int w = template.getSize().getX();
    int d = template.getSize().getZ();
    for (int x = 0, cx = (w + 2) / 16 + 1; x < cx; x++) {
        for (int z = 0, cz = (d + 2) / 16 + 1; z < cz; z++) {
            ((ChunkProviderClient) world.getChunkProvider()).loadChunk(x, z);
        }
    }
    template.addBlocksToWorld(world, origin, placement);
    return new StructureRenderer(template.getSize(), world);
}
Also used : ChunkProviderClient(net.minecraft.client.multiplayer.ChunkProviderClient) WorldProviderSurface(net.minecraft.world.WorldProviderSurface) Profiler(net.minecraft.profiler.Profiler) WorldProvider(net.minecraft.world.WorldProvider) WorldInfo(net.minecraft.world.storage.WorldInfo) BlockPos(net.minecraft.util.math.BlockPos) StructureRenderer(mchorse.blockbuster_pack.morphs.structure.StructureRenderer) PlacementSettings(net.minecraft.world.gen.structure.template.PlacementSettings) WorldSettings(net.minecraft.world.WorldSettings) Template(net.minecraft.world.gen.structure.template.Template) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ChunkProviderClient (net.minecraft.client.multiplayer.ChunkProviderClient)7 Chunk (net.minecraft.world.chunk.Chunk)3 ChunkProviderServer (net.minecraft.world.gen.ChunkProviderServer)3 Minecraft (net.minecraft.client.Minecraft)2 MinecraftServer (net.minecraft.server.MinecraftServer)2 StructureRenderer (mchorse.blockbuster_pack.morphs.structure.StructureRenderer)1 IBlockState (net.minecraft.block.state.IBlockState)1 Entity (net.minecraft.entity.Entity)1 Profiler (net.minecraft.profiler.Profiler)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 ChunkPos (net.minecraft.util.math.ChunkPos)1 WorldProvider (net.minecraft.world.WorldProvider)1 WorldProviderSurface (net.minecraft.world.WorldProviderSurface)1 WorldSettings (net.minecraft.world.WorldSettings)1 PlacementSettings (net.minecraft.world.gen.structure.template.PlacementSettings)1 Template (net.minecraft.world.gen.structure.template.Template)1 WorldInfo (net.minecraft.world.storage.WorldInfo)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1