mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-26 11:07:59 +01:00
Fix compile error with potions
This commit is contained in:
parent
f9ffd83635
commit
7d96b5ad6d
@ -127,6 +127,7 @@ public class EntityControllers {
|
||||
TYPES.put(EntityType.IRON_GOLEM, IronGolemController.class);
|
||||
TYPES.put(EntityType.ITEM_FRAME, ItemFrameController.class);
|
||||
TYPES.put(EntityType.LEASH_HITCH, LeashController.class);
|
||||
TYPES.put(EntityType.LINGERING_POTION, ThrownPotionController.class);
|
||||
TYPES.put(EntityType.MAGMA_CUBE, MagmaCubeController.class);
|
||||
TYPES.put(EntityType.MINECART, MinecartRideableController.class);
|
||||
TYPES.put(EntityType.MINECART_CHEST, MinecartChestController.class);
|
||||
|
@ -1,5 +1,12 @@
|
||||
package net.citizensnpcs.npc.entity.nonliving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftLingeringPotion;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
@ -7,16 +14,10 @@ import net.citizensnpcs.npc.MobEntityController;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_9_R1.EntityPotion;
|
||||
import net.minecraft.server.v1_9_R1.Items;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_9_R1.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftThrownPotion;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ThrownPotionController extends MobEntityController {
|
||||
public ThrownPotionController() {
|
||||
super(EntityThrownPotionNPC.class);
|
||||
@ -34,11 +35,6 @@ public class ThrownPotionController extends MobEntityController {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
public EntityThrownPotionNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
@ -54,6 +50,11 @@ public class ThrownPotionController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean d(NBTTagCompound save) {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
@ -79,7 +80,11 @@ public class ThrownPotionController extends MobEntityController {
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (bukkitEntity == null && npc != null) {
|
||||
bukkitEntity = new ThrownPotionNPC(this);
|
||||
if (getItem() != null && getItem().getItem().equals(Items.LINGERING_POTION)) {
|
||||
bukkitEntity = new LingeringThrownPotionNPC(this);
|
||||
} else {
|
||||
bukkitEntity = new SplashThrownPotionNPC(this);
|
||||
}
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
@ -99,10 +104,24 @@ public class ThrownPotionController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ThrownPotionNPC extends CraftThrownPotion implements NPCHolder {
|
||||
public static class LingeringThrownPotionNPC extends CraftLingeringPotion implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public ThrownPotionNPC(EntityThrownPotionNPC entity) {
|
||||
public LingeringThrownPotionNPC(EntityThrownPotionNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SplashThrownPotionNPC extends CraftLingeringPotion implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public SplashThrownPotionNPC(EntityThrownPotionNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user