/* * Decompiled with CFR 0.152. */ package net.minecraft.world.level.chunk; import java.util.function.Predicate; import net.minecraft.core.IdMap; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.chunk.MissingPaletteEntryException; import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PaletteResize; public class GlobalPalette implements Palette { private final IdMap registry; public GlobalPalette(IdMap registry) { this.registry = registry; } @Override public int idFor(T value, PaletteResize resizeHandler) { int id = this.registry.getId(value); return id == -1 ? 0 : id; } @Override public boolean maybeHas(Predicate predicate) { return true; } @Override public T valueFor(int index) { T value = this.registry.byId(index); if (value == null) { throw new MissingPaletteEntryException(index); } return value; } @Override public void read(FriendlyByteBuf buffer, IdMap globalMap) { } @Override public void write(FriendlyByteBuf buffer, IdMap globalMap) { } @Override public int getSerializedSize(IdMap globalMap) { return 0; } @Override public int getSize() { return this.registry.size(); } @Override public Palette copy() { return this; } }