mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 02:15:11 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -19,49 +19,49 @@ import java.util.List;
|
||||
public class MarkData implements IExtendedEntityProperties {
|
||||
|
||||
private static final String CNPCMARK = "cnpcmark";
|
||||
private EntityLivingBase entity;
|
||||
private EntityLivingBase entity;
|
||||
|
||||
public List<Mark> marks = new ArrayList<Mark>();
|
||||
public List<Mark> marks = new ArrayList<Mark>();
|
||||
|
||||
public void setNBT(NBTTagCompound compound){
|
||||
List<Mark> marks = new ArrayList<Mark>();
|
||||
NBTTagList list = compound.getTagList("marks", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
NBTTagCompound c = list.getCompoundTagAt(i);
|
||||
Mark m = new Mark();
|
||||
m.type = c.getInteger("type");
|
||||
m.color = c.getInteger("color");
|
||||
m.availability.readFromNBT(c.getCompoundTag("availability"));
|
||||
marks.add(m);
|
||||
}
|
||||
this.marks = marks;
|
||||
}
|
||||
public void setNBT(NBTTagCompound compound) {
|
||||
List<Mark> marks = new ArrayList<Mark>();
|
||||
NBTTagList list = compound.getTagList("marks", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound c = list.getCompoundTagAt(i);
|
||||
Mark m = new Mark();
|
||||
m.type = c.getInteger("type");
|
||||
m.color = c.getInteger("color");
|
||||
m.availability.readFromNBT(c.getCompoundTag("availability"));
|
||||
marks.add(m);
|
||||
}
|
||||
this.marks = marks;
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Mark m : marks){
|
||||
NBTTagCompound c = new NBTTagCompound();
|
||||
c.setInteger("type", m.type);
|
||||
c.setInteger("color", m.color);
|
||||
c.setTag("availability", m.availability.writeToNBT(new NBTTagCompound()));
|
||||
list.appendTag(c);
|
||||
}
|
||||
compound.setTag("marks", list);
|
||||
return compound;
|
||||
}
|
||||
public NBTTagCompound getNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (Mark m : marks) {
|
||||
NBTTagCompound c = new NBTTagCompound();
|
||||
c.setInteger("type", m.type);
|
||||
c.setInteger("color", m.color);
|
||||
c.setTag("availability", m.availability.writeToNBT(new NBTTagCompound()));
|
||||
list.appendTag(c);
|
||||
}
|
||||
compound.setTag("marks", list);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static boolean has(EntityLivingBase entity) {
|
||||
return entity.getExtendedProperties(CNPCMARK) != null;
|
||||
}
|
||||
|
||||
public static MarkData get(EntityNPCInterface npc){
|
||||
if(!MarkData.has(npc)){
|
||||
public static MarkData get(EntityNPCInterface npc) {
|
||||
if (!MarkData.has(npc)) {
|
||||
npc.registerExtendedProperties(CNPCMARK, new MarkData());
|
||||
}
|
||||
|
||||
MarkData data = (MarkData) npc.getExtendedProperties(CNPCMARK);
|
||||
if(data.entity == null){
|
||||
if (data.entity == null) {
|
||||
data.entity = npc;
|
||||
data.setNBT(npc.getEntityData().getCompoundTag(CNPCMARK));
|
||||
}
|
||||
@@ -96,48 +96,50 @@ public class MarkData implements IExtendedEntityProperties {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound compound) {}
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Entity entity, World world) {}
|
||||
public void init(Entity entity, World world) {
|
||||
}
|
||||
|
||||
public void syncClients() {
|
||||
PacketHandler.Instance.sendToAll(new MarkDataPacket(entity.getEntityId(), getNBT()));
|
||||
}
|
||||
|
||||
public class Mark implements IMark {
|
||||
public int type = MarkType.NONE;
|
||||
public Availability availability = new Availability();
|
||||
public int color = 0xFFED51;
|
||||
public int type = MarkType.NONE;
|
||||
public Availability availability = new Availability();
|
||||
public int color = 0xFFED51;
|
||||
|
||||
@Override
|
||||
public IAvailability getAvailability() {
|
||||
return availability;
|
||||
}
|
||||
@Override
|
||||
public IAvailability getAvailability() {
|
||||
return availability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
@Override
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
MarkData.this.syncClients();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
MarkData.this.syncClients();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user