108 lines
5.1 KiB
Java
108 lines
5.1 KiB
Java
package net.minecraft.world.level.dimension.end;
|
|
|
|
import net.minecraft.world.level.levelgen.ChunkGeneratorSettings;
|
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
|
import java.util.Random;
|
|
import net.minecraft.world.level.levelgen.feature.Feature;
|
|
import net.minecraft.world.level.levelgen.feature.configurations.SpikeConfiguration;
|
|
import com.google.common.collect.ImmutableList;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.level.Explosion;
|
|
import net.minecraft.world.level.LevelAccessor;
|
|
import net.minecraft.world.level.levelgen.feature.SpikeFeature;
|
|
import java.util.Iterator;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
|
|
import java.util.List;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
|
|
public enum DragonRespawnAnimation {
|
|
START {
|
|
@Override
|
|
public void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk) {
|
|
final BlockPos fk2 = new BlockPos(0, 128, 0);
|
|
for (final EndCrystal auo9 : list) {
|
|
auo9.setBeamTarget(fk2);
|
|
}
|
|
cbj.setRespawnStage(DragonRespawnAnimation$1.PREPARING_TO_SUMMON_PILLARS);
|
|
}
|
|
},
|
|
PREPARING_TO_SUMMON_PILLARS {
|
|
@Override
|
|
public void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk) {
|
|
if (integer < 100) {
|
|
if (integer == 0 || integer == 50 || integer == 51 || integer == 52 || integer >= 95) {
|
|
xd.levelEvent(3001, new BlockPos(0, 128, 0), 0);
|
|
}
|
|
}
|
|
else {
|
|
cbj.setRespawnStage(DragonRespawnAnimation$2.SUMMONING_PILLARS);
|
|
}
|
|
}
|
|
},
|
|
SUMMONING_PILLARS {
|
|
@Override
|
|
public void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk) {
|
|
final int integer2 = 40;
|
|
final boolean boolean8 = integer % 40 == 0;
|
|
final boolean boolean9 = integer % 40 == 39;
|
|
if (boolean8 || boolean9) {
|
|
final List<SpikeFeature.EndSpike> list2 = SpikeFeature.getSpikesForLevel(xd);
|
|
final int integer3 = integer / 40;
|
|
if (integer3 < list2.size()) {
|
|
final SpikeFeature.EndSpike a12 = list2.get(integer3);
|
|
if (boolean8) {
|
|
for (final EndCrystal auo14 : list) {
|
|
auo14.setBeamTarget(new BlockPos(a12.getCenterX(), a12.getHeight() + 1, a12.getCenterZ()));
|
|
}
|
|
}
|
|
else {
|
|
final int integer4 = 10;
|
|
for (final BlockPos fk2 : BlockPos.betweenClosed(new BlockPos(a12.getCenterX() - 10, a12.getHeight() - 10, a12.getCenterZ() - 10), new BlockPos(a12.getCenterX() + 10, a12.getHeight() + 10, a12.getCenterZ() + 10))) {
|
|
xd.removeBlock(fk2, false);
|
|
}
|
|
xd.explode(null, a12.getCenterX() + 0.5f, a12.getHeight(), a12.getCenterZ() + 0.5f, 5.0f, Explosion.BlockInteraction.DESTROY);
|
|
final SpikeConfiguration chg14 = new SpikeConfiguration(true, ImmutableList.<SpikeFeature.EndSpike>of(a12), new BlockPos(0, 128, 0));
|
|
Feature.END_SPIKE.configured(chg14).place(xd, xd.getChunkSource().getGenerator(), new Random(), new BlockPos(a12.getCenterX(), 45, a12.getCenterZ()));
|
|
}
|
|
}
|
|
else if (boolean8) {
|
|
cbj.setRespawnStage(DragonRespawnAnimation$3.SUMMONING_DRAGON);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
SUMMONING_DRAGON {
|
|
@Override
|
|
public void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk) {
|
|
if (integer >= 100) {
|
|
cbj.setRespawnStage(DragonRespawnAnimation$4.END);
|
|
cbj.resetSpikeCrystals();
|
|
for (final EndCrystal auo8 : list) {
|
|
auo8.setBeamTarget(null);
|
|
xd.explode(auo8, auo8.getX(), auo8.getY(), auo8.getZ(), 6.0f, Explosion.BlockInteraction.NONE);
|
|
auo8.remove();
|
|
}
|
|
}
|
|
else if (integer >= 80) {
|
|
xd.levelEvent(3001, new BlockPos(0, 128, 0), 0);
|
|
}
|
|
else if (integer == 0) {
|
|
for (final EndCrystal auo8 : list) {
|
|
auo8.setBeamTarget(new BlockPos(0, 128, 0));
|
|
}
|
|
}
|
|
else if (integer < 5) {
|
|
xd.levelEvent(3001, new BlockPos(0, 128, 0), 0);
|
|
}
|
|
}
|
|
},
|
|
END {
|
|
@Override
|
|
public void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk) {
|
|
}
|
|
};
|
|
|
|
public abstract void tick(final ServerLevel xd, final EndDragonFight cbj, final List<EndCrystal> list, final int integer, final BlockPos fk);
|
|
}
|