Repackage NMS

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-03-16 09:00:00 +11:00
parent 18496e998f
commit 9da047989c
968 changed files with 5448 additions and 5050 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/BiomeStorage.java
+++ b/net/minecraft/server/BiomeStorage.java
@@ -87,4 +87,14 @@
--- a/net/minecraft/world/level/chunk/BiomeStorage.java
+++ b/net/minecraft/world/level/chunk/BiomeStorage.java
@@ -93,4 +93,14 @@
return this.h[i1 << BiomeStorage.e + BiomeStorage.e | j1 << BiomeStorage.e | l];
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/Chunk.java
+++ b/net/minecraft/server/Chunk.java
@@ -31,7 +31,7 @@
--- a/net/minecraft/world/level/chunk/Chunk.java
+++ b/net/minecraft/world/level/chunk/Chunk.java
@@ -65,7 +65,7 @@
private BiomeStorage d;
private final Map<BlockPosition, NBTTagCompound> e;
public boolean loaded;
@@ -9,7 +9,7 @@
public final Map<HeightMap.Type, HeightMap> heightMap;
private final ChunkConverter i;
public final Map<BlockPosition, TileEntity> tileEntities;
@@ -65,7 +65,7 @@
@@ -99,7 +99,7 @@
this.m = Maps.newHashMap();
this.n = new ShortList[16];
this.entitySlices = (EntitySlice[]) (new EntitySlice[16]);
@@ -18,7 +18,7 @@
this.loc = chunkcoordintpair;
this.i = chunkconverter;
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
@@ -96,8 +96,22 @@
@@ -130,8 +130,22 @@
}
}
@@ -41,7 +41,7 @@
public Chunk(World world, ProtoChunk protochunk) {
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
Iterator iterator = protochunk.y().iterator();
@@ -139,6 +153,7 @@
@@ -173,6 +187,7 @@
this.b(protochunk.r());
this.s = true;
@@ -49,7 +49,7 @@
}
@Override
@@ -229,9 +244,16 @@
@@ -263,9 +278,16 @@
}
}
@@ -66,17 +66,17 @@
int i = blockposition.getX() & 15;
int j = blockposition.getY();
int k = blockposition.getZ() & 15;
@@ -283,7 +305,8 @@
@@ -317,7 +339,8 @@
}
}
- if (!this.world.isClientSide) {
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
+ if (!this.world.isClientSide && doPlace && (!this.world.captureBlockStates || block instanceof BlockTileEntity)) {
+ if (!this.world.isClientSide && doPlace && (!this.world.captureBlockStates || block instanceof net.minecraft.world.level.block.BlockTileEntity)) {
iblockdata.onPlace(this.world, blockposition, iblockdata1, flag);
}
@@ -378,7 +401,12 @@
@@ -412,7 +435,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -90,13 +90,13 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
@@ -424,6 +452,13 @@
@@ -458,6 +486,13 @@
tileentity1.al_();
}
+ // CraftBukkit start
+ } else {
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ()
+ + " (" + getType(blockposition) + ") where there was no entity tile!");
+ System.out.println("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
+ new Exception().printStackTrace();
@@ -104,7 +104,7 @@
}
}
@@ -473,6 +508,50 @@
@@ -507,6 +542,50 @@
}
@@ -155,7 +155,7 @@
public void markDirty() {
this.s = true;
}
@@ -526,7 +605,7 @@
@@ -560,7 +639,7 @@
Iterator iterator = this.entitySlices[k].a(Entity.class).iterator();
while (iterator.hasNext()) {
@@ -164,7 +164,7 @@
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
list.add(entity);
@@ -547,7 +626,7 @@
@@ -581,7 +660,7 @@
Iterator iterator = this.entitySlices[k].a(oclass).iterator();
while (iterator.hasNext()) {
@@ -173,7 +173,7 @@
if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
list.add(t0);
@@ -621,7 +700,7 @@
@@ -655,7 +734,7 @@
@Override
public boolean isNeedsSaving() {
@@ -182,7 +182,7 @@
}
public void d(boolean flag) {
@@ -763,7 +842,7 @@
@@ -797,7 +876,7 @@
public void B() {
if (this.o instanceof ProtoChunkTickList) {
@@ -191,7 +191,7 @@
return this.getType(blockposition).getBlock();
});
this.o = TickListEmpty.b();
@@ -773,7 +852,7 @@
@@ -807,7 +886,7 @@
}
if (this.p instanceof ProtoChunkTickList) {
@@ -200,7 +200,7 @@
return this.getFluid(blockposition).getType();
});
this.p = TickListEmpty.b();
@@ -785,12 +864,12 @@
@@ -819,12 +898,12 @@
}
public void a(WorldServer worldserver) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkGenerator.java
+++ b/net/minecraft/server/ChunkGenerator.java
@@ -210,7 +210,16 @@
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -246,7 +246,16 @@
while (iterator.hasNext()) {
Supplier<StructureFeature<?, ?>> supplier = (Supplier) iterator.next();
@@ -18,7 +18,7 @@
}
}
@@ -294,9 +303,11 @@
@@ -330,9 +339,11 @@
}
static {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkStatus.java
+++ b/net/minecraft/server/ChunkStatus.java
@@ -27,7 +27,7 @@
--- a/net/minecraft/world/level/chunk/ChunkStatus.java
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -38,7 +38,7 @@
});
public static final ChunkStatus STRUCTURE_STARTS = a("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.n, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, worldserver, chunkgenerator, definedstructuremanager, lightenginethreaded, function, list, ichunkaccess) -> {
if (!ichunkaccess.getChunkStatus().b(chunkstatus)) {
@@ -9,7 +9,7 @@
chunkgenerator.createStructures(worldserver.r(), worldserver.getStructureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
}
@@ -90,7 +90,7 @@
@@ -101,7 +101,7 @@
return (CompletableFuture) function.apply(ichunkaccess);
});
private static final List<ChunkStatus> q = ImmutableList.of(ChunkStatus.FULL, ChunkStatus.FEATURES, ChunkStatus.LIQUID_CARVERS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkRegionLoader.java
+++ b/net/minecraft/server/ChunkRegionLoader.java
@@ -91,7 +91,7 @@
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -133,7 +133,7 @@
if (nbttagcompound1.hasKeyOfType("TileTicks", 9)) {
nbttaglist1 = nbttagcompound1.getList("TileTicks", 10);
@@ -9,7 +9,7 @@
registryblocks = IRegistry.BLOCK;
registryblocks.getClass();
object1 = TickListChunk.a(nbttaglist1, function, registryblocks::get);
@@ -103,7 +103,7 @@
@@ -145,7 +145,7 @@
if (nbttagcompound1.hasKeyOfType("LiquidTicks", 9)) {
nbttaglist1 = nbttagcompound1.getList("LiquidTicks", 10);
@@ -18,12 +18,12 @@
registryblocks = IRegistry.FLUID;
registryblocks.getClass();
object2 = TickListChunk.a(nbttaglist1, function, registryblocks::get);
@@ -113,6 +113,12 @@
@@ -155,6 +155,12 @@
object = new Chunk(worldserver.getMinecraftWorld(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, (chunk) -> {
loadEntities(nbttagcompound1, chunk);
+ // CraftBukkit start - load chunk persistent data from nbt
+ NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues");
+ net.minecraft.nbt.NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues");
+ if (persistentBase instanceof NBTTagCompound) {
+ chunk.persistentDataContainer.putAll((NBTTagCompound) persistentBase);
+ }
@@ -31,7 +31,7 @@
});
} else {
ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1);
@@ -246,8 +252,9 @@
@@ -288,8 +294,9 @@
NBTTagCompound nbttagcompound2;
for (int i = -1; i < 17; ++i) {
@@ -42,7 +42,7 @@
}).findFirst().orElse(Chunk.a);
NibbleArray nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i));
NibbleArray nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i));
@@ -302,6 +309,12 @@
@@ -344,6 +351,12 @@
if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.LEVELCHUNK) {
Chunk chunk = (Chunk) ichunkaccess;

View File

@@ -1,6 +1,21 @@
--- a/net/minecraft/server/IChunkLoader.java
+++ b/net/minecraft/server/IChunkLoader.java
@@ -18,10 +18,49 @@
--- a/net/minecraft/world/level/chunk/storage/IChunkLoader.java
+++ b/net/minecraft/world/level/chunk/storage/IChunkLoader.java
@@ -15,6 +15,14 @@
import net.minecraft.world.level.levelgen.structure.PersistentStructureLegacy;
import net.minecraft.world.level.storage.WorldPersistentData;
+// CraftBukkit start
+import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.GeneratorAccess;
+import net.minecraft.world.level.chunk.ChunkStatus;
+import net.minecraft.world.level.dimension.DimensionManager;
+// CraftBukkit end
+
public class IChunkLoader implements AutoCloseable {
private final IOWorker a;
@@ -27,10 +35,49 @@
this.a = new IOWorker(file, flag, "chunk");
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionFileCache.java
+++ b/net/minecraft/server/RegionFileCache.java
@@ -21,7 +21,7 @@
--- a/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -25,7 +25,7 @@
this.c = flag;
}
@@ -9,7 +9,7 @@
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
@@ -37,6 +37,7 @@
@@ -41,6 +41,7 @@
}
File file = new File(this.b, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca");
@@ -17,7 +17,7 @@
RegionFile regionfile1 = new RegionFile(file, this.b, this.c);
this.cache.putAndMoveToFirst(i, regionfile1);
@@ -46,7 +47,12 @@
@@ -50,7 +51,12 @@
@Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
@@ -31,7 +31,7 @@
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
Throwable throwable = null;
@@ -81,7 +87,7 @@
@@ -85,7 +91,7 @@
}
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {