@@ -139,6 +139,7 @@ public void onUpdateServer() {
139139 }
140140 }
141141 if (!transit .isEmpty ()) {
142+ BlockPos pos = getBlockPos ();
142143 InventoryNetwork network = getTransmitterNetwork ();
143144 //Update stack positions
144145 IntSet deletes = new IntOpenHashSet ();
@@ -160,7 +161,7 @@ public void onUpdateServer() {
160161 if (stack .progress >= 100 ) {
161162 BlockPos prevSet = null ;
162163 if (stack .hasPath ()) {
163- int currentIndex = stack .getPath ().indexOf (getBlockPos () );
164+ int currentIndex = stack .getPath ().indexOf (pos );
164165 if (currentIndex == 0 ) { //Necessary for transition reasons, not sure why
165166 deletes .add (stackId );
166167 continue ;
@@ -221,15 +222,20 @@ public void onUpdateServer() {
221222 tryRecalculate = true ;
222223 }
223224 } else {
224- LogisticalTransporterBase nextTransmitter = network .getTransmitter (stack .getNext (this ));
225- if (nextTransmitter == null && stack .getPathType ().noTarget () && stack .getPath ().size () == 2 ) {
226- //If there is no next transmitter, and it was an idle path, assume that we are idling
227- // in a single length transmitter, in which case we only recalculate it at 50 if it won't
228- // be able to go into that connection type
229- ConnectionType connectionType = getConnectionType (stack .getSide (this ));
230- tryRecalculate = !connectionType .canSendTo ();
225+ BlockPos nextPos = stack .getNext (this );
226+ if (nextPos == null ) {
227+ tryRecalculate = true ;
231228 } else {
232- tryRecalculate = !stack .canInsertToTransporter (nextTransmitter , stack .getSide (this ), this );
229+ Direction nextSide = stack .getSide (pos , nextPos );
230+ LogisticalTransporterBase nextTransmitter = network .getTransmitter (nextPos );
231+ if (nextTransmitter == null && stack .getPathType ().noTarget () && stack .getPath ().size () == 2 ) {
232+ //If there is no next transmitter, and it was an idle path, assume that we are idling
233+ // in a single length transmitter, in which case we only recalculate it at 50 if it won't
234+ // be able to go into that connection type
235+ tryRecalculate = !getConnectionType (nextSide ).canSendTo ();
236+ } else {
237+ tryRecalculate = !stack .canInsertToTransporter (nextTransmitter , nextSide , this );
238+ }
233239 }
234240 }
235241 if (tryRecalculate && !recalculate (stackId , stack , null )) {
@@ -240,7 +246,7 @@ public void onUpdateServer() {
240246
241247 if (!deletes .isEmpty () || !needsSync .isEmpty ()) {
242248 //Notify clients, so that we send the information before we start clearing our lists
243- PacketUtils .sendToAllTracking (new PacketTransporterBatch (getBlockPos () , deletes , needsSync ), getTransmitterTile ());
249+ PacketUtils .sendToAllTracking (new PacketTransporterBatch (pos , deletes , needsSync ), getTransmitterTile ());
244250 // Now remove any entries from transit that have been deleted
245251 OfInt ofInt = deletes .iterator ();
246252 while (ofInt .hasNext ()) {
0 commit comments