geforkt von Mirrors/Paper
9df2066642
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: dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles 825ab30d PR-905: Add missing MapCursor.Type and update documentation e03d10e6 PR-903: Make BARRIER Waterlogged 1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer CraftBukkit Changes: f71a799f0 Make BARRIER Waterlogged 172f76a45 Upgrade specialsource-maven-plugin f0702775c SPIGOT-7486: Alternate approach to null profile names 069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic 5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents 02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion 9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer 6d4b25bf1 Increase diff stability
52 Zeilen
3.2 KiB
Diff
52 Zeilen
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 14 Oct 2021 12:09:39 -0500
|
|
Subject: [PATCH] Add ItemFactory#getSpawnEgg API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
index aa90b0bc1ca3f79a38b39442bf87e376cd2d73ae..48a88dae70fdf2757537d4a90aa60046e6346323 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
@@ -528,4 +528,19 @@ public final class CraftItemFactory implements ItemFactory {
|
|
new net.md_5.bungee.api.chat.TextComponent(customName));
|
|
}
|
|
// Paper end - bungee hover events
|
|
+
|
|
+ // Paper start - old getSpawnEgg API
|
|
+ // @Override // used to override, upstream added conflicting method, is called via Commodore now
|
|
+ @Deprecated
|
|
+ public ItemStack getSpawnEgg0(org.bukkit.entity.EntityType type) {
|
|
+ if (type == null) {
|
|
+ return null;
|
|
+ }
|
|
+ String typeId = type.getKey().toString();
|
|
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
|
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(typeKey);
|
|
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
|
|
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
|
index 8f8b14cb845bf1ba28276b3e3c0d8f8c56106c7d..d7495ea25713e959d106764054ce6642af497035 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
|
@@ -461,6 +461,16 @@ public class Commodore
|
|
return;
|
|
}
|
|
// Paper end
|
|
+
|
|
+ // Paper start - ItemFactory#getSpawnEgg (paper had original method that returned ItemStack, upstream added identical but returned Material)
|
|
+ if (owner.equals("org/bukkit/inventory/ItemFactory") && name.equals("getSpawnEgg") && desc.equals("(Lorg/bukkit/entity/EntityType;)Lorg/bukkit/inventory/ItemStack;")) {
|
|
+ super.visitInsn(Opcodes.SWAP); // has 1 param, this moves the owner instance to the top for the checkcast
|
|
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE + "/inventory/CraftItemFactory");
|
|
+ super.visitInsn(Opcodes.SWAP); // moves param back to the the top of stack
|
|
+ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE + "/inventory/CraftItemFactory", "getSpawnEgg0", desc, false);
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - ItemFactory#getSpawnEgg
|
|
if ( modern )
|
|
{
|
|
if ( owner.equals( "org/bukkit/Material" ) )
|