update upstream (and fix a few bugs)

This commit is contained in:
Blast-MC
2025-02-15 01:22:45 -05:00
parent 30cfeef7c6
commit e224056a29
22 changed files with 124 additions and 103 deletions

View File

@@ -1,28 +1,50 @@
name: Patch and Build
name: Build main
on:
push:
branches: [ "**" ]
pull_request:
on: [push]
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
matrix:
java: [21]
fail-fast: true
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Configure Git User Details
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
- name: Apply Patches
run: ./gradlew applyAllPatches --stacktrace
- name: Build
run: ./gradlew build
java-version: ${{ matrix.java }}
distribution: 'adopt'
- name: Cache gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/jdks
~/.gradle/native
~/.gradle/wrapper
key: ${{ runner.os }}-parchment-2-${{ hashFiles('**/*.gradle*', 'gradle/**', 'gradle.properties') }}
restore-keys: ${{ runner.os }}-parchment-2
- name: Patch Parchment
env:
ORG_GRADLE_PROJECT_edenSnapshotsUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_edenSnapshotsPassword: ${{ secrets.SONATYPE_PASSWORD }}
run: |
git config --global user.email "no-reply@github.com"
git config --global user.name "GitHub Actions"
./gradlew applyAllPatches
./gradlew createMojmapPaperclipJar
./gradlew :parchment-api:publishMavenPublicationToEdenSnapshotsRepository
./gradlew publishDevBundlePublicationToEdenSnapshotsRepository -PpublishDevBundle
- uses: actions/upload-artifact@v3
with:
name: Parchment-JDK${{ matrix.java }}
path: parchment-server/build/libs/parchment-paperclip-*-mojmap.jar

View File

@@ -3,8 +3,11 @@ Things I've found while just trying to get this to work:
- If you've made an update to either of the build.gradle.kts files in api or server, run `./gradlew rebuildPaperSingleFilePatches` after adding to git (no commit)
- To create a file patch:
- Make the changes you need and have no other staged changes
- cd paper-api or paper-server
- cd **paper-api** or **paper-server** or **parchment-server/src/minecraft/java**
- git add .
- git commit --ammend
- This ammends it to the specific 'File Patch Commit'
- ./gradlew rebuildPaper<Api/Server>FilePatches
- git commit --amend
- This ammends it to the specific 'File Patch Commit'
- Then run one of the following
- ./gradlew rebuildPaperApiFilePatches
- ./gradlew rebuildPaperServerFilePatches
- ./gradlew rebuildMinecraftFilePatches

View File

@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java // TODO java launcher tasks
id("io.papermc.paperweight.patcher") version "2.0.0-beta.13"
id("io.papermc.paperweight.patcher") version "2.0.0-beta.14"
}
paperweight {
@@ -26,11 +26,6 @@ paperweight {
patchesDir = file("parchment-api/paper-patches")
outputDir = file("paper-api")
}
patchDir("paperApiGenerator") {
upstreamPath = "paper-api-generator"
patchesDir = file("parchment-api-generator/paper-patches")
outputDir = file("paper-api-generator")
}
}
}

View File

@@ -1,7 +1,7 @@
group=gg.projecteden.parchment
version=1.21.4-R0.1-SNAPSHOT
mcVersion=1.21.4
paperRef=b03d39b5ce6b5046ce6854ddba74e8ae3641c230
paperRef=6cfa2f7f315cbad23d7b12984b751f2721b496b6
org.gradle.configuration-cache=true
org.gradle.caching=true

View File

