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("Start", pattern),
COMMENT_MARKER_FORMAT.formatted("End", 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); .targetClass(targetClass);
} }

View File

@@ -30,7 +30,7 @@ public class ScanOldGeneratedSourceCode {
static { static {
Main.bootStrap(false); Main.bootStrap(false);
CURRENT_VERSION = SharedConstants.getCurrentVersion().getId(); CURRENT_VERSION = SharedConstants.getCurrentVersion().id();
} }
public static void main(String[] args) throws IOException { 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 NULL_MARKED = AnnotationSpec.builder(NullMarked.class).build();
public static final AnnotationSpec OVERRIDE = AnnotationSpec.builder(Override.class).build(); public static final AnnotationSpec OVERRIDE = AnnotationSpec.builder(Override.class).build();
public static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class) public static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
.addMember("value", "$S", SharedConstants.getCurrentVersion().getId()) .addMember("value", "$S", SharedConstants.getCurrentVersion().id())
.build(); .build();
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of( public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
suppressWarnings("unused", "SpellCheckingInspection"), suppressWarnings("unused", "SpellCheckingInspection"),

View File

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

View File

@@ -1355,11 +1355,11 @@
public void loadGameTypes(@Nullable ValueInput input) { public void loadGameTypes(@Nullable ValueInput input) {
+ // Paper start - Expand PlayerGameModeChangeEvent + // 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()) { + 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); + this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE);
+ } else { + } else {
+ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(tag, "previousPlayerGameType")); + this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(input, "previousPlayerGameType"));
+ } + }
+ return; + return;
+ } + }

View File

@@ -114,7 +114,7 @@
+ return; + 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 net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
+ final byte[] data = discardedPayload.data(); + final byte[] data = discardedPayload.data();

View File

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

View File

@@ -89,7 +89,7 @@
output.putInt("Temper", this.getTemper()); output.putInt("Temper", this.getTemper());
output.putBoolean("Tame", this.isTamed()); output.putBoolean("Tame", this.isTamed());
EntityReference.store(this.owner, output, "Owner"); 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 @Override
@@ -97,7 +97,7 @@
this.setTemper(input.getIntOr("Temper", 0)); this.setTemper(input.getIntOr("Temper", 0));
this.setTamed(input.getBooleanOr("Tame", false)); this.setTamed(input.getBooleanOr("Tame", false));
this.owner = EntityReference.readWithOldOwnerConversion(input, "Owner", this.level()); 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 @Override

View File

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

View File

@@ -72,14 +72,14 @@
- @Override - @Override
- public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) { - public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem) {
- super.onEquipItem(slot, oldItem, 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 + // Paper start - shouldBurnInDay API
+ @Override + @Override
+ public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) { + protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) {
+ super.addAdditionalSaveData(nbt); + super.addAdditionalSaveData(output);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); + output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
+ } + }
+ // Paper end - shouldBurnInDay API + // Paper end - shouldBurnInDay API
+ +

View File

@@ -17,7 +17,7 @@
+ if (this.featureflagset != null) { + if (this.featureflagset != null) {
+ this.finalizeRecipeLoading(this.featureflagset); + 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()); 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 @@ @@ -234,6 +_,7 @@
); );
private final Map<GameRules.Key<?>, GameRules.Value<?>> rules; private final Map<GameRules.Key<?>, GameRules.Value<?>> rules;

View File

@@ -6,8 +6,8 @@
} }
+ // Paper start - Configurable sculk sensor listener range + // Paper start - Configurable sculk sensor listener range
+ @Override + @Override
+ protected void saveRangeOverride(final net.minecraft.nbt.CompoundTag nbt) { + protected void saveRangeOverride(final net.minecraft.world.level.storage.ValueOutput output) {
+ 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 + 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 + // Paper end - Configurable sculk sensor listener range

View File

@@ -1,12 +1,13 @@
package io.papermc.paper.entity.activation; package io.papermc.paper.entity.activation;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ambient.AmbientCreature; import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.AgeableWaterCreature; import net.minecraft.world.entity.animal.AgeableWaterCreature;
import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.monster.Enemy; 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.npc.Villager;
import net.minecraft.world.entity.raid.Raider; import net.minecraft.world.entity.raid.Raider;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
@@ -33,7 +34,7 @@ public enum ActivationType {
return ActivationType.WATER; return ActivationType.WATER;
} else if (entity instanceof Villager) { } else if (entity instanceof Villager) {
return ActivationType.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; return ActivationType.FLYING_MONSTER;
} else if (entity instanceof Raider) { } else if (entity instanceof Raider) {
return ActivationType.RAIDER; return ActivationType.RAIDER;

View File

@@ -828,7 +828,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
CraftPlayer cp = (CraftPlayer) p; CraftPlayer cp = (CraftPlayer) p;
if (cp.getHandle().connection == null) continue; 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; 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.craftbukkit.CraftServer;
import org.bukkit.entity.Flying; import org.bukkit.entity.Flying;
// TODO: REMOVE?
public class CraftFlying extends CraftMob implements Flying { public class CraftFlying extends CraftMob implements Flying {
public CraftFlying(CraftServer server, FlyingMob entity) { public CraftFlying(CraftServer server, Mob entity) {
super(server, entity); super(server, entity);
} }
@Override
public FlyingMob getHandle() {
return (FlyingMob) this.entity;
}
} }