Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
d25437bc Update to Minecraft 1.18-pre8

CraftBukkit Changes:
5a39a236 Update to Minecraft 1.18-pre8

Spigot Changes:
7840c2af Update to Minecraft 1.18-pre8
This commit is contained in:
Jake Potrebic 2021-11-24 14:26:32 -08:00
parent 2253e953c6
commit 60caeea54e
34 changed files with 147 additions and 139 deletions

View File

@ -46,7 +46,7 @@ repositories {
}
dependencies {
paramMappings("net.fabricmc:yarn:1.18-pre5+build.4:mergedv2")
paramMappings("net.fabricmc:yarn:1.18-pre8+build.4:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.7.0:fat")
decompiler("net.minecraftforge:forgeflower:1.5.498.22")
paperclip("io.papermc:paperclip:2.0.1")

View File

@ -1,7 +1,7 @@
group=io.papermc.paper
version=1.18-pre5-R0.1-SNAPSHOT
version=1.18-pre8-R0.1-SNAPSHOT
mcVersion=1.18-pre5
mcVersion=1.18-pre8
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -112,7 +112,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
- <version>1.18-pre5-R0.1-SNAPSHOT</version>
- <version>1.18-pre8-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>Spigot-API</name>

View File

@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -0,0 +0,0 @@ public class PortalForcer {
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, boolean destIsNether, WorldBorder worldborder) {
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) {
// CraftBukkit start
- return this.findPortalAround(blockposition, worldborder, destIsNether ? 16 : 128); // Search Radius
+ return this.findPortalAround(blockposition, worldborder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius
- return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius
+ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius
}
public Optional<BlockUtil.FoundRectangle> findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) {

View File

@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
+ public final Path regionFile; // Paper
public RegionFile(Path path, Path path1, boolean dsync) throws IOException {
this(path, path1, RegionFileVersion.VERSION_DEFLATE, dsync);
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {

View File

@ -2336,8 +2336,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ //this.flushWorker(); // Paper - nuke IOWorker
+ this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour
} else {
this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> {
ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
this.visibleChunkMap.values().forEach(this::saveChunkIfNeeded);
}
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void tick(BooleanSupplier shouldKeepTicking) {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@ -2462,7 +2462,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void markPositionReplaceable(ChunkPos pos) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.tickingGenerated.get();
}
}
+ // Paper start - async chunk save for unload
@ -3287,8 +3287,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected final RegionBitmap usedSectors;
+ public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
public RegionFile(Path path, Path path1, boolean dsync) throws IOException {
this(path, path1, RegionFileVersion.VERSION_DEFLATE, dsync);
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
return (byteCount + 4096 - 1) / 4096;
}

View File

@ -44,32 +44,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntitySection<T extends EntityAccess> {
}
public void add(T entityAccess) {
public void add(T entity) {
+ // Paper start
+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) {
+ if (entity instanceof net.minecraft.world.entity.item.ItemEntity) {
+ this.itemCount++;
+ } else if (entityAccess instanceof net.minecraft.world.Container) {
+ } else if (entity instanceof net.minecraft.world.Container) {
+ this.inventoryEntityCount++;
+ }
+ // Paper end
this.storage.add(entityAccess);
this.storage.add(entity);
}
public boolean remove(T entityAccess) {
public boolean remove(T entity) {
+ // Paper start
+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) {
+ if (entity instanceof net.minecraft.world.entity.item.ItemEntity) {
+ this.itemCount--;
+ } else if (entityAccess instanceof net.minecraft.world.Container) {
+ } else if (entity instanceof net.minecraft.world.Container) {
+ this.inventoryEntityCount--;
+ }
+ // Paper end
return this.storage.remove(entityAccess);
return this.storage.remove(entity);
}
@@ -0,0 +0,0 @@ public class EntitySection<T extends EntityAccess> {
for(T entityAccess : collection) {
U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess));
if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(aABB)) {
if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box)) {
- action.accept((T)entityAccess2);
+ action.accept(entityAccess2); // Paper - decompile fixes
}
@ -84,20 +84,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void getEntities(AABB box, Consumer<T> action) {
+ // Paper start
+ this.getEntities(box, action, false);
+ }
+ public void getEntities(AABB box, Consumer<T> action, boolean isContainerSearch) {
+ // Paper end
this.forEachAccessibleNonEmptySection(box, (entitySection) -> {
+ if (isContainerSearch && entitySection.inventoryEntityCount <= 0) return; // Paper
entitySection.getEntities(box, action);
this.forEachAccessibleNonEmptySection(box, (section) -> {
+ if (isContainerSearch && section.inventoryEntityCount <= 0) return; // Paper
section.getEntities(box, action);
});
}
public <U extends T> void getEntities(EntityTypeTest<T, U> filter, AABB box, Consumer<U> action) {
this.forEachAccessibleNonEmptySection(box, (entitySection) -> {
+ if (filter.getBaseClass() == net.minecraft.world.entity.item.ItemEntity.class && entitySection.itemCount <= 0) return; // Paper
entitySection.getEntities(filter, box, action);
this.forEachAccessibleNonEmptySection(box, (section) -> {
+ if (filter.getBaseClass() == net.minecraft.world.entity.item.ItemEntity.class && section.itemCount <= 0) return; // Paper
section.getEntities(filter, box, action);
});
}
diff --git a/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java b/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java

View File

@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int o = j + i * m;
int p = k + i * n;
ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, o, p);
+ if (!levelReader.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper
+ if (!world.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper
StructureCheckResult structureCheckResult = structureAccessor.checkStructurePresence(chunkPos, this, skipExistingChunks);
if (structureCheckResult != StructureCheckResult.START_NOT_PRESENT) {
if (!skipExistingChunks && structureCheckResult == StructureCheckResult.START_PRESENT) {

View File

@ -9,21 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
+ PlayerItemConsumeEvent event = null; // Paper
if (this instanceof ServerPlayer) {
org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
- PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
if (this instanceof ServerPlayer) {
org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
- PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); // Paper
level.getCraftServer().getPluginManager().callEvent(event);
level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (event.isCancelled()) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
} else {
itemstack = this.useItem.finishUsingItem(this.level, this);
}
} else {
itemstack = this.useItem.finishUsingItem(this.level, this);
}
+
+ // Paper start - save the default replacement item and change it if necessary
+ final ItemStack defaultReplacement = itemstack;
@ -31,18 +31,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ itemstack = CraftItemStack.asNMSCopy(event.getReplacement());
+ }
+ // Paper end
// CraftBukkit end
// CraftBukkit end
if (itemstack != this.useItem) {
if (itemstack != this.useItem) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
}
}
this.stopUsingItem();
this.stopUsingItem();
+ // Paper start - if the replacement is anything but the default, update the client inventory
+ if (this instanceof ServerPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ ((ServerPlayer) this).getBukkitEntity().updateInventory();
+ }
+ // Paper end
}
}
}
}

View File

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
@@ -0,0 +0,0 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
public ClientboundChatPacket(Component message, ChatType location, UUID sender) {
public ClientboundChatPacket(Component message, ChatType type, UUID sender) {
this.message = message;
this.type = location;
this.type = type;
- this.sender = sender;
+ this.sender = sender != null ? sender : net.minecraft.Util.NIL_UUID;
}

View File

@ -13,10 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
level.getCraftServer().getPluginManager().callEvent(event);
level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (event.isCancelled()) {
+ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use
// Update client
((ServerPlayer) this).getBukkitEntity().updateInventory();
((ServerPlayer) this).getBukkitEntity().updateScaledHealth();
// Update client
((ServerPlayer) this).getBukkitEntity().updateInventory();
((ServerPlayer) this).getBukkitEntity().updateScaledHealth();

View File

@ -164,8 +164,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
public RegionFile(Path path, Path path1, boolean dsync) throws IOException {
this(path, path1, RegionFileVersion.VERSION_DEFLATE, dsync);
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync);
}
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
return this.getOffset(pos) != 0;

View File

@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -0,0 +0,0 @@ public class PistonMovingBlockEntity extends BlockEntity {
if (blockEntity.movedState != null && world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos);
if (blockState.isAir()) {
- world.setBlock(pos, blockEntity.movedState, 84);

View File

@ -296,8 +296,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} catch (Exception var3) {
+ if (var3.getCause() instanceof ThreadDeath) throw var3; // Paper
LOGGER.fatal("Error executing task on {}", this.name(), var3);
throw var3;
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Level.java

View File

@ -39,6 +39,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
};
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
@@ -0,0 +0,0 @@ public class MappedRegistry<T> extends WritableRegistry<T> {
}
static record RegistryEntry<T>(ResourceKey<T> key, int id, T value) {
- RegistryEntry(ResourceKey<T> key, int rawId, T entry) {
- this.key = key;
- this.id = rawId;
- this.value = entry;
- }
}
}
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/nbt/ListTag.java
@ -126,15 +141,7 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginP
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.dimension.DimensionType;
-public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType gameType, GameType previousGameType, Set<ResourceKey<Level>> levels, RegistryAccess.RegistryHolder registryHolder, DimensionType dimensionType, ResourceKey<Level> dimension, long seed, int maxPlayers, int chunkRadius, int simulationDistance, boolean reducedDebugInfo, boolean showDeathScreen, boolean isDebug, boolean isFlat) implements Packet {
+public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType gameType, GameType previousGameType, Set<ResourceKey<Level>> levels, RegistryAccess.RegistryHolder registryHolder, DimensionType dimensionType, ResourceKey<Level> dimension, long seed, int maxPlayers, int chunkRadius, int simulationDistance, boolean reducedDebugInfo, boolean showDeathScreen, boolean isDebug, boolean isFlat) implements Packet<ClientGamePacketListener> { // Paper - fix missing generic
public ClientboundLoginPacket(FriendlyByteBuf buf) {
this(buf.readInt(), buf.readBoolean(), GameType.byId(buf.readByte()), GameType.byNullableId(buf.readByte()), buf.readCollection(Sets::newHashSetWithExpectedSize, (b) -> {
return ResourceKey.create(Registry.DIMENSION_REGISTRY, b.readResourceLocation());
@@ -0,0 +0,0 @@ public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType ga
}), buf.readWithCodec(RegistryAccess.RegistryHolder.NETWORK_CODEC), buf.readWithCodec(DimensionType.CODEC).get(), ResourceKey.create(Registry.DIMENSION_REGISTRY, buf.readResourceLocation()), buf.readLong(), buf.readVarInt(), buf.readVarInt(), buf.readVarInt(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean());
}
@ -223,8 +230,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- return (entry1.getValue()); // CraftBukkit
+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore?
}));
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
}
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java

View File

@ -5450,18 +5450,15 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelData;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.LevelData;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper
+import java.util.function.Function; // Paper
public class ServerChunkCache extends ChunkSource {
+ public static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper
public static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList();
private final DistanceManager distanceManager;
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@VisibleForDebug
@ -6480,8 +6477,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- protected final ChunkPos chunkPos;
+ protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
private long inhabitedTime;
/** @deprecated */
@Nullable
@Deprecated
@@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
protected final LevelChunkSection[] sections;

View File

@ -43,27 +43,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
}
public CompoundTag save(CompoundTag nbttagcompound) {
- nbttagcompound.putShort("Delay", (short) this.spawnDelay);
- nbttagcompound.putShort("MinSpawnDelay", (short) this.minSpawnDelay);
- nbttagcompound.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
public CompoundTag save(CompoundTag nbt) {
- nbt.putShort("Delay", (short) this.spawnDelay);
- nbt.putShort("MinSpawnDelay", (short) this.minSpawnDelay);
- nbt.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
+ // Paper start
+ if (spawnDelay > Short.MAX_VALUE) {
+ nbttagcompound.putInt("Paper.Delay", this.spawnDelay);
+ nbt.putInt("Paper.Delay", this.spawnDelay);
+ }
+ nbttagcompound.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay));
+ nbt.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay));
+
+ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) {
+ nbttagcompound.putInt("Paper.MinSpawnDelay", this.minSpawnDelay);
+ nbttagcompound.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay);
+ nbt.putInt("Paper.MinSpawnDelay", this.minSpawnDelay);
+ nbt.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay);
+ }
+
+ nbttagcompound.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
+ nbttagcompound.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
+ // Paper end
nbttagcompound.putShort("SpawnCount", (short) this.spawnCount);
nbttagcompound.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbttagcompound.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
+ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
+ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
+ // Paper nbt
nbt.putShort("SpawnCount", (short) this.spawnCount);
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java

