ChunkCompileTaskGenerator .java

net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator (class, 142 lines): members: getRegionRenderCacheBuilder, setRegionRenderCacheBuilder, lock.

net.minecraft.client.renderer.chunkclass142 linesclient3.2 KB

API Surface (12)

ChunkCompileTaskGenerator.Status getStatus()
RenderChunk getRenderChunk()
CompiledChunk getCompiledChunk()
void setCompiledChunk(CompiledChunk compiledChunkIn)
RegionRenderCacheBuilder getRegionRenderCacheBuilder()
void setRegionRenderCacheBuilder(RegionRenderCacheBuilder regionRenderCacheBuilderIn)
void setStatus(ChunkCompileTaskGenerator.Status statusIn)
void finish()
void addFinishRunnable(Runnable p_178539_1_)
ReentrantLock getLock()
ChunkCompileTaskGenerator.Type getType()
boolean isFinished()

Fields & Constants (8)

renderChunk
lock
listFinishRunnables
type
regionRenderCacheBuilder
compiledChunk
status
finished

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ChunkCompileTaskGenerator.java142 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.chunk;
2
3
import com.google.common.collect.Lists;
4
import java.util.List;
5
import java.util.concurrent.locks.ReentrantLock;
6
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
7
8
public class ChunkCompileTaskGenerator
9
{
10
    private final RenderChunk renderChunk;
11
    private final ReentrantLock lock = new ReentrantLock();
12
    private final List<Runnable> listFinishRunnables = Lists.<Runnable>newArrayList();
13
    private final ChunkCompileTaskGenerator.Type type;
14
    private RegionRenderCacheBuilder regionRenderCacheBuilder;
15
    private CompiledChunk compiledChunk;
16
    private ChunkCompileTaskGenerator.Status status = ChunkCompileTaskGenerator.Status.PENDING;
17
    private boolean finished;
18
19
    public ChunkCompileTaskGenerator(RenderChunk renderChunkIn, ChunkCompileTaskGenerator.Type typeIn)
20
    {
21
        this.renderChunk = renderChunkIn;
22
        this.type = typeIn;
23
    }
24
25
    public ChunkCompileTaskGenerator.Status getStatus()
26
    {
27
        return this.status;
28
    }
29
30
    public RenderChunk getRenderChunk()
31
    {
32
        return this.renderChunk;
33
    }
34
35
    public CompiledChunk getCompiledChunk()
36
    {
37
        return this.compiledChunk;
38
    }
39
40
    public void setCompiledChunk(CompiledChunk compiledChunkIn)
41
    {
42
        this.compiledChunk = compiledChunkIn;
43
    }
44
45
    public RegionRenderCacheBuilder getRegionRenderCacheBuilder()
46
    {
47
        return this.regionRenderCacheBuilder;
48
    }
49
50
    public void setRegionRenderCacheBuilder(RegionRenderCacheBuilder regionRenderCacheBuilderIn)
51
    {
52
        this.regionRenderCacheBuilder = regionRenderCacheBuilderIn;
53
    }
54
55
    public void setStatus(ChunkCompileTaskGenerator.Status statusIn)
56
    {
57
        this.lock.lock();
58
59
        try
60
        {
61
            this.status = statusIn;
62
        }
63
        finally
64
        {
65
            this.lock.unlock();
66
        }
67
    }
68
69
    public void finish()
70
    {
71
        this.lock.lock();
72
73
        try
74
        {
75
            if (this.type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK && this.status != ChunkCompileTaskGenerator.Status.DONE)
76
            {
77
                this.renderChunk.setNeedsUpdate(true);
78
            }
79
80
            this.finished = true;
81
            this.status = ChunkCompileTaskGenerator.Status.DONE;
82
83
            for (Runnable runnable : this.listFinishRunnables)
84
            {
85
                runnable.run();
86
            }
87
        }
88
        finally
89
        {
90
            this.lock.unlock();
91
        }
92
    }
93
94
    public void addFinishRunnable(Runnable p_178539_1_)
95
    {
96
        this.lock.lock();
97
98
        try
99
        {
100
            this.listFinishRunnables.add(p_178539_1_);
101
102
            if (this.finished)
103
            {
104
                p_178539_1_.run();
105
            }
106
        }
107
        finally
108
        {
109
            this.lock.unlock();
110
        }
111
    }
112
113
    public ReentrantLock getLock()
114
    {
115
        return this.lock;
116
    }
117
118
    public ChunkCompileTaskGenerator.Type getType()
119
    {
120
        return this.type;
121
    }
122
123
    public boolean isFinished()
124
    {
125
        return this.finished;
126
    }
127
128
    public static enum Status
129
    {
130
        PENDING,
131
        COMPILING,
132
        UPLOADING,
133
        DONE;
134
    }
135
136
    public static enum Type
137
    {
138
        REBUILD_CHUNK,
139
        RESORT_TRANSPARENCY;
140
    }
141
}
142

Deobfuscated MCP 1.8.9 source of ChunkCompileTaskGenerator from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator.java), stored verbatim.