This commit is contained in:
LZX committed 2026-08-14 18:35:54 +08:00
1 parent 189572c7b7
commit 078c05cc0e
77 files changed
+789 -345

No files matched your search

@@ -5,6 +5,7 @@ import com.lzxnone.terraria.client.item.normal.ClientManaStar;
import com.lzxnone.terraria.client.item.ranged.ClientArrowAmmo;
import com.lzxnone.terraria.client.item.ranged.ClientBulletAmmo;
import com.lzxnone.terraria.client.item.magic.ClientBetsysWrath;
import com.lzxnone.terraria.client.item.magic.ClientBubbleGun;
import com.lzxnone.terraria.client.item.magic.ClientLastPrism;
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
import com.lzxnone.terraria.client.item.melee.ClientFirstFractal;
@@ -16,6 +17,7 @@ import com.lzxnone.terraria.client.item.melee.ClientTerraBlade;
import com.lzxnone.terraria.client.item.melee.ClientTerragrim;
import com.lzxnone.terraria.client.item.melee.ClientTrueNightsEdge;
import com.lzxnone.terraria.client.item.ranged.ClientFlamethrower;
import com.lzxnone.terraria.client.item.ranged.ClientSnowballCannon;
import com.lzxnone.terraria.client.item.ranged.ClientStarCannon;
import com.lzxnone.terraria.client.item.ranged.ClientSuperStarShooter;
import com.lzxnone.terraria.client.item.summon.ClientStardustDragonStaff;
@@ -77,7 +79,8 @@ public class ClientStaticSummonRenderBehaviors {
BEHAVIORS.put(StaticSummonBehaviors.TUNGSTEN_BULLET, ClientBulletAmmo.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.WOODEN_ARROW, ClientArrowAmmo.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.SNOWBALL, DEFAULT_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.SNOWBALL, ClientSnowballCannon.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.BUBBLE, ClientBubbleGun.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.FALLEN_STAR, ClientStarCannon.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.FALLEN_STAR_SUPER, ClientSuperStarShooter.SUMMON_BEHAVIOR);
BEHAVIORS.put(StaticSummonBehaviors.FLAMETHROWER_FLAME, ClientFlamethrower.SUMMON_BEHAVIOR);
@@ -0,0 +1,61 @@
package com.lzxnone.terraria.client.item.magic;
import com.lzxnone.terraria.client.entity.summon.IStaticSummonRenderBehavior;
import com.lzxnone.terraria.entity.TintedVertexConsumer;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
public class ClientBubbleGun {
public static final IStaticSummonRenderBehavior SUMMON_BEHAVIOR = new IStaticSummonRenderBehavior() {
@Override
public void renderItem(Entity entity, float entityYaw, float partialTick,
PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
if(!(entity instanceof StaticSummon summon)) return;
ItemStack itemStack = summon.getEntityData().get(StaticSummon.ITEM);
if(itemStack == ItemStack.EMPTY) return;
poseStack.pushPose();
poseStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation());
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F));
poseStack.mulPose(Axis.XP.rotationDegrees(summon.getEntityData().get(StaticSummon.RXP) + summon.getEntityData().get(StaticSummon.RXPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.mulPose(Axis.YP.rotationDegrees(summon.getEntityData().get(StaticSummon.RYP) + summon.getEntityData().get(StaticSummon.RYPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.mulPose(Axis.ZP.rotationDegrees(summon.getEntityData().get(StaticSummon.RZP) + summon.getEntityData().get(StaticSummon.RZPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.scale(
summon.getEntityData().get(StaticSummon.SCALE_X),
summon.getEntityData().get(StaticSummon.SCALE_Y),
summon.getEntityData().get(StaticSummon.SCALE_Z)
);
Minecraft.getInstance().getItemRenderer().renderStatic(
itemStack,
ItemDisplayContext.NONE,
summon.getEntityData().get(StaticSummon.GLOW) ? LightTexture.FULL_BRIGHT : packedLight,
OverlayTexture.NO_OVERLAY,
poseStack,
renderType -> {
VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType);
return new TintedVertexConsumer(vertexConsumer,
summon.getEntityData().get(StaticSummon.COLOR_R),
summon.getEntityData().get(StaticSummon.COLOR_G),
summon.getEntityData().get(StaticSummon.COLOR_B),
summon.getEntityData().get(StaticSummon.COLOR_A));
},
entity.level(),
0
);
poseStack.popPose();
}
};
}
@@ -0,0 +1,61 @@
package com.lzxnone.terraria.client.item.ranged;
import com.lzxnone.terraria.client.entity.summon.IStaticSummonRenderBehavior;
import com.lzxnone.terraria.entity.TintedVertexConsumer;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
public class ClientSnowballCannon {
public static final IStaticSummonRenderBehavior SUMMON_BEHAVIOR = new IStaticSummonRenderBehavior() {
@Override
public void renderItem(Entity entity, float entityYaw, float partialTick,
PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
if(!(entity instanceof StaticSummon summon)) return;
ItemStack itemStack = summon.getEntityData().get(StaticSummon.ITEM);
if(itemStack == ItemStack.EMPTY) return;
poseStack.pushPose();
poseStack.mulPose(Minecraft.getInstance().getEntityRenderDispatcher().cameraOrientation());
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F));
poseStack.mulPose(Axis.XP.rotationDegrees(summon.getEntityData().get(StaticSummon.RXP) + summon.getEntityData().get(StaticSummon.RXPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.mulPose(Axis.YP.rotationDegrees(summon.getEntityData().get(StaticSummon.RYP) + summon.getEntityData().get(StaticSummon.RYPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.mulPose(Axis.ZP.rotationDegrees(summon.getEntityData().get(StaticSummon.RZP) + summon.getEntityData().get(StaticSummon.RZPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick)));
poseStack.scale(
summon.getEntityData().get(StaticSummon.SCALE_X),
summon.getEntityData().get(StaticSummon.SCALE_Y),
summon.getEntityData().get(StaticSummon.SCALE_Z)
);
Minecraft.getInstance().getItemRenderer().renderStatic(
itemStack,
ItemDisplayContext.NONE,
summon.getEntityData().get(StaticSummon.GLOW) ? LightTexture.FULL_BRIGHT : packedLight,
OverlayTexture.NO_OVERLAY,
poseStack,
renderType -> {
VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType);
return new TintedVertexConsumer(vertexConsumer,
summon.getEntityData().get(StaticSummon.COLOR_R),
summon.getEntityData().get(StaticSummon.COLOR_G),
summon.getEntityData().get(StaticSummon.COLOR_B),
summon.getEntityData().get(StaticSummon.COLOR_A));
},
entity.level(),
0
);
poseStack.popPose();
}
};
}
@@ -55,6 +55,8 @@ public class ModCreativeModeTabs {
output.accept(ModItems.LAST_PRISM.get());
output.accept(ModItems.BETSY_WRATH.get());
output.accept(ModItems.LUNAR_FLARE.get());
output.accept(ModItems.NEBULA_BLAZE.get());
output.accept(ModItems.NEBULA_ARCANUM.get());
output.accept(ModItems.BUBBLE_GUN.get());
output.accept(ModItems.MANA_CRYSTAL.get());
output.accept(ModItems.LESSER_MANA_POTION.get());
@@ -127,7 +127,7 @@ public class BeeSummon extends Bee {
if(owner == null) return false;
boolean isHurt;
if(owner instanceof Player) {
isHurt = DamageUtil.meleeAttack(this, target, stackSource, (float) damage, 1.0f);
isHurt = DamageUtil.meleeAttack(this, target, stackSource, (float) damage, 1.0f, -1);
}else {
DamageSource damageSource = this.damageSources().mobAttack(owner);
isHurt = target.hurt(damageSource, (float) damage);
@@ -6,6 +6,7 @@ import com.lzxnone.terraria.item.normal.ManaStar;
import com.lzxnone.terraria.item.weapon.magic.BetsyWrath;
import com.lzxnone.terraria.item.weapon.magic.BubbleGun;
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
import com.lzxnone.terraria.item.weapon.magic.NebulaBlaze;
import com.lzxnone.terraria.item.weapon.ranged.ElfMelter;
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
import com.lzxnone.terraria.item.weapon.melee.*;
@@ -52,6 +53,8 @@ public class StaticSummonBehaviors {
public static final String BETSY_WRATH = "betsys_wrath";
public static final String LUNAR_FLARE = "lunar_flare";
public static final String BUBBLE = "bubble";
public static final String NEBULA_BLAZE = "nebula_blaze";
public static final String NEBULA_BLAZE_EXPLOSIVE = "nebula_blaze_explosive";
public static final String TERRAPRISMA = "terraprisma";
public static final String STARDUST_DRAGON_STAFF = "stardust_dragon_staff";
public static final String POSSESSION = "possession";
@@ -109,6 +112,8 @@ public class StaticSummonBehaviors {
BEHAVIORS.put(BETSY_WRATH, BetsyWrath.SUMMON_BEHAVIOR);
BEHAVIORS.put(LUNAR_FLARE, LunarFlare.SUMMON_BEHAVIOR);
BEHAVIORS.put(BUBBLE, BubbleGun.SUMMON_BEHAVIOR);
BEHAVIORS.put(NEBULA_BLAZE, NebulaBlaze.SUMMON_BEHAVIOR);
BEHAVIORS.put(NEBULA_BLAZE_EXPLOSIVE, NebulaBlaze.SUMMON_BEHAVIOR2);
BEHAVIORS.put(TERRAPRISMA, Terraprisma.SUMMON_BEHAVIOR);
BEHAVIORS.put(STARDUST_DRAGON_STAFF, StardustDragonStaff.SUMMON_BEHAVIOR);
BEHAVIORS.put(POSSESSION, Whip.SUMMON_BEHAVIOR);
@@ -57,6 +57,8 @@ public class ModItems {
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
public static final DeferredItem<Item> BETSY_WRATH = ITEMS.register("betsys_wrath", BetsyWrath::new);
public static final DeferredItem<Item> LUNAR_FLARE = ITEMS.register("lunar_flare", LunarFlare::new);
public static final DeferredItem<Item> NEBULA_BLAZE = ITEMS.register("nebula_blaze", NebulaBlaze::new);
public static final DeferredItem<Item> NEBULA_ARCANUM = ITEMS.register("nebula_arcanum", NebulaArcanum::new);
public static final DeferredItem<Item> BUBBLE_GUN = ITEMS.register("bubble_gun", BubbleGun::new);
//远程武器
@@ -145,8 +145,7 @@ public class ChlorophyteBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity hitTarget = targets.getFirst();
if(DamageUtil.rangedAttack(summon, hitTarget, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
hitTarget.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, hitTarget, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
this.onDied(summon);
return;
}
@@ -163,8 +162,7 @@ public class ChlorophyteBullet extends BulletAmmo {
};
private static Entity findTarget(StaticSummon summon) {
AABB searchBox = summon.getBoundingBox().inflate(TARGET_RANGE.get());
List<Entity> targets = CollisionUtil.searchEnemies(summon.level(), searchBox, summon, summon.getOwner());
List<Entity> targets = SearchUtil.searchEnemies(summon, summon.getOwner(), summon.getBoundingBox().inflate(TARGET_RANGE.get()));
Entity bestTarget = null;
double bestDistance = Double.MAX_VALUE;
for(Entity target : targets) {
@@ -83,8 +83,7 @@ public class CrystalBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
summon.setPos(end);
for(int i = 0;i < FRAGMENT_COUNT.get();i++) {
summonProjectile(summon, (BASE_DAMAGE.get() + damage) * FRAGMENT_DAMAGE_MULTIPLIER.get());
@@ -132,8 +131,7 @@ public class CrystalBullet extends BulletAmmo {
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA);
float damage = customData.contains("damage") ? customData.getFloat("damage") : 0;
if(DamageUtil.rangedAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), damage, 1.0f)) {
target.invulnerableTime = 5;
if(DamageUtil.rangedAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), damage, 1.0f, 5)) {
onDied(projectile);
}
}
@@ -78,8 +78,7 @@ public class CursedBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(target instanceof LivingEntity livingEntity) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.CURSED_INFERNO, EFFECT_TIME.get(), 0);
livingEntity.addEffect(effectInstance);
@@ -88,9 +88,8 @@ public class ExplodingBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
boolean dead = false;
for(Entity target : targets) {
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale * KNOCKBACK_MULTIPLIER.get())) {
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale * KNOCKBACK_MULTIPLIER.get(), invulnerableTime)) {
dead = true;
target.invulnerableTime = invulnerableTime;
SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position());
}
@@ -78,8 +78,7 @@ public class GoldenBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(target instanceof LivingEntity livingEntity) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.MIDAS, EFFECT_TIME.get(), 0);
livingEntity.addEffect(effectInstance);
@@ -78,8 +78,7 @@ public class HighVelocityBullet extends BulletAmmo {
for(Entity target : targets) {
int hit = customData.getInt("hit");
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage) * (float) Math.pow(DAMAGE_DECAY.get(), hit), knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage) * (float) Math.pow(DAMAGE_DECAY.get(), hit), knockbackScale, invulnerableTime)) {
if(incrementHit(summon) >= MAX_HIT.get()) {
this.onDied(summon);
return;
@@ -78,8 +78,7 @@ public class IchorBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(target instanceof LivingEntity livingEntity) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.ICHOR, EFFECT_TIME.get(), 0);
livingEntity.addEffect(effectInstance);
@@ -87,8 +87,7 @@ public class LuminiteBullet extends BulletAmmo {
for(Entity target : targets) {
int hit = customData.getInt("hit");
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage) * (float) Math.pow(DAMAGE_DECAY.get(), hit), knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage) * (float) Math.pow(DAMAGE_DECAY.get(), hit), knockbackScale, invulnerableTime)) {
hit++;
customData.putInt("hit", hit);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
@@ -80,8 +80,7 @@ public class MeteorShot extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(Entity target : targets) {
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage), knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, (BASE_DAMAGE.get() + damage), knockbackScale, invulnerableTime)) {
if(incrementHit(summon) >= MAX_HIT.get()) {
this.onDied(summon);
return;
@@ -72,8 +72,7 @@ public class MusketBall extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
this.onDied(summon);
return;
}
@@ -86,8 +86,7 @@ public class NanoBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
int hit = customData.getInt("hit");
if(DamageUtil.rangedAttack(summon, target, sourceStack, hit > 0 ? (BASE_DAMAGE.get() + damage) * DAMAGE_DECAY.get() : BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, hit > 0 ? (BASE_DAMAGE.get() + damage) * DAMAGE_DECAY.get() : BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(target instanceof LivingEntity livingEntity) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.CONFUSED, EFFECT_TIME.get(), 0);
livingEntity.addEffect(effectInstance);
@@ -75,8 +75,7 @@ public class PartyBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
summon.setPos(end);
ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.PARTY_PARTICLE.get(),
@@ -81,8 +81,7 @@ public class SilverBullet extends BulletAmmo {
if(target instanceof Piglin || target instanceof PiglinBrute || target instanceof ZombifiedPiglin) {
finalDamage *= PIGLIN_DAMAGE_MULTIPLIER.get();
}
if(DamageUtil.rangedAttack(summon, target, sourceStack, finalDamage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, finalDamage, knockbackScale, invulnerableTime)) {
this.onDied(summon);
return;
}
@@ -72,8 +72,7 @@ public class TungstenBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
this.onDied(summon);
return;
}
@@ -78,8 +78,7 @@ public class VenomBullet extends BulletAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime;
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(target instanceof LivingEntity livingEntity) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.ACID_VENOM, EFFECT_TIME.get(), 0);
livingEntity.addEffect(effectInstance);
@@ -82,11 +82,10 @@ public class WoodenArrow extends ArrowAmmo {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale)) {
if(DamageUtil.rangedAttack(summon, target, sourceStack, BASE_DAMAGE.get() + damage, knockbackScale, invulnerableTime)) {
if(customData.contains(StaticSummon.HIT_TARGET_IGNITE_TICKS_KEY)) {
target.igniteForTicks(customData.getInt(StaticSummon.HIT_TARGET_IGNITE_TICKS_KEY));
}
target.invulnerableTime = invulnerableTime;
this.onDied(summon);
return;
}
@@ -52,8 +52,7 @@ public interface FallenStarSummoner {
fallenStarDamage[0] = Math.max(summoner.getFallenStarDamage(accessoryStack, player), fallenStarDamage[0]);
}
});
if(DamageUtil.meleeAttack(projectile, target, stack, (float) fallenStarDamage[0], 1.0f)) {
target.invulnerableTime = 5;
if(DamageUtil.meleeAttack(projectile, target, stack, (float) fallenStarDamage[0], 1.0f, 5)) {
}
}
}
@@ -30,6 +30,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
@@ -210,15 +211,16 @@ public class BetsyWrath extends MagicWeapon {
double explosionRange = EXPLOSION_RANGE.get();
if(explosionRange > 0.0D) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(LivingEntity target : serverLevel.getEntitiesOfClass(
LivingEntity.class,
for(Entity target : serverLevel.getEntitiesOfClass(
Entity.class,
AABB.ofSize(pos, explosionRange * 2.0D, explosionRange * 2.0D, explosionRange * 2.0D),
FilterUtil.createLivingTargetFilter(summon, summon.getOwner())
FilterUtil.createTargetFilter(summon, summon.getOwner())
)) {
if(target.distanceToSqr(pos) > explosionRange * explosionRange) continue;
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.6F)) {
target.invulnerableTime = 10;
if(BUFF_DURATION.get() > 0) target.addEffect(new MobEffectInstance(ModEffects.BETSYS_CURSE, BUFF_DURATION.get(), 0));
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.6F, 10)) {
if(BUFF_DURATION.get() > 0 && target instanceof LivingEntity livingTarget) {
livingTarget.addEffect(new MobEffectInstance(ModEffects.BETSYS_CURSE, BUFF_DURATION.get(), 0));
}
}
}
}
@@ -18,6 +18,7 @@ import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.MathUtil;
import com.lzxnone.terraria.utils.ParticleUtil;
import com.lzxnone.terraria.utils.SoundUtil;
@@ -26,6 +27,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
@@ -33,12 +35,14 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
import java.util.List;
public class BubbleGun extends MagicWeapon {
public static final Vector3f OFFSET = new Vector3f(-0.25F, -0.1F, 1.2F);
public static final double SPRINT_SPREAD_MULTIPLIER = 2.0D;
@@ -87,10 +91,15 @@ public class BubbleGun extends MagicWeapon {
if(summon.level().isClientSide()) return;
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, nextPos, HITBOX_INFLATE);
if(entityHitResult != null) {
if(DamageUtil.magicAttack(summon, entityHitResult.getEntity(), summon.getEntityData().get(StaticSummon.STACK_SOURCE), DAMAGE.get(), 0.2F)) {
entityHitResult.getEntity().invulnerableTime = 5;
AABB hitBox = new AABB(summon.position(), nextPos).inflate(HITBOX_INFLATE);
List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class,
hitBox,
FilterUtil.createTargetFilter(summon, summon.getOwner())
);
if(!targets.isEmpty()) {
Entity target = targets.getFirst();
if(DamageUtil.magicAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), DAMAGE.get(), 0.2F, 5)) {
}
onDied(summon);
return;
@@ -55,7 +55,7 @@ public class LastPrism extends MagicWeapon {
public static final ConfigFloat DAMAGE = new ConfigFloat(
"weapon.last_prism.damage",
"last_prism_damage",
1.0f,
2.0f,
0.0f,
8388600.0f
);
@@ -241,8 +241,7 @@ public class LastPrism extends MagicWeapon {
AABB entityBox = hitEntity.getBoundingBox().inflate(beamData.radius());
Optional<Vec3> clipResult = entityBox.clip(beamData.start(), beamData.end());
if(entityBox.contains(beamData.start()) || clipResult.isPresent()) {
if(DamageUtil.magicAttack(beam, hitEntity, beam.getEntityData().get(StaticSummon.STACK_SOURCE), DAMAGE.get() * beamData.ratio(), 0.1f)) {
hitEntity.invulnerableTime = 5;
if(DamageUtil.magicAttack(beam, hitEntity, beam.getEntityData().get(StaticSummon.STACK_SOURCE), DAMAGE.get() * beamData.ratio(), 0.1f, 5)) {
}
}
}
@@ -25,6 +25,7 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
@@ -161,14 +162,13 @@ public class LunarFlare extends MagicWeapon {
double explosionRange = EXPLOSION_RANGE.get();
if(explosionRange > 0.0D) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(LivingEntity target : serverLevel.getEntitiesOfClass(
LivingEntity.class,
for(Entity target : serverLevel.getEntitiesOfClass(
Entity.class,
AABB.ofSize(pos, explosionRange * 2.0D, explosionRange * 2.0D, explosionRange * 2.0D),
FilterUtil.createLivingTargetFilter(summon, summon.getOwner())
FilterUtil.createTargetFilter(summon, summon.getOwner())
)) {
if(target.distanceToSqr(pos) > explosionRange * explosionRange) continue;
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.4F)) {
target.invulnerableTime = 10;
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.4F, 10)) {
}
}
}
@@ -0,0 +1,52 @@
package com.lzxnone.terraria.item.weapon.magic;
import com.lzxnone.terraria.LzxnoneTerraria;
import com.lzxnone.terraria.item.weapon.MagicWeapon;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.ui.config.struct.ConfigDouble;
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import com.lzxnone.terraria.utils.DamageUtil;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
public class NebulaArcanum extends MagicWeapon {
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.nebula_arcanum.damage", "nebula_arcanum_damage", 0.0F, 0.0F, 8388600.0F);
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.nebula_arcanum.mana_consume", "nebula_arcanum_mana_consume", 0.0D, 0.0D, 10000.0D);
public static final IConfigData CONFIG_DATA = new IConfigData() {
@Override
public void onConfigLoad() {
ConfigStruct.loadAll(DAMAGE, MANA_CONSUME);
}
};
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
"nebula_arcanum",
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/nebula_arcanum.png"),
Component.translatable("item.lzxnoneterraria.nebula_arcanum"),
CONFIG_DATA
);
public NebulaArcanum() {
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC));
}
@Override
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
return applyMagicDamageBonus(weaponStack, entity, damage);
}
@Override
protected double getManaConsumeRate(ItemStack stack, LivingEntity entity) {
return MANA_CONSUME.get();
}
}
@@ -0,0 +1,247 @@
package com.lzxnone.terraria.item.weapon.magic;
import com.lzxnone.terraria.LzxnoneTerraria;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.entity.ModEntities;
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
import com.lzxnone.terraria.item.weapon.MagicWeapon;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.ui.config.struct.ConfigDouble;
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.MathUtil;
import com.lzxnone.terraria.utils.SearchUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
import java.util.List;
public class NebulaBlaze extends MagicWeapon {
public static final Vector3f OFFSET = new Vector3f(-0.25F, -0.1F, 1.2F);
public static final double HITBOX_INFLATE = 0.35D;
public static final String TARGET_UUID_KEY = "target";
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.nebula_blaze.damage", "nebula_blaze_damage", 10.0F, 0.0F, 8388600.0F);
public static final ConfigFloat EXPLOSIVE_DAMAGE = new ConfigFloat("weapon.nebula_blaze.explosive_damage", "nebula_blaze_explosive_damage", 30.0F, 0.0F, 8388600.0F);
public static final ConfigDouble SPEED = new ConfigDouble("weapon.nebula_blaze.speed", "nebula_blaze_speed", 1.0D, 0.0D, 24.0D);
public static final ConfigDouble EXPLOSIVE_SPEED = new ConfigDouble("weapon.nebula_blaze.explosive_speed", "nebula_blaze_explosive_speed", 2.0D, 0.0D, 24.0D);
public static final ConfigDouble TARGET_RANGE = new ConfigDouble("weapon.nebula_blaze.target_range", "nebula_blaze_target_range", 8.0D, 0.0D, 128.0D);
public static final ConfigDouble EXPLOSIVE_TARGET_RANGE = new ConfigDouble("weapon.nebula_blaze.explosive_target_range", "nebula_blaze_explosive_target_range", 16.0D, 0.0D, 128.0D);
public static final ConfigDouble EXPLOSION_RANGE = new ConfigDouble("weapon.nebula_blaze.explosion_range", "nebula_blaze_explosion_range", 3.0D, 0.0D, 64.0D);
public static final ConfigDouble EXPLOSIVE_CHANCE = new ConfigDouble("weapon.nebula_blaze.explosive_chance", "nebula_blaze_explosive_chance", 0.2D, 0.0D, 1.0D);
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.nebula_blaze.mana_consume", "nebula_blaze_mana_consume", 12.0D, 0.0D, 10000.0D);
public static final IConfigData CONFIG_DATA = new IConfigData() {
@Override
public void onConfigLoad() {
ConfigStruct.loadAll(
DAMAGE,
EXPLOSIVE_DAMAGE,
SPEED,
EXPLOSIVE_SPEED,
TARGET_RANGE,
EXPLOSIVE_TARGET_RANGE,
EXPLOSION_RANGE,
EXPLOSIVE_CHANCE,
MANA_CONSUME
);
}
};
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
"nebula_blaze",
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/nebula_blaze.png"),
Component.translatable("item.lzxnoneterraria.nebula_blaze"),
CONFIG_DATA
);
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
@Override
public void tick(StaticSummon summon) {
checkBeforeTick(summon);
tickProjectile(summon, SPEED.get(), TARGET_RANGE.get(), DAMAGE.get());
}
@Override
public void onDied(StaticSummon summon) {
explode(summon, DAMAGE.get());
}
};
public static final IStaticSummonBehavior SUMMON_BEHAVIOR2 = new IStaticSummonBehavior() {
@Override
public void tick(StaticSummon summon) {
checkBeforeTick(summon);
tickProjectile(summon, EXPLOSIVE_SPEED.get(), EXPLOSIVE_TARGET_RANGE.get(), EXPLOSIVE_DAMAGE.get());
}
@Override
public void onDied(StaticSummon summon) {
explode(summon, EXPLOSIVE_DAMAGE.get());
}
};
public NebulaBlaze() {
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE));
}
@Override
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
return 12;
}
@Override
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
return applyMagicDamageBonus(weaponStack, entity, damage);
}
@Override
protected double getManaConsumeRate(ItemStack stack, LivingEntity entity) {
return MANA_CONSUME.get();
}
@Override
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
if(level.isClientSide()) return;
player.playNotifySound(ModSounds.MAGIC_SHOOT.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
Vector3f offset = new Vector3f(
hand == InteractionHand.OFF_HAND ? -OFFSET.x : OFFSET.x,
OFFSET.y,
OFFSET.z
);
Vec3 eyePos = player.getEyePosition();
Vec3 pos = new Vec3(
eyePos.x + dirs[0].x * offset.z + dirs[1].x * offset.y + dirs[2].x * offset.x,
eyePos.y + dirs[0].y * offset.z + dirs[1].y * offset.y + dirs[2].y * offset.x,
eyePos.z + dirs[0].z * offset.z + dirs[1].z * offset.y + dirs[2].z * offset.x
);
Vec3 direction = MathUtil.toVec3(dirs[0]).normalize();
boolean explosive = player.getRandom().nextDouble() < EXPLOSIVE_CHANCE.get();
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
summon.setOwner(player);
summon.setPos(pos);
summon.setDeltaMovement(direction.scale(explosive ? EXPLOSIVE_SPEED.get() : SPEED.get()));
summon.getEntityData().set(StaticSummon.STACK_SOURCE, stack.copy());
summon.getEntityData().set(StaticSummon.BEHAVIOR, explosive ? StaticSummonBehaviors.NEBULA_BLAZE_EXPLOSIVE : StaticSummonBehaviors.NEBULA_BLAZE);
summon.getEntityData().set(StaticSummon.LIFETIME, 100);
summon.getEntityData().set(StaticSummon.GLOW, true);
summon.setNoGravity(true);
summon.noPhysics = true;
float[] xyRot = MathUtil.computeXYRot(direction.toVector3f());
summon.setXRot(xyRot[0]);
summon.setYRot(xyRot[1]);
summon.xRotO = xyRot[0];
summon.yRotO = xyRot[1];
level.addFreshEntity(summon);
}
private static void tickProjectile(StaticSummon summon, double speed, double targetRange, float damage) {
Vec3 direction = summon.getDeltaMovement();
if(direction.lengthSqr() < 1.0E-7D) direction = summon.getLookAngle();
if(direction.lengthSqr() < 1.0E-7D) direction = new Vec3(0.0D, 0.0D, 1.0D);
if(summon.level() instanceof ServerLevel serverLevel) {
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
Entity target = null;
if(customData.contains(TARGET_UUID_KEY)) {
target = serverLevel.getEntity(customData.getUUID(TARGET_UUID_KEY));
if(target == null || !target.isAlive()) {
target = null;
customData.remove(TARGET_UUID_KEY);
}
}
if(target == null) {
List<Entity> targets = SearchUtil.searchNearestEnemies(summon, summon.getOwner(), summon.getBoundingBox().inflate(targetRange), 1);
target = targets.isEmpty() ? null : targets.getFirst();
if(target != null) customData.putUUID(TARGET_UUID_KEY, target.getUUID());
}
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
if(target != null) {
Vec3 targetDir = target.getBoundingBox().getCenter().subtract(summon.position());
if(targetDir.lengthSqr() > 1.0E-7D) direction = targetDir.normalize();
}
}
Vec3 motion = direction.normalize().scale(speed);
Vec3 start = summon.position();
Vec3 end = start.add(motion);
summon.setDeltaMovement(motion);
float[] xyRot = MathUtil.computeXYRot(direction.toVector3f());
summon.setXRot(xyRot[0]);
summon.setYRot(xyRot[1]);
summon.xRotO = xyRot[0];
summon.yRotO = xyRot[1];
if(summon.level().isClientSide()) return;
AABB hitBox = new AABB(start, end).inflate(HITBOX_INFLATE);
List<Entity> hitTargets = summon.level().getEntitiesOfClass(
Entity.class,
hitBox,
FilterUtil.createTargetFilter(summon, summon.getOwner())
);
if(!hitTargets.isEmpty()) {
explode(summon, damage);
return;
}
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) {
summon.setPos(blockHitResult.getLocation());
summon.setDeltaMovement(Vec3.ZERO);
explode(summon, damage);
}
}
private static void explode(StaticSummon summon, float damage) {
if(!(summon.level() instanceof ServerLevel serverLevel)) return;
Vec3 pos = summon.position();
double explosionRange = EXPLOSION_RANGE.get();
if(explosionRange > 0.0D) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(Entity target : serverLevel.getEntitiesOfClass(
Entity.class,
AABB.ofSize(pos, explosionRange * 2.0D, explosionRange * 2.0D, explosionRange * 2.0D),
FilterUtil.createTargetFilter(summon, summon.getOwner())
)) {
if(target.distanceToSqr(pos) > explosionRange * explosionRange) continue;
if(DamageUtil.magicAttack(summon, target, sourceStack, damage, 0.4F, 5)) {
}
}
}
summon.discard();
}
}
@@ -37,7 +37,6 @@ import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigInt;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import java.util.Comparator;
import java.util.List;
public class BladeOfGrass extends MeleeWeapon {
@@ -151,7 +150,7 @@ public class BladeOfGrass extends MeleeWeapon {
CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA);
if(!customData.contains("hitCount") || customData.getInt("hitCount") >= PROJECTILE_MAX_HIT_COUNT.get()) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f, -1)) {
int count = customData.getInt("hitCount");
count++;
if(target instanceof LivingEntity livingEntity && projectile.getRandom().nextInt(4) == 0) {
@@ -185,13 +184,7 @@ public class BladeOfGrass extends MeleeWeapon {
ItemStack stack = player.getItemInHand(hand);
if(!level.isClientSide()) {
List<Entity> targets = CollisionUtil.searchEnemies(
player.level(),
AABB.ofSize(player.getBoundingBox().getCenter(), TARGET_RANGE.get() * 2, TARGET_RANGE.get() * 2, TARGET_RANGE.get() * 2),
player,
player
);
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(player.position())));
List<Entity> targets = SearchUtil.searchNearestEnemies(player, player, player.getBoundingBox().inflate(TARGET_RANGE.get()), 1);
Vec3 playerPos = player.getEyePosition();
@@ -247,4 +240,3 @@ public class BladeOfGrass extends MeleeWeapon {
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
}
}
@@ -320,12 +320,11 @@ public class DevilsDevastation extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f, 5)) {
if(target instanceof LivingEntity le) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, PROJECTILE_EFFECT_DURATION.get(), 0);
le.addEffect(effectInstance);
}
target.invulnerableTime = 5;
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
summon.setOwner(target);
@@ -504,7 +503,7 @@ public class DevilsDevastation extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) STUCK_PROJECTILE_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) STUCK_PROJECTILE_DAMAGE.get(), 1.0f, -1)) {
if(target instanceof LivingEntity le) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, STUCK_PROJECTILE_EFFECT_DURATION.get(), 0);
le.addEffect(effectInstance);
@@ -614,7 +613,7 @@ public class DevilsDevastation extends MeleeWeapon {
Entity target = result.getEntity();
List<UUID> tempStuckList = target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE);
boolean valid = !tempStuckList.isEmpty();
if(projectile.getOwner() instanceof Player player && DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) KILL_MODE_PROJECTILE_DAMAGE.get(), 4.0f)) {
if(projectile.getOwner() instanceof Player player && DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) KILL_MODE_PROJECTILE_DAMAGE.get(), 4.0f, -1)) {
if(target instanceof LivingEntity le) {
MobEffectInstance effectInstance = new MobEffectInstance(ModEffects.DEMONIC_FLAMES, KILL_MODE_PROJECTILE_EFFECT_DURATION.get(), 1);
le.addEffect(effectInstance);
@@ -801,7 +800,7 @@ public class DevilsDevastation extends MeleeWeapon {
UUID uuid = customData.getUUID("uuid");
Entity entity = serverLevel.getEntity(uuid);
if(entity instanceof Player player) {
DamageUtil.meleeAttack(player, owner, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) MARK_LIGHTNING_DAMAGE.get(), 1.0f);
DamageUtil.meleeAttack(player, owner, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) MARK_LIGHTNING_DAMAGE.get(), 1.0f, -1);
StaticSummon newSummon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), serverLevel);
newSummon.setOwner(player);
newSummon.getEntityData().set(StaticSummon.STACK_SOURCE, summon.getEntityData().get(StaticSummon.STACK_SOURCE).copy());
@@ -105,8 +105,7 @@ public class EnchantedSword extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE),(float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 5;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE),(float) DAMAGE.get(), 1.0f, 5)) {
ParticleUtil.addParticles(
(ServerLevel) projectile.level(), ModParticles.COLORFUL_PARTICLE,
projectile.position(), new Vec3(0.2, 0.2, 0.2),
@@ -135,8 +135,7 @@ public class Excalibur extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 20;
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 20)) {
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -196,8 +196,7 @@ public class FirstFractal extends MeleeWeapon {
FilterUtil.createTargetFilter(summon, summon.getOwner())
);
for(Entity target : targets) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 0.2f)) {
target.invulnerableTime = 10;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 0.2f, 10)) {
}
}
}
@@ -37,7 +37,6 @@ import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigInt;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
@@ -204,8 +203,7 @@ public class InfluxWaver extends MeleeWeapon {
Entity target = customData.contains("target") ? summon.level().getEntity(customData.getInt("target")) : null;
if(target != null && !hitTarget.getUUID().equals(target.getUUID())) return;
if(summon.getOwner() instanceof Player player && FilterUtil.createTargetFilter(player).test(hitTarget)) {
if(DamageUtil.meleeAttack(summon, hitTarget, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
hitTarget.invulnerableTime = 2;
if(DamageUtil.meleeAttack(summon, hitTarget, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 2)) {
}
customData.putBoolean("dead", false);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
@@ -271,15 +269,13 @@ public class InfluxWaver extends MeleeWeapon {
}
public static Entity search(Player player, Vec3 pos) {
double targetRange = TARGET_RANGE.get();
AABB searchBox = new AABB(
pos.x - TARGET_RANGE.get(), pos.y - TARGET_RANGE.get(), pos.z - TARGET_RANGE.get(),
pos.x + TARGET_RANGE.get(), pos.y + TARGET_RANGE.get(), pos.z + TARGET_RANGE.get()
pos.x - targetRange, pos.y - targetRange, pos.z - targetRange,
pos.x + targetRange, pos.y + targetRange, pos.z + targetRange
);
List<Entity> entities = CollisionUtil.searchEnemies(player.level(), searchBox, player, player);
Entity target = null;
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
if(!entities.isEmpty()) target = entities.getFirst();
return target;
List<Entity> entities = SearchUtil.searchNearestEnemies(player, player, searchBox, 1);
return entities.isEmpty() ? null : entities.getFirst();
}
@Override
@@ -301,4 +297,3 @@ public class InfluxWaver extends MeleeWeapon {
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
}
}
@@ -19,6 +19,7 @@ import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.ParticleUtil;
import com.lzxnone.terraria.utils.SearchUtil;
import com.mojang.math.Axis;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
@@ -34,7 +35,6 @@ import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
import org.joml.Vector3f;
import java.util.Comparator;
import java.util.List;
public class LightsBane extends MeleeWeapon {
@@ -141,7 +141,7 @@ public class LightsBane extends MeleeWeapon {
List<Entity> targets = summon.level().getEntitiesOfClass(Entity.class, summon.getBoundingBox(), FilterUtil.createTargetFilter(summon, summon.getOwner()));
for(Entity target : targets) {
float damage = customData.contains("big") && customData.getBoolean("big") ? (float) BIG_DAMAGE.get() : (float) SMALL_DAMAGE.get();
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), damage, 1.0f)) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), damage, 1.0f, -1)) {
}
}
@@ -166,9 +166,8 @@ public class LightsBane extends MeleeWeapon {
pos.x - targetRange, pos.y - targetRange, pos.z - targetRange,
pos.x + targetRange, pos.y + targetRange, pos.z + targetRange
);
List<Entity> entities = CollisionUtil.searchEnemies(target.level(), searchBox, player, player);
List<Entity> entities = SearchUtil.searchNearestEnemies(player, player, searchBox, 1);
Entity summonTarget = null;
entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos)));
if(!entities.isEmpty()) summonTarget = entities.getFirst();
if(summonTarget != null) {
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), player.level());
@@ -164,8 +164,7 @@ public class Mace extends MeleeWeapon {
FilterUtil.createTargetFilter(projectile, player)
);
for(Entity target : targets) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 15;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 15)) {
}
}
}
@@ -276,8 +275,7 @@ public class Mace extends MeleeWeapon {
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()), 1.0);
if(entityHitResult != null) {
Entity target = entityHitResult.getEntity();
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 10;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 10)) {
}
}
}
@@ -295,7 +293,7 @@ public class Mace extends MeleeWeapon {
FilterUtil.createTargetFilter(summon, summon.getOwner())
);
for(Entity target : targets) {
DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f);
DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, -1);
}
}else if(state == State.THROWING_BACK.ordinal()){
Vec3 moveDir = player.getEyePosition().subtract(summon.position());
@@ -326,8 +324,7 @@ public class Mace extends MeleeWeapon {
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(summon.getDeltaMovement()), 1.0);
if(entityHitResult != null) {
Entity target = entityHitResult.getEntity();
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 10;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 10)) {
}
}
if(dist < 2.0f) {
@@ -130,7 +130,7 @@ public class Meowmere extends MeleeWeapon {
if(entityHitResult != null) {
Entity target = entityHitResult.getEntity();
if(summon.getOwner() instanceof Player player) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 2)) {
if(customData.contains("hitEntity") && customData.getInt("hitEntity") < 4) {
customData.putInt("hitEntity", customData.getInt("hitEntity") + 1);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
@@ -138,7 +138,6 @@ public class Meowmere extends MeleeWeapon {
onDied(summon);
return;
}
target.invulnerableTime = 2;
}
}
return;
@@ -192,7 +192,7 @@ public class Muramasa extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) BEAM_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) BEAM_DAMAGE.get(), 1.0f, -1)) {
}
}
@@ -198,13 +198,12 @@ public class NightsEdge extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 20)) {
ParticleUtil.addParticles(
(ServerLevel) target.level(), ModParticles.NIGHTS_EDGE_HIT_PARTICLE.get(),
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
0, 1
);
target.invulnerableTime = 20;
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -256,14 +255,13 @@ public class NightsEdge extends MeleeWeapon {
List<Entity> targets = summon.level().getEntitiesOfClass(Entity.class, summon.getBoundingBox(), FilterUtil.createTargetFilter(summon, summon.getOwner()));
for(Entity target : targets) {
if(count >= PROJECTILE_MAX_HIT_COUNT.get()) break;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f, 20)) {
count++;
ParticleUtil.addParticles(
(ServerLevel) target.level(), ModParticles.NIGHTS_EDGE_HIT_PARTICLE.get(),
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
0, 1
);
target.invulnerableTime = 20;
}
}
if(!targets.isEmpty()) customData.putInt("hitCount", count);
@@ -32,7 +32,6 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.phys.*;
import org.joml.Vector3f;
import java.util.Comparator;
import java.util.List;
public class Seedler extends MeleeWeapon {
@@ -138,8 +137,7 @@ public class Seedler extends MeleeWeapon {
if(entityHitResult != null) {
Entity target = entityHitResult.getEntity();
if(summon.getOwner() instanceof Player player) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) THORN_DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 2;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) THORN_DAMAGE.get(), 1.0f, 2)) {
}
}
onDied(summon);
@@ -182,15 +180,8 @@ public class Seedler extends MeleeWeapon {
@Override
public void onDied(StaticSummon summon) {
if(!summon.level().isClientSide()) {
List<Entity> targets = CollisionUtil.searchEnemies(
summon.level(),
AABB.ofSize(summon.position(), 64, 64, 64),
summon,
summon.getOwner()
);
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
int count = summon.getRandom().nextInt(4) + 4;
List<Entity> targets = SearchUtil.searchNearestEnemies(summon, summon.getOwner(), summon.getBoundingBox().inflate(32.0D), count);
for(int i = 0; i < count; i++) {
Vec3 tPos = i < targets.size() ? new Vec3(targets.get(i).getX(), targets.get(i).getEyeY(), targets.get(i).getZ()) : MathUtil.getRandomPosInRadius(summon.position(), 4);
Vec3 dir = new Vec3(tPos.x - summon.getX(), tPos.y - summon.getY(), tPos.z - summon.getZ()).normalize();
@@ -256,8 +247,7 @@ public class Seedler extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) THORN_DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 2;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) THORN_DAMAGE.get(), 1.0f, 2)) {
onDied(projectile);
}
}
@@ -304,4 +294,3 @@ public class Seedler extends MeleeWeapon {
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
}
}
@@ -123,8 +123,7 @@ public class StarWrath extends MeleeWeapon {
Entity target = result.getEntity();
Entity owner = projectile.getOwner();
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 0.2f)) {
target.invulnerableTime = 2;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 0.2f, 2)) {
}
}
}
@@ -103,8 +103,7 @@ public class Starfury extends MeleeWeapon {
Entity owner = projectile.getOwner();
if(owner == null) return;
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 5;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 5)) {
}
}
}
@@ -190,8 +190,7 @@ public class TerraBlade extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < SWORD_BEAM_MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), SWORD_BEAM_DAMAGE.get(), 0.1f)) {
target.invulnerableTime = 20;
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), SWORD_BEAM_DAMAGE.get(), 0.1f, 20)) {
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -258,14 +257,13 @@ public class TerraBlade extends MeleeWeapon {
int count = customData.getInt("hitCount");
List<Entity> targets = summon.level().getEntitiesOfClass(Entity.class, summon.getBoundingBox(), FilterUtil.createTargetFilter(summon, summon.getOwner()));
for(Entity target : targets) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), PROJECTILE_DAMAGE.get() * (float)Math.pow(PROJECTILE_DAMAGE_DECAY.get(), count), 0.1f)) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), PROJECTILE_DAMAGE.get() * (float)Math.pow(PROJECTILE_DAMAGE_DECAY.get(), count), 0.1f, 12)) {
count++;
ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.TERRA_BEAM_HIT_PARTICLE.get(),
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
0, 1
);
target.invulnerableTime = 12;
}
}
if(!targets.isEmpty()) customData.putInt("hitCount", count);
@@ -148,7 +148,7 @@ public class Terragrim extends MeleeWeapon {
);
for(Entity target : targets) {
if(target instanceof LivingEntity livingEntity) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 0.05f)) target.invulnerableTime = 0;
DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) DAMAGE.get(), 0.05f, 0);
}
}
}
@@ -43,7 +43,6 @@ import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
import com.lzxnone.terraria.ui.config.struct.ConfigInt;
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
import java.util.Comparator;
import java.util.List;
public class TheHorsemansBlade extends MeleeWeapon {
@@ -178,8 +177,7 @@ public class TheHorsemansBlade extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < BLADE_MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) BLADE_DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 20;
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) BLADE_DAMAGE.get(), 1.0f, 20)) {
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -285,14 +283,8 @@ public class TheHorsemansBlade extends MeleeWeapon {
if(!summon.level().isClientSide()) {
if(target == null) {
List<Entity> targets = CollisionUtil.searchEnemies(
summon.level(),
AABB.ofSize(summon.position(), PUMPKIN_MAX_TARGET_RANGE.get() * 2, PUMPKIN_MAX_TARGET_RANGE.get() * 2, PUMPKIN_MAX_TARGET_RANGE.get() * 2),
summon,
summon.getOwner()
);
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position())));
if(!targets.isEmpty()) target = targets.getFirst();
List<Entity> targets = SearchUtil.searchNearestEnemies(summon, summon.getOwner(), summon.getBoundingBox().inflate(PUMPKIN_MAX_TARGET_RANGE.get()), 1);
target = targets.isEmpty() ? null : targets.getFirst();
if(target != null) {
customData.putInt("target", target.getId());
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
@@ -312,7 +304,7 @@ public class TheHorsemansBlade extends MeleeWeapon {
summon.setYRot(xyRot[1]);
if(selfPos.distanceToSqr(targetPos) < 2.0D) {
if(summon.getOwner() instanceof Player player && FilterUtil.createTargetFilter(player).test(target) && DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PUMPKIN_DAMAGE.get(), 1.0f)) onDied(summon);
if(summon.getOwner() instanceof Player player && FilterUtil.createTargetFilter(player).test(target) && DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PUMPKIN_DAMAGE.get(), 1.0f, -1)) onDied(summon);
}
}else {
Vec3 dir = summon.getLookAngle().normalize();
@@ -327,18 +319,13 @@ public class TheHorsemansBlade extends MeleeWeapon {
);
summon.setBoundingBox(box);
List<Entity> hitEntities = summon.level().getEntitiesOfClass(
Entity.class,
summon.getBoundingBox().inflate(0.2D),
entity -> CollisionUtil.isEnemySearchTarget(entity, summon, summon.getOwner())
);
List<Entity> hitEntities = SearchUtil.searchEnemies(summon, summon.getOwner(), summon.getBoundingBox().inflate(0.2D));
if(!hitEntities.isEmpty()) {
for(Entity hitEntity : hitEntities) {
if(target != null && hitEntity.getUUID() == target.getUUID()) continue;
if(summon.getOwner() instanceof Player player) {
if(DamageUtil.meleeAttack(summon, hitEntity, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PUMPKIN_DAMAGE.get(), 1.0f)) {
hitEntity.invulnerableTime = 2;
if(DamageUtil.meleeAttack(summon, hitEntity, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PUMPKIN_DAMAGE.get(), 1.0f, 2)) {
}
}
}
@@ -366,4 +353,3 @@ public class TheHorsemansBlade extends MeleeWeapon {
}
};
}
@@ -136,8 +136,7 @@ public class TrueExcalibur extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
target.invulnerableTime = 20;
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 20)) {
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -212,13 +212,12 @@ public class TrueNightsEdge extends MeleeWeapon {
if(custom_data.contains("hitEntityCount")) {
int count = custom_data.getInt("hitEntityCount");
if(count < MAX_HIT_COUNT.get()) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(beam, target, beam.getEntityData().get(SwordBeam.STACK_SOURCE), (float) DAMAGE.get(), 1.0f, 20)) {
ParticleUtil.addParticles(
(ServerLevel) target.level(), ModParticles.NIGHTS_EDGE_HIT_PARTICLE.get(),
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
0, 1
);
target.invulnerableTime = 20;
count++;
custom_data.putInt("hitEntityCount", count);
beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data);
@@ -285,14 +284,13 @@ public class TrueNightsEdge extends MeleeWeapon {
List<Entity> targets = summon.level().getEntitiesOfClass(Entity.class, summon.getBoundingBox(), FilterUtil.createTargetFilter(summon, summon.getOwner()));
for(Entity target : targets) {
if(count >= PROJECTILE_MAX_HIT_COUNT.get()) break;
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(summon, target, summon.getEntityData().get(StaticSummon.STACK_SOURCE), (float) PROJECTILE_DAMAGE.get(), 1.0f, 20)) {
count++;
ParticleUtil.addParticles(
(ServerLevel) target.level(), ModParticles.TRUE_NIGHTS_EDGE_HIT_PARTICLE.get(),
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
0, 1
);
target.invulnerableTime = 20;
}
}
if(!targets.isEmpty()) customData.putInt("hitCount", count);
@@ -166,7 +166,7 @@ public class Volcano extends MeleeWeapon {
for(LivingEntity livingEntity : targets) {
if(livingEntity.getUUID() == target.getUUID()) continue;
if(hitCount >= EXPLOSION_MAX_HIT_COUNT.get()) break;
if(DamageUtil.meleeAttack(player, livingEntity, player.getWeaponItem(), (float) EXPLOSION_DAMAGE.get(), 1.0f)) {
if(DamageUtil.meleeAttack(player, livingEntity, player.getWeaponItem(), (float) EXPLOSION_DAMAGE.get(), 1.0f, -1)) {
livingTarget.igniteForSeconds(IGNITE_SECONDS.get());
hitCount++;
}
@@ -102,27 +102,9 @@ public class Zenith extends MeleeWeapon {
10,
100
);
public static final ConfigDouble SCALE = new ConfigDouble(
"weapon.zenith.scale",
"zenith_scale",
2.0,
0.1,
10.0
);
public static final ConfigDouble TRAIL_ALPHA = new ConfigDouble(
"weapon.zenith.trail_alpha",
"zenith_trail_alpha",
0.15,
0.0,
1.0
);
public static final ConfigInt TRAIL_MAX_LENGTH = new ConfigInt(
"weapon.zenith.trail_max_length",
"zenith_trail_max_length",
10,
0,
100
);
public static final float SCALE = 2.0f;
public static final float TRAIL_ALPHA = 1.0f;
public static final int TRAIL_MAX_LENGTH = 10;
public static final IConfigData CONFIG_DATA = new IConfigData() {
@Override
public void onConfigLoad() {
@@ -137,10 +119,7 @@ public class Zenith extends MeleeWeapon {
TRAIL_OFFSET,
WEAPON_COUNT,
BOUNDING_BOX_SIZE,
CYCLE,
SCALE,
TRAIL_ALPHA,
TRAIL_MAX_LENGTH
CYCLE
);
}
};
@@ -177,11 +156,11 @@ public class Zenith extends MeleeWeapon {
}
public static double getScale() {
return SCALE.get();
return SCALE;
}
public static double getTrailAlpha() {
return TRAIL_ALPHA.get();
return TRAIL_ALPHA;
}
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
@@ -291,7 +270,7 @@ public class Zenith extends MeleeWeapon {
projectile.trailPositions.addFirst(projectile.position().add(right.scale(-1.2)));
projectile.trailPositions.addFirst(projectile.position().add(right.scale(1.5)));
while(projectile.trailPositions.size() > TRAIL_MAX_LENGTH.get()) projectile.trailPositions.removeLast();
while(projectile.trailPositions.size() > TRAIL_MAX_LENGTH) projectile.trailPositions.removeLast();
projectile.setBoundingBox(new AABB(
projectile.getX() - BOUNDING_BOX_SIZE.get(), projectile.getY() - BOUNDING_BOX_SIZE.get(), projectile.getZ() - BOUNDING_BOX_SIZE.get(),
@@ -332,8 +311,7 @@ public class Zenith extends MeleeWeapon {
if(!projectile.level().isClientSide()) {
Entity target = result.getEntity();
if(projectile.getOwner() instanceof Player player && FilterUtil.createTargetFilter(projectile, projectile.getOwner()).test(target)) {
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) (DAMAGE.get() + Math.random() * DAMAGE.get()), 0.2f)) {
target.invulnerableTime = 2;
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), (float) (DAMAGE.get() + Math.random() * DAMAGE.get()), 0.2f, 2)) {
}
}
}
@@ -388,16 +366,16 @@ public class Zenith extends MeleeWeapon {
customData.putInt("angle", randomAngle);
if(i == 0) {
projectile.getEntityData().set(StaticProjectile.COLOR_A, 1.0f);
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE.get().floatValue());
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE.get().floatValue());
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE);
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE);
projectile.getEntityData().set(StaticProjectile.LIFETIME, cycle);
projectile.getEntityData().set(StaticProjectile.EXPRESSION_X, String.format("%.3f*cos(%.3ft-1.571)", b, w));
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*sin(%.3ft-1.571)+%.3f", a, w, a));
customData.putInt("start", 0);
}else if(i == 1) {
projectile.getEntityData().set(StaticProjectile.COLOR_A, 0.75f);
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE.get().floatValue() * 0.75f);
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE.get().floatValue() * 0.75f);
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE * 0.75f);
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE * 0.75f);
projectile.getEntityData().set(StaticProjectile.LIFETIME, (int) (cycle * 1.25));
if(w > 0) {
projectile.getEntityData().set(StaticProjectile.EXPRESSION_X, String.format("%.3f*cos(%.3ft-3.142)", b, w));
@@ -409,8 +387,8 @@ public class Zenith extends MeleeWeapon {
customData.putInt("start", (int) (cycle * 0.25));
}else if(i == 2) {
projectile.getEntityData().set(StaticProjectile.COLOR_A, 0.5f);
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE.get().floatValue() * 0.5f);
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE.get().floatValue() * 0.5f);
projectile.getEntityData().set(StaticProjectile.SCALE_X, SCALE * 0.5f);
projectile.getEntityData().set(StaticProjectile.SCALE_Y, SCALE * 0.5f);
projectile.getEntityData().set(StaticProjectile.LIFETIME, (int) (cycle * 1.5));
if(w > 0) {
projectile.getEntityData().set(StaticProjectile.EXPRESSION_X, String.format("%.3f*cos(%.3ft-4.713)", b, w));
@@ -87,8 +87,7 @@ public class ElfMelter extends RangedWeapon {
for(Entity target : targets) {
if(target.getBoundingBox().inflate(1.0).clip(collisionStart, end).isEmpty()) continue;
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), -0.25f)) {
target.invulnerableTime = 12;
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), -0.25f, 12)) {
if(target instanceof LivingEntity livingTarget) {
livingTarget.setTicksFrozen(Math.max(livingTarget.getTicksFrozen(), FREEZE_TICKS.get()));
}
@@ -113,8 +113,7 @@ public class Flamethrower extends RangedWeapon {
for(Entity target : targets) {
if(target.getBoundingBox().inflate(1.0).clip(collisionStart, end).isEmpty()) continue;
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), -0.25f)) {
target.invulnerableTime = 12;
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), -0.25f, 12)) {
if(target instanceof LivingEntity livingTarget) {
livingTarget.igniteForTicks(IGNITE_TICKS.get());
}
@@ -78,8 +78,7 @@ public class SnowballCannon extends RangedWeapon {
if(!targets.isEmpty()) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.5f)) {
target.invulnerableTime = 10;
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.5f, 10)) {
this.onDied(summon);
return;
}
@@ -81,8 +81,7 @@ public class StarCannon extends RangedWeapon {
);
for(Entity target : targets) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.25f)) {
target.invulnerableTime = 5;
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.25f, 5)) {
}
}
@@ -89,8 +89,7 @@ public class SuperStarShooter extends RangedWeapon {
for(Entity target : targets) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.3f)) {
target.invulnerableTime = 10;
if(DamageUtil.rangedAttack(summon, target, sourceStack, DAMAGE.get(), 0.3f, 10)) {
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), summon.level());
projectile.setOwner(summon.getOwner());
@@ -130,8 +129,7 @@ public class SuperStarShooter extends RangedWeapon {
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
if(!projectile.level().isClientSide()) {
Entity target = result.getEntity();
if(DamageUtil.rangedAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), BOLT_DAMAGE.get(), 0.3f)) {
target.invulnerableTime = 5;
if(DamageUtil.rangedAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), BOLT_DAMAGE.get(), 0.3f, 5)) {
}
}
}
@@ -11,8 +11,8 @@ import com.lzxnone.terraria.item.accessory.AccessoryUtil;
import com.lzxnone.terraria.item.effect.MinionCountModifier;
import com.lzxnone.terraria.item.effect.MinionKnockbackModifier;
import com.lzxnone.terraria.item.weapon.SummonWeapon;
import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.SearchUtil;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@@ -154,19 +154,10 @@ public class MinionWeapon extends SummonWeapon {
if(playerRelatedTarget != null) return playerRelatedTarget;
AABB searchBox = AABB.ofSize(summon.position(), range * 2.0D, range * 2.0D, range * 2.0D);
List<Entity> targets = ignoreBlockOcclusion ? CollisionUtil.searchEntities(
summon.level(),
searchBox,
summon,
player
) : CollisionUtil.searchEnemies(
summon.level(),
searchBox,
summon,
player
);
List<Entity> targets = ignoreBlockOcclusion
? SearchUtil.searchEntities(summon, player, searchBox)
: SearchUtil.searchEnemies(summon, player, searchBox);
targets.removeIf(target -> !isValidSummonTarget(summon, player, target, range)
|| (!ignoreBlockOcclusion && !isValidEnemySummonTarget(summon, player, target, range))
|| (!ignoreBlockOcclusion && !canPlayerSeeTarget(player, target)));
targets.sort(Comparator.comparingDouble(target -> target.distanceToSqr(summon.position())));
return targets.isEmpty() ? null : targets.getFirst();
@@ -199,7 +190,7 @@ public class MinionWeapon extends SummonWeapon {
if(customData.contains("targetPart")) {
String targetPart = customData.getString("targetPart");
for(EnderDragonPart part : dragon.getSubEntities()) {
if(part.name.equals(targetPart) && CollisionUtil.isEnemySearchTarget(part, summon, summon.getOwner())) {
if(part.name.equals(targetPart) && isValidEnemyTarget(summon, summon.getOwner(), part)) {
return part;
}
}
@@ -207,7 +198,7 @@ public class MinionWeapon extends SummonWeapon {
Entity owner = summon.getOwner();
EnderDragonPart nearestPart = List.of(dragon.getSubEntities()).stream()
.filter(part -> CollisionUtil.isEnemySearchTarget(part, summon, owner))
.filter(part -> isValidEnemyTarget(summon, owner, part))
.min(Comparator.comparingDouble(part -> part.distanceToSqr(summon.position())))
.orElse(null);
return nearestPart != null ? nearestPart : dragon;
@@ -232,13 +223,6 @@ public class MinionWeapon extends SummonWeapon {
&& FilterUtil.createTargetFilter(summon, player).test(target);
}
private static boolean isValidEnemySummonTarget(StaticSummon summon, Player player, Entity target, double range) {
return target != null
&& target.level() == summon.level()
&& target.distanceToSqr(summon) <= range * range
&& CollisionUtil.isEnemySearchTarget(target, summon, player);
}
private static boolean canPlayerSeeTarget(Player player, Entity target) {
BlockHitResult hitResult = player.level().clip(new ClipContext(
player.getEyePosition(),
@@ -250,6 +234,10 @@ public class MinionWeapon extends SummonWeapon {
return hitResult.getType() == HitResult.Type.MISS;
}
private static boolean isValidEnemyTarget(StaticSummon summon, Entity owner, Entity target) {
return SearchUtil.searchEnemies(summon, owner, target.getBoundingBox()).contains(target);
}
private static boolean hasBarrenLand(StaticSummon summon, Player player) {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
if(sourceStack.isEmpty()) sourceStack = player.getWeaponItem();
@@ -174,7 +174,7 @@ public class StardustDragonStaff extends MinionWeapon {
float damage = DAMAGE.get() + ADD_DAMAGE.get() * Math.max(0, stardustDragonSlotCount - 1);
for(Entity target : targets) {
if(DamageUtil.minionAttack(summon, target, sourceStack, damage, 1.0f)) target.invulnerableTime = 15;
DamageUtil.minionAttack(summon, target, sourceStack, damage, 1.0f, 15);
}
}
}
@@ -234,7 +234,7 @@ public class Terraprisma extends MinionWeapon {
);
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(Entity target : targets) {
if(DamageUtil.minionAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : DAMAGE.get(), 1.0f)) target.invulnerableTime = 15;
DamageUtil.minionAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : DAMAGE.get(), 1.0f, 15);
}
}else if(state == State.ROTATE.ordinal()) {
int time = customData.contains("rotateTime") ? customData.getInt("rotateTime") : 0;
@@ -285,7 +285,7 @@ public class Terraprisma extends MinionWeapon {
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
for(Entity target : targets) {
if(DamageUtil.minionAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : DAMAGE.get(), 1.0f)) target.invulnerableTime = 15;
DamageUtil.minionAttack(summon, target, sourceStack, customData.contains("damage") ? customData.getFloat("damage") : DAMAGE.get(), 1.0f, 15);
}
customData.putInt("rotateTime", time + 1);
@@ -154,9 +154,7 @@ public class Possession extends Whip {
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
if(!projectile.level().isClientSide()) {
Entity target = result.getEntity();
if(DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), BEAM_DAMAGE.get(), 0)) {
target.invulnerableTime = 5;
}
DamageUtil.meleeAttack(projectile, target, projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), BEAM_DAMAGE.get(), 0, 5);
}
}
};
@@ -6,9 +6,9 @@ import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
import com.lzxnone.terraria.item.weapon.SummonWeapon;
import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.MathUtil;
import com.lzxnone.terraria.utils.SearchUtil;
import com.lzxnone.terraria.utils.SoundUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Mth;
@@ -196,10 +196,9 @@ public abstract class Whip extends SummonWeapon {
double radius = range + height + bend + HITBOX_INFLATE;
AABB searchBox = AABB.ofSize(hand, radius * 2.0D, radius * 2.0D, radius * 2.0D);
for(Entity target : CollisionUtil.searchEntities(summon.level(), searchBox, summon, summon.getOwner())) {
for(Entity target : SearchUtil.searchEntities(summon, summon.getOwner(), searchBox)) {
if(!intersectsWhip(points, target)) continue;
if(DamageUtil.summonAttack(summon, target, sourceStack, whip.getDamage(), whip.getKnockbackScale())) {
target.invulnerableTime = whip.getInvulnerableTime();
if(DamageUtil.summonAttack(summon, target, sourceStack, whip.getDamage(), whip.getKnockbackScale(), whip.getInvulnerableTime())) {
whip.onHitTarget(summon, target);
}
}
@@ -97,6 +97,8 @@ import com.lzxnone.terraria.item.weapon.magic.BetsyWrath;
import com.lzxnone.terraria.item.weapon.magic.BubbleGun;
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
import com.lzxnone.terraria.item.weapon.magic.NebulaArcanum;
import com.lzxnone.terraria.item.weapon.magic.NebulaBlaze;
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
import com.lzxnone.terraria.item.weapon.melee.BladeOfGrass;
import com.lzxnone.terraria.item.weapon.melee.BloodButcherer;
@@ -179,6 +181,8 @@ public class ConfigList {
LastPrism.CONFIG_LIST_ITEM,
BetsyWrath.CONFIG_LIST_ITEM,
LunarFlare.CONFIG_LIST_ITEM,
NebulaBlaze.CONFIG_LIST_ITEM,
NebulaArcanum.CONFIG_LIST_ITEM,
BubbleGun.CONFIG_LIST_ITEM,
Minishark.CONFIG_LIST_ITEM,
FlintlockPistol.CONFIG_LIST_ITEM,
@@ -3,23 +3,11 @@ package com.lzxnone.terraria.utils;
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.projectile.ProjectileUtil;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.entity.PartEntity;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class CollisionUtil {
public static EntityHitResult checkEntityHit(StaticProjectile projectile, double inflate) {
@@ -58,69 +46,4 @@ public class CollisionUtil {
entity
));
}
public static List<Entity> searchEntities(Level level, AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
return level.getEntitiesOfClass(
Entity.class,
searchBox,
FilterUtil.createTargetFilter(attacker, owner)
);
}
public static List<Entity> searchEnemies(Level level, AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
List<Entity> enemies = new ArrayList<>();
Set<Integer> addedIds = new HashSet<>();
for(Entity entity : level.getEntitiesOfClass(Entity.class, searchBox, entity -> isEnemySearchTarget(entity, attacker, owner))) {
if(entity instanceof EnderDragon dragon) {
addEnderDragonParts(enemies, addedIds, dragon, searchBox, attacker, owner);
}else if(addedIds.add(entity.getId())) {
enemies.add(entity);
}
}
for(EnderDragon dragon : level.getEntitiesOfClass(
EnderDragon.class,
searchBox.inflate(16.0D),
dragon -> isEnemySearchTarget(dragon, attacker, owner)
)) {
addEnderDragonParts(enemies, addedIds, dragon, searchBox, attacker, owner);
}
return enemies;
}
public static boolean isEnemySearchTarget(Entity entity, @Nullable Entity attacker, @Nullable Entity owner) {
if(entity instanceof EnderDragonPart dragonPart) {
return isSearchableTarget(dragonPart, attacker, owner, true)
&& isSearchableTarget(dragonPart.parentMob, attacker, owner, false);
}
if(entity instanceof EnderDragon dragon) {
return isSearchableTarget(dragon, attacker, owner, false);
}
return entity instanceof LivingEntity livingTarget
&& FilterUtil.createEnemyFilter(attacker, owner).test(livingTarget);
}
private static boolean isSearchableTarget(Entity entity, @Nullable Entity attacker, @Nullable Entity owner, boolean requirePickable) {
return entity != null
&& entity.isAlive()
&& (!requirePickable || entity.isPickable())
&& !entity.isInvulnerable()
&& !entity.isSpectator()
&& entity != attacker
&& !(entity instanceof PartEntity<?> part && part.getParent() == attacker)
&& (owner == null || (entity != owner && !entity.isAlliedTo(owner)));
}
private static void addEnderDragonParts(List<Entity> enemies, Set<Integer> addedIds, EnderDragon dragon,
AABB searchBox, @Nullable Entity attacker, @Nullable Entity owner) {
for(EnderDragonPart part : dragon.getSubEntities()) {
if(part.getBoundingBox().intersects(searchBox)
&& isEnemySearchTarget(part, attacker, owner)
&& addedIds.add(part.getId())) {
enemies.add(part);
}
}
}
}
@@ -16,15 +16,22 @@ import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.phys.Vec3;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
public class DamageUtil {
private static final Map<String, Long> DRAGON_INVULNERABLE_UNTIL = new HashMap<>();
public enum DamageCategory {
NORMAL,
MELEE,
@@ -36,36 +43,36 @@ public class DamageUtil {
REAL
}
public static boolean normalAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.NORMAL);
public static boolean normalAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.NORMAL);
}
public static boolean meleeAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MELEE);
public static boolean meleeAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MELEE);
}
public static boolean rangedAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.RANGED);
public static boolean rangedAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.RANGED);
}
public static boolean summonAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.SUMMON);
public static boolean summonAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.SUMMON);
}
public static boolean minionAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MINION);
public static boolean minionAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MINION);
}
public static boolean sentryAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.SENTRY);
public static boolean sentryAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.SENTRY);
}
public static boolean magicAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MAGIC);
public static boolean magicAttack(Entity attackEntity, Entity target, ItemStack sourceStack, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, sourceStack, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_NORMAL_ATTACK, DamageCategory.MAGIC);
}
public static boolean realAttack(Entity attackEntity, Entity target, float damage, float knockbackScale) {
return entityAttack(attackEntity, target, ItemStack.EMPTY, damage, knockbackScale, ModDamageTypes.PLAYER_REAL_ATTACK, DamageCategory.REAL);
public static boolean realAttack(Entity attackEntity, Entity target, float damage, float knockbackScale, int invulnerableTime) {
return entityAttack(attackEntity, target, ItemStack.EMPTY, damage, knockbackScale, invulnerableTime, ModDamageTypes.PLAYER_REAL_ATTACK, DamageCategory.REAL);
}
private static boolean entityAttack(
@@ -74,6 +81,7 @@ public class DamageUtil {
ItemStack sourceStack,
float damage,
float knockbackScale,
int invulnerableTime,
ResourceKey<DamageType> damageType,
DamageCategory category
) {
@@ -119,9 +127,16 @@ public class DamageUtil {
}
Vec3 beforeHurtMovement = target instanceof LivingEntity livingTarget ? livingTarget.getDeltaMovement() : Vec3.ZERO;
String dragonInvulnerableKey = getDragonInvulnerableKey(target);
if(dragonInvulnerableKey != null && invulnerableTime > 0) {
long gameTime = serverLevel.getGameTime();
Long invulnerableUntil = DRAGON_INVULNERABLE_UNTIL.get(dragonInvulnerableKey);
if(invulnerableUntil != null && invulnerableUntil > gameTime) return false;
}
boolean hasHurt = target.hurt(source, finalDamage);
if(hasHurt) {
applyInvulnerableTime(serverLevel, target, invulnerableTime, dragonInvulnerableKey);
if(category != DamageCategory.MINION && category != DamageCategory.SENTRY && target instanceof LivingEntity livingTarget) {
player.setLastHurtMob(livingTarget);
}
@@ -154,6 +169,33 @@ public class DamageUtil {
return hasHurt;
}
private static void applyInvulnerableTime(ServerLevel serverLevel, Entity target, int invulnerableTime, String dragonInvulnerableKey) {
if(invulnerableTime < 0) return;
target.invulnerableTime = invulnerableTime;
if(target instanceof EnderDragonPart dragonPart) {
dragonPart.parentMob.invulnerableTime = invulnerableTime;
}
if(dragonInvulnerableKey != null && invulnerableTime > 0) {
DRAGON_INVULNERABLE_UNTIL.put(dragonInvulnerableKey, serverLevel.getGameTime() + invulnerableTime);
if(DRAGON_INVULNERABLE_UNTIL.size() > 1024) {
long gameTime = serverLevel.getGameTime();
DRAGON_INVULNERABLE_UNTIL.entrySet().removeIf(entry -> entry.getValue() <= gameTime);
}
}
}
private static String getDragonInvulnerableKey(Entity target) {
UUID targetUuid = null;
String partName = "";
if(target instanceof EnderDragonPart dragonPart) {
targetUuid = dragonPart.parentMob.getUUID();
partName = ":" + dragonPart.name;
}else if(target instanceof EnderDragon dragon) {
targetUuid = dragon.getUUID();
}
return targetUuid == null ? null : targetUuid + partName;
}
public static float applyPlayerDamageEffects(Player player, float damage) {
float finalDamage = damage;
//力量
@@ -0,0 +1,102 @@
package com.lzxnone.terraria.utils;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.phys.AABB;
import net.neoforged.neoforge.entity.PartEntity;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
public class SearchUtil {
private SearchUtil() {}
public static List<Entity> searchEntities(Entity entity, @Nullable Entity owner, AABB searchBox) {
return entity.level().getEntitiesOfClass(
Entity.class,
searchBox,
FilterUtil.createTargetFilter(entity, owner)
);
}
public static List<Entity> searchEnemies(Entity entity, @Nullable Entity owner, AABB searchBox) {
List<Entity> enemies = new ArrayList<>();
Set<Integer> addedIds = new HashSet<>();
Predicate<Entity> enemyFilter = target -> {
if(target instanceof EnderDragonPart dragonPart) {
EnderDragon dragon = dragonPart.parentMob;
return dragonPart.isAlive()
&& dragonPart.isPickable()
&& !dragonPart.isInvulnerable()
&& !dragonPart.isSpectator()
&& dragonPart != entity
&& !(dragonPart instanceof PartEntity<?> part && part.getParent() == entity)
&& (owner == null || (dragonPart != owner && !dragonPart.isAlliedTo(owner)))
&& dragon != null
&& dragon.isAlive()
&& !dragon.isInvulnerable()
&& !dragon.isSpectator()
&& dragon != entity
&& (owner == null || (dragon != owner && !dragon.isAlliedTo(owner)));
}
if(target instanceof EnderDragon dragon) {
return dragon.isAlive()
&& !dragon.isInvulnerable()
&& !dragon.isSpectator()
&& dragon != entity
&& (owner == null || (dragon != owner && !dragon.isAlliedTo(owner)));
}
return target instanceof LivingEntity livingTarget
&& FilterUtil.createEnemyFilter(entity, owner).test(livingTarget);
};
for(Entity target : entity.level().getEntitiesOfClass(Entity.class, searchBox, enemyFilter)) {
if(target instanceof EnderDragon dragon) {
for(EnderDragonPart part : dragon.getSubEntities()) {
if(part.getBoundingBox().intersects(searchBox)
&& enemyFilter.test(part)
&& addedIds.add(part.getId())) {
enemies.add(part);
}
}
}else if(addedIds.add(target.getId())) {
enemies.add(target);
}
}
for(EnderDragon dragon : entity.level().getEntitiesOfClass(EnderDragon.class, searchBox.inflate(16.0D), enemyFilter)) {
for(EnderDragonPart part : dragon.getSubEntities()) {
if(part.getBoundingBox().intersects(searchBox)
&& enemyFilter.test(part)
&& addedIds.add(part.getId())) {
enemies.add(part);
}
}
}
return enemies;
}
public static List<Entity> searchNearestEntities(Entity entity, @Nullable Entity owner, AABB searchBox, int count) {
List<Entity> targets = searchEntities(entity, owner, searchBox);
if(count <= 0 || targets.isEmpty()) return List.of();
targets.sort(Comparator.comparingDouble(target -> target.distanceToSqr(searchBox.getCenter())));
if(targets.size() <= count) return targets;
return new ArrayList<>(targets.subList(0, count));
}
public static List<Entity> searchNearestEnemies(Entity entity, @Nullable Entity owner, AABB searchBox, int count) {
List<Entity> targets = searchEnemies(entity, owner, searchBox);
if(count <= 0 || targets.isEmpty()) return List.of();
targets.sort(Comparator.comparingDouble(target -> target.distanceToSqr(searchBox.getCenter())));
if(targets.size() <= count) return targets;
return new ArrayList<>(targets.subList(0, count));
}
}
@@ -42,6 +42,8 @@
"item.lzxnoneterraria.last_prism": "Last Prism",
"item.lzxnoneterraria.betsys_wrath": "Betsy's Wrath",
"item.lzxnoneterraria.lunar_flare": "Lunar Flare",
"item.lzxnoneterraria.nebula_blaze": "Nebula Blaze",
"item.lzxnoneterraria.nebula_arcanum": "Nebula Arcanum",
"item.lzxnoneterraria.bubble_gun": "Bubble Gun",
"item.lzxnoneterraria.bubble_gun_projectile": "Bubble",
"item.lzxnoneterraria.terraprisma": "Terraprisma",
@@ -658,12 +660,6 @@
"lzxnoneterraria.configuration.zenith_bounding_box_size.tooltip": "Projectile collision hitbox size",
"lzxnoneterraria.configuration.zenith_cycle": "Cycle Duration",
"lzxnoneterraria.configuration.zenith_cycle.tooltip": "Projectile movement cycle duration",
"lzxnoneterraria.configuration.zenith_scale": "Projectile Scale",
"lzxnoneterraria.configuration.zenith_scale.tooltip": "Projectile size multiplier",
"lzxnoneterraria.configuration.zenith_trail_alpha": "Trail Opacity",
"lzxnoneterraria.configuration.zenith_trail_alpha.tooltip": "Trail rendering opacity",
"lzxnoneterraria.configuration.zenith_trail_max_length": "Trail Length",
"lzxnoneterraria.configuration.zenith_trail_max_length.tooltip": "Maximum number of trail segments",
"lzxnoneterraria.configuration.excalibur_rotate_range": "Blade Rotate Range",
"lzxnoneterraria.configuration.excalibur_rotate_range.tooltip": "Blade rotation angle range",
"lzxnoneterraria.configuration.excalibur_max_hit_count": "Blade Max Hit Count",
@@ -1052,6 +1048,28 @@
"lzxnoneterraria.configuration.lunar_flare_explosion_range.tooltip": "Radius for damage after projectile explosion",
"lzxnoneterraria.configuration.lunar_flare_mana_consume": "Mana Cost",
"lzxnoneterraria.configuration.lunar_flare_mana_consume.tooltip": "Mana consumed per shot",
"lzxnoneterraria.configuration.nebula_blaze_damage": "Damage",
"lzxnoneterraria.configuration.nebula_blaze_damage.tooltip": "Area magic damage dealt by normal projectiles",
"lzxnoneterraria.configuration.nebula_blaze_explosive_damage": "Explosive Damage",
"lzxnoneterraria.configuration.nebula_blaze_explosive_damage.tooltip": "Area magic damage dealt by explosive projectiles",
"lzxnoneterraria.configuration.nebula_blaze_speed": "Normal Speed",
"lzxnoneterraria.configuration.nebula_blaze_speed.tooltip": "Normal projectile movement speed",
"lzxnoneterraria.configuration.nebula_blaze_explosive_speed": "Explosive Speed",
"lzxnoneterraria.configuration.nebula_blaze_explosive_speed.tooltip": "Explosive projectile movement speed",
"lzxnoneterraria.configuration.nebula_blaze_target_range": "Normal Tracking Range",
"lzxnoneterraria.configuration.nebula_blaze_target_range.tooltip": "Range for normal projectiles to search enemies",
"lzxnoneterraria.configuration.nebula_blaze_explosive_target_range": "Explosive Tracking Range",
"lzxnoneterraria.configuration.nebula_blaze_explosive_target_range.tooltip": "Range for explosive projectiles to search enemies",
"lzxnoneterraria.configuration.nebula_blaze_explosion_range": "Area Damage Radius",
"lzxnoneterraria.configuration.nebula_blaze_explosion_range.tooltip": "Radius for area damage after projectile death",
"lzxnoneterraria.configuration.nebula_blaze_explosive_chance": "Explosive Chance",
"lzxnoneterraria.configuration.nebula_blaze_explosive_chance.tooltip": "Chance for each shot to become an explosive projectile",
"lzxnoneterraria.configuration.nebula_blaze_mana_consume": "Mana Cost",
"lzxnoneterraria.configuration.nebula_blaze_mana_consume.tooltip": "Mana consumed per shot",
"lzxnoneterraria.configuration.nebula_arcanum_damage": "Damage",
"lzxnoneterraria.configuration.nebula_arcanum_damage.tooltip": "Magic damage dealt",
"lzxnoneterraria.configuration.nebula_arcanum_mana_consume": "Mana Cost",
"lzxnoneterraria.configuration.nebula_arcanum_mana_consume.tooltip": "Mana consumed per shot",
"lzxnoneterraria.configuration.bubble_gun_damage": "Damage",
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "Magic damage dealt by each bubble hit",
"lzxnoneterraria.configuration.bubble_gun_speed": "Speed",
@@ -42,6 +42,8 @@
"item.lzxnoneterraria.last_prism": "终极棱镜",
"item.lzxnoneterraria.betsys_wrath": "双足翼龙怒气",
"item.lzxnoneterraria.lunar_flare": "月耀",
"item.lzxnoneterraria.nebula_blaze": "星云烈焰",
"item.lzxnoneterraria.nebula_arcanum": "星云奥秘",
"item.lzxnoneterraria.bubble_gun": "泡泡枪",
"item.lzxnoneterraria.bubble_gun_projectile": "泡泡",
"item.lzxnoneterraria.terraprisma": "泰拉棱镜",
@@ -658,12 +660,6 @@
"lzxnoneterraria.configuration.zenith_bounding_box_size.tooltip": "弹射物的碰撞检测体积",
"lzxnoneterraria.configuration.zenith_cycle": "运动周期",
"lzxnoneterraria.configuration.zenith_cycle.tooltip": "弹射物运动周期",
"lzxnoneterraria.configuration.zenith_scale": "弹射大小倍数",
"lzxnoneterraria.configuration.zenith_scale.tooltip": "弹射物尺寸缩放倍数",
"lzxnoneterraria.configuration.zenith_trail_alpha": "尾迹透明度",
"lzxnoneterraria.configuration.zenith_trail_alpha.tooltip": "尾迹渲染透明度",
"lzxnoneterraria.configuration.zenith_trail_max_length": "尾迹长度",
"lzxnoneterraria.configuration.zenith_trail_max_length.tooltip": "尾迹最大段数",
"lzxnoneterraria.configuration.excalibur_rotate_range": "刀光偏转角范围",
"lzxnoneterraria.configuration.excalibur_rotate_range.tooltip": "刀光旋转角度范围",
"lzxnoneterraria.configuration.excalibur_max_hit_count": "刀光最大击中数",
@@ -1052,6 +1048,28 @@
"lzxnoneterraria.configuration.lunar_flare_explosion_range.tooltip": "弹射物爆炸后造成伤害的半径",
"lzxnoneterraria.configuration.lunar_flare_mana_consume": "魔力消耗",
"lzxnoneterraria.configuration.lunar_flare_mana_consume.tooltip": "每次发射消耗的魔力",
"lzxnoneterraria.configuration.nebula_blaze_damage": "伤害",
"lzxnoneterraria.configuration.nebula_blaze_damage.tooltip": "普通弹射的范围魔法伤害",
"lzxnoneterraria.configuration.nebula_blaze_explosive_damage": "爆弹伤害",
"lzxnoneterraria.configuration.nebula_blaze_explosive_damage.tooltip": "爆弹射的范围魔法伤害",
"lzxnoneterraria.configuration.nebula_blaze_speed": "普通速度",
"lzxnoneterraria.configuration.nebula_blaze_speed.tooltip": "普通弹射移动速度",
"lzxnoneterraria.configuration.nebula_blaze_explosive_speed": "爆弹速度",
"lzxnoneterraria.configuration.nebula_blaze_explosive_speed.tooltip": "爆弹射移动速度",
"lzxnoneterraria.configuration.nebula_blaze_target_range": "普通追踪范围",
"lzxnoneterraria.configuration.nebula_blaze_target_range.tooltip": "普通弹射自动搜寻敌人的范围",
"lzxnoneterraria.configuration.nebula_blaze_explosive_target_range": "爆弹追踪范围",
"lzxnoneterraria.configuration.nebula_blaze_explosive_target_range.tooltip": "爆弹射自动搜寻敌人的范围",
"lzxnoneterraria.configuration.nebula_blaze_explosion_range": "范围伤害半径",
"lzxnoneterraria.configuration.nebula_blaze_explosion_range.tooltip": "弹射死亡后造成范围伤害的半径",
"lzxnoneterraria.configuration.nebula_blaze_explosive_chance": "爆弹概率",
"lzxnoneterraria.configuration.nebula_blaze_explosive_chance.tooltip": "每次发射变为爆弹射的概率",
"lzxnoneterraria.configuration.nebula_blaze_mana_consume": "魔力消耗",
"lzxnoneterraria.configuration.nebula_blaze_mana_consume.tooltip": "每次发射消耗的魔力",
"lzxnoneterraria.configuration.nebula_arcanum_damage": "伤害",
"lzxnoneterraria.configuration.nebula_arcanum_damage.tooltip": "造成的魔法伤害",
"lzxnoneterraria.configuration.nebula_arcanum_mana_consume": "魔力消耗",
"lzxnoneterraria.configuration.nebula_arcanum_mana_consume.tooltip": "每次发射消耗的魔力",
"lzxnoneterraria.configuration.bubble_gun_damage": "伤害",
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "每个泡泡命中造成的魔法伤害",
"lzxnoneterraria.configuration.bubble_gun_speed": "速度",
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/sword",
"textures": {
"layer0": "lzxnoneterraria:item/nebula_arcanum"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/sword",
"textures": {
"layer0": "lzxnoneterraria:item/nebula_blaze"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B