Skip to content

Commit

Permalink
[ci skip] Add more patch identifying comments, merge related patches
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Jan 15, 2024
1 parent f9fdedf commit 0ef5984
Show file tree
Hide file tree
Showing 66 changed files with 250 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name


diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 1924757cec5d7f2d13ef35f9bbe1554d786713d7..0a2875f63523cc5eeec603e18eb62520587a8475 100644
index 1924757cec5d7f2d13ef35f9bbe1554d786713d7..f13b0143ad89386f8e8d350ebacf98f4f66f18a8 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,6 +89,7 @@ public class GameProfileCache {
}
};

+ if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name)
+ if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name
repository.findProfilesByNames(new String[]{name}, profilelookupcallback);
GameProfile gameprofile = (GameProfile) atomicreference.get();

Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ index 1ee3e38703175707dec6493a1785b1bbc5170793..73b398ffc86498151944bedb0ef12d63

@Override
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 0a2875f63523cc5eeec603e18eb62520587a8475..64f7c3180a745a62bb5d71a42668cc67b5d56c3a 100644
index f13b0143ad89386f8e8d350ebacf98f4f66f18a8..64f7c3180a745a62bb5d71a42668cc67b5d56c3a 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -89,7 +89,8 @@ public class GameProfileCache {
}
};

