mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 02:37:27 +00:00
IEntity:
-Added setDimension function for all entities (not just players now).
This commit is contained in:
1 parent
fb09c8c39e
commit
daada3cb8a
1 file changed
+19
@@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.IParticle;
|
||||
@@ -423,6 +424,24 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
return entity.dimension;
|
||||
}
|
||||
|
||||
public void setDimension(int dimensionId) {
|
||||
IWorld world = NpcAPI.Instance().getIWorld(dimensionId);
|
||||
if (world != null) {
|
||||
World mcWorld = world.getMCWorld();
|
||||
if (this.entity.riddenByEntity != null)
|
||||
{
|
||||
this.entity.riddenByEntity.mountEntity((Entity)null);
|
||||
}
|
||||
if (this.entity.ridingEntity != null)
|
||||
{
|
||||
this.entity.mountEntity((Entity)null);
|
||||
}
|
||||
this.entity.worldObj = mcWorld;
|
||||
this.entity.dimension = dimensionId;
|
||||
mcWorld.addLoadedEntities(new ArrayList<Entity>(Collections.singleton(this.entity)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param range The search range for entities around this entity
|
||||
* @return Array of entities within range
|
||||
|
||||
Reference in new issue
Block a user