Merge pull request #567 from davboecki/patch-itemload
Fix item drop on world load.
This commit is contained in:
commit
644b173be2
1 changed files with 13 additions and 1 deletions
|
@ -47,6 +47,9 @@ public class PipeTransportItems extends PipeTransport {
|
|||
public Map<Integer, EntityData> travelingEntities = new HashMap<Integer, EntityData>();
|
||||
private final List<EntityData> entitiesToLoad = new LinkedList<EntityData>();
|
||||
|
||||
private final List<EntityData> delayedEntitiesToLoad = new LinkedList<EntityData>();
|
||||
private int delay = -1;
|
||||
|
||||
// TODO: generalize the use of this hook in particular for obsidian pipe
|
||||
public IItemTravelingHook travelHook;
|
||||
|
||||
|
@ -238,6 +241,14 @@ public class PipeTransportItems extends PipeTransport {
|
|||
}
|
||||
|
||||
private void moveSolids() {
|
||||
if(delay > 0) {
|
||||
delay--;
|
||||
if(delay == 0) {
|
||||
entitiesToLoad.addAll(delayedEntitiesToLoad);
|
||||
delayedEntitiesToLoad.clear();
|
||||
delay = -1;
|
||||
}
|
||||
}
|
||||
if (!entitiesToLoad.isEmpty()) {
|
||||
for (EntityData data : entitiesToLoad) {
|
||||
data.item.setWorld(worldObj);
|
||||
|
@ -385,13 +396,14 @@ public class PipeTransportItems extends PipeTransport {
|
|||
data.output = ForgeDirection.getOrientation(dataTag.getInteger("output"));
|
||||
data.toCenter = dataTag.getBoolean("toCenter");
|
||||
|
||||
entitiesToLoad.add(data);
|
||||
delayedEntitiesToLoad.add(data);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
// It may be the case that entities cannot be reloaded between
|
||||
// two versions - ignore these errors.
|
||||
}
|
||||
}
|
||||
delay = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue