PaperMC/paper-server/nms-patches/net/minecraft/world/level/chunk/DataPaletteBlock.patch
CraftBukkit/Spigot 43702a9e10 Update to Minecraft 1.18-pre5
By: md_5 <git@md-5.net>
2021-11-22 09:00:00 +11:00

152 lines
6 KiB
Diff

--- a/net/minecraft/world/level/chunk/DataPaletteBlock.java
+++ b/net/minecraft/world/level/chunk/DataPaletteBlock.java
@@ -54,7 +54,7 @@
}
public static <T> Codec<DataPaletteBlock<T>> codec(Registry<T> registry, Codec<T> codec, DataPaletteBlock.e datapaletteblock_e, T t0) {
- return RecordCodecBuilder.create((instance) -> {
+ return RecordCodecBuilder.<DataPaletteBlock.d<T>>create((instance) -> { // CraftBukkit - decompile error
return instance.group(codec.mapResult(ExtraCodecs.orElsePartial(t0)).listOf().fieldOf("palette").forGetter(DataPaletteBlock.d::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(DataPaletteBlock.d::storage)).apply(instance, DataPaletteBlock.d::new);
}).comapFlatMap((datapaletteblock_d) -> {
return read(registry, datapaletteblock_e, datapaletteblock_d);
@@ -97,7 +97,7 @@
public T getAndSet(int i, int j, int k, T t0) {
this.acquire();
- Object object;
+ T object; // CraftBukkit - decompile error
try {
object = this.getAndSet(this.strategy.getIndex(i, j, k), t0);
@@ -309,19 +309,19 @@
switch (i) {
case 0:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
case 1:
case 2:
case 3:
case 4:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, 4);
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, 4); // CraftBukkit - decompile error
break;
case 5:
case 6:
case 7:
case 8:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.HASHMAP_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(HASHMAP_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
default:
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
@@ -337,12 +337,12 @@
switch (i) {
case 0:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
case 1:
case 2:
case 3:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
default:
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
@@ -375,8 +375,10 @@
}
}
- private static final class a<T> extends Record {
+ // CraftBukkit start
+ private static final record a<T>(DataPalette.a factory, int bits) {
+ /*
private final DataPalette.a factory;
private final int bits;
@@ -384,6 +386,8 @@
this.factory = datapalette_a;
this.bits = i;
}
+ */
+ // CraftBukkit end
public DataPaletteBlock.c<T> createData(Registry<T> registry, DataPaletteExpandable<T> datapaletteexpandable, int i) {
Object object = this.bits == 0 ? new ZeroBitStorage(i) : new SimpleBitStorage(this.bits, i);
@@ -392,6 +396,8 @@
return new DataPaletteBlock.c(this, (DataBits) object, datapalette);
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -403,6 +409,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
}
+ */
+ // CraftBukkit end
public DataPalette.a factory() {
return this.factory;
@@ -413,8 +421,10 @@
}
}
- private static final class c extends Record {
+ // CraftBukkit start
+ private static final record c<T>(DataPaletteBlock.a<T> configuration, DataBits storage, DataPalette<T> palette) {
+ /*
private final DataPaletteBlock.a<T> configuration;
final DataBits storage;
final DataPalette<T> palette;
@@ -424,6 +434,8 @@
this.storage = databits;
this.palette = datapalette;
}
+ */
+ // CraftBukkit end
public void copyFrom(DataPalette<T> datapalette, DataBits databits) {
for (int i = 0; i < databits.getSize(); ++i) {
@@ -444,6 +456,8 @@
packetdataserializer.writeLongArray(this.storage.getRaw());
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -467,10 +481,14 @@
public DataPalette<T> palette() {
return this.palette;
}
+ */
+ // CraftBukkit end
}
- private static final class d extends Record {
+ // CraftBukkit start
+ private static final record d<T>(List<T> paletteEntries, Optional<LongStream> storage) {
+ /*
private final List<T> paletteEntries;
private final Optional<LongStream> storage;
@@ -498,6 +516,8 @@
public Optional<LongStream> storage() {
return this.storage;
}
+ */
+ // CraftBukkit end
}
@FunctionalInterface