mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 11:54:47 +00:00
Added storeAsClone function. Made some fields in Script Entity, NPC, and Player public because of the refactoring.
This commit is contained in:
1 parent
72f2c3c60a
commit
15bfbcdbd1
4 files changed
+15
-2
No files matched your search
@@ -20,7 +20,9 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptEntityParticle;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
@@ -495,4 +497,13 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
public void setNbt(INbt nbt) {
|
||||
this.entity.readFromNBT(nbt.getMCNBT());
|
||||
}
|
||||
|
||||
public void storeAsClone(int tab, String name) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if (!this.entity.writeToNBTOptional(compound)) {
|
||||
throw new CustomNPCsException("Cannot store dead entities", new Object[0]);
|
||||
} else {
|
||||
ServerCloneController.Instance.addClone(compound, name, tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user