1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-27 22:38:11 +01:00

work and compile errors

This commit is contained in:
Jake Potrebic 2023-09-21 19:31:59 -07:00
parent aca9b5cf34
commit 4e0701e69d
48 changed files with 132 additions and 122 deletions
patches
api
server
Add-Raw-Byte-ItemStack-Serialization.patchAdd-ThrownEggHatchEvent.patchAdd-debug-for-sync-chunk-loads.patchAdd-option-to-allow-iron-golems-to-spawn-in-air.patchAdd-option-to-nerf-pigmen-from-nether-portals.patchAdd-tick-times-API-and-mspt-command.patchAdventure.patchBasic-PlayerProfile-API.patchBees-get-gravity-in-void.-Fixes-MC-167279.patchComplete-resource-pack-API.patchConfigurable-chance-of-villager-zombie-infection.patchDead-Player-s-shouldn-t-be-able-to-move.patchDo-not-allow-bees-to-load-chunks-for-beehives.patchDon-t-move-existing-players-to-world-spawn.patchDon-t-tick-dead-players.patchEntity-Activation-Range-2.0.patchEntity-Jump-API.patchExpose-MinecraftServer-isRunning.patchFill-Profile-Property-Events.patchFix-items-vanishing-through-end-portal.patchFix-last-firework-in-stack-not-having-effects-when-d.patchImplement-alternative-item-despawn-rate.patchImprove-Block-breakNaturally-API.patchImprove-exact-choice-recipe-ingredients.patchImprove-java-version-check.patchLag-compensate-eating.patchMake-the-GUI-graph-fancier.patchOptimise-Chunk-getFluid.patchOptimise-getChunkAt-calls-for-loaded-chunks.patchOptimize-Collision-to-not-load-chunks.patchOptimize-GoalSelector-Goal.Flag-Set-operations.patchOptimize-call-to-getFluid-for-explosions.patchPillager-patrol-spawn-settings-and-per-player-option.patchPlayer.setPlayerProfile-API.patchPlayerAdvancementCriterionGrantEvent.patchPrevent-Double-PlayerChunkMap-adds-crashing-server.patchProfile-Lookup-Events.patchRemap-fixes.patchRemote-Connections-shouldn-t-hold-up-shutdown.patchSet-spigots-verbose-world-setting-to-false-by-def.patchTimings-v2.patchTracking-Range-Improvements.patchValidate-tripwire-hook-placement-before-update.patchadd-hand-to-BlockMultiPlaceEvent.patchimplement-optional-per-player-mob-spawns.patch
unapplied/skipped

View file

@ -3466,6 +3466,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ // Paper start + // Paper start
+ /**
+ * @return the player's ping
+ * @deprecated use {@link Player#getPing()}
+ */
+ @Deprecated
+ public int getPing() { + public int getPing() {
+ throw new UnsupportedOperationException( "Not supported yet." ); + throw new UnsupportedOperationException( "Not supported yet." );
} }

View file

@ -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("version"), new VersionCommand());
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,19 +304,27 @@ 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 {
this.entityLookup = new io.papermc.paper.chunk.system.entity.EntityLookup(this, new EntityCallbacks()); // Paper - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
} }
+ // Paper start + // Paper start

View file

@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ tickTimes10s.add(this.tickCount, j); + tickTimes10s.add(this.tickCount, j);
+ tickTimes60s.add(this.tickCount, j); + tickTimes60s.add(this.tickCount, j);
+ // Paper end + // Paper end
this.frameTimer.logFrameDuration(k - i); this.logTickTime(k - i);
this.profiler.pop(); this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View file

@ -3824,7 +3824,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else { + } else {
+ hash = ""; + hash = "";
+ } + }
+ this.getHandle().sendTexturePack(url, hash, force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)); + this.getHandle().connection.send(new ClientboundResourcePackPacket(url, hash, force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)));
+ } + }
+ // Paper end + // Paper end
+ +