- if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name)
- if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name
+ if (!org.apache.commons.lang3.StringUtils.isBlank(name) // Paper - Don't lookup a profile with a blank name
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - Add setting for proxy online mode status
repository.findProfilesByNames(new String[]{name}, profilelookupcallback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Subject: [PATCH] Fix HumanEntity#drop not updating the client inv
public net.minecraft.server.level.ServerPlayer containerSynchronizer

diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 5e5fda690605f767b33f8225bffea98d23299fea..52c9244194f3c0182f3a6010ed97d4238efd4eb4 100644
index 5e5fda690605f767b33f8225bffea98d23299fea..897e693492bdf9293154535d5772929bc2b1a523 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -755,8 +755,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Expand All @@ -16,15 +16,15 @@ index 5e5fda690605f767b33f8225bffea98d23299fea..52c9244194f3c0182f3a6010ed97d423
public boolean dropItem(boolean dropAll) {
- if (!(this.getHandle() instanceof ServerPlayer)) return false;
- return ((ServerPlayer) this.getHandle()).drop(dropAll);
+ // Paper start - notify client of remote slot change
+ // Paper start - Fix HumanEntity#drop not updating the client inv
+ if (!(this.getHandle() instanceof ServerPlayer player)) return false;
+ boolean success = player.drop(dropAll);
+ if (!success) return false;
+ final net.minecraft.world.entity.player.Inventory inv = player.getInventory();
+ final java.util.OptionalInt optionalSlot = player.containerMenu.findSlot(inv, inv.selected);
+ optionalSlot.ifPresent(slot -> player.containerSynchronizer.sendSlotChange(player.containerMenu, slot, inv.getSelected()));
+ return true;
+ // Paper end
+ // Paper end - Fix HumanEntity#drop not updating the client inv
}

@Override
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent


diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index 413b307acaad5823b9e06f49fa2faf561f5f7b9a..de8b5cab7925c1c46478952ed2cb2bd40f9a9c48 100644
index 413b307acaad5823b9e06f49fa2faf561f5f7b9a..d78fe4081bc2938326066e0afddb4a6c833a4bf7 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
@@ -328,7 +328,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL);
float f = ComposterBlock.COMPOSTABLES.getFloat(itemstack.getItem());

- if ((i != 0 || f <= 0.0F) && rand >= (double) f) {
+ // Paper start
+ // Paper start - Add CompostItemEvent and EntityCompostItemEvent
+ boolean willRaiseLevel = !((i != 0 || f <= 0.0F) && rand >= (double) f);
+ final io.papermc.paper.event.block.CompostItemEvent event;
+ if (entity == null) {
Expand All @@ -27,19 +27,19 @@ index 413b307acaad5823b9e06f49fa2faf561f5f7b9a..de8b5cab7925c1c46478952ed2cb2bd4
+ willRaiseLevel = event.willRaiseLevel();
+
+ if (!willRaiseLevel) {
+ // Paper end
+ // Paper end - Add CompostItemEvent and EntityCompostItemEvent
return iblockdata;
} else {
int j = i + 1;
@@ -478,6 +492,11 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
this.changed = true;
BlockState iblockdata = ComposterBlock.addItem((Entity) null, this.state, this.level, this.pos, itemstack);

+ // Paper start
+ // Paper start - Add CompostItemEvent and EntityCompostItemEvent
+ if (iblockdata == null) {
+ return;
+ }
+ // Paper end
+ // Paper end - Add CompostItemEvent and EntityCompostItemEvent
this.level.levelEvent(1500, this.pos, iblockdata != this.state ? 1 : 0);
this.removeItemNoUpdate(0);
}
4 changes: 2 additions & 2 deletions patches/server/0904-Fix-text-display-error-on-spawn.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Fix text display error on spawn


diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java
index dcbaa06f807ba3c1b64c96b3c2dd84d46d6be751..58de4a3ff0b5494fa576a902f33de4cd38b9c7be 100644
index dcbaa06f807ba3c1b64c96b3c2dd84d46d6be751..2ecd3ed5b36475125c6f63af2612011fc8fba8a5 100644
--- a/src/main/java/net/minecraft/world/entity/Display.java
+++ b/src/main/java/net/minecraft/world/entity/Display.java
@@ -864,7 +864,7 @@ public abstract class Display extends Entity {
byte b = loadFlag((byte)0, nbt, "shadow", (byte)1);
b = loadFlag(b, nbt, "see_through", (byte)2);
b = loadFlag(b, nbt, "default_background", (byte)4);
- Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)).map(Pair::getFirst);
+ Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).result().map(Pair::getFirst); // Paper - hide error message
+ Optional<Display.TextDisplay.Align> optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).result().map(Pair::getFirst); // Paper - Hide text display error on spawn
if (optional.isPresent()) {
byte var10000;
switch ((Display.TextDisplay.Align)optional.get()) {
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 15 Mar 2023 18:29:45 -0700
Subject: [PATCH] Fix certain inventories returning null Locations
Subject: [PATCH] Fix inventories returning null Locations

Wandering Trader, AbstractHorse, Beacon and Composter inventories returned null locations
when a block or entity location is readily available

Co-authored-by: Lukas Planz <lukas.planz@web.de>

diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
index d5eeb2fcb119b815213aeffb3811d4a843502e50..061e870e0cdd5bf00351b7e8104361bce86809f3 100644
index d5eeb2fcb119b815213aeffb3811d4a843502e50..ff1aba1e69cfde633fd01724f1a8d0af7f59437f 100644
--- a/src/main/java/net/minecraft/world/SimpleContainer.java
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java
@@ -63,6 +63,16 @@ public class SimpleContainer implements Container, StackedContentsCompatible {

@Override
public Location getLocation() {
+ // Paper start
+ // Paper start - Fix inventories returning null Locations
+ // When the block inventory does not have a tile state that implements getLocation, e. g. composters
+ if (this.bukkitOwner instanceof org.bukkit.inventory.BlockInventoryHolder blockInventoryHolder) {
+ return blockInventoryHolder.getBlock().getLocation();
Expand All @@ -25,37 +25,37 @@ index d5eeb2fcb119b815213aeffb3811d4a843502e50..061e870e0cdd5bf00351b7e8104361bc
+ if (this.bukkitOwner instanceof org.bukkit.entity.Entity entity) {
+ return entity.getLocation();
+ }
+ // Paper end
+ // Paper end - Fix inventories returning null Locations
return null;
}

diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index 0b1a0be964d799f1706c273092dc653fa04e8014..a6e712606ece631502ae4c7513403092df77524f 100644
index 0b1a0be964d799f1706c273092dc653fa04e8014..3c67132bd3c1e4886f7ba823fe330b019359ac9d 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -51,6 +51,12 @@ public class BeaconMenu extends AbstractContainerMenu {
public int getMaxStackSize() {
return 1;
}
+ // Paper start
+ // Paper start - Fix inventories returning null Locations
+ @Override
+ public org.bukkit.Location getLocation() {
+ return context.getLocation();
+ }
+ // Paper end
+ // Paper end - Fix inventories returning null Locations
};
checkContainerDataCount(propertyDelegate, 3);
this.beaconData = propertyDelegate;
diff --git a/src/main/java/net/minecraft/world/inventory/MerchantContainer.java b/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
index 083e50e27685f441ede4c75e913d671fe45d1d15..98cbcf67d8fdb1c80fb7ba8ba7734821e2818da6 100644
index 083e50e27685f441ede4c75e913d671fe45d1d15..ac4ec7157cf93b0cbc4472dc42fbbbff3402335a 100644
--- a/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
+++ b/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
@@ -65,7 +65,7 @@ public class MerchantContainer implements Container {

@Override
public Location getLocation() {
- return (this.merchant instanceof Villager) ? ((Villager) this.merchant).getBukkitEntity().getLocation() : null;
+ return (this.merchant instanceof AbstractVillager) ? ((AbstractVillager) this.merchant).getBukkitEntity().getLocation() : null; // Paper
+ return (this.merchant instanceof AbstractVillager) ? ((AbstractVillager) this.merchant).getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
}
// CraftBukkit end

Loading

0 comments on commit 0ef5984

Please sign in to comment.