Deduplicate adapter fields into superclass (#2967)

Move common adapter fields into supertype
Dieser Commit ist enthalten in:
Hannes Greule 2024-11-04 12:21:14 +01:00 committet von GitHub
Ursprung 9eafbf1c26
Commit bd94632c47
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
5 geänderte Dateien mit 17 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -117,18 +117,10 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
private final com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R2.PaperweightAdapter parent;
// ------------------------------------------------------------------------
// Code that may break between versions of Minecraft
// ------------------------------------------------------------------------
private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil();
private char[] ibdToStateOrdinal = null;
private int[] ordinalToIbdID = null;
private boolean initialised = false;
private Map<String, List<Property<?>>> allBlockProperties = null;
public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException {
this.parent = new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R2.PaperweightAdapter();
super(new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R2.PaperweightAdapter());
}
public Function<BlockEntity, FaweCompoundTag> blockEntityToCompoundTag() {

Datei anzeigen

@ -117,18 +117,10 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
private final com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R3.PaperweightAdapter parent;
// ------------------------------------------------------------------------
// Code that may break between versions of Minecraft
// ------------------------------------------------------------------------
private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil();
private char[] ibdToStateOrdinal = null;
private int[] ordinalToIbdID = null;
private boolean initialised = false;
private Map<String, List<Property<?>>> allBlockProperties = null;
public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException {
this.parent = new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R3.PaperweightAdapter();
super(new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R3.PaperweightAdapter());
}
public Function<BlockEntity, FaweCompoundTag> blockEntityToCompoundTag() {

Datei anzeigen

@ -126,18 +126,10 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
private final com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R4.PaperweightAdapter parent;
// ------------------------------------------------------------------------
// Code that may break between versions of Minecraft
// ------------------------------------------------------------------------
private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil();
private char[] ibdToStateOrdinal = null;
private int[] ordinalToIbdID = null;
private boolean initialised = false;
private Map<String, List<Property<?>>> allBlockProperties = null;
public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException {
this.parent = new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R4.PaperweightAdapter();
super(new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R4.PaperweightAdapter());
}
public Function<BlockEntity, FaweCompoundTag> blockEntityToCompoundTag() {

Datei anzeigen

@ -126,18 +126,10 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
private final com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter parent;
// ------------------------------------------------------------------------
// Code that may break between versions of Minecraft
// ------------------------------------------------------------------------
private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil();
private char[] ibdToStateOrdinal = null;
private int[] ordinalToIbdID = null;
private boolean initialised = false;
private Map<String, List<Property<?>>> allBlockProperties = null;
public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException {
this.parent = new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter();
super(new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter());
}
public Function<BlockEntity, FaweCompoundTag> blockEntityToCompoundTag() {

Datei anzeigen

@ -4,7 +4,9 @@ import com.fastasyncworldedit.core.util.TaskManager;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.TreeGenerator;
import org.bukkit.Material;
import org.bukkit.TreeType;
@ -12,6 +14,7 @@ import org.bukkit.World;
import org.bukkit.block.BlockState;
import java.util.List;
import java.util.Map;
/**
* A base class for version-specific implementations of the BukkitImplAdapter
@ -21,6 +24,16 @@ import java.util.List;
*/
public abstract class FaweAdapter<TAG, SERVER_LEVEL> extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<TAG> {
protected final BukkitImplAdapter<TAG> parent;
protected char[] ibdToStateOrdinal = null;
protected int[] ordinalToIbdID = null;
protected boolean initialised = false;
protected Map<String, List<Property<?>>> allBlockProperties = null;
protected FaweAdapter(final BukkitImplAdapter<TAG> parent) {
this.parent = parent;
}
@Override
public boolean generateTree(
final TreeGenerator.TreeType treeType,