View file

@ -11,7 +11,7 @@ public org.bukkit.craftbukkit.profile.CraftPlayerTextures
public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V
public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V
public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String; public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String;
# needed to maintain visibility with overriden methods # needed to maintain visibility with overridden methods
public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property; public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V
@ -428,7 +428,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.*; +import com.mojang.authlib.Environment;
+import com.mojang.authlib.EnvironmentParser;
+import com.mojang.authlib.GameProfileRepository;
+import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.MinecraftSessionService;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; +import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
@ -436,25 +438,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.net.Proxy; +import java.net.Proxy;
+ +
+public class PaperAuthenticationService extends YggdrasilAuthenticationService { +public class PaperAuthenticationService extends YggdrasilAuthenticationService {
+
+ private final Environment environment; + private final Environment environment;
+
+ public PaperAuthenticationService(Proxy proxy) { + public PaperAuthenticationService(Proxy proxy) {
+ super(proxy); + super(proxy);
+ this.environment = EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD.getEnvironment()); + this.environment = EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD.getEnvironment());
+ } + }
+ +
+ @Override + @Override
+ public UserAuthentication createUserAuthentication(Agent agent) {
+ return new PaperUserAuthentication(this, agent);
+ }
+
+ @Override
+ public MinecraftSessionService createMinecraftSessionService() { + public MinecraftSessionService createMinecraftSessionService() {
+ return new PaperMinecraftSessionService(this, this.environment); + return new PaperMinecraftSessionService(this, this.environment);
+ } + }
+ +
+ @Override + @Override
+ public GameProfileRepository createProfileRepository() { + public GameProfileRepository createProfileRepository() {
+ return new PaperGameProfileRepository(this, this.environment); + return new PaperGameProfileRepository(this.getProxy(), this.environment);
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@ -465,20 +464,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.Environment; +import com.mojang.authlib.Environment;
+import com.mojang.authlib.ProfileLookupCallback; +import com.mojang.authlib.ProfileLookupCallback;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; +import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
+import java.net.Proxy;
+ +
+public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { +public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { + public PaperGameProfileRepository(Proxy proxy, Environment environment) {
+ super(authenticationService, environment); + super(proxy, environment);
+ } + }
+ +
+ @Override + @Override
+ public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) { + public void findProfilesByNames(String[] names, ProfileLookupCallback callback) {
+ super.findProfilesByNames(names, agent, callback); + super.findProfilesByNames(names, callback);
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@ -492,14 +490,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.mojang.authlib.Environment; +import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import com.mojang.authlib.yggdrasil.ProfileResult;
+import com.mojang.authlib.yggdrasil.ServicesKeySet;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
+ +
+import java.net.Proxy;
+import java.util.Map; +import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+ +
+public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService { +public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService {
+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService, Environment environment) { +
+ super(authenticationService, environment); + protected PaperMinecraftSessionService(ServicesKeySet servicesKeySet, Proxy proxy, Environment environment) {
+ super(servicesKeySet, proxy, environment);
+ } + }
+ +
+ @Override + @Override
@ -508,31 +512,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ @Override + @Override
+ public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) { + public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) {
+ return super.fillProfileProperties(profile, requireSecure); + return super.fetchProfile(profileId, requireSecure);
+ }
+
+ @Override
+ protected GameProfile fillGameProfile(GameProfile profile, boolean requireSecure) {
+ return super.fillGameProfile(profile, requireSecure);
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
+import java.util.UUID;
+
+public class PaperUserAuthentication extends YggdrasilUserAuthentication {
+ public PaperUserAuthentication(YggdrasilAuthenticationService authenticationService, Agent agent) {
+ super(authenticationService, UUID.randomUUID().toString(), agent);
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java diff --git a/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/SharedPlayerProfile.java

View file

@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ net.minecraft.network.chat.Component promptComponent = resourcePackPrompt != null ? + net.minecraft.network.chat.Component promptComponent = resourcePackPrompt != null ?
+ io.papermc.paper.adventure.PaperAdventure.asVanilla(resourcePackPrompt) : + io.papermc.paper.adventure.PaperAdventure.asVanilla(resourcePackPrompt) :
+ null; + null;
+ this.getHandle().sendTexturePack(url, hash, required, promptComponent); + this.getHandle().connection.send(new ClientboundResourcePackPacket(url, hash, required, promptComponent));
+ } + }
+ +
+ @Override + @Override

View file

@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.advancements = server.getPlayerList().getPlayerAdvancements(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this);
this.setMaxUpStep(1.0F); this.setMaxUpStep(1.0F);
- this.fudgeSpawnLocation(world); - this.fudgeSpawnLocation(world);
+ //this.fudgeSpawnLocation(world); // Paper - don't move to spawn on login, only first join + // this.fudgeSpawnLocation(world); // Paper - don't move to spawn on login, only first join
this.updateOptions(clientOptions);
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
position = Vec3.atCenterOf(world.getSharedSpawnPos()); position = Vec3.atCenterOf(world.getSharedSpawnPos());
} }

View file

@ -564,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
@ -628,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;
@ -656,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;
@ -685,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

@ -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() || d3 > d4)) {
this.jumpInLiquid(FluidTags.LAVA); this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround() || flag && d7 <= d8) && this.noJumpDelay == 0) { } else if ((this.onGround() || flag && d3 <= d4) && 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;

View file

@ -14,29 +14,39 @@ diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSession
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +0,0 @@
package com.destroystokyo.paper.profile;
import com.mojang.authlib.Environment;
+import com.destroystokyo.paper.event.profile.FillProfileEvent;
+import com.destroystokyo.paper.event.profile.PreFillProfileEvent;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
@@ -0,0 +0,0 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi @@ -0,0 +0,0 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
return super.getTextures(profile, requireSecure);
@Override
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
- return super.fillProfileProperties(profile, requireSecure);
+ CraftPlayerProfile playerProfile = (CraftPlayerProfile) CraftPlayerProfile.asBukkitMirror(profile);
+ new PreFillProfileEvent(playerProfile).callEvent();
+ profile = playerProfile.getGameProfile();
+ if (profile.isComplete() && profile.getProperties().containsKey("textures")) {
+ return profile;
+ }
+ GameProfile gameProfile = super.fillProfileProperties(profile, requireSecure);
+ new FillProfileEvent(CraftPlayerProfile.asBukkitMirror(gameProfile)).callEvent();
+ return gameProfile;
} }
@Override - @Override
+ public @Nullable ProfileResult fetchProfile(GameProfile profile, final boolean requireSecure) {
+ CraftPlayerProfile playerProfile = (CraftPlayerProfile) CraftPlayerProfile.asBukkitMirror(profile);
+ new com.destroystokyo.paper.event.profile.PreFillProfileEvent(playerProfile).callEvent();
+ profile = playerProfile.getGameProfile();
+ if (profile.getProperties().containsKey("textures")) {
+ return new ProfileResult(profile, java.util.Collections.emptySet());
+ }
+ ProfileResult result = super.fetchProfile(profile.getId(), requireSecure);
+ if (result != null) {
+ new com.destroystokyo.paper.event.profile.FillProfileEvent(CraftPlayerProfile.asBukkitMirror(result.profile())).callEvent();
+ }
+ return result;
+ }
+
+ @Override @io.papermc.paper.annotation.DoNotUse @Deprecated
public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) {
return super.fetchProfile(profileId, requireSecure);
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity {
MinecraftSessionService minecraftsessionservice = SkullBlockEntity.sessionService;
if (minecraftsessionservice != null) {
- ProfileResult profileresult = minecraftsessionservice.fetchProfile(profile.getId(), true);
+ ProfileResult profileresult = minecraftsessionservice instanceof com.destroystokyo.paper.profile.PaperMinecraftSessionService paperMinecraftSessionService ? paperMinecraftSessionService.fetchProfile(profile, true) : minecraftsessionservice.fetchProfile(profile.getId(), true); // Paper
return profileresult == null ? Optional.of(profile) : Optional.of(profileresult.profile());
} else {

View file

@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -0,0 +0,0 @@ public interface DispenseItemBehavior {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
- FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.getLevel(), stack, pointer.x(), pointer.y(), pointer.x(), true); Vec3 vec3d = DispenseItemBehavior.getEntityPokingOutOfBlockPos(pointer, EntityType.FIREWORK_ROCKET, enumdirection);
+ FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.getLevel(), itemstack1, pointer.x(), pointer.y(), pointer.x(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed - FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.level(), stack, vec3d.x(), vec3d.y(), vec3d.z(), true);
+ FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.level(), itemstack1, vec3d.x(), vec3d.y(), vec3d.z(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed
DispenseItemBehavior.setEntityPokingOutOfBlock(pointer, entityfireworks, enumdirection);
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F); entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
pointer.level().addFreshEntity(entityfireworks);

View file

@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.inventory = entity.getInventory(); this.inventory = entity.getInventory();
if (this.testClearGrid() || entity.isCreative()) { if (this.testClearGrid() || entity.isCreative()) {
this.stackedContents.clear(); this.stackedContents.clear();
+ this.stackedContents.initialize(recipe); // Paper - better exact choice recipes + this.stackedContents.initialize(recipe.value()); // Paper - better exact choice recipes
entity.getInventory().fillStackedContents(this.stackedContents); entity.getInventory().fillStackedContents(this.stackedContents);
this.menu.fillCraftSlotsStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents);
if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) { if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) {

View file

@ -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");

View file

@ -18,13 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer1.setShiftKeyDown(false);
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end
+ worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) { while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
// CraftBukkit end
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java

View file

@ -179,7 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ //Respawn the player then update their position and selected slot + //Respawn the player then update their position and selected slot
+ ServerLevel worldserver = handle.serverLevel(); + 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(), handle.getPortalCooldown())); + connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(new net.minecraft.network.protocol.game.CommonPlayerSpawnInfo(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), handle.getLastDeathLocation(), handle.getPortalCooldown()), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA));
+ 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);

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (advancementprogress.grantProgress(criterionName)) { if (advancementprogress.grantProgress(criterionName)) {
+ // Paper start + // Paper start
+ if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.bukkit, criterionName).callEvent()) { + if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.toBukkit(), criterionName).callEvent()) {
+ advancementprogress.revokeProgress(criterionName); + advancementprogress.revokeProgress(criterionName);
+ return false; + return false;
+ } + }

