Skip to content

Commit 40af07b

Browse files
committed
Update upstream
1 parent 2f2ebf4 commit 40af07b

File tree

12 files changed

+101
-112
lines changed

12 files changed

+101
-112
lines changed

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
group=de.erethon.papyrus
2-
version=1.21.9-R0.1-SNAPSHOT
3-
mcVersion=1.21.9
4-
paperRef=dad730f2948e4ed0cb42f2af79009ffea4541ba5
2+
version=1.21.10-R0.1-SNAPSHOT
3+
mcVersion=1.21.10
4+
paperRef=1f31ee5ebe45d97a596a4429d9871e3f8910cd28
55

66
org.gradle.configuration-cache=true
77
org.gradle.caching=true

papyrus-api/build.gradle.kts.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/paper-api/build.gradle.kts
22
+++ b/paper-api/build.gradle.kts
3-
@@ -90,16 +_,23 @@
3+
@@ -89,16 +_,23 @@
44
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
55
}
66

@@ -19,7 +19,7 @@
1919
+ srcDir(file("../paper-api/src/main/java"))
2020
+ }
2121
+ resources {
22-
+ srcDir(file("../paper-api/src/main/resources"))
22+
+ srcDir(file("../paper-api/src/main/resources"))
2323
+ }
2424
+ }
2525
+ test {
@@ -31,7 +31,7 @@
3131
}
3232
}
3333
}
34-
@@ -166,7 +_,7 @@
34+
@@ -165,7 +_,7 @@
3535

3636
tasks.withType<Javadoc>().configureEach {
3737
val options = options as StandardJavadocDocletOptions
@@ -40,7 +40,7 @@
4040
options.use()
4141
options.isDocFilesSubDirs = true
4242
options.links(
43-
@@ -201,11 +_,11 @@
43+
@@ -198,11 +_,11 @@
4444
}
4545

4646
// workaround for https://github.com/gradle/gradle/issues/4046
Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--- a/paper-server/build.gradle.kts
22
+++ b/paper-server/build.gradle.kts
3-
@@ -32,6 +_,16 @@
4-
packageVersion = "v1_21_R5" // also needs to be updated in MappingEnvironment
5-
}
6-
3+
@@ -22,9 +_,18 @@
4+
paperweight {
5+
minecraftVersion = providers.gradleProperty("mcVersion")
6+
gitFilePatches = false
77
+ val papyrus = forks.register("papyrus") {
88
+ upstream.patchDir("paperServer") {
99
+ upstreamPath = "paper-server"
@@ -13,33 +13,14 @@
1313
+ }
1414
+ }
1515
+ activeFork = papyrus
16-
+
17-
reobfPackagesToFix.addAll(
18-
"co.aikar.timings",
19-
"com.destroystokyo.paper",
20-
@@ -107,7 +_,20 @@
21-
}
22-
}
2316

24-
-val log4jPlugins = sourceSets.create("log4jPlugins")
25-
+sourceSets {
26-
+ main {
27-
+ java { srcDir("../paper-server/src/main/java") }
28-
+ resources { srcDir("../paper-server/src/main/resources") }
29-
+ }
30-
+ test {
31-
+ java { srcDir("../paper-server/src/test/java") }
32-
+ resources { srcDir("../paper-server/src/test/resources") }
33-
+ }
34-
+}
35-
+
36-
+val log4jPlugins = sourceSets.create("log4jPlugins") {
37-
+ java { srcDir("../paper-server/src/log4jPlugins/java") }
38-
+}
39-
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
40-
extendsFrom(configurations.compileClasspath.get())
41-
}
42-
@@ -130,7 +_,7 @@
17+
spigot {
18+
- enabled = true
19+
+ enabled = false
20+
buildDataRef = "42d18d4c4653ffc549778dbe223f6994a031d69e"
21+
packageVersion = "v1_21_R6" // also needs to be updated in MappingEnvironment
22+
}
23+
@@ -127,7 +_,7 @@
4324
}
4425

4526
dependencies {
@@ -48,17 +29,16 @@
4829
implementation("ca.spottedleaf:concurrentutil:0.0.5")
4930
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
5031
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
51-
@@ -186,6 +_,9 @@
32+
@@ -183,6 +_,8 @@
5233
// Spark
5334
implementation("me.lucko:spark-api:0.1-20240720.200737-2")
54-
implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1")
35+
implementation("me.lucko:spark-paper:1.10.152")
5536
+
56-
+ // Erethon
57-
+ implementation("de.erethon:bedrock:1.5.18")
37+
+ implementation("de.erethon:bedrock:1.5.18") // Erethon
5838
}
5939

6040
tasks.jar {
61-
@@ -200,14 +_,14 @@
41+
@@ -197,14 +_,14 @@
6242
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
6343
attributes(
6444
"Main-Class" to "org.bukkit.craftbukkit.Main",
@@ -78,32 +58,26 @@
7858
"Build-Number" to (build ?: ""),
7959
"Build-Time" to buildTime.toString(),
8060
"Git-Branch" to gitBranch,
81-
@@ -266,12 +_,7 @@
61+
@@ -263,7 +_,7 @@
8262
jvmArgumentProviders.add(provider)
8363
}
8464

8565
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
86-
-idea {
87-
- module {
88-
- generatedSourceDirs.add(generatedDir.toFile())
89-
- }
90-
-}
9166
+val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("../paper-server/src/generated/java").asFile.toPath()
92-
sourceSets {
67+
idea {
68+
module {
69+
generatedSourceDirs.add(generatedDir.toFile())
70+
@@ -273,7 +_,13 @@
9371
main {
9472
java {
95-
@@ -358,7 +_,7 @@
96-
mainClass.set(null as String?)
97-
}
98-
99-
-fill {
100-
+/**fill { // Papyrus - We don't use fill
101-
project("paper")
102-
versionFamily(paperweight.minecraftVersion.map { it.split(".", "-").takeWhile { part -> part.toIntOrNull() != null }.take(2).joinToString(".") })
103-
version(paperweight.minecraftVersion)
104-
@@ -373,4 +_,4 @@
105-
}
73+
srcDir(generatedDir)
74+
+ srcDir("../paper-server/src/main/java")
10675
}
76+
+ resources { srcDir("../paper-server/src/main/resources") }
77+
+ }
78+
+ test {
79+
+ java { srcDir("../paper-server/src/test/java") }
80+
+ resources { srcDir("../paper-server/src/test/resources") }
10781
}
108-
-}
109-
+}**/
82+
}
83+
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
--- a/net/minecraft/server/MinecraftServer.java
22
+++ b/net/minecraft/server/MinecraftServer.java
3-
@@ -1501,6 +_,11 @@
3+
@@ -1651,6 +_,11 @@
44
// Paper start - Server Tick Events
55
long endTime = System.nanoTime();
6-
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
6+
long remaining = this.nextTickTimeNanos - endTime;
77
+ // Papyrus start - Tick spells
88
+ if (remaining > 0) {
99
+ server.getSpellbookAPI().getQueue().run();
1010
+ }
1111
+ // Papyrus end
12-
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
12+
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - this.currentTickStart) / 1000000D), remaining).callEvent();
1313
// Paper end - Server Tick Events
14-
this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
14+
this.server.spark.tickEnd(((double)(endTime - this.currentTickStart) / 1000000D)); // Paper - spark

papyrus-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
22
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
3-
@@ -1555,6 +_,11 @@
3+
@@ -1556,6 +_,11 @@
44

55
boolean flag1 = this.player.verticalCollisionBelow;
66
this.player.move(MoverType.PLAYER, new Vec3(d3, d4, d5));

papyrus-server/minecraft-patches/sources/net/minecraft/server/players/PlayerList.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import net.minecraft.ChatFormatting;
1010
import net.minecraft.FileUtil;
1111
import net.minecraft.commands.CommandSourceStack;
12-
@@ -406,7 +_,11 @@
12+
@@ -407,7 +_,11 @@
1313
protected void save(ServerPlayer player) {
1414
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
1515
player.lastSave = MinecraftServer.currentTick; // Paper - Incremental chunk and player saving

papyrus-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/net/minecraft/world/entity/Entity.java
22
+++ b/net/minecraft/world/entity/Entity.java
3-
@@ -292,7 +_,7 @@
3+
@@ -291,7 +_,7 @@
44
private final Set<TagKey<Fluid>> fluidOnEyes = new HashSet<>();
55
public int invulnerableTime;
66
protected boolean firstTick = true;

papyrus-server/minecraft-patches/sources/net/minecraft/world/entity/EntityType.java.patch

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import org.slf4j.Logger;
2020

2121
public class EntityType<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
22-
@@ -191,6 +_,7 @@
22+
@@ -192,6 +_,7 @@
2323
public static final StreamCodec<RegistryFriendlyByteBuf, EntityType<?>> STREAM_CODEC = ByteBufCodecs.registry(Registries.ENTITY_TYPE);
2424
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
2525
private static final int DISPLAY_TRACKING_RANGE = 10;
2626
+ public static final Map<String, Map.Entry<Plugin, Class<? extends Entity>>> customEntities = new HashMap<>(); // Papyrus - Custom Entities
2727
public static final EntityType<Boat> ACACIA_BOAT = register(
2828
"acacia_boat",
2929
EntityType.Builder.of(boatFactory(() -> Items.ACACIA_BOAT), MobCategory.MISC)
30-
@@ -1494,16 +_,45 @@
30+
@@ -1497,21 +_,31 @@
3131
public static Optional<Entity> create(ValueInput input, Level level, EntitySpawnReason spawnReason, boolean generation) {
3232
// Paper end - Don't fire sync event during generation
3333
return Util.ifElse(
@@ -38,18 +38,22 @@
3838
- entity.load(input);
3939
- },
4040
- // Paper end - Don't fire sync event during generation
41-
- () -> LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"))
41+
- // Paper start - Add logging for debugging entity tags with invalid ids
42+
- () -> {
43+
- LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"));
44+
- if ((DEBUG_ENTITIES_WITH_INVALID_IDS || level.getCraftServer().getServer().isDebugging()) && input instanceof TagValueInput tagInput) {
45+
- LOGGER.warn("Skipped entity tag: {}", tagInput.input);
4246
+ EntityType.by(input).map(entitytypes -> {
4347
+ // Papyrus start - Custom entities
4448
+ if (input.getString("papyrus-entity-id").isPresent()) {
4549
+ Optional<String> customEntityId = input.getString("papyrus-entity-id");
4650
+ if (customEntityId.isPresent() && customEntities.containsKey(customEntityId.get())) {
47-
+ Map.Entry<Plugin, Class<? extends Entity>> entityEntry = customEntities.get(customEntityId.get());
48-
+ if (entitytypes.getBaseClass().isAssignableFrom(entityEntry.getValue())) {
49-
+ return EntityType.createCustomEntity(entityEntry.getValue(), entitytypes, entityEntry.getKey(), level, spawnReason);
50-
+ } else {
51-
+ LOGGER.warn("Entity type {} is not assignable from custom entity class {}", entitytypes, entityEntry.getValue());
52-
+ }
51+
+ Map.Entry<Plugin, Class<? extends Entity>> entityEntry = customEntities.get(customEntityId.get());
52+
+ if (entitytypes.getBaseClass().isAssignableFrom(entityEntry.getValue())) {
53+
+ return EntityType.createCustomEntity(entityEntry.getValue(), entitytypes, entityEntry.getKey(), level, spawnReason);
54+
+ } else {
55+
+ LOGGER.warn("Entity type {} is not assignable from custom entity class {}", entitytypes, entityEntry.getValue());
56+
+ }
5357
+ }
5458
+ }
5559
+ // Papyrus end
@@ -59,13 +63,20 @@
5963
+ entity -> {
6064
+ if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
6165
+ entity.load(input);
62-
+ },
66+
+ },
6367
+ // Paper end - Don't fire sync event during generation
64-
+ () -> {
68+
+ () -> {
6569
+ EntityType.LOGGER.warn("Skipping Entity with id {}", input.getString("id"));
66-
+ }
70+
}
71+
- }
72+
- // Paper end - Add logging for debugging entity tags with invalid ids
6773
);
6874
}
75+
76+
@@ -1716,6 +_,18 @@
77+
public boolean onlyOpCanSetNbt() {
78+
return OP_ONLY_CUSTOM_DATA.contains(this);
79+
}
6980
+
7081
+ // Papyrus start - Custom entities
7182
+ public static Entity createCustomEntity(Class<? extends Entity> customEntityClass, EntityType<?> type, Plugin plugin, Level level, EntitySpawnReason spawnReason) {
@@ -79,5 +90,5 @@
7990
+ }
8091
+ // Papyrus end
8192

82-
public static Optional<Entity> create(EntityType<?> entityType, ValueInput input, Level level, EntitySpawnReason spawnReason) {
83-
Optional<Entity> optional = Optional.ofNullable(entityType.create(level, spawnReason));
93+
public static class Builder<T extends Entity> {
94+
private final EntityType.EntityFactory<T> factory;

papyrus-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import it.unimi.dsi.fastutil.doubles.DoubleDoubleImmutablePair;
1010
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
1111
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
12-
@@ -137,17 +_,16 @@
12+
@@ -138,17 +_,16 @@
1313
import net.minecraft.world.waypoints.Waypoint;
1414
import net.minecraft.world.waypoints.WaypointTransmitter;
1515
import org.jetbrains.annotations.Contract;
@@ -30,7 +30,7 @@
3030
// CraftBukkit end
3131

3232
public abstract class LivingEntity extends Entity implements Attackable, WaypointTransmitter {
33-
@@ -287,6 +_,10 @@
33+
@@ -288,6 +_,10 @@
3434
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
3535
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
3636
// CraftBukkit end
@@ -39,9 +39,9 @@
3939
+ public CraftPDamageType attackDamageType = CraftPDamageType.PHYSICAL;
4040
+ // Papyrus end
4141

42-
protected LivingEntity(EntityType<? extends LivingEntity> entityType, Level level) {
43-
super(entityType, level);
44-
@@ -366,9 +_,42 @@
42+
protected LivingEntity(EntityType<? extends LivingEntity> type, Level level) {
43+
super(type, level);
44+
@@ -367,9 +_,42 @@
4545
.add(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE)
4646
.add(Attributes.WATER_MOVEMENT_EFFICIENCY)
4747
.add(Attributes.MOVEMENT_EFFICIENCY)
@@ -86,15 +86,15 @@
8686
}
8787

8888
@Override
89-
@@ -513,6 +_,7 @@
89+
@@ -514,6 +_,7 @@
9090
}
9191

9292
this.tickEffects();
9393
+ spellbookTick(); // Papyrus - Spellbook
9494
this.yHeadRotO = this.yHeadRot;
9595
this.yBodyRotO = this.yBodyRot;
9696
this.yRotO = this.getYRot();
97-
@@ -520,6 +_,18 @@
97+
@@ -521,6 +_,18 @@
9898
profilerFiller.pop();
9999
}
100100

@@ -113,7 +113,7 @@
113113
protected boolean shouldTakeDrowningDamage() {
114114
return this.getAirSupply() <= -20;
115115
}
116-
@@ -1410,8 +_,93 @@
116+
@@ -1411,8 +_,93 @@
117117
return this.getHealth() <= 0.0F;
118118
}
119119

@@ -207,7 +207,7 @@
207207
if (this.isInvulnerableTo(level, damageSource)) {
208208
return false;
209209
} else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
210-
@@ -1564,7 +_,7 @@
210+
@@ -1565,7 +_,7 @@
211211

212212
return flag2;
213213
}

0 commit comments

Comments
 (0)