/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.datafixers.util.Pair * com.mojang.serialization.DataResult * com.mojang.serialization.DynamicOps * com.mojang.serialization.ListBuilder * com.mojang.serialization.MapLike * com.mojang.serialization.RecordBuilder * com.mojang.serialization.RecordBuilder$AbstractUniversalBuilder * org.jspecify.annotations.Nullable */ package net.minecraft.util; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DataResult; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.ListBuilder; import com.mojang.serialization.MapLike; import com.mojang.serialization.RecordBuilder; import java.nio.ByteBuffer; import java.util.List; import java.util.Map; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; import net.minecraft.util.AbstractListBuilder; import net.minecraft.util.Unit; import org.jspecify.annotations.Nullable; public class NullOps implements DynamicOps { public static final NullOps INSTANCE = new NullOps(); private static final MapLike EMPTY_MAP = new MapLike(){ public @Nullable Unit get(Unit key) { return null; } public @Nullable Unit get(String key) { return null; } public Stream> entries() { return Stream.empty(); } }; private NullOps() { } public U convertTo(DynamicOps outOps, Unit input) { return (U)outOps.empty(); } public Unit empty() { return Unit.INSTANCE; } public Unit emptyMap() { return Unit.INSTANCE; } public Unit emptyList() { return Unit.INSTANCE; } public Unit createNumeric(Number value) { return Unit.INSTANCE; } public Unit createByte(byte value) { return Unit.INSTANCE; } public Unit createShort(short value) { return Unit.INSTANCE; } public Unit createInt(int value) { return Unit.INSTANCE; } public Unit createLong(long value) { return Unit.INSTANCE; } public Unit createFloat(float value) { return Unit.INSTANCE; } public Unit createDouble(double value) { return Unit.INSTANCE; } public Unit createBoolean(boolean value) { return Unit.INSTANCE; } public Unit createString(String value) { return Unit.INSTANCE; } public DataResult getNumberValue(Unit input) { return DataResult.success((Object)0); } public DataResult getBooleanValue(Unit input) { return DataResult.success((Object)false); } public DataResult getStringValue(Unit input) { return DataResult.success((Object)""); } public DataResult mergeToList(Unit input, Unit value) { return DataResult.success((Object)((Object)Unit.INSTANCE)); } public DataResult mergeToList(Unit input, List values) { return DataResult.success((Object)((Object)Unit.INSTANCE)); } public DataResult mergeToMap(Unit input, Unit key, Unit value) { return DataResult.success((Object)((Object)Unit.INSTANCE)); } public DataResult mergeToMap(Unit input, Map values) { return DataResult.success((Object)((Object)Unit.INSTANCE)); } public DataResult mergeToMap(Unit input, MapLike values) { return DataResult.success((Object)((Object)Unit.INSTANCE)); } public DataResult>> getMapValues(Unit input) { return DataResult.success(Stream.empty()); } public DataResult>> getMapEntries(Unit input) { return DataResult.success(consumer -> {}); } public DataResult> getMap(Unit input) { return DataResult.success(EMPTY_MAP); } public DataResult> getStream(Unit input) { return DataResult.success(Stream.empty()); } public DataResult>> getList(Unit input) { return DataResult.success(consumer -> {}); } public DataResult getByteBuffer(Unit input) { return DataResult.success((Object)ByteBuffer.wrap(new byte[0])); } public DataResult getIntStream(Unit input) { return DataResult.success((Object)IntStream.empty()); } public DataResult getLongStream(Unit input) { return DataResult.success((Object)LongStream.empty()); } public Unit createMap(Stream> map) { return Unit.INSTANCE; } public Unit createMap(Map map) { return Unit.INSTANCE; } public Unit createList(Stream input) { return Unit.INSTANCE; } public Unit createByteList(ByteBuffer input) { return Unit.INSTANCE; } public Unit createIntList(IntStream input) { return Unit.INSTANCE; } public Unit createLongList(LongStream input) { return Unit.INSTANCE; } public Unit remove(Unit input, String key) { return input; } public RecordBuilder mapBuilder() { return new NullMapBuilder(this); } public ListBuilder listBuilder() { return new NullListBuilder(this); } public String toString() { return "Null"; } private static final class NullMapBuilder extends RecordBuilder.AbstractUniversalBuilder { public NullMapBuilder(DynamicOps ops) { super(ops); } protected Unit initBuilder() { return Unit.INSTANCE; } protected Unit append(Unit key, Unit value, Unit builder) { return builder; } protected DataResult build(Unit builder, Unit prefix) { return DataResult.success((Object)((Object)prefix)); } } private static final class NullListBuilder extends AbstractListBuilder { public NullListBuilder(DynamicOps ops) { super(ops); } @Override protected Unit initBuilder() { return Unit.INSTANCE; } @Override protected Unit append(Unit builder, Unit value) { return builder; } @Override protected DataResult build(Unit builder, Unit prefix) { return DataResult.success((Object)((Object)builder)); } } }