/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.client.multiplayer; import java.util.function.Function; import org.jspecify.annotations.Nullable; public class CacheSlot, D> { private final Function operation; private @Nullable C context; private @Nullable D value; public CacheSlot(Function operation) { this.operation = operation; } public D compute(C context) { if (context == this.context && this.value != null) { return this.value; } D newValue = this.operation.apply(context); this.value = newValue; this.context = context; context.registerForCleaning(this); return newValue; } public void clear() { this.value = null; this.context = null; } @FunctionalInterface public static interface Cleaner> { public void registerForCleaning(CacheSlot var1); } }