Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sihuai2412 committed Oct 20, 2024
1 parent 892fd0e commit b6fad23
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ protected void addTranslations() {
add("generator.confluence.corruption", "腐化之地");
add("generator.confluence.tr_crimson", "猩红之地");

add("bossevent.confluence.cthulhu_eye.generate", "克苏鲁之眼已经苏醒!");
add("bossevent.confluence.cthulhu_eye.death", "克苏鲁之眼已被击败!");
add("bossevent.confluence.boss_generate", "%s已经苏醒!");
add("bossevent.confluence.boss_death", "%s已被击败!");
add("bossevent.confluence.cthulhu_eye.leave", "克苏鲁之眼离开了!");

add("entity.confluence.ice_slime", "冰冻史莱姆");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ protected void addTranslations() {
add("item.confluence.meteorite_ingot.tooltip", "Warm to the touch");
add("item.confluence.alpha.desc", "C418 - alpha");

add("bossevent.confluence.cthulhu_eye.generate", "The CthulhuEye has awakened!");
add("bossevent.confluence.cthulhu_eye.death", "The CthulhuEye been defeated!");
add("bossevent.confluence.boss_generate", "The %s has awakened!");
add("bossevent.confluence.boss_death", "The %s been defeated!");
add("bossevent.confluence.cthulhu_eye.leave", "The CthulhuEye leaved!");

add("curios.tooltip.speed_boots", "The wearer can run super fast");
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/confluence/mod/entity/boss/Boss.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.confluence.mod.entity.boss;

public interface Boss {
default boolean shouldShowMessage(){
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import static org.confluence.mod.util.ModUtils.switchByDifficulty;

@SuppressWarnings("all")
public class KingSlime extends Slime implements DeathAnimOptions, IBossFSM {
public class KingSlime extends Slime implements DeathAnimOptions, IBossFSM, Boss {
private static final int COLOR_INT = 0x73bcf4;
// 缩小/膨胀时长,单位:刻
private static final int SHRINK_ENLARGE_DURATION = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import static org.confluence.mod.util.ModUtils.switchByDifficulty;

@SuppressWarnings("all")
public abstract class TerraBossBase extends Monster implements GeoEntity {
public abstract class TerraBossBase extends Monster implements GeoEntity, Boss {

public int difficultyIdx;

Expand Down Expand Up @@ -250,10 +250,6 @@ public void onRemovedFromWorld() {
super.onRemovedFromWorld();
}

public void onDeath() {}

public void onFinializeSpawn() {}

@Override // 取消墙体窒息伤害
public boolean isInWall() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,4 @@ public void tick() {
super.tick();
syncRot();
}

@Override
public void onDeath() {
if (!level().isClientSide) level().players().forEach(player -> player.sendSystemMessage(Component.translatable("bossevent.confluence.cthulhu_eye.death").withStyle(ChatFormatting.DARK_PURPLE)));
}

@Override
public void onFinializeSpawn() {
if (!level().isClientSide) level().players().forEach(player -> player.sendSystemMessage(Component.translatable("bossevent.confluence.cthulhu_eye.generate").withStyle(ChatFormatting.DARK_PURPLE)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public Vec3 getNextPos(){
return newPos;
}

@Override
public boolean shouldShowMessage() {
return false;
}

public boolean isNoGravity(){
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public void tick() {
super.tick();
noPhysics = true;
checkCollision();
if (owner == null || owner.isDeadOrDying()){
kill();
}
}

private void checkCollision() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.ArrayList;

public class TestWormEntity extends AbstractWormEntity {
public static final int WORM_LENGTH = 72;
public static final float WORM_HEALTH = 5f;
public static final int WORM_LENGTH = 5;
public static final float WORM_HEALTH = 1f;
public static final WormMovementUtils.WormSegmentMovementOptions FOLLOW_INFO =
new WormMovementUtils.WormSegmentMovementOptions()
.setFollowDistance(0.5)
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/org/confluence/mod/event/ForgeEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
import net.minecraftforge.event.entity.EntityMountEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.level.BlockEvent;
import net.minecraftforge.event.level.ExplosionEvent;
import net.minecraftforge.event.server.ServerAboutToStartEvent;
Expand All @@ -54,7 +53,6 @@
import org.confluence.mod.block.natural.LogBlocks;
import org.confluence.mod.capability.ability.AbilityProvider;
import org.confluence.mod.capability.mana.ManaProvider;
import org.confluence.mod.client.color.AnimateColor;
import org.confluence.mod.client.particle.options.DamageIndicatorOptions;
import org.confluence.mod.command.ConfluenceCommand;
import org.confluence.mod.command.ConfluenceData;
Expand All @@ -67,6 +65,7 @@
import org.confluence.mod.effect.harmful.ManaSicknessEffect;
import org.confluence.mod.entity.FallingStarItemEntity;
import org.confluence.mod.entity.ModEntities;
import org.confluence.mod.entity.boss.Boss;
import org.confluence.mod.entity.boss.TerraBossBase;
import org.confluence.mod.entity.monster.demoneye.DemonEye;
import org.confluence.mod.entity.monster.demoneye.DemonEyeVariant;
Expand All @@ -81,7 +80,6 @@
import org.confluence.mod.item.curio.movement.IFallResistance;
import org.confluence.mod.item.sword.BloodButchereSword;
import org.confluence.mod.item.sword.BreathingReed;
import org.confluence.mod.item.sword.DeveloperSword;
import org.confluence.mod.item.sword.TentacleMaceSword;
import org.confluence.mod.misc.ModAttributes;
import org.confluence.mod.misc.ModConfigs;
Expand Down Expand Up @@ -231,8 +229,15 @@ public static void livingDeath(LivingDeathEvent event) {
}
}
if (!living.level().isClientSide) {
if (living instanceof TerraBossBase terra) {
terra.onDeath();
if (living instanceof Boss boss) {
if (boss.shouldShowMessage()){
LivingEntity e = (LivingEntity) boss;
Level level = e.level();
if (!level.isClientSide) level.players().
forEach(player ->
player.sendSystemMessage(Component.translatable("bossevent.confluence.boss_death", e.getDisplayName().getString())
.withStyle(ChatFormatting.DARK_PURPLE)));
}
}
}
}
Expand Down Expand Up @@ -400,8 +405,17 @@ public static void mobFinalizeSpawn(MobSpawnEvent.FinalizeSpawn event) {
demonEye.setVariant(DemonEyeVariant.random(randomSource));
} else if (mob instanceof BlackSlime blackSlime) {
blackSlime.finalizeSpawn(randomSource, event.getDifficulty());
} else if (mob instanceof TerraBossBase terra) {
terra.onFinializeSpawn();
} else if (mob instanceof Boss boss) {
if (boss.shouldShowMessage()){
LivingEntity e = (LivingEntity) boss;
Level level = e.level();
if (!level.isClientSide) level.players().
forEach(player ->
player.sendSystemMessage(Component.translatable(
"bossevent.confluence.boss_generate",
e.getDisplayName().getString())
.withStyle(ChatFormatting.DARK_PURPLE)));
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/confluence/mod/util/ModUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.confluence.mod.Confluence;
import org.confluence.mod.client.color.AnimateColor;
import org.confluence.mod.client.color.FloatRGBA;
import org.confluence.mod.entity.boss.Boss;
import org.confluence.mod.entity.boss.IBossFSM;
import org.confluence.mod.item.ModItems;
import org.confluence.mod.misc.ModConfigs;
Expand Down Expand Up @@ -431,7 +432,7 @@ public static boolean hasBoss(double radius, Level level,
AABB box){
boolean flag = false;
for (Entity entity : getNearbyEntities(radius, level, Entity.class, box)) {
if (entity instanceof IBossFSM) {
if (entity instanceof Boss) {
flag = true;
break;
}
Expand Down

0 comments on commit b6fad23

Please sign in to comment.