mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-20 03:44:23 +01:00
Change pillar height for the altar from 3 to 4, check for sky visibility on the pillars, and allow the altar to fix itself if the current placement is determined to be valid
This commit is contained in:
parent
1f64e6c4a6
commit
f4c68bb0c3
2 changed files with 21 additions and 8 deletions
|
@ -190,11 +190,18 @@ public class SpellbookEntity extends MobEntity implements MagicImmune {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getWorld().isClient && age % 15 == 0) {
|
if (!getWorld().isClient && age % 15 == 0) {
|
||||||
altar.ifPresent(altar -> {
|
|
||||||
|
|
||||||
|
if (altar.isEmpty()) {
|
||||||
|
altar = Altar.locateAltar(getWorld(), getBlockPos()).map(altar -> {
|
||||||
|
altar.generateDecorations(getWorld());
|
||||||
|
return altar;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
altar = altar.filter(altar -> {
|
||||||
if (!altar.isValid(getWorld())) {
|
if (!altar.isValid(getWorld())) {
|
||||||
altar.tearDown(null, getWorld());
|
altar.tearDown(null, getWorld());
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
altar.pillars().forEach(pillar -> {
|
altar.pillars().forEach(pillar -> {
|
||||||
|
@ -229,6 +236,8 @@ public class SpellbookEntity extends MobEntity implements MagicImmune {
|
||||||
getWorld().setBlockState(pillar, Blocks.CRYING_OBSIDIAN.getDefaultState());
|
getWorld().setBlockState(pillar, Blocks.CRYING_OBSIDIAN.getDefaultState());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,10 @@ public record Altar(BlockPos origin, Set<BlockPos> pillars) {
|
||||||
|
|
||||||
if (isObsidian(world, pos.move(pillarPos))
|
if (isObsidian(world, pos.move(pillarPos))
|
||||||
&& isObsidian(world, pos.move(Direction.UP))
|
&& isObsidian(world, pos.move(Direction.UP))
|
||||||
&& isObsidian(world, pos.move(Direction.UP))) {
|
&& isObsidian(world, pos.move(Direction.UP))
|
||||||
pillarPosCollector.accept(pos.toImmutable());
|
&& isObsidian(world, pos.move(Direction.UP))
|
||||||
|
&& world.isSkyVisible(pos.move(Direction.UP))) {
|
||||||
|
pillarPosCollector.accept(pos.move(Direction.DOWN).toImmutable());
|
||||||
pos.set(x, y, z);
|
pos.set(x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,9 +157,6 @@ public record Altar(BlockPos origin, Set<BlockPos> pillars) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tearDown(@Nullable Entity except, World world) {
|
public void tearDown(@Nullable Entity except, World world) {
|
||||||
if (!(except instanceof SpellbookEntity)) {
|
|
||||||
world.getOtherEntities(except, new Box(origin).expand(3), IS_PARTICIPANT).forEach(Entity::kill);
|
|
||||||
}
|
|
||||||
pillars.forEach(pillar -> removeExisting(except, world, pillar));
|
pillars.forEach(pillar -> removeExisting(except, world, pillar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +168,11 @@ public record Altar(BlockPos origin, Set<BlockPos> pillars) {
|
||||||
return checkState(world, origin, Blocks.SOUL_FIRE)
|
return checkState(world, origin, Blocks.SOUL_FIRE)
|
||||||
&& checkState(world, origin.down(), Blocks.SOUL_SAND)
|
&& checkState(world, origin.down(), Blocks.SOUL_SAND)
|
||||||
&& checkSlab(world, origin.down())
|
&& checkSlab(world, origin.down())
|
||||||
&& pillars.stream().allMatch(pillar -> isObsidian(world, pillar) && isObsidian(world, pillar.down()) && isObsidian(world, pillar.down(2)));
|
&& pillars.stream().allMatch(pillar ->
|
||||||
|
isObsidian(world, pillar)
|
||||||
|
&& world.isSkyVisible(pillar.up())
|
||||||
|
&& isObsidian(world, pillar.down())
|
||||||
|
&& isObsidian(world, pillar.down(2))
|
||||||
|
&& isObsidian(world, pillar.down(3)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue