mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
more work and compile fixes
This commit is contained in:
parent
eb4be91142
commit
074728fe8c
31 changed files with 50 additions and 43 deletions
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle);
|
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle);
|
||||||
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
|
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
|
||||||
+ if (!itemstack.isEmpty() && itemstack.getItem().canBeDepleted()) {
|
+ if (!itemstack.isEmpty() && itemstack.getItem().canBeDepleted()) {
|
||||||
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level);
|
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
|
||||||
+ orb.value = amount;
|
+ orb.value = amount;
|
||||||
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;
|
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;
|
||||||
+ orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ());
|
+ orb.setPosRaw(handle.getX(), handle.getY(), handle.getZ());
|
||||||
|
|
|
@ -24,4 +24,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (hatching) {
|
if (hatching) {
|
||||||
for (int i = 0; i < b0; ++i) {
|
for (int i = 0; i < b0; ++i) {
|
||||||
Entity entity = level.getWorld().createEntity(new org.bukkit.Location(level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
|
Entity entity = this.level().getWorld().createEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (entityhuman != null) {
|
if (entityhuman != null) {
|
||||||
double d0 = entityhuman.distanceToSqr((Entity) this);
|
double d0 = entityhuman.distanceToSqr((Entity) this);
|
||||||
- int i = this.getType().getCategory().getDespawnDistance();
|
- int i = this.getType().getCategory().getDespawnDistance();
|
||||||
+ int i = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
|
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances
|
||||||
int j = i * i;
|
int j = i * i;
|
||||||
|
|
||||||
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||||
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
- int k = this.getType().getCategory().getNoDespawnDistance();
|
- int k = this.getType().getCategory().getNoDespawnDistance();
|
||||||
+ int k = this.level.paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
|
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances
|
||||||
int l = k * k;
|
int l = k * k;
|
||||||
|
|
||||||
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {
|
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {
|
||||||
|
|
|
@ -198,9 +198,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
|
||||||
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
@@ -0,0 +0,0 @@ public final class PaperCommand extends Command {
|
||||||
|
commands.put(Set.of("callback"), new CallbackCommand());
|
||||||
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
|
||||||
commands.put(Set.of("fixlight"), new FixLightCommand());
|
commands.put(Set.of("fixlight"), new FixLightCommand());
|
||||||
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
|
|
||||||
+ commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
+ commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
|
||||||
|
|
||||||
return commands.entrySet().stream()
|
return commands.entrySet().stream()
|
||||||
|
@ -304,27 +304,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
// Paper start - async chunk io/loading
|
@Nullable
|
||||||
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
|
@Override
|
||||||
// Paper end
|
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
|
||||||
|
+ final int x1 = x; final int z1 = z; // Paper - conflict on variable change
|
||||||
|
if (Thread.currentThread() != this.mainThread) {
|
||||||
|
return (ChunkAccess) CompletableFuture.supplyAsync(() -> {
|
||||||
|
return this.getChunk(x, z, leastStatus, create);
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
|
||||||
|
Objects.requireNonNull(completablefuture);
|
||||||
|
if (!completablefuture.isDone()) { // Paper
|
||||||
+ com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
|
+ com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
|
||||||
this.level.timings.syncChunkLoad.startTiming(); // Paper
|
this.level.timings.syncChunkLoad.startTiming(); // Paper
|
||||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||||
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
|
this.level.timings.syncChunkLoad.stopTiming(); // Paper
|
||||||
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 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
return this.entityLookup;
|
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
||||||
+ return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null;
|
+ return this.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ) != null;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
+
|
||||||
// Paper start - optimise getPlayerByUUID
|
/** @deprecated */
|
||||||
@Nullable
|
@Deprecated
|
||||||
|
@VisibleForTesting
|
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
||||||
|
|
||||||
+ // Paper start - Prevent moving into unloaded chunks
|
+ // Paper start - Prevent moving into unloaded chunks
|
||||||
+ if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && (
|
+ if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (
|
||||||
+ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) ||
|
+ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) ||
|
||||||
+ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
|
+ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
|
||||||
+ )) {
|
+ )) {
|
||||||
|
|
|
@ -2999,7 +2999,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ } else if (emitter instanceof org.bukkit.craftbukkit.entity.CraftEntity craftEntity) {
|
+ } else if (emitter instanceof org.bukkit.craftbukkit.entity.CraftEntity craftEntity) {
|
||||||
+ final net.minecraft.world.entity.Entity entity = craftEntity.getHandle();
|
+ final net.minecraft.world.entity.Entity entity = craftEntity.getHandle();
|
||||||
+ io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, entity, seed, this.playSound0(entity.getX(), entity.getY(), entity.getZ(), List.of((ServerLevel) entity.getLevel())));
|
+ io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, entity, seed, this.playSound0(entity.getX(), entity.getY(), entity.getZ(), List.of((ServerLevel) entity.level())));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter);
|
+ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter);
|
||||||
+ }
|
+ }
|
||||||
|
@ -3860,7 +3860,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private net.minecraft.network.chat.ChatType.Bound toHandle(net.kyori.adventure.chat.ChatType.Bound boundChatType) {
|
+ private net.minecraft.network.chat.ChatType.Bound toHandle(net.kyori.adventure.chat.ChatType.Bound boundChatType) {
|
||||||
+ net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
+ net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
||||||
+
|
+
|
||||||
+ return new net.minecraft.network.chat.ChatType.Bound(
|
+ return new net.minecraft.network.chat.ChatType.Bound(
|
||||||
+ chatTypeRegistry.get(io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.type().key())),
|
+ chatTypeRegistry.get(io.papermc.paper.adventure.PaperAdventure.asVanilla(boundChatType.type().key())),
|
||||||
|
@ -3906,7 +3906,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
|
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
|
||||||
+ if (getHandle().connection == null) return;
|
+ if (getHandle().connection == null) return;
|
||||||
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.CHAT_TYPE);
|
||||||
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, false));
|
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, false));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
|
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||||
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
|
||||||
public boolean wasKilled(ServerLevel world, LivingEntity other) {
|
public boolean killedEntity(ServerLevel world, LivingEntity other) {
|
||||||
boolean flag = super.wasKilled(world, other);
|
boolean flag = super.killedEntity(world, other);
|
||||||
|
|
||||||
- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) {
|
- if ((world.getDifficulty() == Difficulty.NORMAL || world.getDifficulty() == Difficulty.HARD) && other instanceof Villager) {
|
||||||
- Villager entityvillager = (Villager) other;
|
- Villager entityvillager = (Villager) other;
|
|
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- this.getHandle().connection.chat(msg, PlayerChatMessage.system(msg), false);
|
- this.getHandle().connection.chat(msg, PlayerChatMessage.system(msg), false);
|
||||||
+ // Paper start - improve chat handling
|
+ // Paper start - improve chat handling
|
||||||
+ if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {
|
+ if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {
|
||||||
+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS);
|
+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ if (msg.startsWith("/")) {
|
+ if (msg.startsWith("/")) {
|
||||||
+ this.getHandle().connection.handleCommand(msg);
|
+ this.getHandle().connection.handleCommand(msg);
|
||||||
|
|
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/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 implements Attackable {
|
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
} else if (this.isInLava() && (!this.onGround || d7 > d8)) {
|
} else if (this.isInLava() && (!this.onGround() || d7 > d8)) {
|
||||||
this.jumpInLiquid(FluidTags.LAVA);
|
this.jumpInLiquid(FluidTags.LAVA);
|
||||||
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
|
} else if ((this.onGround() || flag && d7 <= d8) && this.noJumpDelay == 0) {
|
||||||
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
||||||
this.jumpFromGround();
|
this.jumpFromGround();
|
||||||
this.noJumpDelay = 10;
|
this.noJumpDelay = 10;
|
||||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class Panda extends Animal {
|
@@ -0,0 +0,0 @@ public class Panda extends Animal {
|
||||||
Panda entitypanda = (Panda) iterator.next();
|
Panda entitypanda = (Panda) iterator.next();
|
||||||
|
|
||||||
if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
|
if (!entitypanda.isBaby() && entitypanda.onGround() && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
|
||||||
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
||||||
entitypanda.jumpFromGround();
|
entitypanda.jumpFromGround();
|
||||||
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
||||||
|
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class Ravager extends Raider {
|
@@ -0,0 +0,0 @@ public class Ravager extends Raider {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flag && this.onGround) {
|
if (!flag && this.onGround()) {
|
||||||
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
+ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
|
||||||
this.jumpFromGround();
|
this.jumpFromGround();
|
||||||
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
+ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
|
|
@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot
|
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
|
||||||
+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
|
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
|
||||||
// CraftBukkit start - fire ItemDespawnEvent
|
// CraftBukkit start - fire ItemDespawnEvent
|
||||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||||
this.age = 0;
|
this.age = 0;
|
||||||
|
@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.lastTick = MinecraftServer.currentTick;
|
this.lastTick = MinecraftServer.currentTick;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
- if (!this.level.isClientSide && this.age >= level.spigotConfig.itemDespawnRate) { // Spigot
|
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
|
||||||
+ if (!this.level.isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
|
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
|
||||||
// CraftBukkit start - fire ItemDespawnEvent
|
// CraftBukkit start - fire ItemDespawnEvent
|
||||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||||
this.age = 0;
|
this.age = 0;
|
||||||
|
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
|
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
|
||||||
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
||||||
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
|
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
|
||||||
+ this.despawnRate = level.paperConfig().entities.spawning.altItemDespawnRate.enabled ? level.paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), level.spigotConfig.itemDespawnRate) : level.spigotConfig.itemDespawnRate; // Paper
|
+ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
public void makeFakeItem() {
|
public void makeFakeItem() {
|
||||||
this.setNeverPickUp();
|
this.setNeverPickUp();
|
||||||
- this.age = level.spigotConfig.itemDespawnRate - 1; // Spigot
|
- this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
|
||||||
+ this.age = this.despawnRate - 1; // Spigot
|
+ this.age = this.despawnRate - 1; // Spigot // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getSpin(float tickDelta) {
|
public float getSpin(float tickDelta) {
|
|
@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ this.getCombatTracker().recheckStatus();
|
+ this.getCombatTracker().recheckStatus();
|
||||||
+ if (entity != null) {
|
+ if (entity != null) {
|
||||||
+ entity.wasKilled((ServerLevel) this.level(), this);
|
+ entity.killedEntity((ServerLevel) this.level(), this);
|
||||||
+ }
|
+ }
|
||||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||||
- this.dropAllDeathLoot(damageSource);
|
- this.dropAllDeathLoot(damageSource);
|
||||||
|
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
gameprofilerfiller.incrementCounter("getChunk");
|
gameprofilerfiller.incrementCounter("getChunk");
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
if (!io.papermc.paper.util.TickThread.isTickThread()) { // Paper - rewrite chunk system
|
if (Thread.currentThread() != this.mainThread) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
- this.level.getProfiler().incrementCounter("getChunkNow");
|
- this.level.getProfiler().incrementCounter("getChunkNow");
|
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.discard();
|
this.discard();
|
||||||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||||
- Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
- Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
||||||
+ Player entityhuman = this.level().getNearestPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
|
+ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
|
||||||
|
|
||||||
if (entityhuman != null) {
|
if (entityhuman != null) {
|
||||||
double d0 = entityhuman.distanceToSqr((Entity) this);
|
double d0 = entityhuman.distanceToSqr((Entity) this);
|
||||||
|
|
|
@ -160,8 +160,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ ServerGamePacketListenerImpl connection = handle.connection;
|
+ ServerGamePacketListenerImpl connection = handle.connection;
|
||||||
+
|
+
|
||||||
+ //Respawn the player then update their position and selected slot
|
+ //Respawn the player then update their position and selected slot
|
||||||
+ ServerLevel worldserver = handle.getLevel();
|
+ ServerLevel worldserver = handle.serverLevel();
|
||||||
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation()));
|
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA, this.getHandle().getLastDeathLocation(), handle.getPortalCooldown()));
|
||||||
+ handle.onUpdateAbilities();
|
+ handle.onUpdateAbilities();
|
||||||
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
|
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
|
||||||
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
|
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
|
||||||
|
|
|
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (this.pickupDelay <= 0) {
|
+ if (this.pickupDelay <= 0) {
|
||||||
+ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
+ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||||
+ this.level.getCraftServer().getPluginManager().callEvent(attemptEvent);
|
+ this.level().getCraftServer().getPluginManager().callEvent(attemptEvent);
|
||||||
+
|
+
|
||||||
+ flyAtPlayer = attemptEvent.getFlyAtPlayer();
|
+ flyAtPlayer = attemptEvent.getFlyAtPlayer();
|
||||||
+ if (attemptEvent.isCancelled()) {
|
+ if (attemptEvent.isCancelled()) {
|
||||||
|
|
|
@ -261,8 +261,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
int viewDistance;
|
int viewDistance;
|
||||||
+ public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
|
+ public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
|
||||||
|
|
||||||
// Paper - rewrite chunk system
|
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||||
|
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||||
|
@ -275,7 +275,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||||
this.playerChunkManager.removePlayer(player); // Paper - replace chunk loader
|
|
||||||
|
|
||||||
+ // Paper start - per player mob spawning
|
+ // Paper start - per player mob spawning
|
||||||
+ if (this.playerMobDistanceMap != null) {
|
+ if (this.playerMobDistanceMap != null) {
|
||||||
|
@ -285,10 +284,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateMaps(ServerPlayer player) {
|
void updateMaps(ServerPlayer player) {
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||||
this.playerChunkManager.updatePlayer(player); // Paper - replace chunk loader
|
|
||||||
+ // Paper start - per player mob spawning
|
+ // Paper start - per player mob spawning
|
||||||
+ if (this.playerMobDistanceMap != null) {
|
+ if (this.playerMobDistanceMap != null) {
|
||||||
+ this.playerMobDistanceMap.update(player, chunkX, chunkZ, io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player));
|
+ this.playerMobDistanceMap.update(player, chunkX, chunkZ, io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player));
|
Loading…
Reference in a new issue