Implement cross-world teleporting for NPCs

This commit is contained in:
fullwall 2022-01-16 14:05:23 +08:00
parent c702e19828
commit 1ee92a07ea
117 changed files with 973 additions and 16 deletions

View File

@ -321,7 +321,7 @@ public class EventListen implements Listener {
@EventHandler @EventHandler
public void onEntityPortal(EntityPortalEvent event) { public void onEntityPortal(EntityPortalEvent event) {
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity()); NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
if (npc == null || event.getEntityType() != EntityType.PLAYER) if (npc == null || npc.getEntity().getType() != EntityType.PLAYER)
return; return;
event.setCancelled(true); event.setCancelled(true);
npc.despawn(DespawnReason.PENDING_RESPAWN); npc.despawn(DespawnReason.PENDING_RESPAWN);

View File

@ -329,13 +329,13 @@ public class NPCCommands {
aliases = { "npc" }, aliases = { "npc" },
usage = "collidable", usage = "collidable",
desc = "Toggles an NPC's collidability", desc = "Toggles an NPC's collidability",
modifiers = { "collidable" }, modifiers = { "collidable", "pushable" },
min = 1, min = 1,
max = 1, max = 1,
permission = "citizens.npc.collidable") permission = "citizens.npc.collidable")
@Requirements(ownership = true, selected = true, types = { EntityType.PLAYER }) @Requirements(ownership = true, selected = true)
public void collidable(CommandContext args, CommandSender sender, NPC npc) throws CommandException { public void collidable(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
npc.data().setPersistent(NPC.COLLIDABLE_METADATA, !npc.data().get(NPC.COLLIDABLE_METADATA, true)); npc.data().setPersistent(NPC.COLLIDABLE_METADATA, !npc.data().get(NPC.COLLIDABLE_METADATA, false));
Messaging.sendTr(sender, Messaging.sendTr(sender,
npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA) ? Messages.COLLIDABLE_SET : Messages.COLLIDABLE_UNSET, npc.data().<Boolean> get(NPC.COLLIDABLE_METADATA) ? Messages.COLLIDABLE_SET : Messages.COLLIDABLE_UNSET,
npc.getName()); npc.getName());

View File

@ -197,11 +197,18 @@ public class NMS {
} }
public static MethodHandle getFirstMethodHandle(Class<?> clazz, boolean log, Class<?>... params) { public static MethodHandle getFirstMethodHandle(Class<?> clazz, boolean log, Class<?>... params) {
return getFirstMethodHandleWithReturnType(clazz, log, null, params);
}
public static MethodHandle getFirstMethodHandleWithReturnType(Class<?> clazz, boolean log, Class<?> returnType,
Class<?>... params) {
if (clazz == null) if (clazz == null)
return null; return null;
try { try {
Method first = null; Method first = null;
for (Method method : clazz.getDeclaredMethods()) { for (Method method : clazz.getDeclaredMethods()) {
if (returnType != null && !returnType.equals(method.getReturnType()))
continue;
Class<?>[] paramTypes = method.getParameterTypes(); Class<?>[] paramTypes = method.getParameterTypes();
if (paramTypes.length == params.length) { if (paramTypes.length == params.length) {
first = method; first = method;

View File

@ -52,7 +52,7 @@ public class Util {
return new Vector(x, y, z); return new Vector(x, y, z);
} }
boolean allowed = !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true) boolean allowed = !npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)
|| !npc.data().get(NPC.COLLIDABLE_METADATA, true); || (npc.data().has(NPC.COLLIDABLE_METADATA) && npc.data().get(NPC.COLLIDABLE_METADATA, true));
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
return allowed ? new Vector(x, y, z) : null; return allowed ? new Vector(x, y, z) : null;
} }

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -210,6 +211,13 @@ public class AxolotlController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -164,5 +166,12 @@ public class BatController extends MobEntityController {
public void setFlying(boolean flying) { public void setFlying(boolean flying) {
setResting(flying); setResting(flying);
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
} }

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -160,5 +162,12 @@ public class BeeController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
} }

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -153,5 +155,12 @@ public class BlazeController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
} }

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -195,6 +196,13 @@ public class CatController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -193,6 +194,13 @@ public class CaveSpiderController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -204,6 +205,13 @@ public class ChickenController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -225,6 +226,13 @@ public class CodController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -211,6 +212,13 @@ public class CowController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -197,6 +197,13 @@ public class CreeperController extends MobEntityController {
this.allowPowered = allowPowered; this.allowPowered = allowPowered;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) { public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) {
if (npc == null || allowPowered) { if (npc == null || allowPowered) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -194,6 +195,13 @@ public class DolphinController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -181,6 +182,13 @@ public class DrownedController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -173,5 +175,12 @@ public class EnderDragonController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
} }

View File

@ -18,6 +18,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -206,6 +207,13 @@ public class EndermanController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class EndermiteController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -176,6 +177,13 @@ public class EvokerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class FoxController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -156,6 +158,13 @@ public class GhastController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
public static class GhastNPC extends CraftGhast implements ForwardingNPCHolder { public static class GhastNPC extends CraftGhast implements ForwardingNPCHolder {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class GiantController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class GlowSquidController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class GoatController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -191,6 +192,13 @@ public class GuardianController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -191,6 +192,13 @@ public class GuardianElderController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -178,6 +179,13 @@ public class HoglinController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -235,6 +236,13 @@ public class HorseController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -234,6 +235,13 @@ public class HorseDonkeyController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -234,6 +235,13 @@ public class HorseMuleController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -234,6 +235,13 @@ public class HorseSkeletonController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -234,6 +235,13 @@ public class HorseZombieController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -176,6 +177,13 @@ public class IllusionerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class IronGolemController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -19,6 +19,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -206,6 +207,13 @@ public class LlamaController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class MagmaCubeController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -199,6 +200,13 @@ public class MushroomCowController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -196,6 +197,13 @@ public class OcelotController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class PandaController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -167,6 +169,13 @@ public class ParrotController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
public static class ParrotNPC extends CraftParrot implements ForwardingNPCHolder { public static class ParrotNPC extends CraftParrot implements ForwardingNPCHolder {

View File

@ -17,6 +17,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
@ -222,6 +223,13 @@ public class PhantomController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
// avoid suicide // avoid suicide

View File

@ -198,6 +198,13 @@ public class PigController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) { public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) {
if (npc == null) { if (npc == null) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -176,6 +177,13 @@ public class PigZombieController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_18_R1.entity; package net.citizensnpcs.nms.v1_18_R1.entity;
import java.util.TreeMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer; import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
@ -17,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -39,7 +38,6 @@ public class PiglinBruteController extends MobEntityController {
} }
public static class EntityPiglinBruteNPC extends PiglinBrute implements NPCHolder { public static class EntityPiglinBruteNPC extends PiglinBrute implements NPCHolder {
private TreeMap<?, ?> behaviorMap;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityPiglinBruteNPC(EntityType<? extends PiglinBrute> types, Level level) { public EntityPiglinBruteNPC(EntityType<? extends PiglinBrute> types, Level level) {
@ -181,6 +179,13 @@ public class PiglinBruteController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -178,6 +179,13 @@ public class PiglinController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class PillagerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,8 +13,10 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -163,6 +165,13 @@ public class PolarBearController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
public static class PolarBearNPC extends CraftPolarBear implements ForwardingNPCHolder { public static class PolarBearNPC extends CraftPolarBear implements ForwardingNPCHolder {

View File

@ -17,6 +17,7 @@ import net.citizensnpcs.trait.versioned.PufferFishTrait;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -234,6 +235,13 @@ public class PufferFishController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -17,6 +17,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -41,7 +42,6 @@ public class RabbitController extends MobEntityController {
public static class EntityRabbitNPC extends Rabbit implements NPCHolder { public static class EntityRabbitNPC extends Rabbit implements NPCHolder {
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityRabbitNPC(EntityType<? extends Rabbit> types, Level level) { public EntityRabbitNPC(EntityType<? extends Rabbit> types, Level level) {
@ -212,6 +212,13 @@ public class RabbitController extends MobEntityController {
super.setRabbitType(i); super.setRabbitType(i);
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -189,6 +190,13 @@ public class RavagerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -217,6 +218,13 @@ public class SalmonController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -39,7 +40,6 @@ public class SheepController extends MobEntityController {
public static class EntitySheepNPC extends Sheep implements NPCHolder { public static class EntitySheepNPC extends Sheep implements NPCHolder {
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntitySheepNPC(EntityType<? extends Sheep> types, Level level) { public EntitySheepNPC(EntityType<? extends Sheep> types, Level level) {
@ -190,6 +190,13 @@ public class SheepController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -188,6 +189,13 @@ public class ShulkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -182,6 +183,13 @@ public class SilverfishController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class SkeletonController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class SkeletonStrayController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class SkeletonWitherController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -190,6 +191,13 @@ public class SlimeController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -197,6 +198,13 @@ public class SnowmanController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class SpiderController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class SquidController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -175,6 +176,13 @@ public class StriderController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -19,6 +19,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -207,6 +208,13 @@ public class TraderLlamaController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
@ -219,6 +220,13 @@ public class TropicalFishController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -204,6 +205,13 @@ public class TurtleController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -150,6 +152,13 @@ public class VexController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
public static class VexNPC extends CraftVex implements ForwardingNPCHolder { public static class VexNPC extends CraftVex implements ForwardingNPCHolder {

View File

@ -222,6 +222,13 @@ public class VillagerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) { public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) {
if (npc == null) { if (npc == null) {

View File

@ -16,6 +16,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -39,7 +40,6 @@ public class VindicatorController extends MobEntityController {
public static class EntityVindicatorNPC extends Vindicator implements NPCHolder { public static class EntityVindicatorNPC extends Vindicator implements NPCHolder {
boolean calledNMSHeight = false; boolean calledNMSHeight = false;
private final CitizensNPC npc; private final CitizensNPC npc;
public EntityVindicatorNPC(EntityType<? extends Vindicator> types, Level level) { public EntityVindicatorNPC(EntityType<? extends Vindicator> types, Level level) {
@ -191,6 +191,13 @@ public class VindicatorController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -229,6 +229,13 @@ public class WanderingTraderController extends MobEntityController {
this.blockTrades = blocked; this.blockTrades = blocked;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) { public void thunderHit(ServerLevel worldserver, LightningBolt entitylightning) {
if (npc == null) { if (npc == null) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -184,6 +185,13 @@ public class WitchController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -156,6 +158,13 @@ public class WitherController extends MobEntityController {
public boolean save(CompoundTag save) { public boolean save(CompoundTag save) {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
} }
public static class WitherNPC extends CraftWither implements ForwardingNPCHolder { public static class WitherNPC extends CraftWither implements ForwardingNPCHolder {

View File

@ -17,6 +17,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -197,6 +198,13 @@ public class WolfController extends MobEntityController {
return npc == null || this.equals(entityliving) ? super.setTarget(entityliving, reason, fire) : false; return npc == null || this.equals(entityliving) ? super.setTarget(entityliving, reason, fire) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -177,6 +178,13 @@ public class ZoglinController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -175,6 +176,13 @@ public class ZombieController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -175,6 +176,13 @@ public class ZombieHuskController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -175,6 +176,13 @@ public class ZombieVillagerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void travel(Vec3 vec3d) { public void travel(Vec3 vec3d) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -83,6 +85,13 @@ public class AreaEffectCloudController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -99,6 +101,13 @@ public class ArmorStandController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
@ -150,6 +151,13 @@ public class BoatController extends MobEntityController {
return m; return m;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.DragonFireball; import net.minecraft.world.entity.projectile.DragonFireball;
@ -92,6 +94,13 @@ public class DragonFireballController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -98,6 +99,13 @@ public class EggController extends AbstractEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.boss.enderdragon.EndCrystal; import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
@ -83,6 +85,13 @@ public class EnderCrystalController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.ThrownEnderpearl; import net.minecraft.world.entity.projectile.ThrownEnderpearl;
@ -84,6 +86,13 @@ public class EnderPearlController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.EyeOfEnder; import net.minecraft.world.entity.projectile.EyeOfEnder;
@ -84,6 +86,13 @@ public class EnderSignalController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -93,6 +95,13 @@ public class EvokerFangsController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.ExperienceOrb;
@ -77,6 +79,13 @@ public class ExperienceOrbController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -19,6 +19,7 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -118,6 +119,13 @@ public class FallingBlockController extends AbstractEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.entity.projectile.FireworkRocketEntity;
@ -78,6 +80,13 @@ public class FireworkController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -18,6 +18,7 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -97,6 +98,13 @@ public class FishingHookController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.GlowItemFrame; import net.minecraft.world.entity.decoration.GlowItemFrame;
@ -97,6 +98,13 @@ public class GlowItemFrameController extends MobEntityController {
return npc == null || !npc.isProtected() ? super.survives() : true; return npc == null || !npc.isProtected() ? super.survives() : true;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -20,6 +20,7 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -113,6 +114,13 @@ public class ItemController extends AbstractEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -19,6 +19,7 @@ import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.decoration.ItemFrame;
@ -96,6 +97,13 @@ public class ItemFrameController extends MobEntityController {
return npc == null || !npc.isProtected() ? super.survives() : true; return npc == null || !npc.isProtected() ? super.survives() : true;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.projectile.LargeFireball; import net.minecraft.world.entity.projectile.LargeFireball;
@ -86,6 +88,13 @@ public class LargeFireballController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.LeashFenceKnotEntity; import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
@ -83,6 +85,13 @@ public class LeashController extends MobEntityController {
return npc == null || !npc.isProtected() ? super.survives() : true; return npc == null || !npc.isProtected() ? super.survives() : true;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -15,6 +15,7 @@ import net.citizensnpcs.npc.AbstractEntityController;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -95,6 +96,13 @@ public class LlamaSpitController extends AbstractEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -13,7 +13,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Marker; import net.minecraft.world.entity.Marker;
@ -77,6 +79,13 @@ public class MarkerController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
if (npc != null) { if (npc != null) {

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.vehicle.MinecartChest; import net.minecraft.world.entity.vehicle.MinecartChest;
@ -78,6 +80,13 @@ public class MinecartChestController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.vehicle.MinecartCommandBlock; import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
@ -78,6 +80,13 @@ public class MinecartCommandController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

View File

@ -14,7 +14,9 @@ import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util; import net.citizensnpcs.util.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.vehicle.MinecartFurnace; import net.minecraft.world.entity.vehicle.MinecartFurnace;
@ -78,6 +80,13 @@ public class MinecartFurnaceController extends MobEntityController {
return npc == null ? super.save(save) : false; return npc == null ? super.save(save) : false;
} }
@Override
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
if (npc == null)
return super.teleportTo(worldserver, location);
return NMSImpl.teleportAcrossWorld(this, worldserver, location);
}
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();

Some files were not shown because too many files have changed in this diff Show More