Compilation fixes

This commit is contained in:
Nassim Jahnke 2024-12-03 22:06:05 +01:00
parent 5e0c01db49
commit b4c75aa92c
13 changed files with 40 additions and 39 deletions

View file

@ -1153,7 +1153,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the model key or null
+ */
+ @Contract(pure = true)
+ @Nullable Key model();
+ @Nullable Key assetId();
+
+ /**
+ * Gets the camera overlay key if present.
@ -1219,7 +1219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the builder for chaining
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder model(@Nullable Key model);
+ Builder assetId(@Nullable Key model);
+
+ /**
+ * Sets the camera overlay key for this item.

View file

@ -57,8 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ FeatureFlag.VANILLA, FeatureFlags.VANILLA,
+ FeatureFlag.TRADE_REBALANCE, FeatureFlags.TRADE_REBALANCE,
+ FeatureFlag.MINECART_IMPROVEMENTS, FeatureFlags.MINECART_IMPROVEMENTS,
+ FeatureFlag.REDSTONE_EXPERIMENTS, FeatureFlags.REDSTONE_EXPERIMENTS,
+ FeatureFlag.WINTER_DROP, FeatureFlags.WINTER_DROP
+ FeatureFlag.REDSTONE_EXPERIMENTS, FeatureFlags.REDSTONE_EXPERIMENTS
+ );
+
+ @Override

View file

@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper start - Add Listing API for Player
+ Entry(UUID profileId, boolean listed) {
+ this(profileId, null, listed, 0, GameType.DEFAULT_MODE, null, 0, null);
+ this(profileId, null, listed, 0, GameType.DEFAULT_MODE, null, true, 0, null);
+ }
+ // Paper end - Add Listing API for Player
}

View file

@ -17,7 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public org.bukkit.Color getSpawnEggLayerColor(final EntityType entityType, final int layer) {
+ final net.minecraft.world.entity.EntityType<?> nmsType = org.bukkit.craftbukkit.entity.CraftEntityType.bukkitToMinecraft(entityType);
+ final net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
+ return eggItem == null ? null : org.bukkit.Color.fromRGB(eggItem.getColor(layer));
+ if (eggItem != null) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+ return eggItem == null ? null : org.bukkit.Color.fromRGB(1); // TODO
+ }
+ // Paper end - spawn egg color visibility
+

View file

@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) ||
+ !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
+ )) {
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
+ this.connection.send(ClientboundMoveVehiclePacket.fromEntity(entity));
+ return;
+ }
+ // Paper end - Prevent moving into unloaded chunks

View file

@ -578,7 +578,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public CustomModelData customModelData(final int id) {
+ return new PaperCustomModelData(new net.minecraft.world.item.component.CustomModelData(id));
+ throw new UnsupportedOperationException("Not implemented yet");
+ //return new PaperCustomModelData(new net.minecraft.world.item.component.CustomModelData(id));
+ }
+
+ @Override
@ -1213,10 +1214,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public @Nullable Key model() {
+ return this.impl.model()
+ .map(PaperAdventure::asAdventure)
+ .orElse(null);
+ public @Nullable Key assetId() {
+ // TODO
+ throw new UnsupportedOperationException("Not yet implemented");
+ //return this.impl.assetId()
+ // .map(PaperAdventure::asAdventure)
+ // .orElse(null);
+ }
+
+ @Override
@ -1252,7 +1255,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public Builder toBuilder() {
+ return new BuilderImpl(this.slot())
+ .equipSound(this.equipSound())
+ .model(this.model())
+ .assetId(this.assetId())
+ .cameraOverlay(this.cameraOverlay())
+ .allowedEntities(this.allowedEntities())
+ .dispensable(this.dispensable())
@ -1265,7 +1268,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private final net.minecraft.world.entity.EquipmentSlot equipmentSlot;
+ private Holder<SoundEvent> equipSound = SoundEvents.ARMOR_EQUIP_GENERIC;
+ private Optional<ResourceLocation> model = Optional.empty();
+ private Optional<ResourceLocation> assetId = Optional.empty();
+ private Optional<ResourceLocation> cameraOverlay = Optional.empty();
+ private Optional<HolderSet<net.minecraft.world.entity.EntityType<?>>> allowedEntities = Optional.empty();
+ private boolean dispensable = true;
@ -1283,8 +1286,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @Override
+ public Builder model(final @Nullable Key model) {
+ this.model = Optional.ofNullable(model)
+ public Builder assetId(final @Nullable Key model) {
+ this.assetId = Optional.ofNullable(model)
+ .map(PaperAdventure::asVanilla);
+
+ return this;
@ -1329,7 +1332,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ new net.minecraft.world.item.equipment.Equippable(
+ this.equipmentSlot,
+ this.equipSound,
+ this.model,
+ null, // TODO
+ this.cameraOverlay,
+ this.allowedEntities,
+ this.dispensable,

View file

@ -319,6 +319,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.setRemoved();
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
@@ -0,0 +0,0 @@ public final class TrialSpawner {
}
public void overrideEntityToSpawn(EntityType<?> entityType, Level world) {
- this.data.reset();
+ this.data.reset(this); // Paper
this.normalConfig = Holder.direct(((TrialSpawnerConfig) this.normalConfig.value()).withSpawning(entityType));
this.ominousConfig = Holder.direct(((TrialSpawnerConfig) this.ominousConfig.value()).withSpawning(entityType));
this.setState(world, TrialSpawnerState.INACTIVE);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java

View file

@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
+ // Paper start - Fix item duplication and teleport issues
+ if (this instanceof Leashable leashable) {
+ leashable.dropLeash(true, true); // Paper drop lead
+ leashable.dropLeash(); // Paper drop lead
+ }
+ // Paper end - Fix item duplication and teleport issues
entity.restoreFrom(this);
@ -93,8 +93,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops, () -> {
+ final LivingEntity entityliving = this.getKillCredit();
+ if (this.deathScore >= 0 && entityliving != null) {
+ entityliving.awardKillScore(this, this.deathScore, damageSource);
+ if (entityliving != null) {
+ entityliving.awardKillScore(this, damageSource);
+ }
+ }); // Paper end
this.postDeathDropItems(deathEvent); // Paper

View file

@ -272,7 +272,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bukkitMap.put(net.minecraft.world.entity.animal.armadillo.Armadillo.class, org.bukkit.entity.Armadillo.class);
+ bukkitMap.put(net.minecraft.world.entity.monster.Bogged.class, org.bukkit.entity.Bogged.class);
+ bukkitMap.put(net.minecraft.world.entity.monster.creaking.Creaking.class, org.bukkit.entity.Creaking.class);
+ bukkitMap.put(net.minecraft.world.entity.monster.creaking.CreakingTransient.class, org.bukkit.entity.CreakingTransient.class);
+ bukkitMap.put(net.minecraft.world.entity.animal.AgeableWaterCreature.class, org.bukkit.entity.Squid.class); // close enough
+ }
+

View file

@ -546,7 +546,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
launch = new net.minecraft.world.entity.projectile.Arrow(world, this.getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
}
- ((net.minecraft.world.entity.projectile.AbstractArrow) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, 3.0F, 1.0F); // ItemBow
+ ((net.minecraft.world.entity.projectile.AbstractArrow) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, Trident.class.isAssignableFrom(projectile) ? net.minecraft.world.item.TridentItem.SHOOT_POWER : 3.0F, 1.0F); // ItemBow // Paper - see TridentItem
+ ((net.minecraft.world.entity.projectile.AbstractArrow) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, Trident.class.isAssignableFrom(projectile) ? net.minecraft.world.item.TridentItem.PROJECTILE_SHOOT_POWER : 3.0F, 1.0F); // ItemBow // Paper - see TridentItem
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle(), new net.minecraft.world.item.ItemStack(Items.LINGERING_POTION));

View file

@ -88,10 +88,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ world.loadChunksForMoveAsync(getHandle().getBoundingBoxAt(locationClone.getX(), locationClone.getY(), locationClone.getZ()),
+ this instanceof CraftPlayer ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL, (list) -> {
+ net.minecraft.server.level.ServerChunkCache chunkProviderServer = world.getChunkSource();
+ for (net.minecraft.world.level.chunk.ChunkAccess chunk : list) {
+ chunkProviderServer.addTicketAtLevel(net.minecraft.server.level.TicketType.POST_TELEPORT, chunk.getPos(), 33, CraftEntity.this.getEntityId());
+ }
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
+ try {
+ ret.complete(CraftEntity.this.teleport(locationClone, cause, teleportFlags) ? Boolean.TRUE : Boolean.FALSE);

View file

@ -15,18 +15,6 @@ massive amounts of surrounding chunks due to large AABB lookups.
Feature patch
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/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 {
Vec3 vec3d = teleporttransition.position();
entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, teleporttransition.yRot(), teleporttransition.xRot());
+ worldserver.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(net.minecraft.util.Mth.floor(vec3d.x()) >> 4, net.minecraft.util.Mth.floor(vec3d.z()) >> 4), 1, entityplayer.getId()); // Paper
// CraftBukkit end
if (teleporttransition.missingRespawnBlock()) {
entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
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
--- a/src/main/java/net/minecraft/world/entity/Entity.java

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper start - track changed items in the dispense event
+ itemstack1 = CraftItemStack.unwrap(event.getItem()); // unwrap is safe because the stack won't be modified
+ entitytypes = ((SpawnEggItem) itemstack1.getItem()).getType(itemstack1);
+ entitytypes = ((SpawnEggItem) itemstack1.getItem()).getType(worldserver.registryAccess(), itemstack1);
+ // Paper end - track changed item from dispense event
}