use of logisticspipes.routing.ItemRoutingInformation in project LogisticsPipes by RS485.
the class ThermalDynamicsHooks method travelingItemToNBT.
public static void travelingItemToNBT(TravelingItem travelingItem, NBTTagCompound paramNBTTagCompound) {
if (((ILPTravelingItemInfo) travelingItem).getLPRoutingInfoAddition() != null) {
NBTTagCompound save = new NBTTagCompound();
((ItemRoutingInformation) ((ILPTravelingItemInfo) travelingItem).getLPRoutingInfoAddition()).writeToNBT(save);
paramNBTTagCompound.setTag("LPRoutingInformation", save);
}
}
use of logisticspipes.routing.ItemRoutingInformation in project LogisticsPipes by RS485.
the class ThermalDynamicsHooks method travelingItemNBTContructor.
public static void travelingItemNBTContructor(TravelingItem travelingItem, NBTTagCompound paramNBTTagCompound) {
if (!paramNBTTagCompound.hasKey("LPRoutingInformation")) {
return;
}
((ILPTravelingItemInfo) travelingItem).setLPRoutingInfoAddition(new ItemRoutingInformation());
((ItemRoutingInformation) ((ILPTravelingItemInfo) travelingItem).getLPRoutingInfoAddition()).readFromNBT(paramNBTTagCompound.getCompoundTag("LPRoutingInformation"));
}
use of logisticspipes.routing.ItemRoutingInformation in project LogisticsPipes by RS485.
the class LogisticsEventListener method onItemStackToolTip.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onItemStackToolTip(ItemTooltipEvent event) {
if (event.getItemStack().hasTagCompound()) {
for (String key : event.getItemStack().getTagCompound().getKeySet()) {
if (key.startsWith("logisticspipes:routingdata")) {
ItemRoutingInformation info = ItemRoutingInformation.restoreFromNBT(event.getItemStack().getTagCompound().getCompoundTag(key));
List<String> list = event.getToolTip();
list.set(0, ChatColor.RED + "!!! " + ChatColor.WHITE + list.get(0) + ChatColor.RED + " !!!" + ChatColor.WHITE);
list.add(1, TextUtil.translate("itemstackinfo.lprouteditem"));
list.add(2, TextUtil.translate("itemstackinfo.lproutediteminfo"));
list.add(3, TextUtil.translate("itemstackinfo.lprouteditemtype") + ": " + info.getItem().toString());
}
}
}
}
use of logisticspipes.routing.ItemRoutingInformation in project LogisticsPipes by RS485.
the class LogisticsEventListener method onEntitySpawn.
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event) {
if (event != null && event.getEntity() instanceof EntityItem && event.getEntity().world != null && !event.getEntity().world.isRemote) {
// Get ItemStack
ItemStack stack = ((EntityItem) event.getEntity()).getItem();
if (!stack.isEmpty() && stack.getItem() instanceof IItemAdvancedExistance && !((IItemAdvancedExistance) stack.getItem()).canExistInWorld(stack)) {
event.setCanceled(true);
}
if (stack.hasTagCompound()) {
for (String key : Objects.requireNonNull(stack.getTagCompound(), "nbt for stack must be non-null").getKeySet()) {
if (key.startsWith("logisticspipes:routingdata")) {
ItemRoutingInformation info = ItemRoutingInformation.restoreFromNBT(stack.getTagCompound().getCompoundTag(key));
info.setItemTimedout();
((EntityItem) event.getEntity()).setItem(info.getItem().getItem().makeNormalStack(stack.getCount()));
break;
}
}
}
}
}
use of logisticspipes.routing.ItemRoutingInformation in project LogisticsPipes by RS485.
the class CoreRoutedPipe method addStatusInformation.
@Override
public void addStatusInformation(List<StatusEntry> status) {
StatusEntry entry = new StatusEntry();
entry.name = "Send Queue";
entry.subEntry = new ArrayList<>();
for (Triplet<IRoutedItem, EnumFacing, ItemSendMode> part : _sendQueue) {
StatusEntry subEntry = new StatusEntry();
subEntry.name = part.toString();
entry.subEntry.add(subEntry);
}
status.add(entry);
entry = new StatusEntry();
entry.name = "In Transit To Me";
entry.subEntry = new ArrayList<>();
for (ItemRoutingInformation part : _inTransitToMe) {
StatusEntry subEntry = new StatusEntry();
subEntry.name = part.toString();
entry.subEntry.add(subEntry);
}
status.add(entry);
}
Aggregations