HELLLL YES (circles actually working!!)

This commit is contained in:
Talia-12 2023-04-03 23:05:57 +10:00
parent 6fd69a5343
commit 285a647a9c
2 changed files with 17 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.api.block.circle.BlockCircleComponent;
import at.petrak.hexcasting.api.casting.eval.env.CircleCastEnv;
import at.petrak.hexcasting.api.casting.eval.vm.CastingImage;
import at.petrak.hexcasting.api.casting.eval.vm.CastingVM;
import at.petrak.hexcasting.api.casting.iota.PatternIota;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.common.lib.HexItems;
@ -77,14 +78,26 @@ public class BlockSlate extends BlockCircleComponent implements EntityBlock, Sim
@Override
public ControlFlow acceptControlFlow(CastingImage imageIn, CircleCastEnv env, Direction enterDir, BlockPos pos, BlockState bs, ServerLevel world) {
// TODO: Do something here actually with imageIn
HexPattern pattern;
if (world.getBlockEntity(pos) instanceof BlockEntitySlate tile) {
pattern = tile.pattern;
} else {
return new ControlFlow.Stop();
}
var exitDirsSet = this.possibleExitDirections(pos, bs, world);
exitDirsSet.remove(enterDir.getOpposite());
var exitDirs = exitDirsSet.stream().map((dir) -> this.exitPositionFromDirection(pos, dir));
return new ControlFlow.Continue(imageIn, exitDirs.toList());
if (pattern == null)
return new ControlFlow.Continue(imageIn, exitDirs.toList());
var vm = new CastingVM(imageIn, env);
vm.queueExecuteAndWrapIota(new PatternIota(pattern), world);
return new ControlFlow.Continue(vm.getImage(), exitDirs.toList());
}
@Override

View file

@ -53,14 +53,14 @@ class OpConjureBlock(val light: Boolean) : SpellAction {
if (worldState.canBeReplaced(placeContext)) {
val block = if (this.light) HexBlocks.CONJURED_LIGHT else HexBlocks.CONJURED_BLOCK
if (!IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(block), ctx.caster))
if (ctx.caster != null && !IXplatAbstractions.INSTANCE.isPlacingAllowed(ctx.world, pos, ItemStack(block), ctx.caster))
return
val state = block.getStateForPlacement(placeContext)
if (state != null) {
ctx.world.setBlock(pos, state, 5)
val colorizer = IXplatAbstractions.INSTANCE.getColorizer(ctx.caster)
val colorizer = ctx.colorizer
if (ctx.world.getBlockState(pos).block is BlockConjured) {
BlockConjured.setColor(ctx.world, pos, colorizer)