View File

@ -55,19 +55,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
@@ -0,0 +0,0 @@ public abstract class Property<T extends Comparable<T>> {
}
@Override
public boolean equals(Object object) {
- if (this == object) {
- return true;
- } else if (!(object instanceof Property)) {
- return false;
- } else {
- Property<?> iblockstate = (Property) object;
-
- return this.clazz.equals(iblockstate.clazz) && this.name.equals(iblockstate.name);
- Property<?> property = (Property)object;
- return this.clazz.equals(property.clazz) && this.name.equals(property.name);
- }
+ return this == object; // Paper
}
public final int hashCode() {
@Override

View File

@ -109,17 +109,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!this.getEntityCollisions(entity, box).isEmpty()) {
return false;
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
@@ -0,0 +0,0 @@ public final class Shapes {
if (s < 3) {
mutableBlockPos.set(axisCycle, q, r, p);
- BlockState blockState = world.getBlockState(mutableBlockPos);
+ BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper
+ if (blockState == null) return 0.0D; // Paper
if ((s != 1 || blockState.hasLargeCollisionShape()) && (s != 2 || blockState.is(Blocks.MOVING_PISTON))) {
initial = blockState.getCollisionShape(world, mutableBlockPos, context).collide(axis3, box.move((double)(-mutableBlockPos.getX()), (double)(-mutableBlockPos.getY()), (double)(-mutableBlockPos.getZ())), initial);
if (Math.abs(initial) < 1.0E-7D) {

View File

@ -11,16 +11,18 @@ diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
@@ -0,0 +0,0 @@ public class MappedRegistry<T> extends WritableRegistry<T> {
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
public class MappedRegistry<T> extends WritableRegistry<T> {
protected static final Logger LOGGER = LogManager.getLogger();
private final ObjectList<T> byId = new ObjectArrayList(256);
- private final Object2IntMap<T> toId = (Object2IntMap) Util.make(new Object2IntOpenCustomHashMap(Util.identityStrategy()), (object2intopencustomhashmap) -> {
- object2intopencustomhashmap.defaultReturnValue(-1);
- private final ObjectList<T> byId = new ObjectArrayList<>(256);
- private final Object2IntMap<T> toId = Util.make(new Object2IntOpenCustomHashMap<>(Util.identityStrategy()), (object2IntOpenCustomHashMap) -> {
- object2IntOpenCustomHashMap.defaultReturnValue(-1);
- });
- private final BiMap<ResourceLocation, T> storage = HashBiMap.create();
- private final BiMap<ResourceKey<T>, T> keyStorage = HashBiMap.create();
- private final Map<T, Lifecycle> lifecycles = Maps.newIdentityHashMap();
+ private final ObjectList<T> byId = new ObjectArrayList(256);
+ private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<T> toId = new it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<T>(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map
+ private final BiMap<ResourceLocation, T> storage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions
+ private final BiMap<ResourceKey<T>, T> keyStorage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions

View File

@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet bitSet, @Nullable BitSet bitSet2, boolean bl) {
public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) {
ChunkPos chunkPos = chunk.getPos();
this.x = chunkPos.x;
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java

View File

@ -24,8 +24,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.openSet.clear();
this.nodeEvaluator.prepare(world, mob);
Node node = this.nodeEvaluator.getStart();
- Map<Target, BlockPos> map = positions.stream().collect(Collectors.toMap((blockPos) -> {
- return this.nodeEvaluator.getGoal((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ());
- Map<Target, BlockPos> map = positions.stream().collect(Collectors.toMap((pos) -> {
- return this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
- }, Function.identity()));
+ // Paper start - remove streams - and optimize collection
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();

View File

@ -100,9 +100,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag);
+ }
+ // Paper end
/** @deprecated */
@Deprecated
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java

View File

@ -25,17 +25,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.useItemRemaining = itemstack.getUseDuration();
if (!this.level.isClientSide) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
+ this.startUsingItem(this.getUsedItemHand(), true); // Paper
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
}
}
this.stopUsingItem();
this.stopUsingItem();
- // Paper start - if the replacement is anything but the default, update the client inventory
- if (this instanceof ServerPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ // Paper start

View File

@ -139,14 +139,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour {
/** @deprecated */
@Deprecated
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
- return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem()));
+ return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper
}
@Deprecated
/** @deprecated */
@@ -0,0 +0,0 @@ public abstract class BlockBehaviour {
public Block getBlock() {
return (Block) this.owner;

View File

@ -82,14 +82,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -0,0 +0,0 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
Map<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, Recipe<?>>> map = Maps.newHashMap(); // CraftBukkit
Builder<ResourceLocation, Recipe<?>> builder = ImmutableMap.builder();
recipes.forEach((irecipe) -> {
- Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
+ Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - remap fix
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
});
Recipe<?> irecipe1 = (Recipe) map1.put(irecipe.getId(), irecipe);
ResourceLocation minecraftkey = irecipe.getId();
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/DyeColorsTest.java

View File

@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId>
- <packaging>jar</packaging>
- <version>1.18-pre5-R0.1-SNAPSHOT</version>
- <version>1.18-pre8-R0.1-SNAPSHOT</version>
- <name>Spigot</name>
- <url>https://www.spigotmc.org/</url>
-
@ -552,6 +552,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <algorithms>
- <algorithm>SHA-256</algorithm>
- </algorithms>
- <quiet>true</quiet>
- <scopes>
- <scope>compile</scope>
- <scope>runtime</scope>

View File

@ -1315,7 +1315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!flag1) {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
+ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
if (progressListener != null) {

View File

@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
}
public String toString() {
- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.level == null ? "~NULL~" : this.level.toString(), this.getX(), this.getY(), this.getZ());
+ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, rR=%s]", new Object[] { this.getClass().getSimpleName(), this.getName().getString(), Integer.valueOf(this.id), this.uuid.toString(), this.level == null ? "~NULL~" : this.level.toString(), Double.valueOf(this.getX()), Double.valueOf(this.getY()), Double.valueOf(this.getZ()), this.chunkPosition(), this.tickCount, this.valid, this.removalReason}); // Paper - add more information
String s = this.level == null ? "~NULL~" : this.level.toString();
- return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ(), this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ());
+ return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid, this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid);
}
public boolean isInvulnerableTo(DamageSource damageSource) {

View File

@ -6,3 +6,20 @@ Improve Server Thread Pool and Thread Priorities: mojang added a max thread coun
Use Vanilla Minecart Speeds: is this needed?
Handle Oversized Tile Entities: make sure impl is correct
0467-Optimize-WorldBorder-collision-checks-and-air check first hunk that has been removed
Not sure where this needs to go, if anywhere
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
@@ -0,0 +0,0 @@ public final class Shapes {
if (s < 3) {
mutableBlockPos.set(axisCycle, q, r, p);
- BlockState blockState = world.getBlockState(mutableBlockPos);
+ BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper
+ if (blockState == null) return 0.0D; // Paper
if ((s != 1 || blockState.hasLargeCollisionShape()) && (s != 2 || blockState.is(Blocks.MOVING_PISTON))) {
initial = blockState.getCollisionShape(world, mutableBlockPos, context).collide(axis3, box.move((double)(-mutableBlockPos.getX()), (double)(-mutableBlockPos.getY()), (double)(-mutableBlockPos.getZ())), initial);
if (Math.abs(initial) < 1.0E-7D) {

@ -1 +1 @@
Subproject commit 8581e449a3490934f8bfa8b36d45842393dc8a20
Subproject commit 09c3da501e40b5090cbd93cc91c8e5c49ce053b7

@ -1 +1 @@
Subproject commit ea30a299e948f5545b0ad042bd8e11716aeaa7f2
Subproject commit d25437bce34e0cb0b7c895867183dc949ea41667

@ -1 +1 @@
Subproject commit a58fde42cc9cd946db4c502a91dfe5cdf314fade
Subproject commit 5a39a236c11b6a5a19f8d26b4c5af1f59f16d447

@ -1 +1 @@
Subproject commit c07753b057d92ef6c0f9ad8e8446f51bcc37604d
Subproject commit 7840c2af5f487981d5a2eab4f9e832fdd7cfb298