View file

@ -16,22 +16,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.destroystokyo.paper.event.profile.LookupProfileEvent; +import com.destroystokyo.paper.event.profile.LookupProfileEvent;
+import com.destroystokyo.paper.event.profile.PreLookupProfileEvent; +import com.destroystokyo.paper.event.profile.PreLookupProfileEvent;
+import com.google.common.collect.Sets; +import com.google.common.collect.Sets;
import com.mojang.authlib.Agent;
import com.mojang.authlib.Environment; import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
import com.mojang.authlib.ProfileLookupCallback; import com.mojang.authlib.ProfileLookupCallback;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
import java.net.Proxy;
+import java.util.Set; +import java.util.Set;
public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { public PaperGameProfileRepository(Proxy proxy, Environment environment) {
super(authenticationService, environment);
@@ -0,0 +0,0 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { @@ -0,0 +0,0 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
@Override @Override
public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) { public void findProfilesByNames(String[] names, ProfileLookupCallback callback) {
- super.findProfilesByNames(names, agent, callback); - super.findProfilesByNames(names, callback);
+ Set<String> unfoundNames = Sets.newHashSet(); + Set<String> unfoundNames = Sets.newHashSet();
+ for (String name : names) { + for (String name : names) {
+ PreLookupProfileEvent event = new PreLookupProfileEvent(name); + PreLookupProfileEvent event = new PreLookupProfileEvent(name);
@ -55,27 +53,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Some things were not found.... Proceed to look up. + // Some things were not found.... Proceed to look up.
+ if (!unfoundNames.isEmpty()) { + if (!unfoundNames.isEmpty()) {
+ String[] namesArr = unfoundNames.toArray(new String[unfoundNames.size()]); + String[] namesArr = unfoundNames.toArray(new String[unfoundNames.size()]);
+ super.findProfilesByNames(namesArr, agent, new PreProfileLookupCallback(callback)); + super.findProfilesByNames(namesArr, new PreProfileLookupCallback(callback));
+ } + }
+ } + }
+ +
+ private static class PreProfileLookupCallback implements ProfileLookupCallback { + private record PreProfileLookupCallback(ProfileLookupCallback callback) implements ProfileLookupCallback {
+ private final ProfileLookupCallback callback;
+
+ PreProfileLookupCallback(ProfileLookupCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override + @Override
+ public void onProfileLookupSucceeded(GameProfile gameProfile) { + public void onProfileLookupSucceeded(GameProfile gameProfile) {
+ PlayerProfile from = CraftPlayerProfile.asBukkitMirror(gameProfile); + PlayerProfile from = CraftPlayerProfile.asBukkitMirror(gameProfile);
+ new LookupProfileEvent(from).callEvent(); + new LookupProfileEvent(from).callEvent();
+ callback.onProfileLookupSucceeded(gameProfile); + this.callback.onProfileLookupSucceeded(gameProfile);
+ } + }
+ +
+ @Override + @Override
+ public void onProfileLookupFailed(GameProfile gameProfile, Exception e) { + public void onProfileLookupFailed(final String profileName, final Exception exception) {
+ callback.onProfileLookupFailed(gameProfile, e); + this.callback.onProfileLookupFailed(profileName, exception);
+ } + }
} }
} }

View file

@ -73,6 +73,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
}); });
ResourceLocation minecraftkey = recipeholder.id(); ResourceLocation minecraftkey = recipeholder.id();
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
@@ -0,0 +0,0 @@ public class LootTable {
public static class Builder implements FunctionUserBuilder<LootTable.Builder> {
- private final Builder<LootPool> pools = ImmutableList.builder();
- private final Builder<LootItemFunction> functions = ImmutableList.builder();
+ private final ImmutableList.Builder<LootPool> pools = ImmutableList.builder();
+ private final ImmutableList.Builder<LootItemFunction> functions = ImmutableList.builder();
private LootContextParamSet paramSet;
private Optional<ResourceLocation> randomSequence;
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/DyeColorsTest.java --- a/src/test/java/org/bukkit/DyeColorsTest.java

View file

@ -1862,7 +1862,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public int getPing() + public int getPing()
+ { + {
+ return getHandle().latency; + return CraftPlayer.this.getPing();
+ } + }
+ // Paper end + // Paper end
}; };

View file

@ -258,14 +258,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2LongMap chunkSaveCooldowns; private final Long2LongMap chunkSaveCooldowns;
private final Queue<Runnable> unloadQueue; private final Queue<Runnable> unloadQueue;
int viewDistance; private int serverViewDistance;
+ 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 = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = io.papermc.paper.util.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
+ // Paper start - per player mob spawning + // Paper start - per player mob spawning
+ if (this.playerMobDistanceMap != null) { + if (this.playerMobDistanceMap != null) {
@ -275,7 +275,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
void removePlayerFromDistanceMaps(ServerPlayer player) { void removePlayerFromDistanceMaps(ServerPlayer player) {
this.level.playerChunkLoader.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,10 @@ 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 = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = io.papermc.paper.util.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.level.playerChunkLoader.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));