1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-31 03:50:36 +01:00

Updated Upstream (Bukkit/CraftBukkit/Spigot) ()

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:
01aa02eb PR-858: Add LivingEntity#playHurtAnimation()
9421320f PR-884: Refinements to new ban API for improved compatibility and correctness
37a60b45 SPIGOT-6455, SPIGOT-7030, PR-750: Improve ban API
4eeb174b All smithing inventories are now the new smithing inventory
f2bb168e PR-880: Add methods to get/set FallingBlock CancelDrop
e7a807fa PR-879: Add Player#sendHealthUpdate()
692b8e96 SPIGOT-7370: Remove float value conversion in plugin.yml
2d033390 SPIGOT-7403: Add direct API for waxed signs
16a08373 PR-876: Add missing Raider API and 'no action ticks'

CraftBukkit Changes:
b60a95c8c PR-1189: Add LivingEntity#playHurtAnimation()
95c335c63 PR-1226: Fix VehicleEnterEvent not being called for certain entities
0a0fc3bee PR-1227: Refinements to new ban API for improved compatibility and correctness
0d0b1e5dc Revert bad change to PathfinderGoalSit causing all cats to sit
648196070 SPIGOT-6455, SPIGOT-7030, PR-1054: Improve ban API
31fe848d6 All smithing inventories are now the new smithing inventory
9a919a143 SPIGOT-7416: SmithItemEvent not firing in Smithing Table
9f64f0d22 PR-1221: Add methods to get/set FallingBlock CancelDrop
3be9ac171 PR-1220: Add Player#sendHealthUpdate()
c1279f775 PR-1209: Clean up various patches
c432e4397 Fix Raider#setCelebrating() implementation
504d96665 SPIGOT-7403: Add direct API for waxed signs
c68c1f1b3 PR-1216: Add missing Raider API and 'no action ticks'
85b89c3dd Increase outdated build delay

Spigot Changes:
9ebce8af Rebuild patches
64b565e6 Rebuild patches
This commit is contained in:
Nassim Jahnke 2023-07-04 10:22:56 +02:00
parent 1dec9836ed
commit c32c74f4ce
44 changed files with 95 additions and 516 deletions
patches
api
server
work

