mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 02:54:27 +00:00
Animation overhaul, along with animation changes to the API.
This commit is contained in:
1 parent
bda76bafe6
commit
be18e756fc
23 files changed
+648
-1229
No files matched your search
@@ -2,67 +2,169 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class Animation {
|
||||
public class Animation implements IAnimation {
|
||||
|
||||
public ArrayList<Frame> frames = new ArrayList<Frame>();
|
||||
public int currentFrame = 0;
|
||||
public int currentFrameTime = 0;
|
||||
|
||||
public int id = 0;
|
||||
public String name;
|
||||
public float speed = 1.0F;
|
||||
public boolean smooth = false;
|
||||
public byte smooth = 0;
|
||||
public boolean renderTicks = false; // If true, MC ticks are used. If false, render ticks are used.
|
||||
|
||||
public boolean whileStanding = true;
|
||||
public boolean whileAttacking = true;
|
||||
public boolean whileMoving = true;
|
||||
|
||||
public Animation(){}
|
||||
|
||||
public Animation(ArrayList<Frame> parts, String name){
|
||||
this.frames = parts;
|
||||
public Animation(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Animation(ArrayList<Frame> parts, String name, float speed, boolean smooth){
|
||||
this.frames = parts;
|
||||
public Animation(String name, float speed, byte smooth){
|
||||
this.name = name;
|
||||
this.speed = speed;
|
||||
this.smooth = smooth;
|
||||
}
|
||||
|
||||
public ArrayList<Frame> getFrames() {
|
||||
return frames;
|
||||
public IFrame currentFrame() {
|
||||
return currentFrame < frames.size() ? frames.get(currentFrame) : null;
|
||||
}
|
||||
|
||||
public IFrame[] getFrames() {
|
||||
return frames.toArray(new Frame[0]);
|
||||
}
|
||||
|
||||
public IAnimation setFrames(IFrame[] frames) {
|
||||
this.clearFrames();
|
||||
for (IFrame frame : frames) {
|
||||
this.frames.add((Frame) frame);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IAnimation clearFrames() {
|
||||
this.frames.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IAnimation addFrame(IFrame frame) {
|
||||
this.frames.add((Frame) frame);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IAnimation addFrame(int index, IFrame frame) {
|
||||
this.frames.add(index, (Frame) frame);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IAnimation removeFrame(IFrame frame) {
|
||||
this.frames.remove((Frame) frame);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public IAnimation setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public IAnimation setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
return this.speed;
|
||||
}
|
||||
|
||||
public boolean isSmooth() {
|
||||
return smooth;
|
||||
public IAnimation setSmooth(byte smooth) {
|
||||
this.smooth = smooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte isSmooth() {
|
||||
return this.smooth;
|
||||
}
|
||||
|
||||
public IAnimation useRenderTicks(boolean renderTicks) {
|
||||
this.renderTicks = renderTicks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean useRenderTicks() {
|
||||
return this.renderTicks;
|
||||
}
|
||||
|
||||
public IAnimation doWhileStanding(boolean whileStanding) {
|
||||
this.whileStanding = whileStanding;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean doWhileStanding() {
|
||||
return this.whileStanding;
|
||||
}
|
||||
|
||||
public IAnimation doWhileMoving(boolean whileMoving) {
|
||||
this.whileMoving = whileMoving;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean doWhileMoving() {
|
||||
return this.whileMoving;
|
||||
}
|
||||
|
||||
public IAnimation doWhileAttacking(boolean whileAttacking) {
|
||||
this.whileAttacking = whileAttacking;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean doWhileAttacking() {
|
||||
return this.whileAttacking;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
name = compound.getString("Name");
|
||||
id = compound.getInteger("ID");
|
||||
speed = compound.getFloat("Speed");
|
||||
smooth = compound.getBoolean("Smooth");
|
||||
smooth = compound.getByte("Smooth");
|
||||
|
||||
renderTicks = compound.getBoolean("RenderTicks");
|
||||
currentFrame = compound.getInteger("CurrentFrame");
|
||||
|
||||
ArrayList<Frame> frames = new ArrayList<Frame>();
|
||||
NBTTagList list = compound.getTagList("Frames", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
Frame frame = new Frame();
|
||||
frame.parent = this;
|
||||
frame.readFromNBT(item);
|
||||
frames.add(frame);
|
||||
}
|
||||
this.frames = frames;
|
||||
|
||||
this.whileStanding = compound.getBoolean("WhileStanding");
|
||||
this.whileMoving = compound.getBoolean("WhileWalking");
|
||||
this.whileAttacking = compound.getBoolean("WhileAttacking");
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
@@ -70,7 +172,10 @@ public class Animation {
|
||||
compound.setString("Name", name);
|
||||
compound.setInteger("ID", id);
|
||||
compound.setFloat("Speed", speed);
|
||||
compound.setBoolean("Smooth", smooth);
|
||||
compound.setByte("Smooth", smooth);
|
||||
|
||||
compound.setBoolean("RenderTicks", renderTicks);
|
||||
compound.setInteger("CurrentFrame", currentFrame);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Frame frame : frames){
|
||||
@@ -78,7 +183,28 @@ public class Animation {
|
||||
list.appendTag(item);
|
||||
}
|
||||
compound.setTag("Frames", list);
|
||||
|
||||
compound.setBoolean("WhileStanding", whileStanding);
|
||||
compound.setBoolean("WhileWalking", whileMoving);
|
||||
compound.setBoolean("WhileAttacking", whileAttacking);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void increaseTime() {
|
||||
this.currentFrameTime++;
|
||||
if (this.currentFrameTime == this.currentFrame().getDuration()) {
|
||||
Frame prevFrame = (Frame) this.currentFrame();
|
||||
this.currentFrameTime = 0;
|
||||
this.currentFrame++;
|
||||
if (this.currentFrame < this.frames.size()) {
|
||||
Frame nextFrame = this.frames.get(this.currentFrame);
|
||||
for (EnumAnimationPart part : EnumAnimationPart.values()) {
|
||||
if (prevFrame.frameParts.containsKey(part) && nextFrame.frameParts.containsKey(part)) {
|
||||
nextFrame.frameParts.get(part).prevRotations = prevFrame.frameParts.get(part).prevRotations;
|
||||
nextFrame.frameParts.get(part).prevPivots = prevFrame.frameParts.get(part).prevPivots;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,71 +2,101 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
import noppes.npcs.api.handler.data.IFramePart;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class Frame {
|
||||
|
||||
public ArrayList<FramePart> frameParts = new ArrayList<FramePart>();
|
||||
public class Frame implements IFrame {
|
||||
public Animation parent;
|
||||
public HashMap<EnumAnimationPart,FramePart> frameParts = new HashMap<>();
|
||||
public int duration = 0;
|
||||
boolean customized = false;
|
||||
public float speed = 1.0F;
|
||||
public boolean smooth = false;
|
||||
public byte smooth = 0;
|
||||
|
||||
public Frame(){}
|
||||
|
||||
public Frame(ArrayList<FramePart> parts, int duration){
|
||||
this.frameParts = parts;
|
||||
public Frame(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Frame(ArrayList<FramePart> parts, int duration, float speed, boolean smooth){
|
||||
this.frameParts = parts;
|
||||
public Frame(int duration, float speed, byte smooth) {
|
||||
this.duration = duration;
|
||||
this.speed = speed;
|
||||
this.smooth = smooth;
|
||||
this.customized = true;
|
||||
}
|
||||
|
||||
public ArrayList<FramePart> getFrameParts() {
|
||||
public HashMap<EnumAnimationPart,FramePart> getFrameMap() {
|
||||
return frameParts;
|
||||
}
|
||||
|
||||
public void setFrameParts(ArrayList<FramePart> frameParts) {
|
||||
this.frameParts = frameParts;
|
||||
public IFramePart[] getParts() {
|
||||
return frameParts.values().toArray(new IFramePart[0]);
|
||||
}
|
||||
|
||||
public IFrame addPart(IFramePart partConfig) {
|
||||
this.frameParts.put(((FramePart)partConfig).getPart(),(FramePart) partConfig);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame removePart(String partName) {
|
||||
try {
|
||||
this.frameParts.remove(EnumAnimationPart.valueOf(partName));
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame removePart(int partId) {
|
||||
for (EnumAnimationPart part : EnumAnimationPart.values()) {
|
||||
this.frameParts.remove(part);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFrame clearParts() {
|
||||
frameParts.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
public IFrame setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCustomized() {
|
||||
return customized;
|
||||
}
|
||||
|
||||
public void setCustomized(boolean customized) {
|
||||
public IFrame setCustomized(boolean customized) {
|
||||
this.customized = customized;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
public IFrame setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSmooth() {
|
||||
public byte smoothType() {
|
||||
return smooth;
|
||||
}
|
||||
|
||||
public void setSmooth(boolean smooth) {
|
||||
public IFrame setSmooth(byte smooth) {
|
||||
this.smooth = smooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
@@ -79,16 +109,25 @@ public class Frame {
|
||||
}
|
||||
if(compound.hasKey("Smooth")){
|
||||
customized = true;
|
||||
smooth = compound.getBoolean("Smooth");
|
||||
smooth = compound.getByte("Smooth");
|
||||
}
|
||||
|
||||
ArrayList<FramePart> frameParts = new ArrayList<FramePart>();
|
||||
if (!customized) {
|
||||
this.speed = parent.speed;
|
||||
this.smooth = parent.smooth;
|
||||
}
|
||||
|
||||
HashMap<EnumAnimationPart,FramePart> frameParts = new HashMap<>();
|
||||
NBTTagList list = compound.getTagList("FrameParts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
FramePart framePart = new FramePart();
|
||||
framePart.readFromNBT(item);
|
||||
frameParts.add(framePart);
|
||||
if (!framePart.customized) {
|
||||
framePart.smooth = this.smooth;
|
||||
framePart.speed = this.speed;
|
||||
}
|
||||
frameParts.put(framePart.part,framePart);
|
||||
}
|
||||
this.frameParts = frameParts;
|
||||
}
|
||||
@@ -98,11 +137,11 @@ public class Frame {
|
||||
compound.setInteger("Duration", duration);
|
||||
if(customized){
|
||||
compound.setFloat("Speed", speed);
|
||||
compound.setBoolean("Smooth", smooth);
|
||||
compound.setByte("Smooth", smooth);
|
||||
}
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(FramePart framePart : frameParts){
|
||||
for(FramePart framePart : frameParts.values()){
|
||||
NBTTagCompound item = framePart.writeToNBT();
|
||||
list.appendTag(item);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IFramePart;
|
||||
import noppes.npcs.client.ClientEventHandler;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
|
||||
public class FramePart {
|
||||
public class FramePart implements IFramePart {
|
||||
|
||||
public EnumAnimationPart part;
|
||||
public int[] rotation = {0, 0, 0};
|
||||
@@ -12,7 +16,14 @@ public class FramePart {
|
||||
boolean customized = false;
|
||||
|
||||
public float speed = 1.0F;
|
||||
public boolean smooth = false;
|
||||
//0 - Interpolated, 1 - Linear, 2 - None
|
||||
public byte smooth = 0;
|
||||
|
||||
//Client-sided fields (unsaved)
|
||||
public float[] prevRotations = {0,0,0};
|
||||
public float[] prevPivots = {0,0,0};
|
||||
public float partialRotationTick;
|
||||
public float partialPivotTick;
|
||||
|
||||
public FramePart(){}
|
||||
|
||||
@@ -20,67 +31,82 @@ public class FramePart {
|
||||
this.part = part;
|
||||
}
|
||||
|
||||
public FramePart(EnumAnimationPart part, int[] rotation, int[] pivot){
|
||||
this.part = part;
|
||||
this.rotation = rotation;
|
||||
this.pivot = pivot;
|
||||
}
|
||||
|
||||
public FramePart(EnumAnimationPart part, int[] rotation, int[] pivot, float speed, boolean smooth){
|
||||
this.part = part;
|
||||
this.rotation = rotation;
|
||||
this.pivot = pivot;
|
||||
this.speed = speed;
|
||||
this.smooth = smooth;
|
||||
this.customized = true;
|
||||
}
|
||||
|
||||
public EnumAnimationPart getPart() {
|
||||
return part;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return part.name();
|
||||
}
|
||||
|
||||
public int getPartId() {
|
||||
return part.id;
|
||||
}
|
||||
|
||||
public void setPart(EnumAnimationPart part) {
|
||||
this.part = part;
|
||||
}
|
||||
|
||||
public int[] getRotation() {
|
||||
public IFramePart setPart(String name) {
|
||||
try {
|
||||
this.setPart(EnumAnimationPart.valueOf(name));
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IFramePart setPart(int partId) {
|
||||
for (EnumAnimationPart enumPart : EnumAnimationPart.values()) {
|
||||
if (enumPart.id == partId) {
|
||||
this.setPart(enumPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public int[] getRotations() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(int[] rotation) {
|
||||
public IFramePart setRotations(int[] rotation) {
|
||||
this.rotation = rotation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int[] getPivot() {
|
||||
public int[] getPivots() {
|
||||
return pivot;
|
||||
}
|
||||
|
||||
public void setPivot(int[] pivot) {
|
||||
public IFramePart setPivots(int[] pivot) {
|
||||
this.pivot = pivot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isCustomized() {
|
||||
return customized;
|
||||
}
|
||||
|
||||
public void setCustomized(boolean customized) {
|
||||
public IFramePart setCustomized(boolean customized) {
|
||||
this.customized = customized;
|
||||
return this;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
public IFramePart setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSmooth() {
|
||||
public byte isSmooth() {
|
||||
return smooth;
|
||||
}
|
||||
|
||||
public void setSmooth(boolean smooth) {
|
||||
public IFramePart setSmooth(byte smooth) {
|
||||
this.smooth = smooth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
@@ -95,7 +121,7 @@ public class FramePart {
|
||||
}
|
||||
if(compound.hasKey("Smooth")){
|
||||
customized = true;
|
||||
smooth = compound.getBoolean("Smooth");
|
||||
smooth = compound.getByte("Smooth");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,9 +133,68 @@ public class FramePart {
|
||||
|
||||
if(customized){
|
||||
compound.setFloat("Speed", speed);
|
||||
compound.setBoolean("Smooth", smooth);
|
||||
compound.setByte("Smooth", smooth);
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void interpolateAngles() {
|
||||
float pi = (float) Math.PI / 180;
|
||||
if (this.smooth == 2) {
|
||||
this.prevRotations[0] = this.rotation[0] * pi;
|
||||
this.prevRotations[1] = this.rotation[1] * pi;
|
||||
this.prevRotations[2] = this.rotation[2] * pi;
|
||||
} else if (this.partialRotationTick != ClientEventHandler.partialRenderTick) {
|
||||
this.partialRotationTick = ClientEventHandler.partialRenderTick;
|
||||
if (this.smooth == 0) {
|
||||
this.prevRotations[0] = (this.rotation[0] * pi - this.prevRotations[0]) * Math.abs(this.speed) / 10f + this.prevRotations[0];
|
||||
this.prevRotations[1] = (this.rotation[1] * pi - this.prevRotations[1]) * Math.abs(this.speed) / 10f + this.prevRotations[1];
|
||||
this.prevRotations[2] = (this.rotation[2] * pi - this.prevRotations[2]) * Math.abs(this.speed) / 10f + this.prevRotations[2];
|
||||
} else {
|
||||
int directionX = Float.compare(this.rotation[0] * pi, this.prevRotations[0]);
|
||||
this.prevRotations[0] += directionX * this.speed / 10f;
|
||||
this.prevRotations[0] = directionX == 1 ?
|
||||
Math.min(this.rotation[0] * pi, this.prevRotations[0]) : Math.max(this.rotation[0] * pi, this.prevRotations[0]);
|
||||
int directionY = Float.compare(this.rotation[1] * pi, this.prevRotations[1]);
|
||||
this.prevRotations[1] += directionY * this.speed / 10f;
|
||||
this.prevRotations[1] = directionY == 1 ?
|
||||
Math.min(this.rotation[1] * pi, this.prevRotations[1]) : Math.max(this.rotation[1] * pi, this.prevRotations[1]);
|
||||
int directionZ = Float.compare(this.rotation[2] * pi, this.prevRotations[2]);
|
||||
this.prevRotations[2] += directionZ * this.speed / 10f;
|
||||
this.prevRotations[2] = directionZ == 1 ?
|
||||
Math.min(this.rotation[2] * pi, this.prevRotations[2]) : Math.max(this.rotation[2] * pi, this.prevRotations[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void interpolateOffset() {
|
||||
if (this.smooth == 2) {
|
||||
this.prevPivots[0] = this.pivot[0];
|
||||
this.prevPivots[1] = this.pivot[1];
|
||||
this.prevPivots[2] = this.pivot[2];
|
||||
} else if (this.partialPivotTick != ClientEventHandler.partialRenderTick) {
|
||||
this.partialPivotTick = ClientEventHandler.partialRenderTick;
|
||||
if (this.smooth == 0) {
|
||||
this.prevPivots[0] = (this.pivot[0] - this.prevPivots[0]) * Math.abs(this.speed) / 10f + this.prevPivots[0];
|
||||
this.prevPivots[1] = (this.pivot[1] - this.prevPivots[1]) * Math.abs(this.speed) / 10f + this.prevPivots[1];
|
||||
this.prevPivots[2] = (this.pivot[2] - this.prevPivots[2]) * Math.abs(this.speed) / 10f + this.prevPivots[2];
|
||||
} else {
|
||||
int directionX = Float.compare(this.pivot[0], this.prevPivots[0]);
|
||||
this.prevPivots[0] += directionX * this.speed / 10f;
|
||||
this.prevPivots[0] = directionX == 1 ?
|
||||
Math.min(this.pivot[0],this.prevPivots[0]) : Math.max(this.pivot[0],this.prevPivots[0]);
|
||||
int directionY = Float.compare(this.pivot[1], this.prevPivots[1]);
|
||||
this.prevPivots[1] += directionY * this.speed / 10f;
|
||||
this.prevPivots[1] = directionY == 1 ?
|
||||
Math.min(this.pivot[1],this.prevPivots[1]) : Math.max(this.pivot[1],this.prevPivots[1]);
|
||||
int directionZ = Float.compare(this.pivot[2], this.prevPivots[2]);
|
||||
this.prevPivots[2] += directionZ * this.speed / 10f;
|
||||
this.prevPivots[2] = directionZ == 1 ?
|
||||
Math.min(this.pivot[2],this.prevPivots[2]) : Math.max(this.pivot[2],this.prevPivots[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import noppes.npcs.AnimationDataShared;
|
||||
import noppes.npcs.AnimationData;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
@@ -32,7 +32,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public PlayerFactionData factionData = new PlayerFactionData(this);
|
||||
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(this);
|
||||
public PlayerMailData mailData = new PlayerMailData(this);
|
||||
public AnimationDataShared modelData = new AnimationDataShared(this);
|
||||
public AnimationData animationData = new AnimationData(this);
|
||||
|
||||
public DataTimers timers = new DataTimers(this);
|
||||
public DataSkinOverlays skinOverlays = new DataSkinOverlays(this);
|
||||
@@ -82,7 +82,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
mailData.loadNBTData(data);
|
||||
timers.readFromNBT(data);
|
||||
skinOverlays.readFromNBT(data);
|
||||
modelData.readFromNBT(data);
|
||||
animationData.readFromNBT(data);
|
||||
|
||||
if(player != null){
|
||||
playername = player.getCommandSenderName();
|
||||
@@ -120,7 +120,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
mailData.saveNBTData(compound);
|
||||
timers.writeToNBT(compound);
|
||||
skinOverlays.writeToNBT(compound);
|
||||
modelData.writeToNBT(compound);
|
||||
animationData.writeToNBT(compound);
|
||||
|
||||
compound.setString("PlayerName", playername);
|
||||
compound.setString("UUID", uuid);
|
||||
@@ -302,10 +302,6 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
return mailData;
|
||||
}
|
||||
|
||||
public IPlayerModelData getModelData() {
|
||||
return modelData;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
PlayerDataController.instance.savePlayerData(this);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user