More more more more more more more more work

This commit is contained in:
Nassim Jahnke 2023-06-07 23:14:56 +02:00
parent dc0aa6ed0a
commit 1450690de9
40 changed files with 76 additions and 91 deletions

View file

@ -2796,14 +2796,6 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntit
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
}
}
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
// CraftBukkit start // CraftBukkit start

View file

@ -50,9 +50,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
private final IntBuffer timestamps;
@VisibleForTesting @VisibleForTesting
protected final RegionBitmap usedSectors; protected final RegionBitmap usedSectors;
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper
+ public final Path regionFile; // Paper + public final Path regionFile; // Paper
public RegionFile(Path file, Path directory, boolean dsync) throws IOException { public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
@ -229,7 +229,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CompoundTag read(ChunkPos pos) throws IOException { public CompoundTag read(ChunkPos pos) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { @@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
try { // Paper // CraftBukkit end
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos); DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
+ // Paper start + // Paper start

View file

@ -26,7 +26,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- ServerChunkCache chunkproviderserver = worldserver.getChunkSource(); - ServerChunkCache chunkproviderserver = worldserver.getChunkSource();
+ //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up + //ChunkProviderServer chunkproviderserver = worldserver.getChunkProvider(); // Paper - move up
chunkproviderserver.getLightEngine().setTaskPerBatch(500);
this.nextTickTime = Util.getMillis(); this.nextTickTime = Util.getMillis();
- // CraftBukkit start - // CraftBukkit start
- if (worldserver.getWorld().getKeepSpawnInMemory()) { - if (worldserver.getWorld().getKeepSpawnInMemory()) {
@ -60,21 +59,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
- worldloadlistener.stop(); - worldloadlistener.stop();
+ if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper + if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper
chunkproviderserver.getLightEngine().setTaskPerBatch(5);
// CraftBukkit start // CraftBukkit start
// this.updateMobSpawningFlags(); // this.updateMobSpawningFlags();
worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.resources.ResourceKey;
+import io.papermc.paper.util.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.level.progress.ChunkProgressListener;
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap(); return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
} }

View file

@ -32,8 +32,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); this.shoot((double) f5, (double) f6, (double) f7, speed, divergence);
Vec3 vec3d = shooter.getDeltaMovement(); Vec3 vec3d = shooter.getDeltaMovement();
- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); - this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z));
+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity + if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity
} }
// CraftBukkit start - call projectile hit event // CraftBukkit start - call projectile hit event

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sat, 11 Sep 2021 11:56:51 +0200
Subject: [PATCH] Dont send unnecessary sign update
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
} else {
SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper
((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
}
}

View file

@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
})); }));
// CraftBukkit end // CraftBukkit end
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
throw new UnsupportedOperationException(); // Paper - rewrite chunk system });
} }
+ // Paper start + // Paper start
@ -115,5 +115,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) { public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> prepareTickingChunk(ChunkHolder holder) {
throw new UnsupportedOperationException(); // Paper - rewrite chunk system CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(holder, 1, (i) -> {
} return ChunkStatus.FULL;

View file

@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper + public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper
public float getWalkTargetValue(BlockPos pos) { public float getWalkTargetValue(BlockPos pos) {
return this.getWalkTargetValue(pos, this.level); return this.getWalkTargetValue(pos, this.level());
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@ -245,7 +245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.mob = mob; this.mob = mob;
@@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal { @@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal {
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level, mutableBlockPos)) { if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
this.blockPos = mutableBlockPos; this.blockPos = mutableBlockPos;
+ setTargetPosition(mutableBlockPos.immutable()); // Paper + setTargetPosition(mutableBlockPos.immutable()); // Paper
return true; return true;
@ -259,19 +259,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void inactiveTick() { public void inactiveTick() {
// SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
- if (level.spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) { - if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
- this.customServerAiStep(); - this.customServerAiStep();
+ // Paper start + // Paper start
+ if (this.getUnhappyCounter() > 0) { + if (this.getUnhappyCounter() > 0) {
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1); + this.setUnhappyCounter(this.getUnhappyCounter() - 1);
+ } }
+ if (this.isEffectiveAi()) { + if (this.isEffectiveAi()) {
+ if (level.spigotConfig.tickInactiveVillagers) { + if (level.spigotConfig.tickInactiveVillagers) {
+ this.customServerAiStep(); + this.customServerAiStep();
+ } else { + } else {
+ this.mobTick(true); + this.mobTick(true);
+ } + }
} + }
+ maybeDecayGossip(); + maybeDecayGossip();
+ // Paper end + // Paper end
+ +
@ -280,13 +280,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot End // Spigot End
@Override @Override
- protected void customServerAiStep() { + @Deprecated // Paper
+ protected void customServerAiStep() { mobTick(false); } protected void customServerAiStep() {
+ protected void mobTick(boolean inactive) { + // Paper start
this.level.getProfiler().push("villagerBrain"); + this.customServerAiStep(false);
- this.getBrain().tick((ServerLevel) this.level, this); + }
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper + protected void customServerAiStep(final boolean inactive) {
this.level.getProfiler().pop(); + // Paper end
this.level().getProfiler().push("villagerBrain");
- this.getBrain().tick((ServerLevel) this.level(), this);
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
this.level().getProfiler().pop();
if (this.assignProfessionWhenSpawned) { if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false; this.assignProfessionWhenSpawned = false;
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@ -295,7 +299,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (!this.isNoAi() && this.random.nextInt(100) == 0) { - if (!this.isNoAi() && this.random.nextInt(100) == 0) {
+ if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper + if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper
Raid raid = ((ServerLevel) this.level).getRaidAt(this.blockPosition()); Raid raid = ((ServerLevel) this.level()).getRaidAt(this.blockPosition());
if (raid != null && raid.isActive() && !raid.isOver()) { if (raid != null && raid.isActive() && !raid.isOver()) {
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@ -321,11 +325,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -0,0 +0,0 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public boolean suckInItems() { public boolean suckInItems() {
if (HopperBlockEntity.suckInItems(this.level, this)) { if (HopperBlockEntity.suckInItems(this.level(), this)) {
+ this.immunize(); // Paper + this.immunize(); // Paper
return true; return true;
} else { } else {
for(ItemEntity itemEntity : this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) { for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) {
if (HopperBlockEntity.addItem(this, itemEntity)) { if (HopperBlockEntity.addItem(this, itemEntity)) {
+ this.immunize(); // Paper + this.immunize(); // Paper
return true; return true;
@ -560,8 +564,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange ); + ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange );
+ // Paper end + // Paper end
// Paper start world.getEntities().get(maxBB, ActivationRange::activateEntity);
java.util.List<Entity> entities = world.getEntities((Entity)null, maxBB, null); }
@@ -0,0 +0,0 @@ public class ActivationRange @@ -0,0 +0,0 @@ public class ActivationRange
* @param entity * @param entity
* @return * @return
@ -598,8 +602,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
if ( !( entity instanceof AbstractArrow ) ) if ( !( entity instanceof AbstractArrow ) )
{ {
- if ( !entity.isOnGround() || !entity.passengers.isEmpty() || entity.isPassenger() ) - if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() )
+ if ( (!entity.isOnGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic + if ( (!entity.onGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic
{ {
- return true; - return true;
+ return 10; // Paper + return 10; // Paper
@ -624,7 +628,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
{ {
- return true; - return true;
+ return 20; // Paper + return 20; // Paper
+ } }
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ // Paper start + // Paper start
+ if (entity instanceof Bee) { + if (entity instanceof Bee) {
+ Bee bee = (Bee)entity; + Bee bee = (Bee)entity;
@ -652,8 +657,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return config.villagersWorkImmunityFor; + return config.villagersWorkImmunityFor;
+ } + }
+ } + }
} + }
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
+ if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() ) + if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() )
{ {
- return true; - return true;
@ -681,11 +685,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) { + if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) {
+ return 0; + return 0;
} + }
+ if (entity instanceof Pillager) { + if (entity instanceof Pillager) {
+ Pillager pillager = (Pillager) entity; + Pillager pillager = (Pillager) entity;
+ // TODO:? + // TODO:?
+ } }
+ // Paper end + // Paper end
} }
// SPIGOT-6644: Otherwise the target refresh tick will be missed // SPIGOT-6644: Otherwise the target refresh tick will be missed

View file

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ } + }
+ // Paper end + // Paper end
player.setLevel(worldserver1); player.setServerLevel(worldserver1);
String s1 = "local"; String s1 = "local";
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end }
private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) { private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) {
- return this.read(chunkPos).thenApplyAsync((optional) -> { - return this.read(chunkPos).thenApplyAsync((optional) -> {
@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper protected final RegionBitmap usedSectors;
public final Path regionFile; // Paper public final Path regionFile; // Paper
+ // Paper start - Cache chunk status + // Paper start - Cache chunk status
@ -135,10 +135,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private static int getOffsetIndex(ChunkPos pos) { private static int getOffsetIndex(ChunkPos pos) {
return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32;
} }
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
synchronized (this) { public void close() throws IOException {
try {
// Paper end
+ this.closed = true; // Paper + this.closed = true; // Paper
try { try {
this.padToFullSector(); this.padToFullSector();

View file

@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
- if (!this.onGround || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { - if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) {
+ if (!this.onGround || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change + if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
float f1 = 0.98F; float f1 = 0.98F;

View file

@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/Bootstrap.java --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -0,0 +0,0 @@ public class Bootstrap { @@ -0,0 +0,0 @@ public class Bootstrap {
CauldronInteraction.bootStrap(); BuiltInRegistries.bootStrap();
// Paper start // Paper start
BuiltInRegistries.bootStrap(() -> { BuiltInRegistries.bootStrap(() -> {
+ net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec()); + net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec());

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
// Paper end - rewrite chunk system // Paper end
+ // Paper start - optimise getPlayerByUUID + // Paper start - optimise getPlayerByUUID
+ @Nullable + @Nullable
@ -23,5 +23,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error

View file

@ -26,5 +26,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper end + // Paper end
// CraftBukkit end // CraftBukkit end
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !io.papermc.paper.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE));
} }

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (this.isTooFarAway(this.hivePos)) { } else if (this.isTooFarAway(this.hivePos)) {
return false; return false;
} else { } else {
+ if (level.getChunkIfLoadedImmediately(hivePos.getX() >> 4, hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s) + if (this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s)
BlockEntity tileentity = this.level.getBlockEntity(this.hivePos); BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE; return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE;

View file

@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag + if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack; this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration(); this.useItemRemaining = itemstack.getUseDuration();
if (!this.level.isClientSide) { if (!this.level().isClientSide) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.releaseUsingItem(); this.releaseUsingItem();
} else { } else {

View file

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sat, 11 Sep 2021 11:56:51 +0200
Subject: [PATCH] Dont send unnecessary sign update
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32) // Paper
this.send(tileentity.getUpdatePacket()); // CraftBukkit
return;
}