#734: Add EnderSignal ItemStack API

This commit is contained in:
Parker Hawke 2020-08-28 12:35:14 +10:00 committed by md_5
parent e14c9acbec
commit 7d31adb5f7
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 17 additions and 2 deletions

View File

@ -1,10 +1,12 @@
--- a/net/minecraft/server/EntityEnderSignal.java
+++ b/net/minecraft/server/EntityEnderSignal.java
@@ -21,7 +21,7 @@
@@ -20,8 +20,8 @@
}
public void b(ItemStack itemstack) {
if (itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) {
- if (itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) {
- this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a((Object) itemstack.cloneItemStack(), (itemstack1) -> {
+ if (true || itemstack.getItem() != Items.ENDER_EYE || itemstack.hasTag()) { // CraftBukkit - always allow item changing
+ this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
itemstack1.setCount(1);
}));

View File

@ -3,10 +3,13 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityEnderSignal;
import net.minecraft.server.Items;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
public class CraftEnderSignal extends CraftEntity implements EnderSignal {
public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) {
@ -49,6 +52,16 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
getHandle().shouldDropItem = shouldDropItem;
}
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getHandle().g()); // PAIL rename getItemStack
}
@Override
public void setItem(ItemStack item) {
getHandle().b(item != null ? CraftItemStack.asNMSCopy(item) : Items.ENDER_EYE.r()); // PAIL rename setItemStack, createItemStack
}
@Override
public int getDespawnTimer() {
return getHandle().despawnTimer;