Newer
Older
void-pack-super-server / work / decompile-ee3ecae0 / net / minecraft / server / NBTReadLimiter.java
Simon Lindgren on 26 Mar 2020 552 bytes first commit
package net.minecraft.server;

public class NBTReadLimiter {

    public static final NBTReadLimiter a = new NBTReadLimiter(0L) {
        @Override
        public void a(long i) {}
    };
    private final long b;
    private long c;

    public NBTReadLimiter(long i) {
        this.b = i;
    }

    public void a(long i) {
        this.c += i / 8L;
        if (this.c > this.b) {
            throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.c + "bytes where max allowed: " + this.b);
        }
    }
}