use of hellfirepvp.astralsorcery.common.crafting.nojson.freezing.WorldFreezingRecipe in project AstralSorcery by HellFirePvP.
the class CEffectFornax method playEffect.
@Override
public boolean playEffect(World world, BlockPos pos, ConstellationEffectProperties properties, @Nullable IMinorConstellation trait) {
if (!(world instanceof ServerWorld)) {
return false;
}
Consumer<ItemStack> dropResult = stack -> ItemUtils.dropItemNaturally(world, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, stack);
return this.peekNewPosition(world, pos, properties).mapLeft(newEntry -> {
BlockPos at = newEntry.getPos();
if (properties.isCorrupted()) {
WorldFreezingRecipe freezingRecipe = WorldFreezingRegistry.INSTANCE.getRecipeFor(world, at);
if (freezingRecipe != null) {
freezingRecipe.doOutput(world, at, world.getBlockState(at), dropResult);
return true;
}
sendConstellationPing(world, new Vector3(at).add(0.5, 0.5, 0.5));
return false;
}
WorldMeltableRecipe meltRecipe = WorldMeltableRegistry.INSTANCE.getRecipeFor(world, at);
if (meltRecipe != null) {
meltRecipe.doOutput(world, at, world.getBlockState(at), dropResult);
return true;
}
sendConstellationPing(world, new Vector3(at).add(0.5, 0.5, 0.5));
return false;
}).left().orElse(false);
}
Aggregations