More Core Class Conversion

This commit is contained in:
Kam committed 2026-03-13 16:59:00 -04:00
1 parent 27a9e4c808
commit 79b63efa19
36 files changed
+420 -102

No files matched your search

@@ -1,6 +1,7 @@
package kamkeel.npcs.controllers.data.profile;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class ProfileInfoEntry {
private String label;
@@ -26,8 +27,8 @@ public class ProfileInfoEntry {
this(label, 0xFFFFFF, result, 0xFFFFFF);
}
public NBTTagCompound writeToNBT() {
NBTTagCompound tag = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound tag = NBT.compound();
tag.setString("Label", label);
tag.setInteger("LabelColor", labelColor);
tag.setString("Result", result);
@@ -35,7 +36,7 @@ public class ProfileInfoEntry {
return tag;
}
public static ProfileInfoEntry readFromNBT(NBTTagCompound tag) {
public static ProfileInfoEntry readFromNBT(INBTCompound tag) {
return new ProfileInfoEntry(
tag.getString("Label"),
tag.getInteger("LabelColor"),
@@ -1,17 +1,20 @@
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 noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import java.util.HashMap;
import java.util.Map;
public class Frame implements IFrame {
public Animation parent;
public float parentSpeed = 1.0f;
public byte parentSmooth = 0;
public HashMap<EnumAnimationPart, FramePart> frameParts = new HashMap<>();
public int duration = 0;
@@ -121,7 +124,7 @@ public class Frame implements IFrame {
this.comment = comment;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
duration = compound.getInteger("Duration");
if (compound.hasKey("ColorMarker")) {
this.setColorMarker(compound.getInteger("ColorMarker"));
@@ -140,15 +143,15 @@ public class Frame implements IFrame {
smooth = compound.getByte("Smooth");
}
if (!customized && parent != null) {
this.speed = parent.speed;
this.smooth = parent.smooth;
if (!customized) {
this.speed = parentSpeed;
this.smooth = parentSmooth;
}
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);
INBTList list = compound.getList("FrameParts", 10);
for (int i = 0; i < list.size(); i++) {
INBTCompound item = list.getCompound(i);
FramePart framePart = new FramePart();
framePart.readFromNBT(item);
if (!framePart.customized) {
@@ -160,8 +163,8 @@ public class Frame implements IFrame {
this.frameParts = frameParts;
}
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound compound = NBT.compound();
compound.setInteger("Duration", duration);
compound.setInteger("ColorMarker", this.colorMarker);
compound.setString("Comment", this.comment);
@@ -171,12 +174,12 @@ public class Frame implements IFrame {
compound.setByte("Smooth", smooth);
}
NBTTagList list = new NBTTagList();
INBTList list = NBT.list();
for (FramePart framePart : frameParts.values()) {
NBTTagCompound item = framePart.writeToNBT();
list.appendTag(item);
INBTCompound item = framePart.writeToNBT();
list.addCompound(item);
}
compound.setTag("FrameParts", list);
compound.setList("FrameParts", list);
return compound;
}
@@ -186,7 +189,8 @@ public class Frame implements IFrame {
for (Map.Entry<EnumAnimationPart, FramePart> entry : frameParts.entrySet()) {
frame.frameParts.put(entry.getKey(), entry.getValue().copy());
}
frame.parent = this.parent;
frame.parentSpeed = this.parentSpeed;
frame.parentSmooth = this.parentSmooth;
frame.duration = this.duration;
frame.customized = this.customized;
frame.speed = this.speed;
@@ -1,14 +1,14 @@
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;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class FramePart implements IFramePart {
public Animation parent;
public boolean paused = false;
public static float renderPartialTick = 0;
public EnumAnimationPart part;
public float[] rotation = {0, 0, 0};
public float[] pivot = {0, 0, 0};
@@ -111,7 +111,7 @@ public class FramePart implements IFramePart {
return this;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
part = EnumAnimationPart.valueOf(compound.getString("Part"));
for (int i = 0; i < 3; i++) {
rotation[i] = compound.getFloat("Rotation" + i);
@@ -131,8 +131,8 @@ public class FramePart implements IFramePart {
}
}
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound compound = NBT.compound();
compound.setString("Part", part.toString());
for (int i = 0; i < 3; i++) {
compound.setFloat("Rotation" + i, rotation[i]);
@@ -159,9 +159,8 @@ public class FramePart implements IFramePart {
return part;
}
@SideOnly(Side.CLIENT)
public void interpolateAngles() {
if (parent != null && parent.paused)
if (paused)
return;
float pi = (float) Math.PI / 180;
@@ -169,8 +168,8 @@ public class FramePart implements IFramePart {
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;
} else if (this.partialRotationTick != FramePart.renderPartialTick) {
this.partialRotationTick = FramePart.renderPartialTick;
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];
@@ -192,17 +191,16 @@ public class FramePart implements IFramePart {
}
}
@SideOnly(Side.CLIENT)
public void interpolateOffset() {
if (parent != null && parent.paused)
if (paused)
return;
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;
} else if (this.partialPivotTick != FramePart.renderPartialTick) {
this.partialPivotTick = FramePart.renderPartialTick;
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];
@@ -224,10 +222,9 @@ public class FramePart implements IFramePart {
}
}
@SideOnly(Side.CLIENT)
public void jumpToCurrentFrame() {
this.partialRotationTick = ClientEventHandler.partialRenderTick;
this.partialPivotTick = ClientEventHandler.partialRenderTick;
this.partialRotationTick = FramePart.renderPartialTick;
this.partialPivotTick = FramePart.renderPartialTick;
this.prevPivots[0] = this.pivot[0];
this.prevPivots[1] = this.pivot[1];
@@ -1,44 +1,43 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.api.handler.IPlayerDialogData;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import java.util.HashSet;
public class PlayerDialogData implements IPlayerDialogData {
private final PlayerData parent;
public HashSet<Integer> dialogsRead = new HashSet<Integer>();
public PlayerDialogData(PlayerData parent) {
this.parent = parent;
public PlayerDialogData() {
}
public void loadNBTData(NBTTagCompound compound) {
public void loadNBTData(INBTCompound compound) {
HashSet<Integer> dialogsRead = new HashSet<Integer>();
if (compound == null)
return;
NBTTagList list = compound.getTagList("DialogData", 10);
INBTList list = compound.getList("DialogData", 10);
if (list == null) {
return;
}
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
for (int i = 0; i < list.size(); i++) {
INBTCompound nbttagcompound = list.getCompound(i);
dialogsRead.add(nbttagcompound.getInteger("Dialog"));
}
this.dialogsRead = dialogsRead;
}
public void saveNBTData(NBTTagCompound compound) {
NBTTagList list = new NBTTagList();
public void saveNBTData(INBTCompound compound) {
INBTList list = NBT.list();
for (int dia : dialogsRead) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
INBTCompound nbttagcompound = NBT.compound();
nbttagcompound.setInteger("Dialog", dia);
list.appendTag(nbttagcompound);
list.addCompound(nbttagcompound);
}
compound.setTag("DialogData", list);
compound.setList("DialogData", list);
}
public boolean hasReadDialog(int id) {
@@ -1,47 +1,44 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.api.handler.IPlayerTransportData;
import noppes.npcs.api.handler.data.ITransportLocation;
import noppes.npcs.controllers.TransportController;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import java.util.ArrayList;
import java.util.HashSet;
public class PlayerTransportData implements IPlayerTransportData {
private final PlayerData parent;
public HashSet<Integer> transports = new HashSet<Integer>();
public PlayerTransportData(PlayerData parent) {
this.parent = parent;
public PlayerTransportData() {
}
public void loadNBTData(NBTTagCompound compound) {
public void loadNBTData(INBTCompound compound) {
HashSet<Integer> dialogsRead = new HashSet<Integer>();
if (compound == null)
return;
NBTTagList list = compound.getTagList("TransportData", 10);
INBTList list = compound.getList("TransportData", 10);
if (list == null) {
return;
}
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
for (int i = 0; i < list.size(); i++) {
INBTCompound nbttagcompound = list.getCompound(i);
dialogsRead.add(nbttagcompound.getInteger("Transport"));
}
this.transports = dialogsRead;
}
public void saveNBTData(NBTTagCompound compound) {
NBTTagList list = new NBTTagList();
public void saveNBTData(INBTCompound compound) {
INBTList list = NBT.list();
for (int dia : transports) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
INBTCompound nbttagcompound = NBT.compound();
nbttagcompound.setInteger("Transport", dia);
list.appendTag(nbttagcompound);
list.addCompound(nbttagcompound);
}
compound.setTag("TransportData", list);
compound.setList("TransportData", list);
}
public boolean hasTransport(int id) {
@@ -57,17 +54,11 @@ public class PlayerTransportData implements IPlayerTransportData {
}
public ITransportLocation getTransport(int id) {
return TransportController.getInstance().getTransport(id);
return null; // Resolved in version-specific code
}
public ITransportLocation[] getTransports() {
ArrayList<ITransportLocation> list = new ArrayList<>();
for (int id : transports) {
ITransportLocation location = TransportController.getInstance().getTransport(id);
list.add(location);
}
return list.toArray(new ITransportLocation[0]);
return new ITransportLocation[0]; // Resolved in version-specific code
}
public void removeTransport(int id) {
@@ -0,0 +1,29 @@
package noppes.npcs.api.handler;
/**
* Tracks which dialogs a player has read.
*/
public interface IPlayerDialogData {
/**
* Checks if the player has read the dialog with the given ID.
*
* @param id the dialog ID.
* @return true if the dialog has been read; false otherwise.
*/
boolean hasReadDialog(int id);
/**
* Marks the dialog with the given ID as read.
*
* @param id the dialog ID.
*/
void readDialog(int id);
/**
* Marks the dialog with the given ID as unread.
*
* @param id the dialog ID.
*/
void unreadDialog(int id);
}
@@ -0,0 +1,51 @@
package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.ITransportLocation;
/**
* Tracks which transport locations a player has unlocked.
*/
public interface IPlayerTransportData {
/**
* @param id the transport location ID.
* @return true if the player has unlocked this transport.
*/
boolean hasTransport(int id);
/**
* Unlocks a transport location by ID.
*
* @param id the transport location ID.
*/
void addTransport(int id);
/**
* Unlocks the given transport location.
*
* @param location the transport location.
*/
void addTransport(ITransportLocation location);
/**
* Returns the transport location with the given ID.
*
* @param id the transport location ID.
* @return the transport location, or null if not found.
*/
ITransportLocation getTransport(int id);
/**
* Returns all unlocked transport locations for the player.
*
* @return an array of transport locations.
*/
ITransportLocation[] getTransports();
/**
* Removes an unlocked transport location by ID.
*
* @param id the transport location ID.
*/
void removeTransport(int id);
}
@@ -0,0 +1,39 @@
package noppes.npcs.api.handler.data;
/**
* Defines the blueprint for an attribute.
* <p>
* An attribute definition contains identifying information such as a unique key,
* a human-readable display name, a translation key for localization, and a color code.
* </p>
*/
public interface IAttributeDefinition {
/**
* Returns the unique key that identifies this attribute.
*
* @return a String representing the attribute key
*/
String getKey();
/**
* Returns the human-readable display name for this attribute.
*
* @return a String representing the display name
*/
String getDisplayName();
/**
* Returns the translation key used for localizing this attribute.
*
* @return a String representing the translation key
*/
String getTranslationKey();
/**
* Returns the color code associated with this attribute.
*
* @return a char representing the color code
*/
char getColorCode();
}
@@ -0,0 +1,25 @@
package noppes.npcs.api.handler.data;
/**
* Represents an instance of a custom attribute.
* <p>
* A custom attribute instance encapsulates an {@link IAttributeDefinition}
* along with its current calculated value (which may be affected by modifiers).
* </p>
*/
public interface ICustomAttribute {
/**
* Returns the attribute definition associated with this custom attribute.
*
* @return the {@link IAttributeDefinition} instance defining this attribute
*/
IAttributeDefinition getAttribute();
/**
* Returns the current value of this attribute.
*
* @return the float value representing the attribute's current state
*/
float getValue();
}
@@ -0,0 +1,84 @@
package noppes.npcs.api.handler.data;
public interface IFrame {
/**
* @return An array of all frame parts in this frame
*/
IFramePart[] getParts();
/**
* Adds a frame part to this frame.
* @param partConfig The frame part to add
* @return This frame for chaining
*/
IFrame addPart(IFramePart partConfig);
/**
* Removes a frame part by its name.
* @param partName The animation part name (e.g. HEAD, BODY, RIGHT_ARM, LEFT_ARM, RIGHT_LEG, LEFT_LEG, FULL_MODEL)
* @return This frame for chaining
*/
IFrame removePart(String partName);
/**
* Removes a frame part by its ordinal ID.
* @param partId The animation part ordinal ID
* @return This frame for chaining
*/
IFrame removePart(int partId);
/**
* Removes all frame parts from this frame.
* @return This frame for chaining
*/
IFrame clearParts();
/**
* @return The duration of this frame in ticks
*/
int getDuration();
/**
* Sets the duration of this frame.
* @param duration The duration in ticks
* @return This frame for chaining
*/
IFrame setDuration(int duration);
/**
* @return Whether this frame has custom speed and smooth settings that override the parent animation
*/
boolean isCustomized();
/**
* Sets whether this frame uses custom speed and smooth settings.
* @param customized True to use frame-level settings instead of the parent animation's
* @return This frame for chaining
*/
IFrame setCustomized(boolean customized);
/**
* @return The interpolation speed of this frame
*/
float getSpeed();
/**
* Sets the interpolation speed of this frame.
* @param speed The speed value
* @return This frame for chaining
*/
IFrame setSpeed(float speed);
/**
* @return The smooth interpolation type: 0 = Interpolated, 1 = Linear, 2 = None
*/
byte smoothType();
/**
* Sets the smooth interpolation type.
* @param smooth The smooth type: 0 = Interpolated, 1 = Linear, 2 = None
* @return This frame for chaining
*/
IFrame setSmooth(byte smooth);
}
@@ -0,0 +1,88 @@
package noppes.npcs.api.handler.data;
public interface IFramePart {
/**
* @return The name of the animation part (e.g. HEAD, BODY, RIGHT_ARM, LEFT_ARM, RIGHT_LEG, LEFT_LEG, FULL_MODEL)
*/
String getName();
/**
* @return The ordinal ID of the animation part
*/
int getPartId();
/**
* Sets the animation part by name.
* @param name The part name (e.g. HEAD, BODY, RIGHT_ARM, LEFT_ARM, RIGHT_LEG, LEFT_LEG, FULL_MODEL)
* @return This frame part for chaining
*/
IFramePart setPart(String name);
/**
* Sets the animation part by ordinal ID.
* @param partId The part ordinal ID
* @return This frame part for chaining
*/
IFramePart setPart(int partId);
/**
* @return The rotation angles as a float array [x, y, z] in degrees
*/
float[] getRotations();
/**
* Sets the rotation angles.
* @param rotation A float array [x, y, z] in degrees
* @return This frame part for chaining
*/
IFramePart setRotations(float[] rotation);
/**
* @return The pivot offsets as a float array [x, y, z]
*/
float[] getPivots();
/**
* Sets the pivot offsets.
* @param pivot A float array [x, y, z]
* @return This frame part for chaining
*/
IFramePart setPivots(float[] pivot);
/**
* @return Whether this part has custom speed and smooth settings that override the parent frame
*/
boolean isCustomized();
/**
* Sets whether this part uses custom speed and smooth settings.
* @param customized True to use part-level settings instead of the parent frame's
* @return This frame part for chaining
*/
IFramePart setCustomized(boolean customized);
/**
* @return The interpolation speed of this part
*/
float getSpeed();
/**
* Sets the interpolation speed of this part.
* @param speed The speed value
* @return This frame part for chaining
*/
IFramePart setSpeed(float speed);
/**
* @return The smooth interpolation type: 0 = Interpolated, 1 = Linear, 2 = None
*/
byte isSmooth();
/**
* Sets the smooth interpolation type.
* @param smooth The smooth type: 0 = Interpolated, 1 = Linear, 2 = None
* @return This frame part for chaining
*/
IFramePart setSmooth(byte smooth);
}
@@ -7,6 +7,7 @@ import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.profile.Profile;
import kamkeel.npcs.controllers.data.profile.ProfileInfoEntry;
import kamkeel.npcs.network.AbstractPacket;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import kamkeel.npcs.network.PacketChannel;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.enums.EnumPlayerPacket;
@@ -72,7 +73,7 @@ public final class ProfileGetInfoPacket extends AbstractPacket {
slotCompound.setInteger("ID", slot.getId());
List<ProfileInfoEntry> profileInfo = ProfileController.Instance.getProfileInfo(player, slot.getId());
for (ProfileInfoEntry profileInfoEntry : profileInfo) {
infoList.appendTag(profileInfoEntry.writeToNBT());
infoList.appendTag(((MC1710NBTCompound) profileInfoEntry.writeToNBT()).getMCTag());
}
slotCompound.setTag("INFO", infoList);
slotList.appendTag(slotCompound);
@@ -98,7 +99,7 @@ public final class ProfileGetInfoPacket extends AbstractPacket {
List<ProfileInfoEntry> infoEntries = new ArrayList<>();
for (int j = 0; j < infoList.tagCount(); j++) {
NBTTagCompound infoTag = infoList.getCompoundTagAt(j);
infoEntries.add(ProfileInfoEntry.readFromNBT(infoTag)); // Convert back to InfoEntry
infoEntries.add(ProfileInfoEntry.readFromNBT(new MC1710NBTCompound(infoTag))); // Convert back to InfoEntry
}
slotInfoMap.put(slotId, infoEntries);
@@ -165,6 +165,7 @@ public class ClientEventHandler {
}
ClientEventHandler.renderer = event.renderer;
ClientEventHandler.partialRenderTick = Minecraft.getMinecraft().timer.renderPartialTicks;
FramePart.renderPartialTick = ClientEventHandler.partialRenderTick;
this.setOriginalPlayerParts(event.entity);
}
@@ -195,7 +195,8 @@ public class GuiAnimationDirectory extends GuiDirectoryCategorized {
data.animation.loop = 0;
if (!animation.frames.isEmpty()) {
Frame firstFrame = new Frame();
firstFrame.parent = data.animation;
firstFrame.parentSpeed = data.animation.speed;
firstFrame.parentSmooth = data.animation.smooth;
firstFrame.readFromNBT(animation.frames.get(0).writeToNBT());
data.animation.addFrame(firstFrame);
}
@@ -113,14 +113,15 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
for (Frame frame : animation.frames) {
frame.parent = animation;
frame.parentSpeed = animation.speed;
frame.parentSmooth = animation.smooth;
if (!frame.isCustomized()) {
frame.speed = animation.speed;
frame.smooth = animation.smooth;
}
for (Map.Entry<EnumAnimationPart, FramePart> entry : frame.frameParts.entrySet()) {
FramePart part = entry.getValue();
part.parent = animation;
part.paused = animation.paused;
if (!part.isCustomized()) {
part.speed = frame.speed;
part.smooth = frame.smooth;
@@ -675,7 +676,8 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
case 47:
if (copiedFrame != null) {
Frame frame = new Frame(10);
frame.parent = this.animation;
frame.parentSpeed = this.animation.speed;
frame.parentSmooth = this.animation.smooth;
frame.readFromNBT(copiedFrame.writeToNBT());
this.addFrame(frame);
this.initGui();
@@ -116,7 +116,8 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
if (this.animation.frames.size() > 0) {
Frame firstFrame = new Frame();
firstFrame.parent = data.animation;
firstFrame.parentSpeed = data.animation.speed;
firstFrame.parentSmooth = data.animation.smooth;
firstFrame.readFromNBT(this.animation.frames.get(0).writeToNBT());
data.animation.addFrame(firstFrame);
}
@@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.EventHooks;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.api.handler.data.IAnimation;
import noppes.npcs.api.handler.data.IAnimationData;
import noppes.npcs.api.handler.data.IFrame;
@@ -223,8 +224,9 @@ public class Animation implements IAnimation {
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound item = list.getCompoundTagAt(i);
Frame frame = new Frame();
frame.parent = this;
frame.readFromNBT(item);
frame.parentSpeed = this.speed;
frame.parentSmooth = this.smooth;
frame.readFromNBT(new MC1710NBTCompound(item));
frames.add(frame);
}
this.frames = frames;
@@ -247,7 +249,7 @@ public class Animation implements IAnimation {
NBTTagList list = new NBTTagList();
for (Frame frame : frames) {
NBTTagCompound item = frame.writeToNBT();
NBTTagCompound item = ((MC1710NBTCompound) frame.writeToNBT()).getMCTag();
list.appendTag(item);
}
compound.setTag("Frames", list);
@@ -2,6 +2,7 @@ package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.handler.data.IAnimation;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
/**
* A read-only animation loaded from mod assets.
@@ -78,8 +79,9 @@ public class BuiltInAnimation extends Animation {
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound item = list.getCompoundTagAt(i);
Frame frame = new Frame();
frame.parent = this;
frame.readFromNBT(item);
frame.parentSpeed = this.speed;
frame.parentSmooth = this.smooth;
frame.readFromNBT(new MC1710NBTCompound(item));
frames.add(frame);
}
@@ -49,10 +49,10 @@ import java.util.HashSet;
import java.util.UUID;
public class PlayerData implements IExtendedEntityProperties, IPlayerData {
public PlayerDialogData dialogData = new PlayerDialogData(this);
public PlayerDialogData dialogData = new PlayerDialogData();
public PlayerBankData bankData = new PlayerBankData(this);
public PlayerQuestData questData = new PlayerQuestData(this);
public PlayerTransportData transportData = new PlayerTransportData(this);
public PlayerTransportData transportData = new PlayerTransportData();
public PlayerFactionData factionData = new PlayerFactionData(this);
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(this);
public PlayerMailData mailData = new PlayerMailData(this);
@@ -141,10 +141,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
}
public void setNBT(NBTTagCompound data) {
dialogData.loadNBTData(data);
dialogData.loadNBTData(new MC1710NBTCompound(data));
bankData.loadNBTData(data);
questData.loadNBTData(data);
transportData.loadNBTData(data);
transportData.loadNBTData(new MC1710NBTCompound(data));
factionData.loadNBTData(data);
itemgiverData.loadNBTData(data);
mailData.loadNBTData(data);
@@ -186,10 +186,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
uuid = player.getPersistentID().toString();
}
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
dialogData.saveNBTData(new MC1710NBTCompound(compound));
bankData.saveNBTData(compound);
questData.saveNBTData(compound);
transportData.saveNBTData(compound);
transportData.saveNBTData(new MC1710NBTCompound(compound));
factionData.saveNBTData(compound);
itemgiverData.saveNBTData(compound);
mailData.saveNBTData(compound);
@@ -219,14 +219,14 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
public NBTTagCompound getSyncNBT() {
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
dialogData.saveNBTData(new MC1710NBTCompound(compound));
questData.saveNBTData(compound);
factionData.saveNBTData(compound);
return compound;
}
public void setSyncNBT(NBTTagCompound data) {
dialogData.loadNBTData(data);
dialogData.loadNBTData(new MC1710NBTCompound(data));
questData.loadNBTData(data);
factionData.loadNBTData(data);
}
@@ -247,10 +247,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
uuid = player.getPersistentID().toString();
}
NBTTagCompound compound = new NBTTagCompound();
dialogData.saveNBTData(compound);
dialogData.saveNBTData(new MC1710NBTCompound(compound));
bankData.saveNBTData(compound);
questData.saveNBTData(compound);
transportData.saveNBTData(compound);
transportData.saveNBTData(new MC1710NBTCompound(compound));
factionData.saveNBTData(compound);
mailData.saveNBTData(compound);
tradeData.writeToNBT(compound);
@@ -263,10 +263,10 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
}
public void setSyncNBTFull(NBTTagCompound data) {
dialogData.loadNBTData(data);
dialogData.loadNBTData(new MC1710NBTCompound(data));
bankData.loadNBTData(data);
questData.loadNBTData(data);
transportData.loadNBTData(data);
transportData.loadNBTData(new MC1710NBTCompound(data));
factionData.loadNBTData(data);
mailData.loadNBTData(data);
tradeData.readFromNBT(data);