View file

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 8 Jun 2023 23:22:31 -0700
Subject: [PATCH] Add API for waxed signs
diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/block/Sign.java
+++ b/src/main/java/org/bukkit/block/Sign.java
@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable {
* outside of this event is undefined.
*
* @return if this sign is currently editable
+ * @deprecated use {@link #isWaxed()}
*/
+ @Deprecated // Paper
public boolean isEditable();
/**
@@ -0,0 +0,0 @@ public interface Sign extends TileState, Colorable {
* outside of this event is undefined.
*
* @param editable if this sign is currently editable
+ * @deprecated use {@link #setWaxed(boolean)}
*/
+ @Deprecated // Paper
public void setEditable(boolean editable);
+ // Paper start
+ /**
+ * Gets whether the sign has been waxed and therefore prevents editing.
+ *
+ * @return true if waxed
+ */
+ boolean isWaxed();
+
+ /**
+ * Sets whether the sign is waxed.
+ *
+ * @param waxed true to wax and therefore prevent editing
+ */
+ void setWaxed(boolean waxed);
+ // Paper end
+
/**
* Gets whether this sign has glowing text. Only affects the {@link Side#FRONT}.
*

View file

@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
/**
* Checks if this player is whitelisted or not
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java

View file

@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SamB440 <sam@islandearth.net>
Date: Wed, 17 Nov 2021 12:30:36 +0000
Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public double getHealthScale();
+ // Paper start
+ /**
+ * Forcefully sends a health update to the player.
+ * <p>This method can cause the client to display health values
+ * different to their true server values. If the player takes damage or
+ * causes an action to otherwise cause a health update, these values
+ * will no longer be shown.</p>
+ * Setting the visible health to 0 will result in the client seeing
+ * the death screen, unable to press the respawn button.
+ * @see #sendHealthUpdate()
+ * @param health the health of the player
+ * @param foodLevel the food level of the player
+ * @param saturationLevel the saturation level of the player
+ */
+ public void sendHealthUpdate(final double health, final int foodLevel, final float saturationLevel);
+
+ /**
+ * Forcefully sends a health update to the player.
+ * This uses the player's current health, saturation, and food level.
+ * <p>Use after {@link #setHealth(double)} to show the heart animation
+ * of gaining or losing health.</p>
+ */
+ public void sendHealthUpdate();
+ // Paper end
+
/**
* Gets the entity which is followed by the camera when in
* {@link GameMode#SPECTATOR}.

View file

@ -2270,8 +2270,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
/**
* Says a message (or runs a command).
*
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
* update the entry.
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull Map<EquipmentSlot, ItemStack> items);

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/Ba
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/BanList.java
+++ b/src/main/java/org/bukkit/BanList.java
@@ -0,0 +0,0 @@ public interface BanList {
@@ -0,0 +0,0 @@ public interface BanList<T> {
/**
* Gets a {@link BanEntry} by target.
@ -19,12 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*
* @param target entry parameter to search for
* @return the corresponding entry, or null if none found
@@ -0,0 +0,0 @@ public interface BanList {
public BanEntry getBanEntry(@NotNull String target);
@@ -0,0 +0,0 @@ public interface BanList<T> {
/**
- * Adds a ban to the this list. If a previous ban exists, this will
+ * Adds a ban to this list. If a previous ban exists, this will
* Adds a ban to this list. If a previous ban exists, this will
* update the previous entry.
+ * <p>
+ * Bans by name for ban type {@link Type#NAME NAME} are no longer supported and this method will return
@ -32,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*
* @param target the target of the ban
* @param reason reason for the ban, null indicates implementation default
@@ -0,0 +0,0 @@ public interface BanList {
@@ -0,0 +0,0 @@ public interface BanList<T> {
/**
* Gets if a {@link BanEntry} exists for the target, indicating an active
* ban status.
@ -41,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * The replacement is bans by UUID.
*
* @param target the target to find
* @return true if a {@link BanEntry} exists for the name, indicating an
@@ -0,0 +0,0 @@ public interface BanList {
* @return true if a {@link BanEntry} exists for the target, indicating an
@@ -0,0 +0,0 @@ public interface BanList<T> {
/**
* Removes the specified target from this list, therefore indicating a
* "not banned" status.
@ -56,18 +53,6 @@ diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Buk
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -0,0 +0,0 @@ public final class Bukkit {
}
/**
- * Gets a ban list for the supplied type.
- * <p>
- * Bans by name are no longer supported and this method will return
- * null when trying to request them. The replacement is bans by UUID.
+ * Gets a ban list for the supplied type. <!-- Paper Remove notice: wrong place -->
*
* @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type
@@ -0,0 +0,0 @@ public final class Bukkit {
/**
@ -148,18 +133,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
public int getTicksPerSpawns(@NotNull SpawnCategory spawnCategory);
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public Set<OfflinePlayer> getBannedPlayers();
/**
- * Gets a ban list for the supplied type.
- * <p>
- * Bans by name are no longer supported and this method will return
- * null when trying to request them. The replacement is bans by UUID.
+ * Gets a ban list for the supplied type. <!-- Paper Remove notice: wrong place -->
*
* @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
/**

View file

@ -796,31 +796,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
* Represents the various types a Rabbit might be.
diff --git a/src/main/java/org/bukkit/entity/Raider.java b/src/main/java/org/bukkit/entity/Raider.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Raider.java
+++ b/src/main/java/org/bukkit/entity/Raider.java
@@ -0,0 +0,0 @@ public interface Raider extends Monster {
*/
@NotNull
Sound getCelebrationSound();
+
+ // Paper start
+ /**
+ * Returns whether the raider is celebrating a raid victory.
+ *
+ * @return whether the raider is celebrating a raid victory
+ */
+ boolean isCelebrating();
+
+ /**
+ * Sets whether the raider is celebrating a raid victory.
+ *
+ * @param celebrating whether the raider is celebrating a raid victory
+ */
+ void setCelebrating(boolean celebrating);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Ravager.java b/src/main/java/org/bukkit/entity/Ravager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Ravager.java

View file

@ -1444,7 +1444,7 @@ diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
+++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.nodes.Tag;
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.representer.Representer;
* inferno.burningdeaths: true
*</pre></blockquote>
*/

View file

@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); // Paper
/**
* Checks if this player is banned or not
* Checks if this player has had their profile banned.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/Server.java

View file

@ -9,13 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -0,0 +0,0 @@ public enum InventoryType {
/**
* The new smithing inventory, with 3 CRAFTING slots and 1 RESULT slot.
*
- * @apiNote draft, experimental 1.20 API
+ * @deprecated use {@link #SMITHING}
* @deprecated use {@link #SMITHING}
*/
- @MinecraftExperimental
- @Deprecated
+ @Deprecated(forRemoval = true) // Paper
SMITHING_NEW(4, "Upgrade Gear"),
;

View file

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 8 Jun 2023 23:22:36 -0700
Subject: [PATCH] Add API for waxed signs
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -0,0 +0,0 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
getSnapshot().setWaxed(!editable);
}
+ // Paper start
+ @Override
+ public boolean isWaxed() {
+ return this.getSnapshot().isWaxed();
+ }
+
+ @Override
+ public void setWaxed(final boolean waxed) {
+ this.getSnapshot().setWaxed(waxed);
+ }
+ // Paper end
+
@Override
public boolean isGlowingText() {
return this.front.isGlowingText();

View file

@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (entity instanceof Ravager && !CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // CraftBukkit
if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@ -253,9 +253,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
super.entityInside(state, world, pos, entity);
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (world instanceof ServerLevel && entity instanceof Boat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
world.destroyBlock(new BlockPos(pos), true, entity);
}
if (world instanceof ServerLevel && entity instanceof Boat) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/WebBlock.java

View file

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
return event;
return !event.isCancelled();
}
+ // Paper start
@ -43,6 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
+
public static HorseJumpEvent callHorseJumpEvent(Entity horse, float power) {
HorseJumpEvent event = new HorseJumpEvent((AbstractHorse) horse.getBukkitEntity(), power);
horse.getBukkitEntity().getServer().getPluginManager().callEvent(event);
public static boolean callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock) {
return CraftEventFactory.callEntityChangeBlockEvent(entity, position, newBlock, false);
}

View file

@ -11,17 +11,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
@@ -0,0 +0,0 @@ public class ThrownEgg extends ThrowableItemProjectile {
hatchingType = event.getHatchingType();
}
}
// CraftBukkit end
+ // Paper start
+ com.destroystokyo.paper.event.entity.ThrownEggHatchEvent event = new com.destroystokyo.paper.event.entity.ThrownEggHatchEvent((org.bukkit.entity.Egg) getBukkitEntity(), hatching, b0, hatchingType);
+ event.callEvent();
+
+ b0 = event.getNumHatches();
+ hatching = event.isHatching();
+ hatchingType = event.getHatchingType();
+ // Paper end
if (hatching) {
for (int i = 0; i < b0; ++i) {
Entity entity = this.level().getWorld().createEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass());
for (int i = 0; i < b0; ++i) {
Entity entitychicken = this.level().getWorld().createEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit

View file

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SamB440 <sam@islandearth.net>
Date: Wed, 17 Nov 2021 12:31:42 +0000
Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().maxHealthCache = getMaxHealth();
}
- public void sendHealthUpdate() {
+ // Paper start
+ @Override
+ public void sendHealthUpdate(final double health, final int foodLevel, final float saturationLevel) {
// Paper start - cancellable death event
- ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket((float) health, foodLevel, saturationLevel);
if (this.getHandle().queueHealthUpdatePacket) {
this.getHandle().queuedHealthUpdatePacket = packet;
} else {
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
}
+ @Override
+ public void sendHealthUpdate() {
+ this.sendHealthUpdate(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
+ }
+ // Paper end
+
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
if (!this.scaledHealth && !force) {
return;

View file

@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View file

@ -29,21 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
if ((this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/entity/Marker.java b/src/main/java/net/minecraft/world/entity/Marker.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Marker.java
+++ b/src/main/java/net/minecraft/world/entity/Marker.java
@@ -0,0 +0,0 @@ public class Marker extends Entity {
}
@Override
- protected void addPassenger(Entity passenger) {
- throw new IllegalStateException("Should never addPassenger without checking couldAcceptPassenger()");
+ protected boolean addPassenger(Entity passenger) { // Paper - fix return type
+ return false; // Paper
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java

View file

@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Sun, 8 Jan 2017 04:31:36 +0000
Subject: [PATCH] Don't allow entities to ride themselves - #572
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
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
protected boolean addPassenger(Entity entity) { // CraftBukkit
+ if (entity == this) throw new IllegalArgumentException("Entities cannot become a passenger of themselves"); // Paper - issue 572
if (entity.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
this.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
}
+ // Paper start
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
@Override
public boolean setTarget(LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) {

View file

@ -12,13 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
protected boolean addPassenger(Entity entity) { // CraftBukkit
+ // Paper start
+ if (entity.level != this.level) {
+ LOGGER.error("Entity passenger world must match, cannot add " + entity + " as passenger to " + this, new Throwable());
+ return false;
+ }
+ // Paper end
if (entity == this) throw new IllegalArgumentException("Entities cannot become a passenger of themselves"); // Paper - issue 572
if (entity.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
public boolean startRiding(Entity entity, boolean force) {
- if (entity == this.vehicle) {
+ if (entity == this.vehicle || entity.level != this.level) { // Paper - check level
return false;
} else if (!entity.couldAcceptPassenger()) {
return false;

View file

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- world.setBlockAndUpdate(blockposition1, WeatheringCopper.getFirst(world.getBlockState(blockposition1)));
+ // Paper start - call EntityChangeBlockEvent
+ BlockState newBlock = WeatheringCopper.getFirst(world.getBlockState(blockposition1));
+ if (!CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1, newBlock).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1, newBlock)) {
+ world.setBlockAndUpdate(blockposition1, newBlock);
+ }
+ // Paper end
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
BlockPos blockposition1Final = blockposition1; // CraftBukkit - decompile error
WeatheringCopper.getPrevious(iblockdata).ifPresent((iblockdata1) -> {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1Final, iblockdata1).isCancelled()) // Paper - call EntityChangeBlockEvent
+ if (CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1Final, iblockdata1)) // Paper - call EntityChangeBlockEvent
world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
});
world.levelEvent(3002, blockposition1, -1);
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (world.getBlockState(blockPos3).isAir()) {
BlockState blockState = frogSpawn.defaultBlockState();
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPos3, blockState).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPos3, blockState)) {
+ isPregnant.erase(); // forgot pregnant memory
+ return true;
+ }
@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (optional4.isPresent()) {
+ // Paper start - EntityChangeBlockEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, optional4.get()).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, optional4.get())) {
+ return InteractionResult.PASS;
+ }
+ // Paper end
@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
BlockState iblockdata1 = (BlockState) iblockdata.setValue(EndPortalFrameBlock.HAS_EYE, true);
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockposition, iblockdata1).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockposition, iblockdata1)) {
+ return InteractionResult.PASS;
+ }
+ // Paper end
@ -136,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Player player = context.getPlayer();
ItemStack itemStack = context.getItemInHand();
+ // Paper start - EntityChangeBlockEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, state).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, state)) {
+ if (!player.isCreative()) {
+ player.containerMenu.sendAllDataToRemote();
+ }
@ -155,7 +155,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (context.getClickedFace() != Direction.DOWN && iblockdata.is(BlockTags.CONVERTABLE_TO_MUD) && PotionUtils.getPotion(itemstack) == Potions.WATER) {
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState()).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState())) {
+ entityhuman.containerMenu.sendAllDataToRemote();
+ return InteractionResult.PASS;
+ }
@ -190,7 +190,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (blockState3 != null) {
if (!level.isClientSide) {
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockPos, blockState3).isCancelled()) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockPos, blockState3)) {
+ return InteractionResult.PASS;
+ }
+ afterAction.run();
@ -219,9 +219,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start
double rand = world.getRandom().nextDouble();
- BlockState iblockdata1 = ComposterBlock.addItem(user, state, DummyGeneratorAccess.INSTANCE, pos, stack, rand);
- if (state == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(user, pos, iblockdata1).isCancelled()) {
- if (state == iblockdata1 || !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(user, pos, iblockdata1)) {
+ BlockState iblockdata1 = null; // Paper
+ if (false && (state == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(user, pos, iblockdata1).isCancelled())) { // Paper - call it later
+ if (false && (state == iblockdata1 || !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(user, pos, iblockdata1))) { // Paper - move event call into addItem
return state;
}
iblockdata1 = ComposterBlock.addItem(user, state, world, pos, stack, rand);
@ -252,7 +252,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int j = i + 1;
BlockState iblockdata1 = (BlockState) iblockdata.setValue(ComposterBlock.LEVEL, j);
+ // Paper start - move the EntityChangeBlockEvent here to avoid conflict later for the compost events
+ if (entity != null && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
+ if (entity != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1)) {
+ return null;
+ }
+ // Paper end

View file

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 22 Mar 2023 13:12:01 -0700
Subject: [PATCH] Fix api checking banned ips
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftIpBanList.java b/src/main/java/org/bukkit/craftbukkit/CraftIpBanList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftIpBanList.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftIpBanList.java
@@ -0,0 +0,0 @@ public class CraftIpBanList implements org.bukkit.BanList {
public boolean isBanned(String target) {
Preconditions.checkArgument(target != null, "Target cannot be null");
- return this.list.isBanned(InetSocketAddress.createUnresolved(target, 0));
+ return this.list.isBanned(target); // Paper - fix checking banned ips
}
@Override

View file

@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack {
int oldCount = this.getCount();
ServerLevel world = (ServerLevel) itemactioncontext.getLevel();
ServerLevel world = (ServerLevel) context.getLevel();
- if (!(this.getItem() instanceof BucketItem || this.getItem() instanceof SolidBucketItem)) { // if not bucket
+ if (!(this.getItem() instanceof BucketItem/* || this.getItem() instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets

View file

@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
@@ -0,0 +0,0 @@ public class EatBlockGoal extends Goal {
BlockPos blockposition1 = blockposition.below();
if (this.level.getBlockState(blockposition1).is(Blocks.GRASS_BLOCK)) {
// CraftBukkit
- if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // Paper - Fix wrong block state
- if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.AIR.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition1, Blocks.DIRT.defaultBlockState(), !this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state
this.level.levelEvent(2001, blockposition1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
this.level.setBlock(blockposition1, Blocks.DIRT.defaultBlockState(), 2);
}
@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (WitherBoss.canDestroy(iblockdata)) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) { // Paper
- if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper
continue;
}
// CraftBukkit end
@ -36,14 +36,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -0,0 +0,0 @@ public class Ravager extends Raider {
BlockState iblockdata = this.level().getBlockState(blockposition);
Block block = iblockdata.getBlock();
- if (block instanceof LeavesBlock && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
+ if (block instanceof LeavesBlock && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) { // CraftBukkit // Paper
flag = this.level().destroyBlock(blockposition, true, this) || flag;
}
}
if (block instanceof LeavesBlock) {
// CraftBukkit start
- if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - use correct block state
continue;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
@ -52,12 +52,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (block instanceof InfestedBlock) {
// CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) {
+ // Paper start
+ BlockState afterState = world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? net.minecraft.world.level.block.Blocks.AIR.defaultBlockState() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1));
+ org.bukkit.event.entity.EntityChangeBlockEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, afterState);
+ if (event.isCancelled()) {
+ // Paper end
- if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
+ // Paper start - use correct block state
+ final BlockState afterState = world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? net.minecraft.world.level.block.Blocks.AIR.defaultBlockState() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1));
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, afterState)) {
+ // Paper end - use correct block state
continue;
}
// CraftBukkit end
@ -69,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide && projectile.mayInteract(world, blockposition) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6D) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock()).isCancelled()) { // Paper
- if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, state.getFluidState().createLegacyBlock())) { // Paper - use correct block state
return;
}
// CraftBukkit end

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.item instanceof BlockItem) {
- SoundType soundeffecttype = ((BlockItem) this.item).getBlock().defaultBlockState().getSoundType(); // TODO: not strictly correct, however currently only affects decorated pots
+ // Paper start
+ BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(itemactioncontext).getClickedPos();
+ BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(context).getClickedPos();
+ net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position);
+ SoundType soundeffecttype = blockData.getSoundType();
+ // Paper end

View file

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main {
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit

View file

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.lastTick = MinecraftServer.currentTick;
@ -45,9 +45,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void tryToMerge(ItemEntity other) {
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity implements TraceableEntity {
public void setItem(ItemStack stack) {
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
+ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper
}

View file

@ -36,8 +36,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
return !event.isCancelled();
Bukkit.getPluginManager().callEvent(event);
return event;
}
+
+ // Paper start

View file

@ -396,12 +396,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
@Override
public void sendHealthUpdate() {
- this.getHandle().connection.send(new ClientboundSetHealthPacket(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel()));
FoodData foodData = this.getHandle().getFoodData();
- this.sendHealthUpdate(this.getScaledHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel());
+ // Paper start - cancellable death event
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(this.getScaledHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel());
+ if (this.getHandle().queueHealthUpdatePacket) {
+ this.getHandle().queuedHealthUpdatePacket = packet;
+ } else {

View file

@ -945,8 +945,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
@@ -0,0 +0,0 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
entity.setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
public void setRabbitType(Type type) {
this.getHandle().setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
}
+ // Paper start
+ @Override
@ -958,27 +958,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public int getMoreCarrotTicks() {
+ return this.getHandle().moreCarrotTicks;
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
@@ -0,0 +0,0 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
public Sound getCelebrationSound() {
return CraftSound.getBukkit(this.getHandle().getCelebrateSound());
}
+
+ // Paper start
+ @Override
+ public boolean isCelebrating() {
+ return this.getHandle().isCelebrating();
+ }
+
+ @Override
+ public void setCelebrating(boolean celebrating) {
+ this.getHandle().setCelebrating(celebrating);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java

View file

@ -58,7 +58,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
@@ -0,0 +0,0 @@ import net.minecraft.world.food.FoodData;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.Blocks;

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.stats.Stats;
@@ -0,0 +0,0 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end

View file

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity implements TraceableEntity {
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems());
this.level().getCraftServer().getPluginManager().callEvent(playerEvent);
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true);
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, context); // Paper - pass context
}
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point

View file

@ -29,5 +29,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
+ // com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit // Paper - Remove check
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper
}

View file

@ -1,130 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 8 Jun 2023 14:45:18 -0700
Subject: [PATCH] Properly remove the experimental smithing inventory type
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
@@ -0,0 +0,0 @@ public class SmithingMenu extends ItemCombinerMenu {
return this.bukkitEntity;
}
- org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithingNew(
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing( // Paper
access.getLocation(), this.inputSlots, this.resultSlots);
this.bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
return this.bukkitEntity;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -0,0 +0,0 @@ public class CraftContainer extends AbstractContainerMenu {
case STONECUTTER:
return MenuType.STONECUTTER;
case SMITHING_NEW:
+ case SMITHING:
return MenuType.SMITHING;
case CREATIVE:
case CRAFTING:
@@ -0,0 +0,0 @@ public class CraftContainer extends AbstractContainerMenu {
this.delegate = new HopperMenu(windowId, bottom, top);
break;
case ANVIL:
- case SMITHING:
this.setupAnvil(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one
break;
case BEACON:
@@ -0,0 +0,0 @@ public class CraftContainer extends AbstractContainerMenu {
case MERCHANT:
this.delegate = new MerchantMenu(windowId, bottom);
break;
+ case SMITHING: // Paper
case SMITHING_NEW:
this.setupSmithing(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one
break;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -0,0 +0,0 @@ public class CraftInventory implements Inventory {
return InventoryType.COMPOSTER;
} else if (this.inventory instanceof JukeboxBlockEntity) {
return InventoryType.JUKEBOX;
- } else if (this instanceof CraftInventorySmithingNew) {
- return InventoryType.SMITHING_NEW;
+ // Paper - remove
} else {
return InventoryType.CHEST;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithing.java
@@ -0,0 +0,0 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit
@Override
public ItemStack getResult() {
- return getItem(2);
+ return getItem(net.minecraft.world.inventory.SmithingMenu.RESULT_SLOT); // Paper
}
@Override
public void setResult(ItemStack item) {
- setItem(2, item);
+ setItem(net.minecraft.world.inventory.SmithingMenu.RESULT_SLOT, item); // Paper
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithingNew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithingNew.java
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventorySmithingNew.java
+++ /dev/null
@@ -0,0 +0,0 @@
-package org.bukkit.craftbukkit.inventory;
-
-import net.minecraft.world.Container;
-import net.minecraft.world.inventory.ResultContainer;
-import org.bukkit.Location;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.Recipe;
-import org.bukkit.inventory.SmithingInventory;
-
-public class CraftInventorySmithingNew extends CraftResultInventory implements SmithingInventory {
-
- private final Location location;
-
- public CraftInventorySmithingNew(Location location, Container inventory, ResultContainer resultInventory) {
- super(inventory, resultInventory);
- this.location = location;
- }
-
- @Override
- public ResultContainer getResultInventory() {
- return (ResultContainer) super.getResultInventory();
- }
-
- @Override
- public Location getLocation() {
- return this.location;
- }
-
- @Override
- public ItemStack getResult() {
- return getItem(3);
- }
-
- @Override
- public void setResult(ItemStack item) {
- setItem(3, item);
- }
-
- @Override
- public Recipe getRecipe() {
- net.minecraft.world.item.crafting.Recipe recipe = this.getResultInventory().getRecipeUsed();
- return (recipe == null) ? null : recipe.toBukkitRecipe();
- }
-}

View file

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -0,0 +0,0 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -3);
deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

View file

@ -37,12 +37,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
Level world = this.turtle.level();
// CraftBukkit start
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit
+ // CraftBukkit start
+ // Paper start
+ int eggCount = this.turtle.random.nextInt(4) + 1;
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount);
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) {
+ if (layEggEvent.callEvent() && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()))) {
world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
BlockPos blockposition1 = this.blockPos.above();
- BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1);

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -0,0 +0,0 @@ public class Creeper extends Monster implements PowerableMob {
this.spawnLingeringCloud();
// CraftBukkit start
} else {
this.swell = 0;
+ this.entityData.set(DATA_IS_IGNITED, Boolean.valueOf(false)); // Paper

View file

@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void remove(K key) {
@@ -0,0 +0,0 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
// CraftBukkit end
}
public boolean isEmpty() {
- return this.map.size() < 1;

View file

@ -106,8 +106,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Squid(EntityType<? extends Squid> type, Level world) {
super(type, world);
- this.random.setSeed((long) this.getId());
+ //this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed
- this.random.setSeed((long)this.getId());
+ //this.random.setSeed((long)this.getId()); // Paper - we set the random to shared, do not clobber the seed
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}

View file

@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return true; // CraftBukkit
}
}
- protected boolean removePassenger(Entity entity) { // CraftBukkit

@ -1 +1 @@
Subproject commit 0c5d870919854258f5f51530a66d839fba20e288
Subproject commit 01aa02eb531ba554701b02986193c874ccb7635d

@ -1 +1 @@
Subproject commit b6b514b7ec49531dc334c4e7bfee2569cfe33398
Subproject commit b60a95c8cf3ca3a6353be1ecf2a6baa6f9072c57

@ -1 +1 @@
Subproject commit c62f4bd99c6f565026bdba8eabb941b0c58a19d8
Subproject commit 9ebce8afbf14ba4b857ce5befe716fecbd6d8879