mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-18 03:15:29 +00:00
Use argument object for survival autoplace
This commit is contained in:
1 parent
23605fc22d
commit
c0814274ec
24 files changed
+1083
-183
No files matched your search
@@ -74,4 +74,28 @@ public interface IStructureElementChain<T> extends IStructureElement<T> {
|
||||
// TODO need reconsider to ensure this is the right course of action
|
||||
return haveSkip ? PlaceResult.SKIP : PlaceResult.REJECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
default PlaceResult survivalPlaceBlock(
|
||||
T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) {
|
||||
boolean haveSkip = false;
|
||||
List<IChatComponent> bufferedNoise = new ArrayList<>();
|
||||
for (IStructureElement<T> fallback : fallbacks()) {
|
||||
PlaceResult result =
|
||||
fallback.survivalPlaceBlock(t, world, x, y, z, trigger, env.withChatter(bufferedNoise::add));
|
||||
switch (result) {
|
||||
case REJECT:
|
||||
break;
|
||||
case SKIP:
|
||||
haveSkip = true;
|
||||
break;
|
||||
default:
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// dump all that noise back into upstream
|
||||
bufferedNoise.forEach(env.getChatter());
|
||||
// TODO need reconsider to ensure this is the right course of action
|
||||
return haveSkip ? PlaceResult.SKIP : PlaceResult.REJECT;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user