@@ -17,6 +17,15 @@
// api dependencies are listed transitively to API consumers
api("com.google.guava:guava:33.3.1-jre")
@@ -93,7 +_,7 @@
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
idea {
module {
generatedSourceDirs.add(generatedApiPath.toFile())
@@ -103,6 +_,18 @@
main {
java {

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -27,13 +_,20 @@
@@ -28,13 +_,20 @@
* magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation.
*/

View File

@@ -1,9 +1,9 @@
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -19,7 +_,14 @@
* player that is stored on the disk and can, thus, be retrieved without the
@@ -20,7 +_,14 @@
* player needing to be online.
*/
@NullMarked
-public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API
+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder, gg.projecteden.parchment.HasOfflinePlayer, gg.projecteden.parchment.OptionalPlayer { // Parchment
+

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -52,6 +_,36 @@
@@ -53,6 +_,36 @@
*/
public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper

View File

@@ -9,7 +9,7 @@
/**
* Gets the metadata for this block
@@ -593,6 +_,20 @@
@@ -590,6 +_,20 @@
* @return true if the block was destroyed
*/
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);

View File

@@ -1,15 +1,15 @@
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -23,7 +_,14 @@
/**
@@ -25,7 +_,14 @@
* Represents a human entity, such as an NPC or a player
*/
@NullMarked
-public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity { // Parchment
+
+ // Parchment start
+ @Override
+ default @NotNull HumanEntity getPlayer() {
+ default HumanEntity getPlayer() {
+ return this;
+ }
+ // Parchment end

View File

@@ -1,11 +1,11 @@
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -59,7 +_,17 @@
/**
@@ -62,7 +_,17 @@
* Represents a player, connected or not
*/
@NullMarked
-public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient { // Paper
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient , gg.projecteden.parchment.HasPlayer { // Paper // Parchment
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient, gg.projecteden.parchment.HasPlayer { // Paper // Parchment
+
+ // Parchment start
+ /**
@@ -14,14 +14,14 @@
+ * @return this player
+ */
+ @Override
+ @NotNull Player getPlayer();
+ Player getPlayer();
+ // Parchment end
// Paper start
@Override
@@ -2128,6 +_,17 @@
@@ -2084,6 +_,16 @@
*/
public boolean canSee(@NotNull Entity entity);
public boolean canSee(Player player);
+ // Parchment start
+ /**
@@ -30,17 +30,16 @@
+ * @param plugin Plugin that has hidden entities
+ * @return a view of hidden entity UUIDs
+ */
+ public java.util.@NotNull Set<java.util.UUID> getHiddenEntities(@NotNull Plugin plugin);
+ public java.util.Set<java.util.UUID> getHiddenEntities(Plugin plugin);
+ // Parchment end
+
+
// Paper start
/**
* Returns whether the {@code other} player is listed for {@code this}.
@@ -3892,4 +_,45 @@
* Visually hides an entity from this player.
*
@@ -3902,4 +_,43 @@
* @return the result of this method, holding leftovers and spawned items.
*/
void sendEntityEffect(org.bukkit.@NotNull EntityEffect effect, @NotNull Entity target);
// Paper end - entity effect API
PlayerGiveResult give(Collection<ItemStack> items, boolean dropIfFull);
+
+ /**
+ * Checks if the player will spawn phantoms at night
@@ -80,6 +79,4 @@
+ * @return ticks since the player last slept
+ */
+ int getTimeSinceLastRest();
+// Parchment end
+
}

View File

@@ -1,9 +1,10 @@
--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -21,8 +_,19 @@
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
// gitFilePatches = true
@@ -37,6 +_,21 @@
"org.bukkit.craftbukkit",
"org.spigotmc",
)
+
+ val fork = forks.register("parchment") {
+ upstream.patchDir("paperServer") {
+ upstreamPath = "paper-server"
@@ -15,13 +16,13 @@
+
+ activeFork = fork
+
paper {
- reobfMappingsPatch = layout.projectDirectory.file("../build-data/reobf-mappings-patch.tiny")
+ paper {
+ paperServerDir = upstreamsDirectory().map { it.dir("paper/paper-server") }
}
+ }
}
spigot {
@@ -105,7 +_,20 @@
tasks.generateDevelopmentBundle {
@@ -101,7 +_,20 @@
}
}
@@ -43,16 +44,16 @@
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get())
}
@@ -123,7 +_,7 @@
@@ -119,7 +_,7 @@
}
dependencies {
- implementation(project(":paper-api"))
+ implementation(project(":parchment-api"))
implementation("ca.spottedleaf:concurrentutil:0.0.2")
implementation("ca.spottedleaf:concurrentutil:0.0.3")
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
@@ -192,14 +_,14 @@
@@ -188,14 +_,14 @@
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -778,9 +_,12 @@
@@ -785,9 +_,12 @@
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start
@@ -16,7 +16,7 @@
}
// CraftBukkit end
// Paper start - Don't suggest if tab-complete is disabled
@@ -2490,6 +_,7 @@
@@ -2497,6 +_,7 @@
// Spigot start - spam exclusions
private void detectRateSpam(String message) {
@@ -24,7 +24,7 @@
// CraftBukkit start - replaced with thread safe throttle
for (String exclude : org.spigotmc.SpigotConfig.spamExclusions) {
if (exclude != null && message.startsWith(exclude)) {
@@ -3245,9 +_,11 @@
@@ -3280,9 +_,11 @@
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -5081,4 +_,31 @@
@@ -5077,4 +_,31 @@
return ((ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
}
// Paper end - Expose entity id counter

View File

@@ -36,7 +36,7 @@
}
}
// Paper end - send while respecting visibility
@@ -2432,4 +_,11 @@
@@ -2440,4 +_,11 @@
return this.message;
}
}

View File

@@ -16,29 +16,27 @@
this.hasImpulse = true;
double d = movementToShoot.horizontalDistance();
this.setYRot((float)(Mth.atan2(movementToShoot.x, movementToShoot.z) * 180.0F / (float)Math.PI));
@@ -193,14 +_,19 @@
@@ -193,6 +_,10 @@
}
public void shootFromRotation(Entity shooter, float x, float y, float z, float velocity, float inaccuracy) {
+ // Parchment start
+ shootFromRotation(shooter, x, y, z, velocity, inaccuracy, true);
+ this.shootFromRotation(shooter, x, y, z, velocity, inaccuracy, true);
+ }
+
+ public void shootFromRotation(Entity shooter, float x, float y, float z, float velocity, float inaccuracy, boolean relative) {
float f = -Mth.sin(y * (float) (Math.PI / 180.0)) * Mth.cos(x * (float) (Math.PI / 180.0));
float f1 = -Mth.sin((x + z) * (float) (Math.PI / 180.0));
float f2 = Mth.cos(y * (float) (Math.PI / 180.0)) * Mth.cos(x * (float) (Math.PI / 180.0));
this.shoot(f, f1, f2, velocity, inaccuracy);
Vec3 knownMovement = shooter.getKnownMovement();
// Paper start - allow disabling relative velocity
@@ -202,7 +_,7 @@
if (Double.isNaN(knownMovement.x) || Double.isNaN(knownMovement.y) || Double.isNaN(knownMovement.z)) {
knownMovement = new Vec3(0, 0, 0);
}
- if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) {
- this.setDeltaMovement(this.getDeltaMovement().add(knownMovement.x, shooter.onGround() ? 0.0 : knownMovement.y, knownMovement.z));
+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity && relative) {
+ this.setDeltaMovement(this.getDeltaMovement().add(knownMovement.x, shooter.onGround() ? 0.0 : knownMovement.y, knownMovement.z));
this.setDeltaMovement(this.getDeltaMovement().add(knownMovement.x, shooter.onGround() ? 0.0 : knownMovement.y, knownMovement.z));
}
// Paper end - allow disabling relative velocity
}
@@ -232,7 +_,11 @@
@@ -235,7 +_,11 @@
float velocity,
float inaccuracy
) {
@@ -51,7 +49,7 @@
}
public static <T extends Projectile> T spawnProjectileUsingShoot(
@@ -241,9 +_,19 @@
@@ -244,9 +_,19 @@
// Paper start - fixes and addition to spawn reason API
return spawnProjectileUsingShootDelayed(projectile, level, spawnedFrom, x, y, z, velocity, inaccuracy).spawn();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -308,30 +_,46 @@
@@ -308,30 +_,45 @@
}
// Paper end - Add BlockBreakBlockEvent
@@ -43,7 +43,6 @@
- getDrops(state, (ServerLevel)level, pos, blockEntity, entity, tool).forEach(itemStack -> popResource(level, pos, itemStack));
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(level, pos, Block.getDrops(state, (ServerLevel) level, pos, blockEntity, entity, tool)).forEach((itemstack1) -> { // Parchment
+ Block.popResource(level, pos, itemstack1);
+ itemEntities.add(Block.popResourceWithReturn(level, pos, itemstack1));
+ });
state.spawnAfterBreak((ServerLevel) level, pos, tool, dropExperience); // Paper - Properly handle xp dropping

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2472,4 +_,16 @@
@@ -2498,4 +_,16 @@
return this.adventure$pointers;
}
// Paper end

View File

@@ -1,11 +1,13 @@
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -267,7 +_,7 @@
@@ -266,8 +_,8 @@
deadline.add(Calendar.DAY_OF_YEAR, -14);
if (buildDate.before(deadline.getTime())) {
// Paper start - This is some stupid bullshit
System.err.println("*** Warning, you've not updated in a while! ***");
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
+ System.err.println("*** Please download a new build as per instructions from https://github.com/ProjectEdenGG/Parchment ***"); // Paper
- System.err.println("*** Warning, you've not updated in a while! ***");
- System.err.println("*** Please download a new build from https://papermc.io/downloads/paper ***"); // Paper
+ // System.err.println("*** Warning, you've not updated in a while! ***");
+ // System.err.println("*** Please download a new build from https://papermc.io/downloads/paper ***"); // Paper
//System.err.println("*** Server will start in 20 seconds ***");
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
// Paper end

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -219,6 +_,7 @@
@@ -226,6 +_,7 @@
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
private long lastSaveTime; // Paper - getLastPlayed replacement API
@@ -8,11 +8,11 @@
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -3541,4 +_,41 @@
this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundEntityEventPacket(((CraftEntity) target).getHandle(), effect.getData()));
@@ -3583,4 +_,39 @@
handle.containerMenu.broadcastChanges();
return new PaperPlayerGiveResult(leftovers.build(), drops.build());
}
// Paper end - entity effect API
+
+
+ // Parchment start
+ @Override
+ public Set<UUID> getHiddenEntities(Plugin plugin) {
@@ -21,7 +21,7 @@
+ .map(Map.Entry::getKey)
+ .collect(java.util.stream.Collectors.toSet());
+ }
+
+
+ @Override
+ public boolean isInsomniac() {
+ return net.minecraft.world.entity.EntitySelector.IS_INSOMNIAC.test(this.getHandle());
@@ -46,7 +46,5 @@
+ public int getTimeSinceLastRest() {
+ return net.minecraft.util.Mth.clamp(this.getHandle().getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
+ }
+
+ // Parchment end
+
+
}

View File

@@ -9,7 +9,7 @@
return CraftEventFactory.callEntityDamageEvent(event, damagee, cancelled);
}
@@ -2271,4 +_,57 @@
@@ -2272,4 +_,57 @@
return event;
}
// Paper end - add EntityFertilizeEggEvent

View File

@@ -1,3 +0,0 @@
--- a/src/main/resources/data/.paperassetsroot
+++ b/src/main/resources/data/.paperassetsroot
@@ -1,0 +_,0 @@