Skip to content
Permalink
Browse files

fix entity.item mech for 1.13, fixes #1891

  • Loading branch information...
mcmonkey4eva committed Jan 19, 2019
1 parent 9ba1077 commit b376ce67eb170d1a39286f51e7b9663f8cfa7084
@@ -6,11 +6,7 @@
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@@ -23,6 +19,10 @@ default void setRiptide(Entity entity, boolean state) {
dB.echoError("Riptide control not available on this server version.");
}

default void setCarriedItem(Enderman entity, ItemStack item) {
entity.setCarriedMaterial(item.getData());
}

int getBodyArrows(Entity entity);

void setBodyArrows(Entity entity, int numArrows);
@@ -1,5 +1,6 @@
package net.aufdemrand.denizen.objects.properties.entity;

import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.objects.dEntity;
import net.aufdemrand.denizen.objects.dItem;
import net.aufdemrand.denizencore.objects.Mechanism;
@@ -113,8 +114,8 @@ public void adjust(Mechanism mechanism) {
.asType(dItem.class).getItemStack());
}
else {
((Enderman) item.getBukkitEntity()).setCarriedMaterial(
mechanism.getValue().asType(dItem.class).getItemStack().getData());
NMSHandler.getInstance().getEntityHelper().setCarriedItem((Enderman) item.getBukkitEntity(),
mechanism.getValue().asType(dItem.class).getItemStack());
}
}
}
@@ -11,6 +11,7 @@
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_13_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftAnimals;
@@ -43,6 +44,11 @@
General Entity Methods
*/

@Override
public void setCarriedItem(Enderman entity, ItemStack item) {
entity.setCarriedBlock(Bukkit.createBlockData(item.getType()));
}

@Override
public void setRiptide(Entity entity, boolean state) {
// https://wiki.vg/Entity_metadata#Living

0 comments on commit b376ce6

Please sign in to comment.
You can’t perform that action at this time.