Make payload blocks run onDestroyed() of the block payload it carries when destroyed. (#8253)
* Payloads go boom. * When a payload unit dies too * Keep the functionality, but limit it to a rule
This commit is contained in:
@@ -51,6 +51,11 @@ public class BuildPayload implements Payload{
|
||||
build.updatePayload(unitHolder, buildingHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyed(){
|
||||
build.onDestroyed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] requirements(){
|
||||
return build.block.requirements;
|
||||
|
||||
@@ -54,6 +54,8 @@ public interface Payload extends Position{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
default void destroyed(){};
|
||||
|
||||
/** writes the payload for saving. */
|
||||
void write(Writes write);
|
||||
|
||||
|
||||
@@ -151,6 +151,12 @@ public class PayloadBlock extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyed(){
|
||||
if(payload != null) payload.destroyed();
|
||||
super.onDestroyed();
|
||||
}
|
||||
|
||||
public boolean blends(int direction){
|
||||
return PayloadBlock.blends(this, direction);
|
||||
}
|
||||
|
||||
@@ -190,6 +190,12 @@ public class PayloadConveyor extends Block{
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyed(){
|
||||
if(item != null) item.destroyed();
|
||||
super.onDestroyed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
Reference in New Issue
Block a user