v1.4.2-t3
This commit is contained in:
1 parent
d04c730b67
commit
d362e58d3e
20 files changed
+754
-91
No files matched your search
@@ -10,6 +10,9 @@ import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
public class Config {
|
||||
public static final ModConfigSpec SPEC;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue BLOOD_BUTCHERER_DAMAGE_PER_LEVEL;
|
||||
public static final ModConfigSpec.DoubleValue DEMONIC_FLAMES_DAMAGE_PER_LEVEL;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue ENCHANTED_SWORD_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue ENCHANTED_SWORD_LIFETIME;
|
||||
public static final ModConfigSpec.DoubleValue ENCHANTED_SWORD_SPEED;
|
||||
@@ -20,7 +23,6 @@ public class Config {
|
||||
|
||||
public static final ModConfigSpec.IntValue BLOOD_BUTCHERER_EFFECT_DURATION;
|
||||
public static final ModConfigSpec.IntValue BLOOD_BUTCHERER_MAX_LEVEL;
|
||||
public static final ModConfigSpec.DoubleValue BLOOD_BUTCHERER_DAMAGE_PER_LEVEL;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue BLADE_OF_GRASS_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue BLADE_OF_GRASS_EFFECT_DURATION;
|
||||
@@ -147,6 +149,27 @@ public class Config {
|
||||
public static final ModConfigSpec.IntValue TRUE_NIGHTS_EDGE_PROJECTILE_LIFETIME;
|
||||
public static final ModConfigSpec.IntValue TRUE_NIGHTS_EDGE_PROJECTILE_ROTATION_SPEED;
|
||||
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_KILL_MODE_TIME;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_KILL_MODE_COOLDOWN_TIME;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_PROJECTILE_LIFETIME;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_PROJECTILE_SPEED;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_STUCK_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_STUCK_PROJECTILE_LIFETIME;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_STUCK_PROJECTILE_SPEED;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_CYCLE;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_ROTATE;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_STUCK_LIFETIME;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_MAX_STUCK_COUNT;
|
||||
public static final ModConfigSpec.DoubleValue DEVILS_DEVASTATION_MARK_LIGHTNING_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_PROJECTILE_EFFECT_DURATION;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_STUCK_PROJECTILE_EFFECT_DURATION;
|
||||
public static final ModConfigSpec.IntValue DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_EFFECT_DURATION;
|
||||
|
||||
public static double bloodButchererDamagePerLevel;
|
||||
public static double demonicFlamesDamagePerLevel;
|
||||
|
||||
public static double enchantedSwordDamage;
|
||||
public static int enchantedSwordLifetime;
|
||||
public static double enchantedSwordSpeed;
|
||||
@@ -157,7 +180,6 @@ public class Config {
|
||||
|
||||
public static int bloodButchererEffectDuration;
|
||||
public static int bloodButchererMaxLevel;
|
||||
public static double bloodButchererDamagePerLevel;
|
||||
|
||||
public static double bladeOfGrassProjectileDamage;
|
||||
public static int bladeOfGrassEffectDuration;
|
||||
@@ -284,9 +306,39 @@ public class Config {
|
||||
public static int trueNightsEdgeProjectileLifetime;
|
||||
public static int trueNightsEdgeProjectileRotationSpeed;
|
||||
|
||||
public static int devilsDevastationKillModeTime;
|
||||
public static int devilsDevastationKillModeCooldownTime;
|
||||
public static double devilsDevastationProjectileDamage;
|
||||
public static int devilsDevastationProjectileLifetime;
|
||||
public static double devilsDevastationProjectileSpeed;
|
||||
public static double devilsDevastationStuckProjectileDamage;
|
||||
public static int devilsDevastationStuckProjectileLifetime;
|
||||
public static double devilsDevastationStuckProjectileSpeed;
|
||||
public static int devilsDevastationKillModeProjectileCycle;
|
||||
public static double devilsDevastationKillModeProjectileDamage;
|
||||
public static int devilsDevastationKillModeProjectileRotate;
|
||||
public static int devilsDevastationStuckLifetime;
|
||||
public static int devilsDevastationMaxStuckCount;
|
||||
public static double devilsDevastationMarkLightningDamage;
|
||||
public static int devilsDevastationProjectileEffectDuration;
|
||||
public static int devilsDevastationStuckProjectileEffectDuration;
|
||||
public static int devilsDevastationKillModeProjectileEffectDuration;
|
||||
|
||||
static {
|
||||
ModConfigSpec.Builder builder = new ModConfigSpec.Builder();
|
||||
|
||||
builder.push("effect_settings");
|
||||
|
||||
BLOOD_BUTCHERER_DAMAGE_PER_LEVEL = builder
|
||||
.comment("血腥屠宰效果每级伤害")
|
||||
.defineInRange("blood_butcherer_damage_per_level", 0.5, 0, 8388600);
|
||||
|
||||
DEMONIC_FLAMES_DAMAGE_PER_LEVEL = builder
|
||||
.comment("恶魔之焰效果每级伤害")
|
||||
.defineInRange("demonic_flames_damage_per_level", 2.5, 0, 8388600);
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("enchanted_sword_settings");
|
||||
|
||||
ENCHANTED_SWORD_DAMAGE = builder
|
||||
@@ -330,10 +382,6 @@ public class Config {
|
||||
.comment("血腥屠宰效果最大等级")
|
||||
.defineInRange("blood_butcherer_max_level", 4, 0, 255);
|
||||
|
||||
BLOOD_BUTCHERER_DAMAGE_PER_LEVEL = builder
|
||||
.comment("血腥屠宰效果每级伤害")
|
||||
.defineInRange("blood_butcherer_damage_per_level", 0.5, 0, 8388600);
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("blade_of_grass_settings");
|
||||
@@ -847,12 +895,86 @@ public class Config {
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("devils_devastation_settings");
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_TIME = builder
|
||||
.comment("杀戮模式持续时间(刻)")
|
||||
.defineInRange("devils_devastation_kill_mode_time", 100, 0, 72000);
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_COOLDOWN_TIME = builder
|
||||
.comment("杀戮模式冷却时间(刻)")
|
||||
.defineInRange("devils_devastation_kill_mode_cooldown_time", 100, 0, 72000);
|
||||
|
||||
DEVILS_DEVASTATION_PROJECTILE_DAMAGE = builder
|
||||
.comment("右键弹射伤害")
|
||||
.defineInRange("devils_devastation_projectile_damage", 30.0, 0, 2147483647.0);
|
||||
|
||||
DEVILS_DEVASTATION_PROJECTILE_LIFETIME = builder
|
||||
.comment("右键弹射持续时间(刻)")
|
||||
.defineInRange("devils_devastation_projectile_lifetime", 40, 1, 1200);
|
||||
|
||||
DEVILS_DEVASTATION_PROJECTILE_SPEED = builder
|
||||
.comment("右键弹射速度")
|
||||
.defineInRange("devils_devastation_projectile_speed", 3.0, 0, 10);
|
||||
|
||||
DEVILS_DEVASTATION_STUCK_PROJECTILE_DAMAGE = builder
|
||||
.comment("弹出弹射伤害")
|
||||
.defineInRange("devils_devastation_stuck_projectile_damage", 30.0, 0, 2147483647.0);
|
||||
|
||||
DEVILS_DEVASTATION_STUCK_PROJECTILE_LIFETIME = builder
|
||||
.comment("弹出弹射持续时间(刻)")
|
||||
.defineInRange("devils_devastation_stuck_projectile_lifetime", 40, 1, 1200);
|
||||
|
||||
DEVILS_DEVASTATION_STUCK_PROJECTILE_SPEED = builder
|
||||
.comment("弹出弹射速度")
|
||||
.defineInRange("devils_devastation_stuck_projectile_speed", 3.0, 0, 10);
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_CYCLE = builder
|
||||
.comment("杀戮模式弹射周期(刻)")
|
||||
.defineInRange("devils_devastation_kill_mode_projectile_cycle", 10, 1, 200);
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_DAMAGE = builder
|
||||
.comment("杀戮模式弹射伤害")
|
||||
.defineInRange("devils_devastation_kill_mode_projectile_damage", 200.0, 0, 2147483647.0);
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_ROTATE = builder
|
||||
.comment("杀戮模式弹射旋转角度")
|
||||
.defineInRange("devils_devastation_kill_mode_projectile_rotate", 30, 0, 360);
|
||||
|
||||
DEVILS_DEVASTATION_STUCK_LIFETIME = builder
|
||||
.comment("附着弹射存在时间(刻)")
|
||||
.defineInRange("devils_devastation_stuck_lifetime", 200, 1, 72000);
|
||||
|
||||
DEVILS_DEVASTATION_MAX_STUCK_COUNT = builder
|
||||
.comment("最大附着数量")
|
||||
.defineInRange("devils_devastation_max_stuck_count", 5, 1, 50);
|
||||
|
||||
DEVILS_DEVASTATION_MARK_LIGHTNING_DAMAGE = builder
|
||||
.comment("标记闪电伤害")
|
||||
.defineInRange("devils_devastation_mark_lightning_damage", 100.0, 0, 2147483647.0);
|
||||
|
||||
DEVILS_DEVASTATION_PROJECTILE_EFFECT_DURATION = builder
|
||||
.comment("右键弹射造成效果持续时间(刻)")
|
||||
.defineInRange("devils_devastation_projectile_effect_duration", 40, 0, 72000);
|
||||
|
||||
DEVILS_DEVASTATION_STUCK_PROJECTILE_EFFECT_DURATION = builder
|
||||
.comment("弹出弹射造成效果持续时间(刻)")
|
||||
.defineInRange("devils_devastation_stuck_projectile_effect_duration", 60, 0, 72000);
|
||||
|
||||
DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_EFFECT_DURATION = builder
|
||||
.comment("杀戮模式弹射造成效果持续时间(刻)")
|
||||
.defineInRange("devils_devastation_kill_mode_projectile_effect_duration", 70, 0, 72000);
|
||||
|
||||
builder.pop();
|
||||
|
||||
SPEC = builder.build();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event) {
|
||||
if(event.getConfig().getSpec() == SPEC) {
|
||||
bloodButchererDamagePerLevel = BLOOD_BUTCHERER_DAMAGE_PER_LEVEL.get();
|
||||
demonicFlamesDamagePerLevel = DEMONIC_FLAMES_DAMAGE_PER_LEVEL.get();
|
||||
enchantedSwordDamage = ENCHANTED_SWORD_DAMAGE.get();
|
||||
enchantedSwordLifetime = ENCHANTED_SWORD_LIFETIME.get();
|
||||
enchantedSwordSpeed = ENCHANTED_SWORD_SPEED.get();
|
||||
@@ -968,6 +1090,23 @@ public class Config {
|
||||
trueNightsEdgeProjectileAcceleration = TRUE_NIGHTS_EDGE_PROJECTILE_ACCELERATION.get();
|
||||
trueNightsEdgeProjectileLifetime = TRUE_NIGHTS_EDGE_PROJECTILE_LIFETIME.get();
|
||||
trueNightsEdgeProjectileRotationSpeed = TRUE_NIGHTS_EDGE_PROJECTILE_ROTATION_SPEED.get();
|
||||
devilsDevastationKillModeTime = DEVILS_DEVASTATION_KILL_MODE_TIME.get();
|
||||
devilsDevastationKillModeCooldownTime = DEVILS_DEVASTATION_KILL_MODE_COOLDOWN_TIME.get();
|
||||
devilsDevastationProjectileDamage = DEVILS_DEVASTATION_PROJECTILE_DAMAGE.get();
|
||||
devilsDevastationProjectileLifetime = DEVILS_DEVASTATION_PROJECTILE_LIFETIME.get();
|
||||
devilsDevastationProjectileSpeed = DEVILS_DEVASTATION_PROJECTILE_SPEED.get();
|
||||
devilsDevastationStuckProjectileDamage = DEVILS_DEVASTATION_STUCK_PROJECTILE_DAMAGE.get();
|
||||
devilsDevastationStuckProjectileLifetime = DEVILS_DEVASTATION_STUCK_PROJECTILE_LIFETIME.get();
|
||||
devilsDevastationStuckProjectileSpeed = DEVILS_DEVASTATION_STUCK_PROJECTILE_SPEED.get();
|
||||
devilsDevastationKillModeProjectileCycle = DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_CYCLE.get();
|
||||
devilsDevastationKillModeProjectileDamage = DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_DAMAGE.get();
|
||||
devilsDevastationKillModeProjectileRotate = DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_ROTATE.get();
|
||||
devilsDevastationStuckLifetime = DEVILS_DEVASTATION_STUCK_LIFETIME.get();
|
||||
devilsDevastationMaxStuckCount = DEVILS_DEVASTATION_MAX_STUCK_COUNT.get();
|
||||
devilsDevastationMarkLightningDamage = DEVILS_DEVASTATION_MARK_LIGHTNING_DAMAGE.get();
|
||||
devilsDevastationProjectileEffectDuration = DEVILS_DEVASTATION_PROJECTILE_EFFECT_DURATION.get();
|
||||
devilsDevastationStuckProjectileEffectDuration = DEVILS_DEVASTATION_STUCK_PROJECTILE_EFFECT_DURATION.get();
|
||||
devilsDevastationKillModeProjectileEffectDuration = DEVILS_DEVASTATION_KILL_MODE_PROJECTILE_EFFECT_DURATION.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
@@ -23,21 +24,19 @@ public class BloodButcheredEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if(entity.level().isClientSide()) {
|
||||
Vec3 center = entity.getBoundingBox().getCenter();
|
||||
ParticleUtil.addParticles(
|
||||
entity.level(), ModParticles.BLOOD_BUTCHERED_PARTICLE.get(),
|
||||
center, 0.05,
|
||||
new Vec3(0, 0, 0), Math.min((amplifier + 1) * 0.1, 0.5),
|
||||
Math.min(amplifier + 1, 5)
|
||||
);
|
||||
}else {
|
||||
if(entity.level() instanceof ServerLevel serverLevel) {
|
||||
MobEffectInstance instance = entity.getEffect(ModEffects.BLOOD_BUTCHERED);
|
||||
if(instance != null) {
|
||||
if(instance.getDuration() % 20 == 0) {
|
||||
entity.hurt(entity.damageSources().magic(), (float) Config.bloodButchererDamagePerLevel * (amplifier + 1));
|
||||
}
|
||||
}
|
||||
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, ModParticles.BLOOD_BUTCHERED_PARTICLE.get(),
|
||||
entity.getBoundingBox().getCenter(), new Vec3(0, 0, 0),
|
||||
Math.min((amplifier + 1) * 0.1, 0.5), Math.min(amplifier + 1, 5)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.lzxnone.terraria.effect;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.particle.CircleParticleOptions;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class DemonicFlamesEffect extends MobEffect {
|
||||
public DemonicFlamesEffect() {
|
||||
super(MobEffectCategory.HARMFUL, 0xCC2DC7);
|
||||
}
|
||||
|
||||
public static final CircleParticleOptions PARTICLE = new CircleParticleOptions(0.075f, 20, new Vector3f(0.8f, 0.176f, 0.78f));
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if(entity.level() instanceof ServerLevel serverLevel) {
|
||||
MobEffectInstance instance = entity.getEffect(ModEffects.DEMONIC_FLAMES);
|
||||
if(instance != null) {
|
||||
if(entity.tickCount % 4 == 0) {
|
||||
entity.invulnerableTime = 5;
|
||||
entity.hurt(entity.damageSources().magic(), (float) Config.demonicFlamesDamagePerLevel * (amplifier + 1));
|
||||
}
|
||||
}
|
||||
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
entity.getBoundingBox().getCenter(), new Vec3(0, 0, 0),
|
||||
0.2, 1
|
||||
);
|
||||
}else {
|
||||
LzxnoneTerraria.LOGGER.info("11");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lzxnone.terraria.effect;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.item.weapon.melee.DevilsDevastation;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -47,7 +48,7 @@ public class EffectLogicHandler {
|
||||
new ClientboundRemoveMobEffectPacket(entity.getId(), currentEffect));
|
||||
}
|
||||
if(currentEffect == ModEffects.KILL_MODE) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, DevilsDevastation.KIll_MODE_COOLDOWN_TIME, 0);
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, Config.devilsDevastationKillModeCooldownTime, 0);
|
||||
entity.addEffect(effectInstance);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class EffectLogicHandler {
|
||||
new ClientboundRemoveMobEffectPacket(entity.getId(), currentEffect));
|
||||
}
|
||||
if(currentEffect == ModEffects.KILL_MODE) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, DevilsDevastation.KIll_MODE_COOLDOWN_TIME, 0);
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, Config.devilsDevastationKillModeCooldownTime, 0);
|
||||
entity.addEffect(effectInstance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@ import net.minecraft.world.effect.MobEffectCategory;
|
||||
|
||||
public class KillModeCooldownEffect extends MobEffect {
|
||||
public KillModeCooldownEffect() {
|
||||
super(MobEffectCategory.NEUTRAL, 0xFF00FF);
|
||||
super(MobEffectCategory.NEUTRAL, 0xCC2DC7);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,26 @@
|
||||
package com.lzxnone.terraria.effect;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.melee.DevilsDevastation;
|
||||
import com.lzxnone.terraria.particle.CircleParticleOptions;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class KillModeEffect extends MobEffect {
|
||||
public KillModeEffect() {
|
||||
super(MobEffectCategory.BENEFICIAL, 0xFF00FF);
|
||||
super(MobEffectCategory.BENEFICIAL, 0xCC2DC7);
|
||||
}
|
||||
|
||||
public static final CircleParticleOptions PARTICLE = new CircleParticleOptions(0.075f, 20, new Vector3f(0.8f, 0.176f, 0.78f));
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
||||
return true;
|
||||
@@ -20,10 +28,23 @@ public class KillModeEffect extends MobEffect {
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if(!entity.level().isClientSide()) {
|
||||
if(entity.level() instanceof ServerLevel serverLevel) {
|
||||
ItemStack stack = entity.getMainHandItem();
|
||||
if(!stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, DevilsDevastation.KIll_MODE_COOLDOWN_TIME, 0);
|
||||
if(stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
if(entity.getDeltaMovement().length() > 0.001) {
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
entity.getBoundingBox().getCenter().add(new Vec3(0, Math.sin(entity.tickCount / 5.0), 0)), new Vec3(0, 0, 0),
|
||||
0, 1
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
entity.getBoundingBox().getCenter().add(new Vec3(0, -Math.sin(entity.tickCount / 5.0), 0)), new Vec3(0, 0, 0),
|
||||
0, 1
|
||||
);
|
||||
}
|
||||
}else {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, Config.devilsDevastationKillModeCooldownTime, 0);
|
||||
entity.addEffect(effectInstance);
|
||||
|
||||
MobEffectInstance effectInstance2 = entity.getEffect(ModEffects.KILL_MODE);
|
||||
|
||||
@@ -18,4 +18,6 @@ public class ModEffects {
|
||||
MOB_EFFECTS.register("kill_mode", KillModeEffect::new);
|
||||
public static final DeferredHolder<MobEffect, KillModeCooldownEffect> KILL_MODE_COOLDOWN =
|
||||
MOB_EFFECTS.register("kill_mode_cooldown", KillModeCooldownEffect::new);
|
||||
public static final DeferredHolder<MobEffect, DemonicFlamesEffect> DEMONIC_FLAMES =
|
||||
MOB_EFFECTS.register("demonic_flames", DemonicFlamesEffect::new);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class StaticSummonBehaviors {
|
||||
public static final String TERRAGRIM_BEAM = "terragrim_beam";
|
||||
public static final String FIRST_FRACTAL_PROJECTILE = "first_fractal_projectile";
|
||||
public static final String MACE_PROJECTILE = "mace_projectile";
|
||||
public static final String DEVILS_DEVASTATION_PROJECTILE = "devils_devastation_projectile";
|
||||
public static final String DEVILS_DEVASTATION_STUCK_PROJECTILE = "devils_devastation_stuck_projectile";
|
||||
public static final String DEVILS_DEVASTATION_LIGHTNING = "devils_devastation_lightning";
|
||||
public static final String DEVILS_DEVASTATION_MARK = "devils_devastation_mark";
|
||||
public static final String DEVILS_DEVASTATION_MARK_LIGHTNING = "devils_devastation_mark_lightning";
|
||||
@@ -40,7 +40,7 @@ public class StaticSummonBehaviors {
|
||||
BEHAVIORS.put(TERRAGRIM_BEAM, Terragrim.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(FIRST_FRACTAL_PROJECTILE, FirstFractal.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(MACE_PROJECTILE, Mace.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_PROJECTILE, DevilsDevastation.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_STUCK_PROJECTILE, DevilsDevastation.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR2);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_MARK, DevilsDevastation.SUMMON_BEHAVIOR3);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_MARK_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR4);
|
||||
|
||||
@@ -21,7 +21,6 @@ public class EntityDeathEventHandler {
|
||||
LivingEntity livingEntity = event.getEntity();
|
||||
|
||||
//消耗插入的破灭魔王剑
|
||||
/*
|
||||
if(livingEntity.level() instanceof ServerLevel serverLevel) {
|
||||
List<UUID> stuckList = livingEntity.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE);
|
||||
while(!stuckList.isEmpty()) {
|
||||
@@ -30,6 +29,6 @@ public class EntityDeathEventHandler {
|
||||
Entity stuck = serverLevel.getEntity(uuid);
|
||||
if(stuck instanceof StaticSummon stuckProjectile) DevilsDevastation.summonStuckProjectile(stuckProjectile);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.lzxnone.terraria.item;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.util.FastColor;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class ItemNameRenderer {
|
||||
public static boolean shouldHackHeldItemName(ItemStack stack) {
|
||||
return stack.is(ModItems.DEVILS_DEVASTATION.get());
|
||||
}
|
||||
|
||||
public static boolean shouldHackTooltipItemName(ItemStack stack) {
|
||||
return stack.is(ModItems.DEVILS_DEVASTATION.get());
|
||||
}
|
||||
|
||||
public static void renderHeldItemName(
|
||||
GuiGraphics guiGraphics,
|
||||
Font font,
|
||||
ItemStack stack,
|
||||
Component name,
|
||||
int yShift,
|
||||
int alpha,
|
||||
boolean canHurtPlayer
|
||||
) {
|
||||
String plainName = name.getString();
|
||||
int textWidth = font.width(plainName);
|
||||
int x = (guiGraphics.guiWidth() - textWidth) / 2;
|
||||
int y = guiGraphics.guiHeight() - Math.max(yShift, 59);
|
||||
if(!canHurtPlayer) {
|
||||
y += 14;
|
||||
}
|
||||
|
||||
if(stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
renderDevilsDevastationItemName(guiGraphics, font, plainName, x, y, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderTooltipItemName(
|
||||
GuiGraphics guiGraphics,
|
||||
Font font,
|
||||
ItemStack stack,
|
||||
int x,
|
||||
int y
|
||||
) {
|
||||
if(stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
renderDevilsDevastationItemName(guiGraphics, font, stack.getHoverName().getString(), x, y, 255);
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderDevilsDevastationItemName(
|
||||
GuiGraphics guiGraphics,
|
||||
Font font,
|
||||
String plainName,
|
||||
int x,
|
||||
int y,
|
||||
int alpha
|
||||
) {
|
||||
int textWidth = font.width(plainName);
|
||||
FormattedCharSequence plainText = FormattedCharSequence.forward(plainName, Style.EMPTY);
|
||||
|
||||
//外层字体和描边颜色
|
||||
int outerTextColor = FastColor.ARGB32.color(0x04, 0xB373F4);
|
||||
int outerOutlineColor = FastColor.ARGB32.color(alpha / 2, 0xB373F4);
|
||||
|
||||
//内层字体和描边颜色
|
||||
int innerTextColor = FastColor.ARGB32.color(alpha, 0x000000);
|
||||
int innerOutlineColor = FastColor.ARGB32.color(alpha, 0xB373F4);
|
||||
|
||||
//外层字体
|
||||
float scale = 0.08F;
|
||||
double speed = 0.004D;
|
||||
double wave = Math.sin(Util.getMillis() * speed);
|
||||
float breathScale = 1.0F + (float)((wave + 1.0D) * 0.5D) * scale;
|
||||
|
||||
float centerX = x + textWidth / 2.0F;
|
||||
float centerY = y + font.lineHeight / 2.0F;
|
||||
|
||||
guiGraphics.pose().pushPose();
|
||||
guiGraphics.pose().translate(centerX, centerY, 0.0F);
|
||||
guiGraphics.pose().scale(breathScale, breathScale, 1.0F);
|
||||
guiGraphics.pose().translate(-centerX, -centerY, 0.0F);
|
||||
font.drawInBatch8xOutline(
|
||||
plainText,
|
||||
x,
|
||||
y,
|
||||
outerTextColor,
|
||||
outerOutlineColor,
|
||||
guiGraphics.pose().last().pose(),
|
||||
guiGraphics.bufferSource(),
|
||||
15728880
|
||||
);
|
||||
guiGraphics.pose().popPose();
|
||||
|
||||
//内层字体
|
||||
font.drawInBatch8xOutline(
|
||||
plainText,
|
||||
x,
|
||||
y,
|
||||
innerTextColor,
|
||||
innerOutlineColor,
|
||||
guiGraphics.pose().last().pose(),
|
||||
guiGraphics.bufferSource(),
|
||||
15728880
|
||||
);
|
||||
guiGraphics.flush();
|
||||
|
||||
//星星流动
|
||||
ResourceLocation starTexture = ResourceLocation.fromNamespaceAndPath(
|
||||
LzxnoneTerraria.MODID,
|
||||
"textures/vfx/devils_name_star.png"
|
||||
);
|
||||
int starSize = 2;
|
||||
int flowHeight = font.lineHeight + starSize * 2;
|
||||
float starSpeed = 0.02F;
|
||||
float time = Util.getMillis() * starSpeed;
|
||||
int charX = x;
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, alpha / 255.0F);
|
||||
for(int i = 0; i < plainName.length(); i++) {
|
||||
String character = plainName.substring(i, i + 1);
|
||||
int charWidth = font.width(character);
|
||||
if(charWidth <= 0) {
|
||||
charX += charWidth;
|
||||
continue;
|
||||
}
|
||||
|
||||
guiGraphics.enableScissor(charX, y, charX + charWidth, y + font.lineHeight);
|
||||
int starCount = charWidth >= 8 ? 2 : 1;
|
||||
for(int starIndex = 0; starIndex < starCount; starIndex++) {
|
||||
int xRange = Math.max(1, charWidth - starSize);
|
||||
int starX = charX + Math.floorMod(i * 5 + starIndex * 3, xRange + 1);
|
||||
float offset = i * 7.0F + starIndex * 13.0F;
|
||||
int starY = Math.round(y + font.lineHeight + starSize - ((time + offset) % flowHeight));
|
||||
guiGraphics.blit(
|
||||
starTexture,
|
||||
starX,
|
||||
starY,
|
||||
starSize,
|
||||
starSize,
|
||||
0.0F,
|
||||
0.0F,
|
||||
8,
|
||||
8,
|
||||
8,
|
||||
8
|
||||
);
|
||||
}
|
||||
guiGraphics.disableScissor();
|
||||
charX += charWidth;
|
||||
}
|
||||
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -74,6 +75,14 @@ public class DevilsDevastation extends SwordItem {
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
|
||||
tooltipComponents.add(Component.translatable("tooltip.lzxnoneterraria.devils_devastation.0").withStyle(style -> style.withColor(0xAE3288)));
|
||||
tooltipComponents.add(Component.translatable("tooltip.lzxnoneterraria.devils_devastation.1").withStyle(style -> style.withColor(0xAE3288)));
|
||||
tooltipComponents.add(Component.translatable("tooltip.lzxnoneterraria.devils_devastation.2").withStyle(style -> style.withColor(0xAE3288)));
|
||||
}
|
||||
|
||||
public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/normal_trail.png");
|
||||
public static final ResourceLocation RES2 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/circular_smear_smokey.png");
|
||||
public static final ResourceLocation RES3 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/circular_smear_fire3.png");
|
||||
@@ -87,32 +96,13 @@ public class DevilsDevastation extends SwordItem {
|
||||
public static final float ENERGY_WAVE_LENGTH = 30;
|
||||
public static final int ENERGY_WAVE_SEG = 20;
|
||||
|
||||
//杀戮模式
|
||||
public static final int KIll_MODE_TIME = 100;
|
||||
public static final int KIll_MODE_COOLDOWN_TIME = 100;
|
||||
|
||||
//右键射出的弹射
|
||||
public static final int PROJECTILE_TRAIL_LENGTH = 10;
|
||||
public static final float PROJECTILE_TRAIL_RADIUS = 0.25F;
|
||||
public static final float PROJECTILE_DAMAGE = 19.9f;
|
||||
public static final int PROJECTILE_LIFETIME = 40;
|
||||
public static final double PROJECTILE_SPEED = 3.0;
|
||||
|
||||
//弹出的弹射
|
||||
public static final float STUCK_PROJECTILE_DAMAGE = 30.0f;
|
||||
public static final int STUCK_PROJECTILE_LIFETIME = 40;
|
||||
public static final double STUCK_PROJECTILE_SPEED = 3.0;
|
||||
public static final double STUCK_PROJECTILE_BOUNDING_SIZE = 3.0;
|
||||
|
||||
//杀戮模式弹射
|
||||
public static final int KILL_MODE_PROJECTILE_CYCLE = 10;
|
||||
public static final float KILL_MODE_PROJECTILE_DAMAGE = 200.0f;
|
||||
public static final int KILL_MODE_PROJECTILE_ROTATE = 30;
|
||||
|
||||
//附着在生物身上的弹射
|
||||
public static final int STUCK_LIFETIME = 200;
|
||||
public static final int MAX_STUCK_COUNT = 5;
|
||||
|
||||
//右键弹射击中生成的闪电
|
||||
public static final float PROJECTILE_HIT_LIGHTNING_RADIUS = 1.0F;
|
||||
public static final float PROJECTILE_HIT_LIGHTNING_LENGTH = 32F;
|
||||
@@ -124,7 +114,6 @@ public class DevilsDevastation extends SwordItem {
|
||||
public static final float MARK_LENGTH = 2.0f;
|
||||
|
||||
//标记触发后的闪电
|
||||
public static final int MARK_LIGHTNING_LIFETIME = 10;
|
||||
public static final float MARK_LIGHTNING_LENGTH = 32F;
|
||||
public static final float MARK_LIGHTNING_RADIUS = 3.0F;
|
||||
public static final int MARK_LIGHTNING_DEPTH = 3;
|
||||
@@ -179,12 +168,18 @@ public class DevilsDevastation extends SwordItem {
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, PROJECTILE_DAMAGE)) {
|
||||
if(DamageUtil.attack(player, target, (float) Config.devilsDevastationProjectileDamage)) {
|
||||
if(target instanceof LivingEntity le) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, Config.devilsDevastationProjectileEffectDuration, 0);
|
||||
le.addEffect(effectInstance);
|
||||
}
|
||||
target.invulnerableTime = 5;
|
||||
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
|
||||
summon.setOwner(target);
|
||||
Vec3 pos = projectile.position();
|
||||
summon.setPos(pos);
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_PROJECTILE);
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_STUCK_PROJECTILE);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "item");
|
||||
summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
summon.getEntityData().set(StaticSummon.SCALE_X, 4.0f);
|
||||
@@ -192,7 +187,7 @@ public class DevilsDevastation extends SwordItem {
|
||||
summon.getEntityData().set(StaticSummon.SCALE_Z, 4.0f);
|
||||
summon.getEntityData().set(StaticSummon.RXP, -90);
|
||||
summon.getEntityData().set(StaticSummon.RZP, -135);
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, STUCK_LIFETIME);
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, Config.devilsDevastationStuckLifetime);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
@@ -211,6 +206,21 @@ public class DevilsDevastation extends SwordItem {
|
||||
|
||||
summon.level().addFreshEntity(summon);
|
||||
|
||||
if(!target.isAlive()) {
|
||||
summonStuckProjectile(summon);
|
||||
}
|
||||
if(target.isAlive()) {
|
||||
List<UUID> uuids = new ArrayList<>(target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE));
|
||||
if (uuids.size() >= Config.devilsDevastationMaxStuckCount) {
|
||||
Entity stuckProjectile = ((ServerLevel) projectile.level()).getEntity(uuids.getFirst());
|
||||
if (stuckProjectile != null && stuckProjectile.isAlive() && stuckProjectile instanceof StaticSummon stuckStaticProjectile)
|
||||
summonStuckProjectile(stuckStaticProjectile);
|
||||
uuids.removeFirst();
|
||||
}
|
||||
uuids.add(summon.getUUID());
|
||||
target.setData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE, uuids);
|
||||
}
|
||||
|
||||
StaticSummon lightning = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
|
||||
lightning.setOwner(owner);
|
||||
lightning.setPos(pos);
|
||||
@@ -226,16 +236,6 @@ public class DevilsDevastation extends SwordItem {
|
||||
lightning.getEntityData().set(StaticSummon.LIFETIME, 10);
|
||||
lightning.level().addFreshEntity(lightning);
|
||||
|
||||
target.invulnerableTime = 5;
|
||||
List<UUID> uuids = new ArrayList<>(target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE));
|
||||
if(uuids.size() >= MAX_STUCK_COUNT) {
|
||||
Entity stuckProjectile = ((ServerLevel) projectile.level()).getEntity(uuids.getFirst());
|
||||
if(stuckProjectile != null && stuckProjectile.isAlive() && stuckProjectile instanceof StaticSummon stuckStaticProjectile) summonStuckProjectile(stuckStaticProjectile);
|
||||
uuids.removeFirst();
|
||||
}
|
||||
uuids.add(summon.getUUID());
|
||||
target.setData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE, uuids);
|
||||
|
||||
for(int i = 0;i < 50;i++) {
|
||||
Vec3 dir = MathUtil.toVec3(projectile.getEntityData().get(StaticProjectile.DIRECTION));
|
||||
dir = spreadDir(dir, new Random(), 0.5f).normalize();
|
||||
@@ -400,7 +400,11 @@ public class DevilsDevastation extends SwordItem {
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, STUCK_PROJECTILE_DAMAGE)) {
|
||||
if(DamageUtil.attack(player, target, (float) Config.devilsDevastationStuckProjectileDamage)) {
|
||||
if(target instanceof LivingEntity le) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, Config.devilsDevastationStuckProjectileEffectDuration, 0);
|
||||
le.addEffect(effectInstance);
|
||||
}
|
||||
target.invulnerableTime = 5;
|
||||
onDied(projectile);
|
||||
}
|
||||
@@ -628,7 +632,14 @@ public class DevilsDevastation extends SwordItem {
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(projectile.level() instanceof ServerLevel serverLevel) {
|
||||
Entity target = result.getEntity();
|
||||
if(projectile.getOwner() instanceof Player player && DamageUtil.attack(player, target, KILL_MODE_PROJECTILE_DAMAGE)) {
|
||||
List<UUID> tempStuckList = target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE);
|
||||
boolean valid = !tempStuckList.isEmpty();
|
||||
if(projectile.getOwner() instanceof Player player && DamageUtil.attack(player, target, (float) Config.devilsDevastationKillModeProjectileDamage)) {
|
||||
if(target instanceof LivingEntity le) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, Config.devilsDevastationKillModeProjectileEffectDuration, 1);
|
||||
le.addEffect(effectInstance);
|
||||
}
|
||||
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if(stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
CompoundTag tag = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
@@ -648,7 +659,7 @@ public class DevilsDevastation extends SwordItem {
|
||||
summon.setPos(pos);
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_MARK);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, KIll_MODE_TIME);
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, Config.devilsDevastationKillModeTime);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
|
||||
CompoundTag summonCustomData = new CompoundTag();
|
||||
@@ -666,9 +677,8 @@ public class DevilsDevastation extends SwordItem {
|
||||
customData.putBoolean("hit", true);
|
||||
projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData);
|
||||
}
|
||||
|
||||
List<UUID> stuckList = new ArrayList<>(target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE));
|
||||
if(!customData.contains("validHit") && !stuckList.isEmpty()) {
|
||||
if(!customData.contains("validHit") && valid) {
|
||||
customData.putBoolean("validHit", true);
|
||||
while(!stuckList.isEmpty()) {
|
||||
UUID uuid = stuckList.getLast();
|
||||
@@ -678,8 +688,22 @@ public class DevilsDevastation extends SwordItem {
|
||||
}
|
||||
target.setData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE, stuckList);
|
||||
}
|
||||
|
||||
projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData);
|
||||
|
||||
StaticSummon lightning = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
|
||||
lightning.setOwner(player);
|
||||
lightning.setPos(target.getBoundingBox().getCenter());
|
||||
lightning.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_LIGHTNING);
|
||||
lightning.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
Vector3f dirVec = target.getBoundingBox().getCenter().subtract(projectile.position()).normalize().toVector3f();
|
||||
CompoundTag lightningData = new CompoundTag();
|
||||
lightningData.putDouble("dirX", dirVec.x());
|
||||
lightningData.putDouble("dirY", dirVec.y());
|
||||
lightningData.putDouble("dirZ", dirVec.z());
|
||||
lightningData.putLong("seed", projectile.getRandom().nextLong());
|
||||
lightning.getEntityData().set(StaticSummon.CUSTOM_DATA, lightningData);
|
||||
lightning.getEntityData().set(StaticSummon.LIFETIME, 10);
|
||||
lightning.level().addFreshEntity(lightning);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -690,13 +714,13 @@ public class DevilsDevastation extends SwordItem {
|
||||
CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA);
|
||||
if(projectile.getOwner() instanceof LivingEntity livingEntity) {
|
||||
if(customData.contains("validHit")) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE, KIll_MODE_TIME, 0);
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE, Config.devilsDevastationKillModeTime, 0);
|
||||
livingEntity.addEffect(effectInstance);
|
||||
|
||||
MobEffectInstance effectInstance2 = livingEntity.getEffect(ModEffects.KILL_MODE_COOLDOWN);
|
||||
if(effectInstance2 != null) livingEntity.removeEffect(effectInstance2.getEffect());
|
||||
}else {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, KIll_MODE_COOLDOWN_TIME, 0);
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE_COOLDOWN, Config.devilsDevastationKillModeCooldownTime, 0);
|
||||
livingEntity.addEffect(effectInstance);
|
||||
|
||||
MobEffectInstance effectInstance2 = livingEntity.getEffect(ModEffects.KILL_MODE);
|
||||
@@ -776,7 +800,7 @@ public class DevilsDevastation extends SwordItem {
|
||||
Vec3 end2 = start2.add(spreadDir(dir, rand2, 0.4F).scale(PROJECTILE_HIT_LIGHTNING_LENGTH * 0.5F));
|
||||
List<Vec3> branch2 = generateBranch(start2, end2, rand2, PROJECTILE_HIT_LIGHTNING_DEPTH, PROJECTILE_HIT_LIGHTNING_JITTER);
|
||||
|
||||
for(List<Vec3> branch : new List[]{branch0, branch1, branch2}) {
|
||||
for(List<Vec3> branch : List.of(branch0, branch1, branch2)) {
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 1.0F, alpha, 1,1,1, true);
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 1.25F, alpha * 0.5F, 0.7F,0.15F,0.55F, true);
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 0.75F, alpha * 0.2F, 0.5F,0.1F,0.4F, true);
|
||||
@@ -863,14 +887,14 @@ public class DevilsDevastation extends SwordItem {
|
||||
UUID uuid = customData.getUUID("uuid");
|
||||
Entity entity = serverLevel.getEntity(uuid);
|
||||
if(entity instanceof Player player) {
|
||||
DamageUtil.attack(player, owner, 10f);
|
||||
DamageUtil.attack(player, owner, (float) Config.devilsDevastationMarkLightningDamage);
|
||||
StaticSummon newSummon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), serverLevel);
|
||||
newSummon.setOwner(player);
|
||||
Vec3 pos = owner.getBoundingBox().getCenter();
|
||||
newSummon.setPos(pos);
|
||||
newSummon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_MARK_LIGHTNING);
|
||||
newSummon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
newSummon.getEntityData().set(StaticSummon.LIFETIME, MARK_LIGHTNING_LIFETIME);
|
||||
newSummon.getEntityData().set(StaticSummon.LIFETIME, 10);
|
||||
newSummon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
|
||||
CompoundTag newCustomData = new CompoundTag();
|
||||
@@ -975,9 +999,9 @@ public class DevilsDevastation extends SwordItem {
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, rotate);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, STUCK_PROJECTILE_LIFETIME);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, Config.devilsDevastationStuckProjectileLifetime);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", STUCK_PROJECTILE_SPEED));
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", Config.devilsDevastationStuckProjectileSpeed));
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
|
||||
serverLevel.addFreshEntity(projectile);
|
||||
@@ -990,12 +1014,12 @@ public class DevilsDevastation extends SwordItem {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(!itemStack.is(ModItems.DEVILS_DEVASTATION.get())) return;
|
||||
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) return;
|
||||
player.getCooldowns().addCooldown(itemStack.getItem(), 20);
|
||||
player.getCooldowns().addCooldown(itemStack.getItem(), Config.devilsDevastationKillModeProjectileCycle + 10);
|
||||
if(!player.level().isClientSide()) {
|
||||
float radius = 4.0f;
|
||||
float w = (float) Math.PI * 1.5f / KILL_MODE_PROJECTILE_CYCLE;
|
||||
float w = (float) Math.PI * 1.5f / Config.devilsDevastationKillModeProjectileCycle;
|
||||
if(player.getRandom().nextInt(2) == 0) w = -w;
|
||||
int rotate = (int) ((Math.random() * 2 - 1) * KILL_MODE_PROJECTILE_ROTATE);
|
||||
int rotate = (int) ((Math.random() * 2 - 1) * Config.devilsDevastationKillModeProjectileRotate);
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], rotate);
|
||||
|
||||
@@ -1010,7 +1034,7 @@ public class DevilsDevastation extends SwordItem {
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, KILL_MODE_PROJECTILE_CYCLE);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, Config.devilsDevastationKillModeProjectileCycle);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, rotate);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_X, w > 0 ? String.format("%.3f*cos(%.3f*t - 0.25 * 3.1415926)", radius, w) : String.format("%.3f*cos(%.3f*t - 0.75 * 3.1415926)", radius, w));
|
||||
@@ -1338,9 +1362,9 @@ public class DevilsDevastation extends SwordItem {
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Z, 4.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.RXP, -90);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, -135);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, PROJECTILE_LIFETIME);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, Config.devilsDevastationProjectileLifetime);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", PROJECTILE_SPEED));
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", Config.devilsDevastationProjectileSpeed));
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
level.addFreshEntity(projectile);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.lzxnone.terraria.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.lzxnone.terraria.item.ItemNameRenderer;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(GuiGraphics.class)
|
||||
public class GuiGraphicsMixin {
|
||||
@Shadow
|
||||
private ItemStack tooltipStack;
|
||||
|
||||
@Unique
|
||||
private boolean lzxnoneterraria$hackTooltipItemName;
|
||||
@Unique
|
||||
private int lzxnoneterraria$tooltipTextLineIndex;
|
||||
|
||||
@Inject(method = "renderTooltipInternal", at = @At("HEAD"))
|
||||
private void beginCustomTooltipName(
|
||||
Font font,
|
||||
List<ClientTooltipComponent> components,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
ClientTooltipPositioner tooltipPositioner,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
this.lzxnoneterraria$hackTooltipItemName = ItemNameRenderer.shouldHackTooltipItemName(this.tooltipStack);
|
||||
this.lzxnoneterraria$tooltipTextLineIndex = 0;
|
||||
}
|
||||
|
||||
@WrapOperation(
|
||||
method = "renderTooltipInternal",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent;renderText(Lnet/minecraft/client/gui/Font;IILorg/joml/Matrix4f;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;)V"
|
||||
)
|
||||
)
|
||||
private void renderCustomTooltipName(
|
||||
ClientTooltipComponent component,
|
||||
Font font,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
Matrix4f matrix,
|
||||
MultiBufferSource.BufferSource bufferSource,
|
||||
Operation<Void> original
|
||||
) {
|
||||
if(this.lzxnoneterraria$hackTooltipItemName && this.lzxnoneterraria$tooltipTextLineIndex == 0) {
|
||||
ItemNameRenderer.renderTooltipItemName(
|
||||
(GuiGraphics)(Object)this,
|
||||
font,
|
||||
this.tooltipStack,
|
||||
mouseX,
|
||||
mouseY
|
||||
);
|
||||
}else {
|
||||
original.call(component, font, mouseX, mouseY, matrix, bufferSource);
|
||||
}
|
||||
|
||||
this.lzxnoneterraria$tooltipTextLineIndex++;
|
||||
}
|
||||
|
||||
@Inject(method = "renderTooltipInternal", at = @At("RETURN"))
|
||||
private void endCustomTooltipName(
|
||||
Font font,
|
||||
List<ClientTooltipComponent> components,
|
||||
int mouseX,
|
||||
int mouseY,
|
||||
ClientTooltipPositioner tooltipPositioner,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
this.lzxnoneterraria$hackTooltipItemName = false;
|
||||
this.lzxnoneterraria$tooltipTextLineIndex = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.lzxnone.terraria.mixin;
|
||||
|
||||
import com.lzxnone.terraria.item.ItemNameRenderer;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Gui.class)
|
||||
public abstract class GuiMixin {
|
||||
@Shadow
|
||||
private Minecraft minecraft;
|
||||
|
||||
@Shadow
|
||||
private int toolHighlightTimer;
|
||||
|
||||
@Shadow
|
||||
private ItemStack lastToolHighlight;
|
||||
|
||||
@Shadow
|
||||
public abstract Font getFont();
|
||||
|
||||
@Inject(method = "renderSelectedItemName(Lnet/minecraft/client/gui/GuiGraphics;I)V", at = @At("HEAD"), cancellable = true)
|
||||
private void renderCustomSelectedItemName(GuiGraphics guiGraphics, int yShift, CallbackInfo ci) {
|
||||
if(this.toolHighlightTimer <= 0 || this.lastToolHighlight.isEmpty()) return;
|
||||
if(!ItemNameRenderer.shouldHackHeldItemName(this.lastToolHighlight)) return;
|
||||
|
||||
this.minecraft.getProfiler().push("customSelectedItemName");
|
||||
|
||||
MutableComponent mutablecomponent = Component.empty()
|
||||
.append(this.lastToolHighlight.getHoverName())
|
||||
.withStyle(this.lastToolHighlight.getRarity().getStyleModifier());
|
||||
if(this.lastToolHighlight.has(DataComponents.CUSTOM_NAME)) {
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent);
|
||||
int alpha = (int)((float)this.toolHighlightTimer * 256.0F / 10.0F);
|
||||
if(alpha > 255) {
|
||||
alpha = 255;
|
||||
}
|
||||
|
||||
if(alpha > 0) {
|
||||
if(this.minecraft.gameMode != null) {
|
||||
ItemNameRenderer.renderHeldItemName(
|
||||
guiGraphics,
|
||||
this.getFont(),
|
||||
this.lastToolHighlight,
|
||||
highlightTip,
|
||||
yShift,
|
||||
alpha,
|
||||
this.minecraft.gameMode.canHurtPlayer()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.minecraft.getProfiler().pop();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -75,9 +75,23 @@ public class ItemInHandRenderMixin {
|
||||
ci.cancel();
|
||||
}
|
||||
}else if(stack.is(ModItems.DEVILS_DEVASTATION.get())) {
|
||||
MobEffectInstance effectInstance = player.getEffect(ModEffects.KILL_MODE);
|
||||
if(effectInstance != null && player.getCooldowns().isOnCooldown(stack.getItem())) {
|
||||
ci.cancel();
|
||||
if(player.getCooldowns().isOnCooldown(stack.getItem())) {
|
||||
MobEffectInstance effectInstance = player.getEffect(ModEffects.KILL_MODE);
|
||||
if(effectInstance != null) {
|
||||
ci.cancel();
|
||||
}else {
|
||||
boolean isMainHand = hand == InteractionHand.MAIN_HAND;
|
||||
HumanoidArm humanoidarm = isMainHand ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
|
||||
poseStack.pushPose();
|
||||
|
||||
if(!player.isInvisible()) {
|
||||
this.renderPlayerArm(poseStack, buffer, combinedLight, equippedProgress, swingProgress, humanoidarm);
|
||||
}
|
||||
|
||||
poseStack.popPose();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,8 +119,7 @@ public class ItemInHandRenderMixin {
|
||||
ci.cancel();
|
||||
}
|
||||
}else if(itemStack.is(ModItems.DEVILS_DEVASTATION.get()) && entity instanceof Player player) {
|
||||
MobEffectInstance effectInstance = player.getEffect(ModEffects.KILL_MODE);
|
||||
if(effectInstance != null && player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
||||
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.lzxnone.terraria.network.handler;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.melee.DevilsDevastation;
|
||||
@@ -21,7 +22,7 @@ public class DevilsDevastationKillModeHandler {
|
||||
MobEffectInstance instance = player.getEffect(ModEffects.KILL_MODE_COOLDOWN);
|
||||
MobEffectInstance instance2 = player.getEffect(ModEffects.KILL_MODE);
|
||||
if(instance == null && instance2 == null) {
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE, DevilsDevastation.KIll_MODE_TIME, 0);
|
||||
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.KILL_MODE, Config.devilsDevastationKillModeTime, 0);
|
||||
player.addEffect(effectInstance);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user