mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 21:05:06 +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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import noppes.npcs.scripted.roles.ScriptRoleTransporter;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> implements ICustomNpc {
|
||||
protected EntityCustomNpc npc;
|
||||
public EntityCustomNpc npc;
|
||||
|
||||
public ScriptNpc(T npc){
|
||||
super(npc);
|
||||
|
||||
@@ -29,7 +29,7 @@ import noppes.npcs.scripted.interfaces.IPlayer;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
|
||||
protected T player;
|
||||
public T player;
|
||||
public ScriptPlayer(T player){
|
||||
super(player);
|
||||
this.player = player;
|
||||
|
||||
@@ -300,4 +300,6 @@ public interface IEntity<T extends Entity> {
|
||||
* @return Returns minecrafts entity
|
||||
*/
|
||||
public T getMCEntity();
|
||||
|
||||
void storeAsClone(int tab, String name);
|
||||
}
|
||||
Reference in new issue
Block a user