Closed Partonetrain closed 1 year ago
This is definitely an intended feature, seems the problem is that the mutator lambda can't see the method.
I was able to get it to work with this
import mods.zensummoning.SummoningDirector;
import mods.zensummoning.SummoningAttempt;
import mods.zensummoning.SummoningInfo;
import mods.zensummoning.MobInfo;
import crafttweaker.api.block.Block;
import crafttweaker.api.util.math.BlockPos;
import crafttweaker.api.world.Level;
SummoningDirector.addSummonInfo(
SummoningInfo.create()
.setCatalyst(<item:minecraft:stick>)
.setConsumeCatalyst(false)
.setReagents([<item:minecraft:diamond>])
.addMob(MobInfo.create()
.setMob(<entityType:minecraft:cow>)
.setCount(4)
.setOffset(0,4,0)
.setSpread(1,1,1)
)
.setMutator((attempt as SummoningAttempt) => {
if (attempt.world.getBlockState(attempt.pos.offset(0,-1,0)).block != <block:minecraft:iron_block>) {
attempt.success = false;
attempt.message = "Need an iron block!";
} else {
attempt.message = "Woohoo!";
}
})
);
(I also fixed the equality check in the if
statement)
LMK if still has issues :D
I'm trying to check for certain blocks in the world through some clever scripting, like so:
But this crashes the game:
I recognize this is probably not an intended feature of the mod, but it would be really nice to have. Let me know if there's a better way to do this, or if I shouldn't be trying at all :P