mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Make the last tile of its kind disappear
This commit is contained in:
parent
0bc6b11c5b
commit
5ea0fa788f
2 changed files with 14 additions and 14 deletions
|
@ -30,6 +30,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.simibubi.create.foundation.render.SuperByteBufferCache.PARTIAL;
|
||||
|
@ -79,15 +80,25 @@ public class FastKineticRenderer {
|
|||
* guaranteed to be no race conditions with the render thread, i.e. when constructing a FastContraptionRenderer.
|
||||
*/
|
||||
public void markAllDirty() {
|
||||
runOnAll(InstanceBuffer::markDirty);
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
runOnAll(InstanceBuffer::delete);
|
||||
belts.values().forEach(Cache::invalidateAll);
|
||||
rotating.values().forEach(Cache::invalidateAll);
|
||||
}
|
||||
|
||||
private void runOnAll(Consumer<InstanceBuffer<?>> f) {
|
||||
for (Cache<Object, InstanceBuffer<RotatingData>> cache : rotating.values()) {
|
||||
for (InstanceBuffer<RotatingData> renderer : cache.asMap().values()) {
|
||||
renderer.markDirty();
|
||||
f.accept(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
for (Cache<Object, InstanceBuffer<BeltData>> cache : belts.values()) {
|
||||
for (InstanceBuffer<BeltData> renderer : cache.asMap().values()) {
|
||||
renderer.markDirty();
|
||||
f.accept(renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,18 +261,6 @@ public class FastKineticRenderer {
|
|||
return new BeltBuffer(builder);
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
for (Cache<Object, InstanceBuffer<RotatingData>> objectInstanceBufferCache : rotating.values()) {
|
||||
objectInstanceBufferCache.asMap().values().forEach(InstanceBuffer::delete);
|
||||
objectInstanceBufferCache.invalidateAll();
|
||||
}
|
||||
|
||||
for (Cache<Object, InstanceBuffer<BeltData>> cache : belts.values()) {
|
||||
cache.asMap().values().forEach(InstanceBuffer::delete);
|
||||
cache.invalidateAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static RenderType getKineticRenderLayer() {
|
||||
return RenderType.getCutoutMipped();
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public abstract class InstanceBuffer<D extends InstanceData> extends TemplateBuf
|
|||
}
|
||||
|
||||
public void clearInstanceData() {
|
||||
instanceCount = 0;
|
||||
shouldBuild = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue