Fix some compile errors

This commit is contained in:
Owen1212055
2025-05-29 21:52:43 -04:00
parent f44197c4da
commit 2f152e015d
16 changed files with 36 additions and 30 deletions

View File

@@ -48,7 +48,7 @@ public class PaperPatternSourceSetRewriter extends SourceSetRewriterImpl<Pattern
COMMENT_MARKER_FORMAT.formatted("Start", pattern),
COMMENT_MARKER_FORMAT.formatted("End", pattern)
)
.generatedComment(Annotations.annotationStyle(GeneratedFrom.class) + " " + SharedConstants.getCurrentVersion().getId())
.generatedComment(Annotations.annotationStyle(GeneratedFrom.class) + " " + SharedConstants.getCurrentVersion().id())
.targetClass(targetClass);
}

View File

@@ -30,7 +30,7 @@ public class ScanOldGeneratedSourceCode {
static {
Main.bootStrap(false);
CURRENT_VERSION = SharedConstants.getCurrentVersion().getId();
CURRENT_VERSION = SharedConstants.getCurrentVersion().id();
}
public static void main(String[] args) throws IOException {

View File

@@ -35,7 +35,7 @@ public final class Annotations {
public static final AnnotationSpec NULL_MARKED = AnnotationSpec.builder(NullMarked.class).build();
public static final AnnotationSpec OVERRIDE = AnnotationSpec.builder(Override.class).build();
public static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
.addMember("value", "$S", SharedConstants.getCurrentVersion().getId())
.addMember("value", "$S", SharedConstants.getCurrentVersion().id())
.build();
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
suppressWarnings("unused", "SpellCheckingInspection"),

View File

@@ -1073,7 +1073,7 @@
}
@Override
@@ -1767,17 +_,25 @@
@@ -1767,17 +_,24 @@
@Override
public void onTickingStart(Entity entity) {
@@ -1086,8 +1086,7 @@
ServerLevel.this.entityTickList.remove(entity);
+ // Paper start - Reset pearls when they stop being ticked
+ if (ServerLevel.this.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && ServerLevel.this.paperConfig().misc.legacyEnderPearlBehavior && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
+ pearl.cachedOwner = null;
+ pearl.ownerUUID = null;
+ pearl.setOwner(null);
+ }
+ // Paper end - Reset pearls when they stop being ticked
}

View File

@@ -1355,11 +1355,11 @@
public void loadGameTypes(@Nullable ValueInput input) {
+ // Paper start - Expand PlayerGameModeChangeEvent
+ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != readPlayerMode(tag, "playerGameType")) {
+ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != readPlayerMode(input, "playerGameType")) {
+ if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) {
+ this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE);
+ } else {
+ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(tag, "previousPlayerGameType"));
+ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(input, "previousPlayerGameType"));
+ }
+ return;
+ }

View File

@@ -114,7 +114,7 @@
+ return;
+ }
+
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
+
+ final net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
+ final byte[] data = discardedPayload.data();

View File

@@ -88,7 +88,7 @@
if (this.isNoAi()) {
output.putBoolean("NoAI", this.isNoAi());
}
+ compound.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
+ output.putBoolean("Bukkit.Aware", this.aware); // CraftBukkit
}
@Override

View File

@@ -89,7 +89,7 @@
output.putInt("Temper", this.getTemper());
output.putBoolean("Tame", this.isTamed());
EntityReference.store(this.owner, output, "Owner");
+ compound.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication
+ output.putInt("Bukkit.MaxDomestication", this.maxDomestication); // Paper - max domestication
}
@Override
@@ -97,7 +97,7 @@
this.setTemper(input.getIntOr("Temper", 0));
this.setTamed(input.getBooleanOr("Tame", false));
this.owner = EntityReference.readWithOldOwnerConversion(input, "Owner", this.level());
+ this.maxDomestication = compound.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication
+ this.maxDomestication = input.getIntOr("Bukkit.MaxDomestication", this instanceof Llama ? 30 : 100); // Paper - max domestication
}
@Override

View File

@@ -100,9 +100,9 @@
+
+ // CraftBukkit start - selectively save tile position
+ @Override
+ public void addAdditionalSaveData(CompoundTag nbt, boolean includeAll) {
+ protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output, final boolean includeAll) {
+ if (includeAll) {
+ this.addAdditionalSaveData(nbt);
+ this.addAdditionalSaveData(output);
+ }
+ }
+ // CraftBukkit end

View File

@@ -72,14 +72,14 @@
- @Override
- public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) {
- super.onEquipItem(slot, oldItem, newItem);
+ this.shouldBurnInDay = compound.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
+ }
+
+ // Paper start - shouldBurnInDay API
+ @Override
+ public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) {
+ super.addAdditionalSaveData(nbt);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) {
+ super.addAdditionalSaveData(output);
+ output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ }
+ // Paper end - shouldBurnInDay API
+

View File

@@ -17,7 +17,7 @@
+ if (this.featureflagset != null) {
+ this.finalizeRecipeLoading(this.featureflagset);
+
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadRecipes();
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadResources();
+ }
+ }
+

View File

@@ -65,6 +65,15 @@
serverLevel.setDefaultSpawnPos(serverLevel.getSharedSpawnPos(), serverLevel.getSharedSpawnAngle());
})
);
@@ -223,7 +_,7 @@
"tntExplodes", GameRules.Category.MISC, GameRules.BooleanValue.create(true)
);
public static final GameRules.Key<GameRules.BooleanValue> RULE_LOCATOR_BAR = register(
- "locatorBar", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true, (server, value) -> server.getAllLevels().forEach(level -> {
+ "locatorBar", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true, (server, value) -> java.util.Optional.of(server).ifPresent(level -> { // Paper
ServerWaypointManager waypointManager = level.getWaypointManager();
if (value.get()) {
level.players().forEach(waypointManager::updatePlayer);
@@ -234,6 +_,7 @@
);
private final Map<GameRules.Key<?>, GameRules.Value<?>> rules;

View File

@@ -6,8 +6,8 @@
}
+ // Paper start - Configurable sculk sensor listener range
+ @Override
+ protected void saveRangeOverride(final net.minecraft.nbt.CompoundTag nbt) {
+ if (this.rangeOverride != null && this.rangeOverride != 16) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default
+ protected void saveRangeOverride(final net.minecraft.world.level.storage.ValueOutput output) {
+ if (this.rangeOverride != null && this.rangeOverride != 16) output.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.rangeOverride); // only save if it's different from the default
+ }
+ // Paper end - Configurable sculk sensor listener range

View File

@@ -1,12 +1,13 @@
package io.papermc.paper.entity.activation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.AgeableWaterCreature;
import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.monster.Enemy;
import net.minecraft.world.entity.monster.Ghast;
import net.minecraft.world.entity.monster.Phantom;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.raid.Raider;
import net.minecraft.world.phys.AABB;
@@ -33,7 +34,7 @@ public enum ActivationType {
return ActivationType.WATER;
} else if (entity instanceof Villager) {
return ActivationType.VILLAGER;
} else if (entity instanceof FlyingMob && entity instanceof Enemy) {
} else if (entity instanceof Ghast || entity instanceof Phantom) { // TODO: some kind of better distinction here?
return ActivationType.FLYING_MONSTER;
} else if (entity instanceof Raider) {
return ActivationType.RAIDER;

View File

@@ -828,7 +828,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
CraftPlayer cp = (CraftPlayer) p;
if (cp.getHandle().connection == null) continue;
cp.getHandle().connection.send(new ClientboundSetTimePacket(cp.getHandle().level().getGameTime(), cp.getHandle().getPlayerTime(), cp.getHandle().relativeTime && cp.getHandle().serverLevel().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
cp.getHandle().connection.send(new ClientboundSetTimePacket(cp.getHandle().level().getGameTime(), cp.getHandle().getPlayerTime(), cp.getHandle().relativeTime && cp.getHandle().level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
}
}

View File

@@ -1,17 +1,14 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.Mob;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Flying;
// TODO: REMOVE?
public class CraftFlying extends CraftMob implements Flying {
public CraftFlying(CraftServer server, FlyingMob entity) {
public CraftFlying(CraftServer server, Mob entity) {
super(server, entity);
}
@Override
public FlyingMob getHandle() {
return (FlyingMob) this.entity;
}
}