Fix more compile issues
This commit is contained in:
parent
0d3ce2d704
commit
a308c7c8d7
17 changed files with 29 additions and 29 deletions
|
@ -3642,7 +3642,7 @@ index 0000000000000000000000000000000000000000..6cdc40cb4a5f94654c874f9dbdb106fa
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f7520ba86c1a650d3bd9b902d2a59ec8eb6cde5d
|
||||
index 0000000000000000000000000000000000000000..3332531d902899a156179ef2e9ec85b2f42c1fd1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/LegacyPaperWorldConfig.java
|
||||
@@ -0,0 +1,322 @@
|
||||
|
@ -3753,7 +3753,7 @@ index 0000000000000000000000000000000000000000..f7520ba86c1a650d3bd9b902d2a59ec8
|
|||
+ )
|
||||
+ .addVersion(26, ConfigurationTransformation.builder().addAction(path("alt-item-despawn-rate", "items", ConfigurationTransformation.WILDCARD_OBJECT), (path, value) -> {
|
||||
+ String itemName = path.get(path.size() - 1).toString();
|
||||
+ final Optional<Holder.Reference<Item>> item = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, new ResourceLocation(itemName.toLowerCase(Locale.ROOT))));
|
||||
+ final Optional<Holder.Reference<Item>> item = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, ResourceLocation.parse(itemName.toLowerCase(Locale.ROOT))));
|
||||
+ if (item.isEmpty()) {
|
||||
+ itemName = Material.valueOf(itemName).getKey().getKey();
|
||||
+ }
|
||||
|
@ -3785,7 +3785,7 @@ index 0000000000000000000000000000000000000000..f7520ba86c1a650d3bd9b902d2a59ec8
|
|||
+ Map<String, Integer> rebuild = new HashMap<>();
|
||||
+ value.childrenMap().forEach((key, node) -> {
|
||||
+ String itemName = key.toString();
|
||||
+ final Optional<Holder.Reference<Item>> itemHolder = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, new ResourceLocation(itemName.toLowerCase(Locale.ROOT))));
|
||||
+ final Optional<Holder.Reference<Item>> itemHolder = BuiltInRegistries.ITEM.getHolder(ResourceKey.create(Registries.ITEM, ResourceLocation.parse(itemName.toLowerCase(Locale.ROOT))));
|
||||
+ final @Nullable String item;
|
||||
+ if (itemHolder.isEmpty()) {
|
||||
+ final @Nullable Material bukkitMat = Material.matchMaterial(itemName);
|
||||
|
|
|
@ -651,7 +651,7 @@ index 0000000000000000000000000000000000000000..23bd6d2d8fed5a3491e856f8b875456d
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..69347ac0547cba3842040f89615e721b5d1ac3ca
|
||||
index 0000000000000000000000000000000000000000..b9a64a40dbb025e34a3de81df1208de45df3cfcc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -0,0 +1,376 @@
|
||||
|
@ -705,7 +705,7 @@ index 0000000000000000000000000000000000000000..69347ac0547cba3842040f89615e721b
|
|||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class ChatProcessor {
|
||||
+ static final ResourceKey<ChatType> PAPER_RAW = ResourceKey.create(Registries.CHAT_TYPE, new ResourceLocation(ResourceLocation.PAPER_NAMESPACE, "raw"));
|
||||
+ static final ResourceKey<ChatType> PAPER_RAW = ResourceKey.create(Registries.CHAT_TYPE, ResourceLocation.fromNamespaceAndPath(ResourceLocation.PAPER_NAMESPACE, "raw"));
|
||||
+ static final String DEFAULT_LEGACY_FORMAT = "<%1$s> %2$s"; // copied from PlayerChatEvent/AsyncPlayerChatEvent
|
||||
+ final MinecraftServer server;
|
||||
+ final ServerPlayer player;
|
||||
|
@ -1157,7 +1157,7 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7397918cf747bc2352bf5bb112a71e7f6844e0e0
|
||||
index 0000000000000000000000000000000000000000..a6aef1ac31f3d2784b5d7b1af616965b5cd2c383
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -0,0 +1,478 @@
|
||||
|
@ -1310,7 +1310,7 @@ index 0000000000000000000000000000000000000000..7397918cf747bc2352bf5bb112a71e7f
|
|||
+ // Key
|
||||
+
|
||||
+ public static ResourceLocation asVanilla(final Key key) {
|
||||
+ return new ResourceLocation(key.namespace(), key.value());
|
||||
+ return ResourceLocation.fromNamespaceAndPath(key.namespace(), key.value());
|
||||
+ }
|
||||
+
|
||||
+ public static ResourceLocation asVanillaNullable(final Key key) {
|
||||
|
|
|
@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..8f07539a82f449ad217e316a7513a170
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
index 7397918cf747bc2352bf5bb112a71e7f6844e0e0..0f9b744a977ec7ab8f138989b2336117b3de1412 100644
|
||||
index a6aef1ac31f3d2784b5d7b1af616965b5cd2c383..2390618c553dec2f32467dd8f76a6e4651f726c9 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -31,6 +31,7 @@ import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
|
|
|
@ -12,7 +12,7 @@ for this on CB at one point but I can't find it. We may need to do this
|
|||
ourselves at some point in the future.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
index 69347ac0547cba3842040f89615e721b5d1ac3ca..e83f9517b31c5171b8dc75ab63a5bfe654221c84 100644
|
||||
index b9a64a40dbb025e34a3de81df1208de45df3cfcc..14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -20,6 +20,7 @@ import net.kyori.adventure.audience.ForwardingAudience;
|
||||
|
|
|
@ -9,7 +9,7 @@ to the nearest Integer when updating its current cook time.
|
|||
Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..b5a26a44b3cf7d864eae909acf619d857c4fa397 100644
|
||||
index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..5ea2b05961590732a43bb5a1abf00bf8a00c72c2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -79,6 +79,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
@ -83,7 +83,7 @@ index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..b5a26a44b3cf7d864eae909acf619d85
|
|||
|
||||
- private static int getTotalCookTime(Level world, AbstractFurnaceBlockEntity furnace) {
|
||||
- if (world == null) return 200; // CraftBukkit - SPIGOT-4302
|
||||
+ private static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { // Paper - cook speed multiplier API
|
||||
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { // Paper - cook speed multiplier API
|
||||
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0));
|
||||
|
||||
- return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add recipe to cook events
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index b5a26a44b3cf7d864eae909acf619d857c4fa397..92a1173dc8be632a4ff4b6137dbe1a9244f64742 100644
|
||||
index 5ea2b05961590732a43bb5a1abf00bf8a00c72c2..84a3130a31f7a0fd5a8ae1b293dd3f2ca07c86d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -444,7 +444,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] add consumeFuel to FurnaceBurnEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 92a1173dc8be632a4ff4b6137dbe1a9244f64742..35061cb17850789e40b0e4bca453df92f1178546 100644
|
||||
index 84a3130a31f7a0fd5a8ae1b293dd3f2ca07c86d3..aa59a45bcbe652996eddb80a3187618b7f6d1234 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -365,7 +365,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
|
|
@ -1367,7 +1367,7 @@ index 794e4fe0a3fbd967f665b2707865c15491370c76..c284eb96a1e330078076cbe61f0f6e2f
|
|||
public void increaseAnger(Entity entity, int increase) {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
index 1113533d281ed159bb735040fb1f913482debf3a..7a8ce6956db56061af93ba9761f5d1057a90bc49 100644
|
||||
index 1113533d281ed159bb735040fb1f913482debf3a..955948f6ec096304671a98f7241930fa91565711 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
||||
@@ -67,4 +67,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
|
||||
|
@ -1393,7 +1393,7 @@ index 1113533d281ed159bb735040fb1f913482debf3a..7a8ce6956db56061af93ba9761f5d105
|
|||
+
|
||||
+ @Override
|
||||
+ public boolean canTravelThroughPortals() {
|
||||
+ return getHandle().canChangeDimensions();
|
||||
+ return getHandle().canChangeDimensions(null, null); // Only used by the enderpearl... right now
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Expose isFuel and canSmelt methods to FurnaceInventory
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
|
||||
index 29a8cd7667860c4598a556e6ef3af39c731683db..4ce9fd8e4e124600f48f34c6943512f39444cb9b 100644
|
||||
index 29a8cd7667860c4598a556e6ef3af39c731683db..bd370f5c856d75b7210ef26036aedaa859c570be 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
|
||||
@@ -40,6 +40,20 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
|
||||
|
@ -22,7 +22,7 @@ index 29a8cd7667860c4598a556e6ef3af39c731683db..4ce9fd8e4e124600f48f34c6943512f3
|
|||
+ public boolean canSmelt(ItemStack stack) {
|
||||
+ // data packs are always loaded in the main world
|
||||
+ net.minecraft.server.level.ServerLevel world = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorlds().get(0)).getHandle();
|
||||
+ return stack != null && !stack.getType().isEmpty() && world.getRecipeManager().getRecipeFor(((AbstractFurnaceBlockEntity) this.inventory).recipeType, new net.minecraft.world.SimpleContainer(CraftItemStack.asNMSCopy(stack)), world).isPresent();
|
||||
+ return stack != null && !stack.getType().isEmpty() && world.getRecipeManager().getRecipeFor(((AbstractFurnaceBlockEntity) this.inventory).recipeType, new net.minecraft.world.item.crafting.SingleRecipeInput(CraftItemStack.asNMSCopy(stack)), world).isPresent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
|
|
@ -8,7 +8,7 @@ public net.minecraft.world.effect.MobEffect attributeModifiers
|
|||
public net.minecraft.world.effect.MobEffect$AttributeTemplate
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
index 21d4224c8993f521d6004d708ecbf71fa6d09306..956b3eb1478b32399e507aead1551b51d6876695 100644
|
||||
index 21d4224c8993f521d6004d708ecbf71fa6d09306..6cf790c9fa23ea313423fdaeb7c181bf530828c6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java
|
||||
@@ -129,6 +129,48 @@ public class CraftPotionEffectType extends PotionEffectType implements Handleabl
|
||||
|
@ -24,7 +24,7 @@ index 21d4224c8993f521d6004d708ecbf71fa6d09306..956b3eb1478b32399e507aead1551b51
|
|||
+ attributeMap.put(
|
||||
+ org.bukkit.craftbukkit.attribute.CraftAttribute.minecraftHolderToBukkit(attribute),
|
||||
+ // use zero as amplifier to get the base amount, as it is amount = base * (amplifier + 1)
|
||||
+ org.bukkit.craftbukkit.attribute.CraftAttributeInstance.convert(attributeModifier.create(this.handle.getDescriptionId(), 0))
|
||||
+ org.bukkit.craftbukkit.attribute.CraftAttributeInstance.convert(attributeModifier.create(0))
|
||||
+ );
|
||||
+ });
|
||||
+ return java.util.Map.copyOf(attributeMap);
|
||||
|
@ -35,7 +35,7 @@ index 21d4224c8993f521d6004d708ecbf71fa6d09306..956b3eb1478b32399e507aead1551b51
|
|||
+ com.google.common.base.Preconditions.checkArgument(effectAmplifier >= 0, "effectAmplifier must be greater than or equal to 0");
|
||||
+ Holder<net.minecraft.world.entity.ai.attributes.Attribute> nmsAttribute = org.bukkit.craftbukkit.attribute.CraftAttribute.bukkitToMinecraftHolder(attribute);
|
||||
+ com.google.common.base.Preconditions.checkArgument(this.handle.attributeModifiers.containsKey(nmsAttribute), attribute + " is not present on " + this.getKey());
|
||||
+ return this.handle.attributeModifiers.get(nmsAttribute).create(this.handle.getDescriptionId(), effectAmplifier).amount();
|
||||
+ return this.handle.attributeModifiers.get(nmsAttribute).create(effectAmplifier).amount();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
|
|
@ -15,7 +15,7 @@ login plugin message packet.
|
|||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3c31ff3330c2e925e205c0c9ff4f0b832682b576
|
||||
index 0000000000000000000000000000000000000000..1b797955357612a4319452de7461ba044cbb88d6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
|
||||
@@ -0,0 +1,86 @@
|
||||
|
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..3c31ff3330c2e925e205c0c9ff4f0b83
|
|||
+ public static final int MODERN_FORWARDING_WITH_KEY_V2 = 3;
|
||||
+ public static final int MODERN_LAZY_SESSION = 4;
|
||||
+ public static final byte MAX_SUPPORTED_FORWARDING_VERSION = MODERN_LAZY_SESSION;
|
||||
+ public static final ResourceLocation PLAYER_INFO_CHANNEL = new ResourceLocation("velocity", "player_info");
|
||||
+ public static final ResourceLocation PLAYER_INFO_CHANNEL = ResourceLocation.fromNamespaceAndPath("velocity", "player_info");
|
||||
+
|
||||
+ public static boolean checkIntegrity(final FriendlyByteBuf buf) {
|
||||
+ final byte[] signature = new byte[32];
|
||||
|
|
|
@ -294,7 +294,7 @@ index fa5366961861370c2366e6f0ff026a6d65128316..a5c7c2d24498c66159316a4f92677625
|
|||
return;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 35061cb17850789e40b0e4bca453df92f1178546..6d9bb60fd6d12933df960c984bc57084bd2f53db 100644
|
||||
index aa59a45bcbe652996eddb80a3187618b7f6d1234..f1a7054a0ee1842e78338d8984f151b24c352849 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -648,13 +648,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Fix crash relating to bad recipes in furnace-like tile
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 6d9bb60fd6d12933df960c984bc57084bd2f53db..86667e93a86d84aabd05aa40a0a37a454ce7d290 100644
|
||||
index f1a7054a0ee1842e78338d8984f151b24c352849..65ab9b22f724877b68f4f25aad2831e2cb080b19 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -616,6 +616,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
|
|
@ -123,7 +123,7 @@ index ccc7367ab2740bea0f2b907223a0920b11665092..845eff7401b811c179dc9dee70eca0d7
|
|||
if (this.getLootTable() != null) {
|
||||
this.lootableData().loadNbt(nbt);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 86667e93a86d84aabd05aa40a0a37a454ce7d290..2ebaf72d795b1d2f1f1ecebb2dae21a035f60d90 100644
|
||||
index 65ab9b22f724877b68f4f25aad2831e2cb080b19..730aca233f6e7564d4cb85b5b628d23c4f01d2f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -295,7 +295,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
|
231
patches/server/0987-Suspicious-Effect-Entry-API.patch
Normal file
231
patches/server/0987-Suspicious-Effect-Entry-API.patch
Normal file
|
@ -0,0 +1,231 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sun, 3 Mar 2024 19:43:40 +0100
|
||||
Subject: [PATCH] Suspicious Effect Entry API
|
||||
|
||||
Exposes a new suspicious effect entry type that properly represents
|
||||
storable effects in the context of suspicious effects as they only
|
||||
define the potion effect type and duration.
|
||||
|
||||
This differentiates them from the existing PotionEffect API found in
|
||||
bukkit and hence clarifies that storable values in the parts of the API
|
||||
in which it replaces PotionEffect.
|
||||
|
||||
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
index 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..5c5b64bd058684520fa175bfd10622ff57856b7c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
||||
@@ -37,16 +37,24 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
|
||||
@Override
|
||||
public boolean addEffectToNextStew(PotionEffect potionEffect, boolean overwrite) {
|
||||
Preconditions.checkArgument(potionEffect != null, "PotionEffect cannot be null");
|
||||
- MobEffectInstance minecraftPotionEffect = CraftPotionUtil.fromBukkit(potionEffect);
|
||||
- if (!overwrite && this.hasEffectForNextStew(potionEffect.getType())) {
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ return this.addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry.create(potionEffect.getType(), potionEffect.getDuration()), overwrite);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite) {
|
||||
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "SuspiciousEffectEntry cannot be null");
|
||||
+ Holder<MobEffect> minecraftPotionEffect = CraftPotionEffectType.bukkitToMinecraftHolder(suspiciousEffectEntry.effect());
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ if (!overwrite && this.hasEffectForNextStew(suspiciousEffectEntry.effect())) {
|
||||
return false;
|
||||
}
|
||||
SuspiciousStewEffects stewEffects = this.getHandle().stewEffects;
|
||||
if (stewEffects == null) {
|
||||
stewEffects = SuspiciousStewEffects.EMPTY;
|
||||
}
|
||||
- SuspiciousStewEffects.Entry recordSuspiciousEffect = new SuspiciousStewEffects.Entry(minecraftPotionEffect.getEffect(), minecraftPotionEffect.getDuration());
|
||||
- this.removeEffectFromNextStew(potionEffect.getType()); // Avoid duplicates of effects
|
||||
+ SuspiciousStewEffects.Entry recordSuspiciousEffect = new SuspiciousStewEffects.Entry(minecraftPotionEffect, suspiciousEffectEntry.duration()); // Paper - sus effect entry API
|
||||
+ this.removeEffectFromNextStew(suspiciousEffectEntry.effect()); // Avoid duplicates of effects // Paper - sus effect entry API
|
||||
this.getHandle().stewEffects = stewEffects.withEffectAdded(recordSuspiciousEffect);
|
||||
return true;
|
||||
}
|
||||
@@ -101,6 +109,43 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm
|
||||
this.getHandle().setVariant(net.minecraft.world.entity.animal.MushroomCow.MushroomType.values()[variant.ordinal()]);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public List<io.papermc.paper.potion.SuspiciousEffectEntry> getStewEffects() {
|
||||
+ if (this.getHandle().stewEffects == null) {
|
||||
+ return List.of();
|
||||
+ }
|
||||
+
|
||||
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> effectEntries = new java.util.ArrayList<>(this.getHandle().stewEffects.effects().size());
|
||||
+ for (final SuspiciousStewEffects.Entry effect : this.getHandle().stewEffects.effects()) {
|
||||
+ effectEntries.add(io.papermc.paper.potion.SuspiciousEffectEntry.create(
|
||||
+ org.bukkit.craftbukkit.potion.CraftPotionEffectType.minecraftHolderToBukkit(effect.effect()),
|
||||
+ effect.duration()
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ return java.util.Collections.unmodifiableList(effectEntries);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setStewEffects(final List<io.papermc.paper.potion.SuspiciousEffectEntry> effects) {
|
||||
+ if (effects.isEmpty()) {
|
||||
+ this.getHandle().stewEffects = null;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ List<SuspiciousStewEffects.Entry> nmsPairs = new java.util.ArrayList<>(effects.size());
|
||||
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry effect : effects) {
|
||||
+ nmsPairs.add(new SuspiciousStewEffects.Entry(
|
||||
+ org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraftHolder(effect.effect()),
|
||||
+ effect.duration()
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ this.getHandle().stewEffects = new SuspiciousStewEffects(nmsPairs);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftMushroomCow";
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
index f6b3798cf06f94d7e3e76d1b6e83236ded5b21e0..39cab624de062514358a2a2942aea0e58cbd6e3e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
@@ -22,7 +22,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
|
||||
static final ItemMetaKeyType<SuspiciousStewEffects> EFFECTS = new ItemMetaKeyType<>(DataComponents.SUSPICIOUS_STEW_EFFECTS, "effects");
|
||||
|
||||
- private List<PotionEffect> customEffects;
|
||||
+ private List<io.papermc.paper.potion.SuspiciousEffectEntry> customEffects; // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
|
||||
CraftMetaSuspiciousStew(CraftMetaItem meta) {
|
||||
super(meta);
|
||||
@@ -48,7 +48,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
continue;
|
||||
}
|
||||
int duration = effect.duration();
|
||||
- this.customEffects.add(new PotionEffect(type, duration, 0));
|
||||
+ this.customEffects.add(io.papermc.paper.potion.SuspiciousEffectEntry.create(type, duration)); // Paper - use suspicious effect entry for suspicious stew meta
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -74,8 +74,8 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
if (this.customEffects != null) {
|
||||
List<SuspiciousStewEffects.Entry> effectList = new ArrayList<>();
|
||||
|
||||
- for (PotionEffect effect : this.customEffects) {
|
||||
- effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration()));
|
||||
+ for (io.papermc.paper.potion.SuspiciousEffectEntry effect : this.customEffects) {
|
||||
+ effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.effect()), effect.duration())); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
}
|
||||
tag.put(CraftMetaSuspiciousStew.EFFECTS, new SuspiciousStewEffects(effectList));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@Override
|
||||
public List<PotionEffect> getCustomEffects() {
|
||||
if (this.hasCustomEffects()) {
|
||||
- return ImmutableList.copyOf(this.customEffects);
|
||||
+ return this.customEffects.stream().map(suspiciousEffectEntry -> suspiciousEffectEntry.effect().createEffect(suspiciousEffectEntry.duration(), 0)).toList(); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -120,27 +120,47 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@Override
|
||||
public boolean addCustomEffect(PotionEffect effect, boolean overwrite) {
|
||||
Preconditions.checkArgument(effect != null, "Potion effect cannot be null");
|
||||
+ return addCustomEffect(io.papermc.paper.potion.SuspiciousEffectEntry.create(effect.getType(), effect.getDuration()), overwrite); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ }
|
||||
|
||||
- int index = this.indexOfEffect(effect.getType());
|
||||
- if (index != -1) {
|
||||
- if (overwrite) {
|
||||
- PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getDuration() == effect.getDuration()) {
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ @Override
|
||||
+ public boolean addCustomEffect(final io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, final boolean overwrite) {
|
||||
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "Suspicious effect entry cannot be null");
|
||||
+ if (this.hasCustomEffects()) {
|
||||
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> matchingEffects = this.customEffects.stream().filter(
|
||||
+ entry -> entry.effect() == suspiciousEffectEntry.effect()
|
||||
+ ).toList();
|
||||
+ if (!matchingEffects.isEmpty()) {
|
||||
+ if (overwrite) {
|
||||
+ boolean foundMatchingDuration = false;
|
||||
+ boolean mutated = false;
|
||||
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry matchingEffect : matchingEffects) {
|
||||
+ if (matchingEffect.duration() != suspiciousEffectEntry.duration()) {
|
||||
+ this.customEffects.remove(suspiciousEffectEntry);
|
||||
+ mutated = true;
|
||||
+ } else {
|
||||
+ foundMatchingDuration = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (foundMatchingDuration && !mutated) {
|
||||
+ return false;
|
||||
+ } else if (!foundMatchingDuration) {
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
+ }
|
||||
+ return true;
|
||||
+ } else {
|
||||
return false;
|
||||
}
|
||||
- this.customEffects.set(index, effect);
|
||||
- return true;
|
||||
- } else {
|
||||
- return false;
|
||||
}
|
||||
- } else {
|
||||
- if (this.customEffects == null) {
|
||||
- this.customEffects = new ArrayList<>();
|
||||
- }
|
||||
- this.customEffects.add(effect);
|
||||
- return true;
|
||||
}
|
||||
+ if (this.customEffects == null) {
|
||||
+ this.customEffects = new ArrayList<>();
|
||||
+ }
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
+ return true;
|
||||
}
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
|
||||
@Override
|
||||
public boolean removeCustomEffect(PotionEffectType type) {
|
||||
@@ -151,10 +171,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
- Iterator<PotionEffect> iterator = this.customEffects.iterator();
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ Iterator<io.papermc.paper.potion.SuspiciousEffectEntry> iterator = this.customEffects.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
- PotionEffect effect = iterator.next();
|
||||
- if (type.equals(effect.getType())) {
|
||||
+ io.papermc.paper.potion.SuspiciousEffectEntry effect = iterator.next();
|
||||
+ if (type.equals(effect.effect())) {
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
iterator.remove();
|
||||
changed = true;
|
||||
}
|
||||
@@ -177,7 +199,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.customEffects.size(); i++) {
|
||||
- if (this.customEffects.get(i).getType().equals(type)) {
|
||||
+ if (this.customEffects.get(i).effect().equals(type)) { // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +244,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
super.serialize(builder);
|
||||
|
||||
if (this.hasCustomEffects()) {
|
||||
- builder.put(CraftMetaSuspiciousStew.EFFECTS.BUKKIT, ImmutableList.copyOf(this.customEffects));
|
||||
+ builder.put(CraftMetaSuspiciousStew.EFFECTS.BUKKIT, ImmutableList.copyOf(com.google.common.collect.Lists.transform(this.customEffects, s -> new PotionEffect(s.effect(), s.duration(), 0)))); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - convert back to potion effect for bukkit legacy item serialisation to maintain backwards compatibility for the written format.
|
||||
}
|
||||
|
||||
return builder;
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: granny <contact@granny.dev>
|
||||
Date: Sat, 24 Feb 2024 19:33:01 -0800
|
||||
Subject: [PATCH] check if itemstack is stackable first
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index a62e7354bf67a66bdf9cd7c8f5d2e8f6bcacc74f..6e66141dca61f777b354854b5d0bac2570b8bf3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
|
||||
- return !existingStack.isEmpty() && ItemStack.isSameItemSameComponents(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack);
|
||||
+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack) && ItemStack.isSameItemSameComponents(existingStack, stack); // Paper - check if itemstack is stackable first
|
||||
}
|
||||
|
||||
// CraftBukkit start - Watch method above! :D
|
19
patches/server/0989-disable-forced-empty-world-ticks.patch
Normal file
19
patches/server/0989-disable-forced-empty-world-ticks.patch
Normal file
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Tue, 21 Mar 2023 23:51:46 +0000
|
||||
Subject: [PATCH] disable forced empty world ticks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..3f17212fc814156e2d3e8c7d4cf40680ab5cdbb5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -528,7 +528,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
- boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
+ boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this
|
||||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
Loading…
Add table
Add a link
Reference in a new issue