mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Fix item frame NPCs
This commit is contained in:
parent
0af9ab304a
commit
f0ee7e7cfa
@ -1,28 +1,41 @@
|
||||
package net.citizensnpcs.npc.entity.nonliving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItemFrame;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.MobEntityController;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.EntityItemFrame;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItemFrame;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ItemFrameController extends MobEntityController {
|
||||
public ItemFrameController() {
|
||||
super(EntityItemFrameNPC.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity createEntity(Location at, NPC npc) {
|
||||
Entity e = super.createEntity(at, npc);
|
||||
EntityItemFrame item = (EntityItemFrame) ((CraftEntity) e).getHandle();
|
||||
item.setDirection(EnumDirection.EAST);
|
||||
item.blockPosition = new BlockPosition(at.getX(), at.getY(), at.getZ());
|
||||
return e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFrame getBukkitEntity() {
|
||||
return (ItemFrame) super.getBukkitEntity();
|
||||
@ -90,6 +103,11 @@ public class ItemFrameController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
return npc == null || !npc.isProtected() ? super.survives() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void t_() {
|
||||
if (npc != null) {
|
||||
@ -98,11 +116,6 @@ public class ItemFrameController extends MobEntityController {
|
||||
super.t_();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
return npc == null || !npc.isProtected() ? super.survives() : true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemFrameNPC extends CraftItemFrame implements NPCHolder {
|
||||
|
Loading…
Reference in New Issue
Block a user