Updated Upstream (Bukkit/CraftBukkit) (#11501)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bb4e97c6 Add support for Java 23 bc6874dd Bump asm to 9.7.1 50e8a00b PR-1064: Add specific getTopInventory methods for InventoryView derivatives 758b0a0f SPIGOT-7911: Fix Location#isWorldLoaded() for re-loaded worlds 133a64a7 Improve Registry#getOrThrow messages be0f5957 PR-1058: Add tests for Minecraft registry <-> Bukkit fields d1b31df2 PR-1062: Clarify BeaconView documentation 3fab4384 PR-1060: Cache Material to BlockType and ItemType conversion 967a7301 SPIGOT-7906: Increase YAML nesting limit to 100 6ecf033d SPIGOT-7899: Smithing recipes don't require inputs CraftBukkit Changes: 0a7bd6c81 PR-1493: Improve reroute performance and add some tests 54941524c Add support for Java 23 f4d957fff SPIGOT-7915: Fix World#getKeepSpawnInMemory() using Spawn Radius rather than Spawn Chunk Radius ded183674 Fix HIDE_ENCHANTS flag in items without enchantments 308785a0a Bump asm to 9.7.1 and re-add ClassReader to ClassWriter 72ce823cd PR-1487: Add specific getTopInventory methods for InventoryView derivatives 11a5e840c SPIGOT-7907, PR-1484: Improve merchant recipe item matching behavior to more closely align with older versions 45b66f7e4 SPIGOT-7909: Always set HIDE_ENCHANTS flag to item if flag is set 963459791 Increase outdated build delay fc5b2d75f SPIGOT-7910: Fix launching breeze wind charge from API and improve dispenser launch API c7d6428f2 SPIGOT-7856, PR-1483: End platform not dropping items after replacing blocks 2a5572b52 SPIGOT-7780, PR-1482: Cannot edit chunks during unload event 527041ab5 SPIGOT-7902, PR-1477: Fix CraftMetaPotion#hasCustomEffects() does not check if customEffects (List) is empty 5529a1769 Implement base methods for tags 30fbdbaaf Improve Registry#getOrThrow messages 6b71a7322 PR-1475: Add tests for Minecraft registry <-> Bukkit fields 5f24c255c SPIGOT-7908: Mark junit-platform-suite-engine as test scope e4c92ef65 PR-1473: Change tests to use suites, to run tests in different environments and feature flags d25e1e722 PR-1481: Fix BeaconView#set[X]Effect(null) d69a05362 PR-1480: Fix PerMaterialTest#isEdible test running for legacy materials bb3284a89 PR-1479: Use custom #isBlock method in legacy init instead of the one in Material, since it relies on legacy being init 98c57cbbe SPIGOT-7904: Fix NPE for PlayerItemBreakEvent f35bae9ec Fix missing hasJukeboxPlayable 8a6f8b6d8 SPIGOT-7881: CTRL+Pick Block saves position data into item 7913b3be7 SPIGOT-7899: Smithing recipes don't require inputs
This commit is contained in:
parent
755a7753af
commit
3b9db2b194
212 changed files with 1502 additions and 1329 deletions
|
@ -518,10 +518,10 @@ index 6e2f91423371ead9890095cf4b1e2299c4dcba28..9d8f4b7176e60180565e3134a14ecf19
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 097f03c83a90f476b74834407d2dcd0e98fe010a..877e3d20edba3fe2ea6b51d0b54ec8893bd112ed 100644
|
||||
index 0ed2910e64b6efdb4180c5bc23a146aced87c3d9..6350d4729fa3fbd9b15f1150cb4322f1c685044a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -569,8 +569,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -570,8 +570,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -538,7 +538,7 @@ index 097f03c83a90f476b74834407d2dcd0e98fe010a..877e3d20edba3fe2ea6b51d0b54ec889
|
|||
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
|
||||
|
||||
net.minecraft.world.level.Level world = ((CraftWorld) this.getWorld()).getHandle();
|
||||
@@ -596,7 +603,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -597,7 +604,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
} else {
|
||||
launch = new net.minecraft.world.entity.projectile.Arrow(world, this.getHandle(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
||||
}
|
||||
|
@ -547,28 +547,7 @@ index 097f03c83a90f476b74834407d2dcd0e98fe010a..877e3d20edba3fe2ea6b51d0b54ec889
|
|||
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
||||
if (LingeringPotion.class.isAssignableFrom(projectile)) {
|
||||
launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, this.getHandle());
|
||||
@@ -622,10 +629,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
launch = new net.minecraft.world.entity.projectile.WitherSkull(world, this.getHandle(), vec);
|
||||
} else if (DragonFireball.class.isAssignableFrom(projectile)) {
|
||||
launch = new net.minecraft.world.entity.projectile.DragonFireball(world, this.getHandle(), vec);
|
||||
- } else if (WindCharge.class.isAssignableFrom(projectile)) {
|
||||
- launch = EntityType.WIND_CHARGE.create(world);
|
||||
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).setOwner(this.getHandle());
|
||||
- ((net.minecraft.world.entity.projectile.windcharge.WindCharge) launch).assignDirectionalMovement(vec, 0.1D);
|
||||
+ // Paper start - more projectile API - correctly launch wind charges
|
||||
+ } else if (org.bukkit.entity.AbstractWindCharge.class.isAssignableFrom(projectile)) {
|
||||
+ if (org.bukkit.entity.BreezeWindCharge.class.isAssignableFrom(projectile)) {
|
||||
+ launch = EntityType.BREEZE_WIND_CHARGE.create(world);
|
||||
+ } else {
|
||||
+ launch = EntityType.WIND_CHARGE.create(world);
|
||||
+ }
|
||||
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).setOwner(this.getHandle());
|
||||
+ ((net.minecraft.world.entity.projectile.windcharge.AbstractWindCharge) launch).shootFromRotation(this.getHandle(), this.getHandle().getXRot(), this.getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // Paper - copied from net.minecraft.world.item.WindChargeItem.use
|
||||
+ // Paper end - more projectile API - correctly launch wind charges
|
||||
} else {
|
||||
launch = new LargeFireball(world, this.getHandle(), vec, 1);
|
||||
}
|
||||
@@ -650,8 +663,26 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -656,8 +663,26 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
} else if (Firework.class.isAssignableFrom(projectile)) {
|
||||
Location location = this.getEyeLocation();
|
||||
|
||||
|
@ -597,7 +576,7 @@ index 097f03c83a90f476b74834407d2dcd0e98fe010a..877e3d20edba3fe2ea6b51d0b54ec889
|
|||
}
|
||||
|
||||
Preconditions.checkArgument(launch != null, "Projectile (%s) not supported", projectile.getName());
|
||||
@@ -659,6 +690,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -665,6 +690,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
if (velocity != null) {
|
||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
||||
}
|
||||
|
@ -865,10 +844,10 @@ index e8a455eb5e17bcfcae3f03664f2b47773fbdf37e..08178a88ba7d0881a6c2843eef24a846
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
||||
index 8b57044518fbb0fd507da6ae3ff12b99eff70b37..e3312df146b942568ccee6595ae609c7d6a4f68f 100644
|
||||
index 93b9e6b32798e32026492fa3f80de9d4a7b3d9a5..baab2e097777a4295e7b14957304c927640a4a77 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java
|
||||
@@ -56,90 +56,68 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
@@ -55,7 +55,15 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
|
||||
@Override
|
||||
public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity) {
|
||||
|
@ -880,116 +859,38 @@ index 8b57044518fbb0fd507da6ae3ff12b99eff70b37..e3312df146b942568ccee6595ae609c7
|
|||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<? super T> function) {
|
||||
+ // Paper end - launchProjectile consumer
|
||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||
- // Copied from BlockDispenser.dispense()
|
||||
- BlockSource sourceblock = new BlockSource((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos(), this.dispenserBlock.getBlockState(), this.dispenserBlock);
|
||||
- // Copied from DispenseBehaviorProjectile
|
||||
- Position iposition = DispenserBlock.getDispensePosition(sourceblock);
|
||||
- Direction enumdirection = (Direction) sourceblock.state().getValue(DispenserBlock.FACING);
|
||||
- net.minecraft.world.level.Level world = this.dispenserBlock.getLevel();
|
||||
- net.minecraft.world.entity.Entity launch = null;
|
||||
|
||||
+ // Paper start - rewrite whole method to match ProjectileDispenseBehavior
|
||||
+ net.minecraft.world.item.Item item = null;
|
||||
if (Snowball.class.isAssignableFrom(projectile)) {
|
||||
- launch = new net.minecraft.world.entity.projectile.Snowball(world, iposition.x(), iposition.y(), iposition.z());
|
||||
+ item = net.minecraft.world.item.Items.SNOWBALL;
|
||||
} else if (Egg.class.isAssignableFrom(projectile)) {
|
||||
- launch = new ThrownEgg(world, iposition.x(), iposition.y(), iposition.z());
|
||||
- } else if (EnderPearl.class.isAssignableFrom(projectile)) {
|
||||
- launch = new ThrownEnderpearl(world, null);
|
||||
- launch.setPos(iposition.x(), iposition.y(), iposition.z());
|
||||
+ item = net.minecraft.world.item.Items.EGG;
|
||||
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
|
||||
- launch = new ThrownExperienceBottle(world, iposition.x(), iposition.y(), iposition.z());
|
||||
+ item = net.minecraft.world.item.Items.EXPERIENCE_BOTTLE;
|
||||
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
|
||||
if (LingeringPotion.class.isAssignableFrom(projectile)) {
|
||||
- launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, iposition.x(), iposition.y(), iposition.z());
|
||||
- ((net.minecraft.world.entity.projectile.ThrownPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.LINGERING_POTION, 1)));
|
||||
+ item = net.minecraft.world.item.Items.LINGERING_POTION;
|
||||
} else {
|
||||
- launch = new net.minecraft.world.entity.projectile.ThrownPotion(world, iposition.x(), iposition.y(), iposition.z());
|
||||
- ((net.minecraft.world.entity.projectile.ThrownPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.SPLASH_POTION, 1)));
|
||||
+ item = net.minecraft.world.item.Items.SPLASH_POTION;
|
||||
}
|
||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
||||
- if (TippedArrow.class.isAssignableFrom(projectile)) {
|
||||
- launch = new net.minecraft.world.entity.projectile.Arrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
||||
- ((Arrow) launch.getBukkitEntity()).setBasePotionType(PotionType.WATER);
|
||||
- } else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||
- launch = new net.minecraft.world.entity.projectile.SpectralArrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.SPECTRAL_ARROW), null);
|
||||
+ if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||
+ item = net.minecraft.world.item.Items.SPECTRAL_ARROW;
|
||||
} else {
|
||||
- launch = new net.minecraft.world.entity.projectile.Arrow(world, iposition.x(), iposition.y(), iposition.z(), new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ARROW), null);
|
||||
- }
|
||||
- ((net.minecraft.world.entity.projectile.AbstractArrow) launch).pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.ALLOWED;
|
||||
- ((net.minecraft.world.entity.projectile.AbstractArrow) launch).projectileSource = this;
|
||||
- } else if (Fireball.class.isAssignableFrom(projectile)) {
|
||||
- double d0 = iposition.x() + (double) ((float) enumdirection.getStepX() * 0.3F);
|
||||
- double d1 = iposition.y() + (double) ((float) enumdirection.getStepY() * 0.3F);
|
||||
- double d2 = iposition.z() + (double) ((float) enumdirection.getStepZ() * 0.3F);
|
||||
- RandomSource random = world.random;
|
||||
- double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepX();
|
||||
- double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepY();
|
||||
- double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepZ();
|
||||
-
|
||||
- if (SmallFireball.class.isAssignableFrom(projectile)) {
|
||||
- launch = new net.minecraft.world.entity.projectile.SmallFireball(world, null, new Vec3(d0, d1, d2));
|
||||
- } else if (WitherSkull.class.isAssignableFrom(projectile)) {
|
||||
- launch = EntityType.WITHER_SKULL.create(world);
|
||||
- launch.setPos(d0, d1, d2);
|
||||
-
|
||||
- ((AbstractHurtingProjectile) launch).assignDirectionalMovement(new Vec3(d3, d4, d5), 0.1D);
|
||||
+
|
||||
// Copied from BlockDispenser.dispense()
|
||||
BlockSource sourceblock = new BlockSource((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos(), this.dispenserBlock.getBlockState(), this.dispenserBlock);
|
||||
// Copied from DispenseBehaviorProjectile
|
||||
@@ -88,7 +96,7 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
} else if (Fireball.class.isAssignableFrom(projectile)) {
|
||||
if (AbstractWindCharge.class.isAssignableFrom(projectile)) {
|
||||
item = Items.WIND_CHARGE;
|
||||
- } else {
|
||||
- launch = EntityType.FIREBALL.create(world);
|
||||
- launch.setPos(d0, d1, d2);
|
||||
-
|
||||
- ((AbstractHurtingProjectile) launch).assignDirectionalMovement(new Vec3(d3, d4, d5), 0.1D);
|
||||
+ item = net.minecraft.world.item.Items.ARROW;
|
||||
+ } else if (org.bukkit.entity.SmallFireball.class.isAssignableFrom(projectile)) { // Paper - more projectile API - only allow firing fire charges.
|
||||
item = Items.FIRE_CHARGE;
|
||||
}
|
||||
+ } else if (org.bukkit.entity.WindCharge.class.isAssignableFrom(projectile)) {
|
||||
+ item = net.minecraft.world.item.Items.WIND_CHARGE;
|
||||
+ } else if (org.bukkit.entity.Firework.class.isAssignableFrom(projectile)) {
|
||||
+ item = net.minecraft.world.item.Items.FIREWORK_ROCKET;
|
||||
+ } else if (SmallFireball.class.isAssignableFrom(projectile)) {
|
||||
+ item = net.minecraft.world.item.Items.FIRE_CHARGE;
|
||||
+ }
|
||||
} else if (Firework.class.isAssignableFrom(projectile)) {
|
||||
@@ -104,7 +112,7 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
Position iposition = dispenseConfig.positionFunction().getDispensePosition(sourceblock, enumdirection);
|
||||
net.minecraft.world.entity.projectile.Projectile launch = projectileItem.asProjectile(world, iposition, itemstack, enumdirection);
|
||||
|
||||
- ((AbstractHurtingProjectile) launch).projectileSource = this;
|
||||
+ if (!(item instanceof net.minecraft.world.item.ProjectileItem projectileItem)) {
|
||||
+ throw new IllegalArgumentException("Projectile '%s' is not supported".formatted(projectile.getSimpleName()));
|
||||
- if (Fireball.class.isAssignableFrom(projectile)) {
|
||||
+ if (false && Fireball.class.isAssignableFrom(projectile)) { // Paper - more project API - dispensers cannot launch anything but fire charges.
|
||||
AbstractHurtingProjectile customFireball = null;
|
||||
if (WitherSkull.class.isAssignableFrom(projectile)) {
|
||||
launch = customFireball = EntityType.WITHER_SKULL.create(world);
|
||||
@@ -129,7 +137,7 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
}
|
||||
}
|
||||
|
||||
- Preconditions.checkArgument(launch != null, "Projectile not supported");
|
||||
+ net.minecraft.world.item.ProjectileItem.DispenseConfig config = projectileItem.createDispenseConfig();
|
||||
+ net.minecraft.world.level.block.state.BlockState state = this.dispenserBlock.getBlockState();
|
||||
+ net.minecraft.world.level.Level world = this.dispenserBlock.getLevel();
|
||||
+ BlockSource pointer = new BlockSource((ServerLevel) world, this.dispenserBlock.getBlockPos(), state, this.dispenserBlock); // copied from DispenseBlock#dispenseFrom
|
||||
+ Direction facing = state.getValue(DispenserBlock.FACING);
|
||||
+ Position pos = config.positionFunction().getDispensePosition(pointer, facing);
|
||||
|
||||
- if (launch instanceof net.minecraft.world.entity.projectile.Projectile) {
|
||||
- if (launch instanceof ThrowableProjectile) {
|
||||
- ((ThrowableProjectile) launch).projectileSource = this;
|
||||
- }
|
||||
- // Values from DispenseBehaviorProjectile
|
||||
- float a = 6.0F;
|
||||
- float b = 1.1F;
|
||||
- if (launch instanceof net.minecraft.world.entity.projectile.ThrownPotion || launch instanceof ThrownExpBottle) {
|
||||
- // Values from respective DispenseBehavior classes
|
||||
- a *= 0.5F;
|
||||
- b *= 1.25F;
|
||||
- }
|
||||
- // Copied from DispenseBehaviorProjectile
|
||||
- ((net.minecraft.world.entity.projectile.Projectile) launch).shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), b, a);
|
||||
- }
|
||||
+ net.minecraft.world.entity.projectile.Projectile launch = projectileItem.asProjectile(world, pos, new net.minecraft.world.item.ItemStack(item), facing);
|
||||
+ // some projectile are not shoot and doesn't rely on the config for power/uncertainty
|
||||
+ projectileItem.shoot(launch, facing.getStepX(), facing.getStepY(), facing.getStepZ(), config.power(), config.uncertainty());
|
||||
+ launch.projectileSource = this;
|
||||
+ // Paper end
|
||||
|
||||
- if (launch instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) {
|
||||
+ if (false && launch instanceof net.minecraft.world.entity.projectile.AbstractArrow arrow) { // Paper - more projectile API - this is set by the respective ArrowItem when constructing the projectile
|
||||
arrow.pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.ALLOWED;
|
||||
}
|
||||
launch.projectileSource = this;
|
||||
@@ -138,6 +146,11 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
if (velocity != null) {
|
||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue