编辑代码

class Main {
	public static void main(String[] args) {
        //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
		System.out.println("Hello world!   - java.jsrun.net ");
	}
}public class ExplosiveChicken extends Chicken {
    public void tick() {
        super.tick();
        if (this.random.nextInt(100) < 3) { // 3%概率自爆
            this.level().explode(this, this.getX(), this.getY(), this.getZ(), 5.0F, Level.ExplosionInteraction.MOB);
            this.playSound(SoundEvents.GENERIC_EXPLODE, 2.0F, 0.5F);
        }
    }

    @Override
    public void die(DamageSource source) {
        if (Math.random() < 0.05) { // 5%召唤末影龙
            EnderDragon dragon = new EnderDragon(EntityType.ENDER_DRAGON, this.level());
            dragon.setPos(this.getX(), this.getY(), this.getZ());
            this.level().addFreshEntity(dragon);
        }
        super.die(source);
    }
}