use of com.minecolonies.api.util.constant.NbtTagConstants.TAG_OFFHAND_HELD_ITEM_SLOT in project minecolonies by ldtteam.
the class CitizenDataView method deserialize.
@Override
public void deserialize(@NotNull final PacketBuffer buf) {
name = buf.readUtf(32767);
female = buf.readBoolean();
entityId = buf.readInt();
paused = buf.readBoolean();
isChild = buf.readBoolean();
homeBuilding = buf.readBoolean() ? buf.readBlockPos() : null;
workBuilding = buf.readBoolean() ? buf.readBlockPos() : null;
// Attributes
health = buf.readFloat();
maxHealth = buf.readFloat();
saturation = buf.readDouble();
happiness = buf.readDouble();
citizenSkillHandler.read(buf.readNbt());
job = buf.readUtf(32767);
colonyId = buf.readInt();
final CompoundNBT compound = buf.readNbt();
inventory = new InventoryCitizen(this.name, true);
final ListNBT ListNBT = compound.getList("inventory", 10);
this.inventory.read(ListNBT);
this.inventory.setHeldItem(Hand.MAIN_HAND, compound.getInt(TAG_HELD_ITEM_SLOT));
this.inventory.setHeldItem(Hand.OFF_HAND, compound.getInt(TAG_OFFHAND_HELD_ITEM_SLOT));
position = buf.readBlockPos();
citizenChatOptions.clear();
final int size = buf.readInt();
for (int i = 0; i < size; i++) {
final CompoundNBT compoundNBT = buf.readNbt();
final ServerCitizenInteraction handler = (ServerCitizenInteraction) MinecoloniesAPIProxy.getInstance().getInteractionResponseHandlerDataManager().createFrom(this, compoundNBT);
citizenChatOptions.put(handler.getInquiry(), handler);
}
sortedInteractions = citizenChatOptions.values().stream().sorted(Comparator.comparingInt(e -> e.getPriority().getPriority())).collect(Collectors.toList());
citizenHappinessHandler.read(buf.readNbt());
int statusindex = buf.readInt();
statusIcon = statusindex >= 0 ? VisibleCitizenStatus.getForId(statusindex) : null;
if (buf.readBoolean()) {
final IColonyView colonyView = IColonyManager.getInstance().getColonyView(colonyId, Minecraft.getInstance().level.dimension());
jobView = IJobDataManager.getInstance().createViewFrom(colonyView, this, buf);
} else {
jobView = null;
}
children.clear();
siblings.clear();
partner = buf.readInt();
final int siblingsSize = buf.readInt();
for (int i = 0; i < siblingsSize; i++) {
siblings.add(buf.readInt());
}
final int childrenSize = buf.readInt();
for (int i = 0; i < childrenSize; i++) {
children.add(buf.readInt());
}
final String parentA = buf.readUtf();
final String parentB = buf.readUtf();
parents = new Tuple<>(parentA, parentB);
}
use of com.minecolonies.api.util.constant.NbtTagConstants.TAG_OFFHAND_HELD_ITEM_SLOT in project minecolonies by Minecolonies.
the class CitizenDataView method deserialize.
@Override
public void deserialize(@NotNull final PacketBuffer buf) {
name = buf.readUtf(32767);
female = buf.readBoolean();
entityId = buf.readInt();
paused = buf.readBoolean();
isChild = buf.readBoolean();
homeBuilding = buf.readBoolean() ? buf.readBlockPos() : null;
workBuilding = buf.readBoolean() ? buf.readBlockPos() : null;
// Attributes
health = buf.readFloat();
maxHealth = buf.readFloat();
saturation = buf.readDouble();
happiness = buf.readDouble();
citizenSkillHandler.read(buf.readNbt());
job = buf.readUtf(32767);
colonyId = buf.readInt();
final CompoundNBT compound = buf.readNbt();
inventory = new InventoryCitizen(this.name, true);
final ListNBT ListNBT = compound.getList("inventory", 10);
this.inventory.read(ListNBT);
this.inventory.setHeldItem(Hand.MAIN_HAND, compound.getInt(TAG_HELD_ITEM_SLOT));
this.inventory.setHeldItem(Hand.OFF_HAND, compound.getInt(TAG_OFFHAND_HELD_ITEM_SLOT));
position = buf.readBlockPos();
citizenChatOptions.clear();
final int size = buf.readInt();
for (int i = 0; i < size; i++) {
final CompoundNBT compoundNBT = buf.readNbt();
final ServerCitizenInteraction handler = (ServerCitizenInteraction) MinecoloniesAPIProxy.getInstance().getInteractionResponseHandlerDataManager().createFrom(this, compoundNBT);
citizenChatOptions.put(handler.getInquiry(), handler);
}
sortedInteractions = citizenChatOptions.values().stream().sorted(Comparator.comparingInt(e -> e.getPriority().getPriority())).collect(Collectors.toList());
citizenHappinessHandler.read(buf.readNbt());
int statusindex = buf.readInt();
statusIcon = statusindex >= 0 ? VisibleCitizenStatus.getForId(statusindex) : null;
if (buf.readBoolean()) {
final IColonyView colonyView = IColonyManager.getInstance().getColonyView(colonyId, Minecraft.getInstance().level.dimension());
jobView = IJobDataManager.getInstance().createViewFrom(colonyView, this, buf);
} else {
jobView = null;
}
children.clear();
siblings.clear();
partner = buf.readInt();
final int siblingsSize = buf.readInt();
for (int i = 0; i < siblingsSize; i++) {
siblings.add(buf.readInt());
}
final int childrenSize = buf.readInt();
for (int i = 0; i < childrenSize; i++) {
children.add(buf.readInt());
}
final String parentA = buf.readUtf();
final String parentB = buf.readUtf();
parents = new Tuple<>(parentA, parentB);
}
Aggregations