use of logisticspipes.transport.LPTravelingItem.LPTravelingItemClient in project LogisticsPipes by RS485.
the class PipeTransportLogistics method handleItemPositionPacket.
public void handleItemPositionPacket(int travelId, ForgeDirection input, ForgeDirection output, float speed, float position, float yaw) {
WeakReference<LPTravelingItemClient> ref = LPTravelingItem.clientList.get(travelId);
LPTravelingItemClient item = null;
if (ref != null) {
item = ref.get();
}
if (item == null) {
sendItemContentRequest(travelId);
item = new LPTravelingItemClient(travelId, position, input, output, yaw);
item.setSpeed(speed);
LPTravelingItem.clientList.put(travelId, new WeakReference<>(item));
} else {
if (item.getContainer() instanceof LogisticsTileGenericPipe) {
((LogisticsTileGenericPipe) item.getContainer()).pipe.transport.items.scheduleRemoval(item);
((LogisticsTileGenericPipe) item.getContainer()).pipe.transport.items.removeScheduledItems();
}
item.updateInformation(input, output, speed, position, yaw);
}
//update lastTicked so we don't double-move items
item.lastTicked = MainProxy.getGlobalTick();
if (items.get(travelId) == null) {
items.add(item);
}
//getPipe().spawnParticle(Particles.OrangeParticle, 1);
}
use of logisticspipes.transport.LPTravelingItem.LPTravelingItemClient in project LogisticsPipes by RS485.
the class PipeContentPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
WeakReference<LPTravelingItemClient> ref = LPTravelingItem.clientList.get(travelId);
LPTravelingItemClient content = null;
if (ref != null) {
content = ref.get();
}
if (content == null) {
content = new LPTravelingItemClient(travelId, item);
LPTravelingItem.clientList.put(travelId, new WeakReference<>(content));
synchronized (LPTravelingItem.forceKeep) {
//Keep in memory for min 10 ticks
LPTravelingItem.forceKeep.add(new Pair<>(10, content));
}
} else {
content.setItem(item);
}
}
Aggregations