mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
#734: Add EnderSignal ItemStack API
This commit is contained in:
parent
e14c9acbec
commit
7d31adb5f7
2 changed files with 17 additions and 2 deletions
|
@ -1,10 +1,12 @@
|
||||||
--- a/net/minecraft/server/EntityEnderSignal.java
|
--- a/net/minecraft/server/EntityEnderSignal.java
|
||||||
+++ b/net/minecraft/server/EntityEnderSignal.java
|
+++ b/net/minecraft/server/EntityEnderSignal.java
|
||||||
@@ -21,7 +21,7 @@
|
@@ -20,8 +20,8 @@
|
||||||
|
}
|
||||||
|
|
||||||
public void b(ItemStack itemstack) {
|
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) -> {
|
- 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
|
+ this.getDataWatcher().set(EntityEnderSignal.b, SystemUtils.a(itemstack.cloneItemStack(), (itemstack1) -> { // CraftBukkit - decompile error
|
||||||
itemstack1.setCount(1);
|
itemstack1.setCount(1);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -3,10 +3,13 @@ package org.bukkit.craftbukkit.entity;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.server.BlockPosition;
|
import net.minecraft.server.BlockPosition;
|
||||||
import net.minecraft.server.EntityEnderSignal;
|
import net.minecraft.server.EntityEnderSignal;
|
||||||
|
import net.minecraft.server.Items;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.EnderSignal;
|
import org.bukkit.entity.EnderSignal;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class CraftEnderSignal extends CraftEntity implements EnderSignal {
|
public class CraftEnderSignal extends CraftEntity implements EnderSignal {
|
||||||
public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) {
|
public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) {
|
||||||
|
@ -49,6 +52,16 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
|
||||||
getHandle().shouldDropItem = shouldDropItem;
|
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
|
@Override
|
||||||
public int getDespawnTimer() {
|
public int getDespawnTimer() {
|
||||||
return getHandle().despawnTimer;
|
return getHandle().despawnTimer;
|
||||||
|
|
Loading…
Reference in a new issue