Added hooks for validate, invalidate and onChunkUnload

This commit is contained in:
Krapht 2012-07-21 01:20:07 +02:00
parent 910fee26a7
commit e785c910fd
2 changed files with 29 additions and 0 deletions

View file

@ -670,4 +670,20 @@ public class Pipe implements IPipe, IDropControlInventory {
public boolean doDrop() {
return logic.doDrop();
}
/**
* Called when TileGenericPipe.invalidate() is called
*/
public void invalidate() {}
/**
* Called when TileGenericPipe.validate() is called
*/
public void validate() {}
/**
* Called when TileGenericPipe.onChunkUnload is called
*/
public void onChunkUnload() {}
}

View file

@ -106,6 +106,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
@Override
public void invalidate() {
initialized = false;
if (pipe != null){
pipe.invalidate();
}
super.invalidate();
// if (BlockGenericPipe.isValid(pipe))
@ -116,6 +119,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
public void validate() {
super.validate();
bindPipe();
if (pipe != null) {
pipe.validate();
}
}
public boolean initialized = false;
@ -432,4 +438,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ILiqu
else
return false;
}
@Override
public void onChunkUnload() {
if (pipe != null){
pipe.onChunkUnload();
}
}
}