mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Fixed the king sombra boss fight
This commit is contained in:
parent
1fdf88dce7
commit
8d736befa5
3 changed files with 23 additions and 5 deletions
|
@ -8,6 +8,7 @@ import com.google.common.base.Predicates;
|
|||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.minelittlepony.unicopia.InteractionManager;
|
||||
import com.minelittlepony.unicopia.USounds;
|
||||
import com.minelittlepony.unicopia.block.UBlocks;
|
||||
import com.minelittlepony.unicopia.compat.trinkets.TrinketsDelegate;
|
||||
import com.minelittlepony.unicopia.entity.*;
|
||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
|
@ -25,7 +26,6 @@ import it.unimi.dsi.fastutil.floats.Float2ObjectFunction;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
@ -198,9 +198,8 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
|||
}
|
||||
|
||||
if (entity instanceof PlayerEntity) {
|
||||
if (entity.isOnFire() && world.getBlockState(entity.getBlockPos().up()).isOf(Blocks.SOUL_FIRE)) {
|
||||
if (UnicopiaWorldProperties.forWorld((ServerWorld)world).isActiveAltar(entity.getBlockPos())
|
||||
|| UnicopiaWorldProperties.forWorld((ServerWorld)world).isActiveAltar(entity.getBlockPos().up())) {
|
||||
if (entity.isOnFire() && world.getBlockState(entity.getBlockPos().up()).isOf(UBlocks.SPECTRAL_FIRE)) {
|
||||
if (UnicopiaWorldProperties.forWorld((ServerWorld)world).isActiveAltar(entity)) {
|
||||
if (living.asEntity().getHealth() < 2) {
|
||||
entity.setFireTicks(0);
|
||||
world.removeBlock(entity.getBlockPos().up(), false);
|
||||
|
|
|
@ -31,7 +31,16 @@ import net.minecraft.util.math.Direction;
|
|||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public record Altar(BlockPos origin, Set<BlockPos> pillars) {
|
||||
public record Altar(
|
||||
/**
|
||||
* The position of the central spectral fire of this altar
|
||||
*/
|
||||
BlockPos origin,
|
||||
/**
|
||||
* Pillar top positions
|
||||
*/
|
||||
Set<BlockPos> pillars
|
||||
) {
|
||||
private static final Direction[] HORIZONTALS = { Direction.SOUTH, Direction.WEST, Direction.NORTH, Direction.EAST };
|
||||
private static final Predicate<Entity> IS_PARTICIPANT = EntityPredicates.VALID_ENTITY.and(e -> e instanceof FloatingArtefactEntity || e instanceof SpellbookEntity);
|
||||
public static final NbtSerialisable.Serializer<Altar> SERIALIZER = NbtSerialisable.Serializer.of(nbt -> {
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.network.Channel;
|
|||
import com.minelittlepony.unicopia.network.MsgSkyAngle;
|
||||
import com.minelittlepony.unicopia.util.NbtSerialisable;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
@ -69,6 +70,15 @@ public class UnicopiaWorldProperties extends PersistentState {
|
|||
return activeAltarPositions.contains(center);
|
||||
}
|
||||
|
||||
public boolean isActiveAltar(Entity entity) {
|
||||
for (int i = 0; i < entity.getHeight(); i++) {
|
||||
if (isActiveAltar(entity.getBlockPos().up(i))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound writeNbt(NbtCompound tag) {
|
||||
tag.putString("defaultRace", Race.REGISTRY.getId(defaultRace).toString());
|
||||
|
|
Loading…
Reference in a new issue