Skip to content

Commit

Permalink
Updated Upstream (Paper)
Browse files Browse the repository at this point in the history
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@77a5779 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11197)
PaperMC/Paper@4d7cef3 Fix source of knockback for spigot events (#11176)
  • Loading branch information
granny committed Aug 10, 2024
1 parent 7950960 commit 73a90e8
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 39 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group = org.purpurmc.purpur
version = 1.21-R0.1-SNAPSHOT

mcVersion = 1.21
paperCommit = 4e6a2a13a3e1f6fa1067a7821d2f018339395533
paperCommit = 4d7cef34181162e301365ada2d0a3e98b4a7cc88

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
23 changes: 21 additions & 2 deletions patches/api/0014-Anvil-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Anvil API


diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
index c60be4fd24c7fdf65251dd6169e5e1ac3b588d95..569deccd2f1cf21da9b5906433ac493c1f2081be 100644
index f1f97a85ec713c05c882d7588f4a3e4a017f4795..468d8b336c8060da346e2dfe60900868148376f6 100644
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
@@ -123,4 +123,14 @@ public interface AnvilInventory extends Inventory {
@@ -138,4 +138,14 @@ public interface AnvilInventory extends Inventory {
setItem(2, result);
}
// Paper end
Expand All @@ -21,6 +21,25 @@ index c60be4fd24c7fdf65251dd6169e5e1ac3b588d95..569deccd2f1cf21da9b5906433ac493c
+ boolean canDoUnsafeEnchants();
+
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/view/AnvilView.java b/src/main/java/org/bukkit/inventory/view/AnvilView.java
index 0344b3db789baf1da0b59f2d2cd66154b69b38a9..c824a94f81925abc91eff7424c8021da10980bad 100644
--- a/src/main/java/org/bukkit/inventory/view/AnvilView.java
+++ b/src/main/java/org/bukkit/inventory/view/AnvilView.java
@@ -59,4 +59,14 @@ public interface AnvilView extends InventoryView {
* @param levels the levels to set
*/
void setMaximumRepairCost(int levels);
+
+ // Purpur start
+ boolean canBypassCost();
+
+ void setBypassCost(boolean bypassCost);
+
+ boolean canDoUnsafeEnchants();
+
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
+ // Purpur end
}
diff --git a/src/main/java/org/purpurmc/purpur/event/inventory/AnvilTakeResultEvent.java b/src/main/java/org/purpurmc/purpur/event/inventory/AnvilTakeResultEvent.java
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0007-Ridables.patch
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ index 23ddd26af762c1cd7fb3920669abb96b3213ab37..e5ae7478cf2d3ef9d484116db742dd8c
this.profiler.push(() -> {
String s = String.valueOf(worldserver);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2766ec28f028c0bd672009928bf64c1a6e5d07d6..1d0f9fa24e8ead7710249575795951dad97ea51f 100644
index 2fe9d9b38c01d04416843fdd48d3e33899b7de63..559bec25060eb8981bf80213ceedb79d6c99e411 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -229,6 +229,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
Expand Down Expand Up @@ -190,7 +190,7 @@ index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..aa76a24421cdb3908a3544d92eb3d1e3
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fe435d4a387bb28be6831cec0c8bb0a7c8b603a4..a387268659a17a4508359f2a69d50593cefd4629 100644
index ccd9dff20a60f019e0c320acfb526b8bf3e5f806..b32460d324d93fed734be5d92baf0359ad5b0a80 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -237,9 +237,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
Expand Down Expand Up @@ -5117,10 +5117,10 @@ index cd789c235acf740ec29c30b180e7fbe1a140caa9..edaaaf0ecc412504b32fe7481f95e594
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0ab53d46f0b8f3f3791dd01766738522c86932e8..ba749cf277aad319709e3da550155488bb33591b 100644
index 8dd85b9ca3b3e3429de4d0ec0654982589c6e93e..8c1fdda7c30c12bc5262d373474deb6930e811e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -597,6 +597,15 @@ public class CraftEventFactory {
@@ -601,6 +601,15 @@ public class CraftEventFactory {
// Paper end
craftServer.getPluginManager().callEvent(event);

Expand All @@ -5136,7 +5136,7 @@ index 0ab53d46f0b8f3f3791dd01766738522c86932e8..ba749cf277aad319709e3da550155488
return event;
}

@@ -1187,6 +1196,7 @@ public class CraftEventFactory {
@@ -1191,6 +1200,7 @@ public class CraftEventFactory {
EntityDamageEvent event;
if (damager != null) {
event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions, critical);
Expand Down
76 changes: 62 additions & 14 deletions patches/server/0016-Anvil-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ index 32910f677b0522ac8ec513fa0d00b714b52cfae4..c491291b522aebf34c7d990d2b485d1a
// CraftBukkit start
public boolean checkReachable = true;
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 7198dc9ffc9a37dab3654e12aa497c442a9993c5..99bfa7cdc58c690d6f0c742dafedd40cace3223f 100644
index d685511104ac552dfc9ae2111e1bfb60fa812102..b1810b5dfc89dd2921607b0040afd69b05d36b9e 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -25,6 +25,12 @@ import org.slf4j.Logger;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.inventory.view.CraftAnvilView;
// CraftBukkit end

+// Purpur start - Anvil API
Expand All @@ -35,7 +35,7 @@ index 7198dc9ffc9a37dab3654e12aa497c442a9993c5..99bfa7cdc58c690d6f0c742dafedd40c
public static final int INPUT_SLOT = 0;
@@ -53,6 +59,10 @@ public class AnvilMenu extends ItemCombinerMenu {
public int maximumRepairCost = 40;
private CraftInventoryView bukkitEntity;
private CraftAnvilView bukkitEntity;
// CraftBukkit end
+ // Purpur start - Anvil API
+ public boolean bypassCost = false;
Expand Down Expand Up @@ -136,21 +136,69 @@ index 7de5e47f9a54263734eeef855a2dc07ef64d30ea..b3bd9bbd96efc4784b86c2be6bb857da

return itemstack;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
index 9ee14589d63bbfc0880f2eee5e924fe946ee0035..062783f30f41761c34d7679844e443e9a55c6011 100644
index 792cb6adf0c7a6335cc5985fce8bed2e0f1149af..5734c5caffda79383ae30df20c3defb51b87f39e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
@@ -9,7 +9,7 @@ import org.bukkit.inventory.AnvilInventory;
public class CraftInventoryAnvil extends CraftResultInventory implements AnvilInventory {

private final Location location;
- private final AnvilMenu container;
+ public final AnvilMenu container; // Purpur - private -> public - Anvil API
@@ -19,6 +19,10 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
private int repairCost;
private int repairCostAmount;
private int maximumRepairCost;
+ // Purpur start - Anvil API
+ private boolean bypassCost;
+ private boolean canDoUnsafeEnchants;
+ // Purpur end - Anvil API

public CraftInventoryAnvil(Location location, Container inventory, Container resultInventory, AnvilMenu container) {
public CraftInventoryAnvil(Location location, Container inventory, Container resultInventory) {
super(inventory, resultInventory);
@@ -57,4 +57,26 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
Preconditions.checkArgument(levels >= 0, "Maximum repair cost must be positive (or 0)");
this.container.maximumRepairCost = levels;
@@ -27,6 +31,10 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
this.repairCost = CraftInventoryAnvil.DEFAULT_REPAIR_COST;
this.repairCostAmount = CraftInventoryAnvil.DEFAULT_REPAIR_COST_AMOUNT;
this.maximumRepairCost = CraftInventoryAnvil.DEFAULT_MAXIMUM_REPAIR_COST;
+ // Purpur start - Anvil API
+ this.bypassCost = false;
+ this.canDoUnsafeEnchants = false;
+ // Purpur end - Anvil API
}

@Override
@@ -113,4 +121,30 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
consumer.accept(cav);
}
}
+
+ // Purpur start - Anvil API
+ @Override
+ public boolean canBypassCost() {
+ this.syncWithArbitraryViewValue((cav) -> this.bypassCost = cav.canBypassCost());
+ return this.bypassCost;
+ }
+
+ @Override
+ public void setBypassCost(boolean bypassCost) {
+ this.bypassCost = bypassCost;
+ this.syncViews((cav) -> cav.setBypassCost(bypassCost));
+ }
+
+ @Override
+ public boolean canDoUnsafeEnchants() {
+ this.syncWithArbitraryViewValue((cav) -> this.canDoUnsafeEnchants = cav.canDoUnsafeEnchants());
+ return this.canDoUnsafeEnchants;
+ }
+
+ @Override
+ public void setDoUnsafeEnchants(boolean canDoUnsafeEnchants) {
+ this.canDoUnsafeEnchants = canDoUnsafeEnchants;
+ this.syncViews((cav) -> cav.setDoUnsafeEnchants(canDoUnsafeEnchants));
+ }
+ // Purpur end - Anvil API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
index e2d8d69c5ae8feb6840462ba8332344972658d83..d1505efcf861224f0b3c9837072690155b36ae32 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftAnvilView.java
@@ -63,4 +63,26 @@ public class CraftAnvilView extends CraftInventoryView<AnvilMenu> implements Anv
this.setMaximumRepairCost(legacy.getMaximumRepairCost());
}
}
+
+ // Purpur start - Anvil API
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0022-Disable-outdated-build-check.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Disable outdated build check


diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 98dd06878b76b0c1d70242afd49738b253cd0e80..577b2f19e625ca71b13477eb96e42e04954fa449 100644
index 22bdc8fe2796940eb971437e1c97d638bfbc42bb..316c5e1460ccf3386c4c8623eabb7f087df8c4b9 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -273,7 +273,7 @@ public class Main {
@@ -267,7 +267,7 @@ public class Main {
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0039-Minecart-settings-and-WASD-controls.patch
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ index d524fcc191cb95d6ec7f12ae7fceeb8077bb08fc..4b8cebb321eddc852b4ec7def7f51d78
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index ded6d148110fe3fbb6272ce44582a28472dd49a6..61918a4a1ea8e1a0f5965bbf2c9fdb2d7b7863e8 100644
index d0109633e8bdf109cfc9178963d7b6cf92f8b189..dd607038f42a73f6311d7a6003a2cf57c1589c83 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -93,7 +93,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -94,7 +94,7 @@ public abstract class BlockBehaviour implements FeatureElement {
protected final float jumpFactor;
protected final boolean dynamicShape;
protected final FeatureFlagSet requiredFeatures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Crying obsidian valid for portal frames


diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index 57139a0b8adcd1ea25cd100be78402681856ee75..e8793e11e94eea41ea9be615f0d46c7add836919 100644
index 86d95edc7dd1e42b4b38eba1177cd508e72e4fc4..6c07fc507df6070854f5950a8616d2949c040656 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -32,7 +32,7 @@ public class PortalShape {
@@ -31,7 +31,7 @@ public class PortalShape {
private static final int MIN_HEIGHT = 3;
public static final int MAX_HEIGHT = 21;
private static final BlockBehaviour.StatePredicate FRAME = (iblockdata, iblockaccess, blockposition) -> {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0181-Store-placer-on-Block-when-placed.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Store placer on Block when placed


diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index fab7bebb8c7fd21a3bcfbd2f04702eb56f9eb310..0527f7e6b7971c32d366107ff4e4c499fcd7b42c 100644
index 4ca65631e19b1064c84551aea3b46702aafc7b98..f6e5f18e2d70261eb4e0bea9818ae59e953f455d 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -497,6 +497,7 @@ public final class ItemStack implements DataComponentHolder {
Expand All @@ -18,7 +18,7 @@ index fab7bebb8c7fd21a3bcfbd2f04702eb56f9eb310..0527f7e6b7971c32d366107ff4e4c499
world.preventPoiUpdated = false;
@@ -529,6 +530,7 @@ public final class ItemStack implements DataComponentHolder {
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
block.onPlace(world, newblockposition, oldBlock, true, context); // Paper - pass context
block.onPlace(world, newblockposition, oldBlock, true, context);
}
+ block.getBlock().forgetPlacer(); // Purpur

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0241-Stonecutter-damage.patch
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ index 31ae0f466ae522d767907ec5066b26695f327b96..f26383cf896785333dbd6f86348d5a5f
} else if (blockState.is(Blocks.HONEY_BLOCK)) {
return PathType.STICKY_HONEY;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ba749cf277aad319709e3da550155488bb33591b..98891112f992978c97b21ab0d7d54228819b7536 100644
index 8c1fdda7c30c12bc5262d373474deb6930e811e8..198a86fc9b8c4dba8c8de27bccc4de65690b84de 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1136,7 +1136,7 @@ public class CraftEventFactory {
@@ -1140,7 +1140,7 @@ public class CraftEventFactory {
return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.LAVA, bukkitDamageSource, modifiers, modifierFunctions, cancelled);
} else if (source.getDirectBlock() != null) {
DamageCause cause;
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0245-Enchantment-Table-Persists-Lapis.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Enchantment Table Persists Lapis


diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 07223046761cb2186d75de8edc03a91d2e8e8b2f..4e5d497b966a04d42b988d26039cbbcc3da7121c 100644
index 1ef014b29645ed09ccffb898f1819428c3dc6259..859deb56915dba0e9189103708060cafd196c58e 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -45,6 +45,12 @@ import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
@@ -42,6 +42,12 @@ import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
import org.bukkit.entity.Player;
// CraftBukkit end

Expand All @@ -21,7 +21,7 @@ index 07223046761cb2186d75de8edc03a91d2e8e8b2f..4e5d497b966a04d42b988d26039cbbcc
public class EnchantmentMenu extends AbstractContainerMenu {

static final ResourceLocation EMPTY_SLOT_LAPIS_LAZULI = ResourceLocation.withDefaultNamespace("item/empty_slot_lapis_lazuli");
@@ -79,6 +85,22 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -76,6 +82,22 @@ public class EnchantmentMenu extends AbstractContainerMenu {
return context.getLocation();
}
// CraftBukkit end
Expand All @@ -44,7 +44,7 @@ index 07223046761cb2186d75de8edc03a91d2e8e8b2f..4e5d497b966a04d42b988d26039cbbcc
};
this.random = RandomSource.create();
this.enchantmentSeed = DataSlot.standalone();
@@ -104,6 +126,17 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -101,6 +123,17 @@ public class EnchantmentMenu extends AbstractContainerMenu {
}
});

Expand All @@ -62,7 +62,7 @@ index 07223046761cb2186d75de8edc03a91d2e8e8b2f..4e5d497b966a04d42b988d26039cbbcc
int j;

for (j = 0; j < 3; ++j) {
@@ -344,6 +377,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
@@ -341,6 +374,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
public void removed(net.minecraft.world.entity.player.Player player) {
super.removed(player);
this.access.execute((world, blockposition) -> {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0260-Configurable-block-blast-resistance.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable block blast resistance


diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 61918a4a1ea8e1a0f5965bbf2c9fdb2d7b7863e8..80d68b91ea4e4eb97e31d1df0c430740fb56bd74 100644
index dd607038f42a73f6311d7a6003a2cf57c1589c83..40f15a30b1a0dd2040e75045f32f33082e70aaeb 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -85,7 +85,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -86,7 +86,7 @@ public abstract class BlockBehaviour implements FeatureElement {

protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
public final boolean hasCollision;
Expand Down

0 comments on commit 73a90e8

Please sign in to comment.