use of logisticspipes.interfaces.IClientInformationProvider in project LogisticsPipes by RS485.
the class ItemModuleInformationManager method saveInfotmation.
public static void saveInfotmation(ItemStack itemStack, LogisticsModule module) {
if (module == null) {
return;
}
NBTTagCompound nbt = new NBTTagCompound();
module.writeToNBT(nbt);
if (nbt.equals(new NBTTagCompound())) {
return;
}
if (MainProxy.isClient()) {
NBTTagList list = new NBTTagList();
String info1 = "Please reopen the window";
String info2 = "to see the information.";
list.appendTag(new NBTTagString(info1));
list.appendTag(new NBTTagString(info2));
if (!itemStack.hasTagCompound()) {
itemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound stacktag = itemStack.getTagCompound();
stacktag.setTag("informationList", list);
stacktag.setDouble("Random-Stack-Prevent", new Random().nextDouble());
return;
}
if (!itemStack.hasTagCompound()) {
itemStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound stacktag = itemStack.getTagCompound();
stacktag.setTag("moduleInformation", nbt);
if (module instanceof IClientInformationProvider) {
List<String> information = ((IClientInformationProvider) module).getClientInformation();
if (information.size() > 0) {
NBTTagList list = new NBTTagList();
for (String info : information) {
list.appendTag(new NBTTagString(info));
}
stacktag.setTag("informationList", list);
}
}
stacktag.setDouble("Random-Stack-Prevent", new Random().nextDouble());
}
use of logisticspipes.interfaces.IClientInformationProvider in project LogisticsPipes by RS485.
the class ItemModuleInformationManager method saveInformation.
public static void saveInformation(@Nonnull ItemStack stack, LogisticsModule module) {
if (module == null) {
return;
}
NBTTagCompound nbt = new NBTTagCompound();
module.writeToNBT(nbt);
if (nbt.equals(new NBTTagCompound())) {
return;
}
if (MainProxy.isClient()) {
NBTTagList list = new NBTTagList();
String info1 = "Please reopen the window";
String info2 = "to see the information.";
list.appendTag(new NBTTagString(info1));
list.appendTag(new NBTTagString(info2));
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = Objects.requireNonNull(stack.getTagCompound());
tag.setTag("informationList", list);
tag.setDouble("Random-Stack-Prevent", new Random().nextDouble());
return;
}
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = Objects.requireNonNull(stack.getTagCompound());
tag.setTag("moduleInformation", nbt);
if (module instanceof IClientInformationProvider) {
List<String> information = ((IClientInformationProvider) module).getClientInformation();
if (information.size() > 0) {
NBTTagList list = new NBTTagList();
for (String info : information) {
list.appendTag(new NBTTagString(info));
}
tag.setTag("informationList", list);
}
}
tag.setDouble("Random-Stack-Prevent", new Random().nextDouble());
}
Aggregations