This commit is contained in:
LZX committed 2026-07-28 21:19:11 +08:00
1 parent e9d4665059
commit 3dbe97dd60
83 files changed
+1385 -243

No files matched your search

@@ -92,5 +92,11 @@ public class LzxnoneTerrariaClient {
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> { modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
event.registerSpriteSet(ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE2.get(), DevilsDevastationRuneParticle2.Provider::new); event.registerSpriteSet(ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE2.get(), DevilsDevastationRuneParticle2.Provider::new);
}); });
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
event.registerSpriteSet(ModParticles.BLACK_DUST_PARTICLE.get(), BlackDustParticle.Provider::new);
});
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
event.registerSpriteSet(ModParticles.PARTY_PARTICLE.get(), PartyParticle.Provider::new);
});
} }
} }
@@ -51,6 +51,26 @@ public class ModSounds {
SOUND_EVENTS.register("shot", SOUND_EVENTS.register("shot",
() -> SoundEvent.createVariableRangeEvent( () -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot"))); ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot")));
public static final Supplier<SoundEvent> SHOT2 =
SOUND_EVENTS.register("shot2",
() -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot2")));
public static final Supplier<SoundEvent> SHOT3 =
SOUND_EVENTS.register("shot3",
() -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot3")));
public static final Supplier<SoundEvent> SHOT4 =
SOUND_EVENTS.register("shot4",
() -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot4")));
public static final Supplier<SoundEvent> SHOT5 =
SOUND_EVENTS.register("shot5",
() -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot5")));
public static final Supplier<SoundEvent> SHOT6 =
SOUND_EVENTS.register("shot6",
() -> SoundEvent.createVariableRangeEvent(
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot6")));
public static final Supplier<SoundEvent> BOOM = public static final Supplier<SoundEvent> BOOM =
SOUND_EVENTS.register("boom", SOUND_EVENTS.register("boom",
() -> SoundEvent.createVariableRangeEvent( () -> SoundEvent.createVariableRangeEvent(
@@ -59,6 +59,17 @@ public class ModCreativeModeTabs {
.title(Component.translatable("itemGroup.lzxnoneterraria.ranged")) .title(Component.translatable("itemGroup.lzxnoneterraria.ranged"))
.icon(() -> ModItems.SDMG.get().getDefaultInstance()) .icon(() -> ModItems.SDMG.get().getDefaultInstance())
.displayItems((parameters, output) -> { .displayItems((parameters, output) -> {
output.accept(ModItems.MINISHARK.get());
output.accept(ModItems.FLINTLOCK_PISTOL.get());
output.accept(ModItems.BOOMSTICK.get());
output.accept(ModItems.REVOLVER.get());
output.accept(ModItems.RED_RYDER.get());
output.accept(ModItems.MUSKET.get());
output.accept(ModItems.THE_UNDERTAKER.get());
output.accept(ModItems.QUAD_BARREL_SHOTGUN.get());
output.accept(ModItems.HANDGUN.get());
output.accept(ModItems.PHOENIX_BLASTER.get());
output.accept(ModItems.MEGASHARK.get());
output.accept(ModItems.SDMG.get()); output.accept(ModItems.SDMG.get());
output.accept(ModItems.MUSKET_BALL.get()); output.accept(ModItems.MUSKET_BALL.get());
output.accept(ModItems.METEOR_SHOT.get()); output.accept(ModItems.METEOR_SHOT.get());
@@ -62,6 +62,12 @@ public class MEntityLuminance implements EntityLuminance {
StaticSummonBehaviors.TERRAPRISMA -> { StaticSummonBehaviors.TERRAPRISMA -> {
return 15; return 15;
} }
case StaticSummonBehaviors.CHLOROPHYTE_BULLET,
StaticSummonBehaviors.ICHOR_BULLET,
StaticSummonBehaviors.NANO_BULLET,
StaticSummonBehaviors.LUMINITE_BULLET -> {
return 5;
}
default -> { default -> {
return 0; return 0;
} }
@@ -2,6 +2,7 @@ package com.lzxnone.terraria.effect;
import com.lzxnone.terraria.LzxnoneTerraria; import com.lzxnone.terraria.LzxnoneTerraria;
import com.lzxnone.terraria.particle.DustParticleOptions; import com.lzxnone.terraria.particle.DustParticleOptions;
import com.lzxnone.terraria.particle.ModParticles;
import com.lzxnone.terraria.ui.config.ConfigFactory; import com.lzxnone.terraria.ui.config.ConfigFactory;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.ConfigUtil; import com.lzxnone.terraria.ui.config.ConfigUtil;
@@ -54,13 +55,6 @@ public class AcidVenomEffect extends MobEffect {
CONFIG_DATA CONFIG_DATA
); );
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
0.075f, 0.5f, 40, false, new Vector3f[]{
new Vector3f(0.12F, 0.0F, 0.18F),
new Vector3f(0.45F, 0.05F, 0.65F)
}
);
@Override @Override
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
return true; return true;
@@ -73,7 +67,7 @@ public class AcidVenomEffect extends MobEffect {
if(entity.hurt(entity.damageSources().magic(), getDamagePerLevel() * (amplifier + 1))) entity.invulnerableTime = 10; if(entity.hurt(entity.damageSources().magic(), getDamagePerLevel() * (amplifier + 1))) entity.invulnerableTime = 10;
} }
ParticleUtil.addParticles( ParticleUtil.addParticles(
serverLevel, PARTICLE, serverLevel, ModParticles.BLACK_DUST_PARTICLE.get(),
entity.getBoundingBox().getCenter(), new Vec3(0, 0, 0), entity.getBoundingBox().getCenter(), new Vec3(0, 0, 0),
0.1, 1 0.1, 1
); );
@@ -15,6 +15,7 @@ import net.neoforged.neoforge.registries.DeferredRegister;
public class ModItems { public class ModItems {
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(LzxnoneTerraria.MODID); public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(LzxnoneTerraria.MODID);
//近战武器
public static final DeferredItem<Item> COPPER_SHORTSWORD = ITEMS.register("copper_shortsword", CopperShortsword::new); public static final DeferredItem<Item> COPPER_SHORTSWORD = ITEMS.register("copper_shortsword", CopperShortsword::new);
public static final DeferredItem<Item> ENCHANTED_SWORD = ITEMS.register("enchanted_sword", EnchantedSword::new); public static final DeferredItem<Item> ENCHANTED_SWORD = ITEMS.register("enchanted_sword", EnchantedSword::new);
public static final DeferredItem<Item> BEE_KEEPER = ITEMS.register("bee_keeper", BeeKeeper::new); public static final DeferredItem<Item> BEE_KEEPER = ITEMS.register("bee_keeper", BeeKeeper::new);
@@ -39,14 +40,30 @@ public class ModItems {
public static final DeferredItem<Item> TRUE_COPPER_SHORTSWORD = ITEMS.register("true_copper_shortsword", TrueCopperShortsword::new); public static final DeferredItem<Item> TRUE_COPPER_SHORTSWORD = ITEMS.register("true_copper_shortsword", TrueCopperShortsword::new);
public static final DeferredItem<Item> FIRST_FRACTAL = ITEMS.register("first_fractal", FirstFractal::new); public static final DeferredItem<Item> FIRST_FRACTAL = ITEMS.register("first_fractal", FirstFractal::new);
public static final DeferredItem<Item> MACE = ITEMS.register("mace", Mace::new); public static final DeferredItem<Item> MACE = ITEMS.register("mace", Mace::new);
public static final DeferredItem<Item> DEVILS_DEVASTATION = ITEMS.register("devils_devastation", DevilsDevastation::new);
//魔法武器 //魔法武器
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new); public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
//远程武器 //远程武器
public static final DeferredItem<Item> MUSKET = ITEMS.register("musket", Musket::new);
public static final DeferredItem<Item> MINISHARK = ITEMS.register("minishark", Minishark::new);
public static final DeferredItem<Item> FLINTLOCK_PISTOL = ITEMS.register("flintlock_pistol", FlintlockPistol::new);
public static final DeferredItem<Item> BOOMSTICK = ITEMS.register("boomstick", Boomstick::new);
public static final DeferredItem<Item> REVOLVER = ITEMS.register("revolver", Revolver::new);
public static final DeferredItem<Item> RED_RYDER = ITEMS.register("red_ryder", RedRyder::new);
public static final DeferredItem<Item> THE_UNDERTAKER = ITEMS.register("the_undertaker", TheUndertaker::new);
public static final DeferredItem<Item> QUAD_BARREL_SHOTGUN = ITEMS.register("quad_barrel_shotgun", QuadBarrelShotgun::new);
public static final DeferredItem<Item> HANDGUN = ITEMS.register("handgun", Handgun::new);
public static final DeferredItem<Item> PHOENIX_BLASTER = ITEMS.register("phoenix_blaster", PhoenixBlaster::new);
public static final DeferredItem<Item> MEGASHARK = ITEMS.register("megashark", Megashark::new);
public static final DeferredItem<Item> SDMG = ITEMS.register("sdmg", SDMG::new); public static final DeferredItem<Item> SDMG = ITEMS.register("sdmg", SDMG::new);
//召唤武器
public static final DeferredItem<Item> TERRAPRISMA = ITEMS.register("terraprisma", Terraprisma::new);
//近战武器 灾厄
public static final DeferredItem<Item> DEVILS_DEVASTATION = ITEMS.register("devils_devastation", DevilsDevastation::new);
//弹药 //弹药
public static final DeferredItem<Item> MUSKET_BALL = ITEMS.register("musket_ball", MusketBall::new); public static final DeferredItem<Item> MUSKET_BALL = ITEMS.register("musket_ball", MusketBall::new);
public static final DeferredItem<Item> METEOR_SHOT = ITEMS.register("meteor_shot", MeteorShot::new); public static final DeferredItem<Item> METEOR_SHOT = ITEMS.register("meteor_shot", MeteorShot::new);
@@ -65,6 +82,7 @@ public class ModItems {
public static final DeferredItem<Item> LUMINITE_BULLET = ITEMS.register("luminite_bullet", LuminiteBullet::new); public static final DeferredItem<Item> LUMINITE_BULLET = ITEMS.register("luminite_bullet", LuminiteBullet::new);
public static final DeferredItem<Item> TUNGSTEN_BULLET = ITEMS.register("tungsten_bullet", TungstenBullet::new); public static final DeferredItem<Item> TUNGSTEN_BULLET = ITEMS.register("tungsten_bullet", TungstenBullet::new);
//弹射物
public static final DeferredItem<Item> BULLET_PROJECTILE = ITEMS.register("bullet_projectile", () -> new Item(new Item.Properties())); public static final DeferredItem<Item> BULLET_PROJECTILE = ITEMS.register("bullet_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> METEOR_SHOT_PROJECTILE = ITEMS.register("meteor_shot_projectile", () -> new Item(new Item.Properties())); public static final DeferredItem<Item> METEOR_SHOT_PROJECTILE = ITEMS.register("meteor_shot_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> SILVER_BULLET_PROJECTILE = ITEMS.register("silver_bullet_projectile", () -> new Item(new Item.Properties())); public static final DeferredItem<Item> SILVER_BULLET_PROJECTILE = ITEMS.register("silver_bullet_projectile", () -> new Item(new Item.Properties()));
@@ -81,34 +99,30 @@ public class ModItems {
public static final DeferredItem<Item> GOLDEN_BULLET_PROJECTILE = ITEMS.register("golden_bullet_projectile", () -> new Item(new Item.Properties())); public static final DeferredItem<Item> GOLDEN_BULLET_PROJECTILE = ITEMS.register("golden_bullet_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> LUMINITE_BULLET_PROJECTILE = ITEMS.register("luminite_bullet_projectile", () -> new Item(new Item.Properties())); public static final DeferredItem<Item> LUMINITE_BULLET_PROJECTILE = ITEMS.register("luminite_bullet_projectile", () -> new Item(new Item.Properties()));
//召唤武器 public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> TERRAPRISMA = ITEMS.register("terraprisma", Terraprisma::new); public static final DeferredItem<Item> STARFURY_STAR = ITEMS.register("starfury_star", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> SEEDLER_NUT = ITEMS.register("seedler_nut", () -> new Item(new Item.Properties()));
//弹射物 public static final DeferredItem<Item> SEEDLER_THORN = ITEMS.register("seedler_thorn", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new); public static final DeferredItem<Item> INFLUX_WAVER_BEAM = ITEMS.register("influx_waver_beam", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> STARFURY_STAR = ITEMS.register("starfury_star", StarfuryStar::new); public static final DeferredItem<Item> STAR_WRATH_STAR = ITEMS.register("star_wrath_star", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> SEEDLER_NUT = ITEMS.register("seedler_nut", SeedlerNut::new); public static final DeferredItem<Item> MEOWMERE_PROJECTILE = ITEMS.register("meowmere_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> SEEDLER_THORN = ITEMS.register("seedler_thorn", SeedlerThorn::new); public static final DeferredItem<Item> LEAF_PROJECTILE = ITEMS.register("leaf_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> INFLUX_WAVER_BEAM = ITEMS.register("influx_waver_beam", InfluxWaverBeam::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE0 = ITEMS.register("first_fractal_projectile0", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> STAR_WRATH_STAR = ITEMS.register("star_wrath_star", StarWrathStar::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE1 = ITEMS.register("first_fractal_projectile1", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> MEOWMERE_PROJECTILE = ITEMS.register("meowmere_projectile", MeowmereProjectile::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE2 = ITEMS.register("first_fractal_projectile2", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> LEAF_PROJECTILE = ITEMS.register("leaf_projectile", LeafProjectile::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE3 = ITEMS.register("first_fractal_projectile3", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE0 = ITEMS.register("first_fractal_projectile0", FirstFractalProjectile0::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE4 = ITEMS.register("first_fractal_projectile4", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE1 = ITEMS.register("first_fractal_projectile1", FirstFractalProjectile1::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE5 = ITEMS.register("first_fractal_projectile5", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE2 = ITEMS.register("first_fractal_projectile2", FirstFractalProjectile2::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE6 = ITEMS.register("first_fractal_projectile6", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE3 = ITEMS.register("first_fractal_projectile3", FirstFractalProjectile3::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE7 = ITEMS.register("first_fractal_projectile7", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE4 = ITEMS.register("first_fractal_projectile4", FirstFractalProjectile4::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE8 = ITEMS.register("first_fractal_projectile8", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE5 = ITEMS.register("first_fractal_projectile5", FirstFractalProjectile5::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE9 = ITEMS.register("first_fractal_projectile9", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE6 = ITEMS.register("first_fractal_projectile6", FirstFractalProjectile6::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE10 = ITEMS.register("first_fractal_projectile10", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE7 = ITEMS.register("first_fractal_projectile7", FirstFractalProjectile7::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE11 = ITEMS.register("first_fractal_projectile11", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE8 = ITEMS.register("first_fractal_projectile8", FirstFractalProjectile8::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE12 = ITEMS.register("first_fractal_projectile12", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE9 = ITEMS.register("first_fractal_projectile9", FirstFractalProjectile9::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE13 = ITEMS.register("first_fractal_projectile13", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE10 = ITEMS.register("first_fractal_projectile10", FirstFractalProjectile10::new); public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE14 = ITEMS.register("first_fractal_projectile14", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE11 = ITEMS.register("first_fractal_projectile11", FirstFractalProjectile11::new); public static final DeferredItem<Item> MACE_PROJECTILE = ITEMS.register("mace_projectile", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE12 = ITEMS.register("first_fractal_projectile12", FirstFractalProjectile12::new); public static final DeferredItem<Item> TERRAPRISMA_SUMMON = ITEMS.register("terraprisma_summon", () -> new Item(new Item.Properties()));
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE13 = ITEMS.register("first_fractal_projectile13", FirstFractalProjectile13::new);
public static final DeferredItem<Item> FIRST_FRACTAL_PROJECTILE14 = ITEMS.register("first_fractal_projectile14", FirstFractalProjectile14::new);
public static final DeferredItem<Item> MACE_PROJECTILE = ITEMS.register("mace_projectile", MaceProjectile::new);
public static final DeferredItem<Item> TERRAPRISMA_SUMMON = ITEMS.register("terraprisma_summon", TerraprismaSummon::new);
} }
@@ -2,12 +2,11 @@ package com.lzxnone.terraria.item.ammo;
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior; import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon; import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.particle.DustParticleOptions;
import com.lzxnone.terraria.particle.ModParticles;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData; import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.CollisionUtil; import com.lzxnone.terraria.utils.*;
import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.MathUtil;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.Monster;
@@ -74,6 +73,13 @@ public class ChlorophyteBullet extends BulletAmmo {
{0.0D, -1.1D} {0.0D, -1.1D}
}; };
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
0.025f, 0f, 20, true, new Vector3f[]{
new Vector3f(0.5F, 1.0F, 0.5F),
new Vector3f(0.0F, 1.0F, 0.2F)
}
);
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
@Override @Override
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
@@ -96,10 +102,34 @@ public class ChlorophyteBullet extends BulletAmmo {
} }
Vec3 motion = nextDir.normalize().scale(getSpeed()); Vec3 motion = nextDir.normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
updateRotation(summon, nextDir); updateRotation(summon, nextDir);
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); if(summon.level().isClientSide()) {
summon.setPos(end);
summon.trailPositions.addFirst(summon.position());
while(summon.trailPositions.size() > 2) summon.trailPositions.removeLast();
if(summon.trailPositions.size() == 2) {
Vec3 pos1 = summon.trailPositions.getFirst();
Vec3 pos2 = summon.trailPositions.getLast();
Vec3 dir = pos1.subtract(pos2).normalize();
double length = pos1.subtract(pos2).length();
int count = 10;
double deltaLength = length / count;
for(int i = 0;i < count;i++) {
Vec3 pos = pos2.add(dir.scale(deltaLength * i));
ParticleUtil.addParticle(
summon.level(), PARTICLE,
pos, 0.0,
new Vec3(0, 0, 0), 0
);
}
}
return;
}
AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -116,13 +146,17 @@ public class ChlorophyteBullet extends BulletAmmo {
if(DamageUtil.rangedAttack(summon, hitTarget, sourceStack, getBaseDamage() + damage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, hitTarget, sourceStack, getBaseDamage() + damage, knockbackScale)) {
hitTarget.invulnerableTime = invulnerableTime; hitTarget.invulnerableTime = invulnerableTime;
this.onDied(summon); this.onDied(summon);
return;
} }
} }
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
@@ -136,7 +170,10 @@ public class ChlorophyteBullet extends BulletAmmo {
Entity bestTarget = null; Entity bestTarget = null;
double bestDistance = Double.MAX_VALUE; double bestDistance = Double.MAX_VALUE;
for(Entity target : targets) { for(Entity target : targets) {
double distance = target.getBoundingBox().getCenter().distanceToSqr(summon.position()); Vec3 targetCenter = target.getBoundingBox().getCenter();
if(!hasLineOfSight(summon.level(), summon, summon.position(), targetCenter)) continue;
double distance = targetCenter.distanceToSqr(summon.position());
if(distance < bestDistance) { if(distance < bestDistance) {
bestDistance = distance; bestDistance = distance;
bestTarget = target; bestTarget = target;
@@ -80,12 +80,16 @@ public class CrystalBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -101,6 +105,7 @@ public class CrystalBullet extends BulletAmmo {
Entity target = targets.getFirst(); Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
summon.setPos(end);
for(int i = 0;i < getFragmentCount();i++) { for(int i = 0;i < getFragmentCount();i++) {
summonProjectile(summon, (getBaseDamage() + damage) * getFragmentDamageMultiplier()); summonProjectile(summon, (getBaseDamage() + damage) * getFragmentDamageMultiplier());
} }
@@ -110,12 +115,14 @@ public class CrystalBullet extends BulletAmmo {
0.2, getParticleCount() 0.2, getParticleCount()
); );
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
summon.setPos(blockHitResult.getLocation());
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
float damage = customData.contains("damage") ? customData.getFloat("damage") : 0; float damage = customData.contains("damage") ? customData.getFloat("damage") : 0;
for(int i = 0;i < getFragmentCount();i++) { for(int i = 0;i < getFragmentCount();i++) {
@@ -127,7 +134,10 @@ public class CrystalBullet extends BulletAmmo {
0.2, getParticleCount() 0.2, getParticleCount()
); );
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
@@ -54,12 +54,16 @@ public class CursedBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -80,14 +84,18 @@ public class CursedBullet extends BulletAmmo {
livingEntity.addEffect(effectInstance); livingEntity.addEffect(effectInstance);
} }
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -68,12 +68,16 @@ public class ExplodingBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -86,10 +90,17 @@ public class ExplodingBullet extends BulletAmmo {
int invulnerableTime = customData.contains("invulnerableTime") ? customData.getInt("invulnerableTime") : 20; int invulnerableTime = customData.contains("invulnerableTime") ? customData.getInt("invulnerableTime") : 20;
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE); ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
Entity target = targets.getFirst(); boolean dead = false;
for(Entity target : targets) {
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale * getKnockbackMultiplier())) { if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale * getKnockbackMultiplier())) {
dead = true;
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position()); SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position());
}
}
if(dead) {
summon.setPos(end);
ParticleUtil.addParticles( ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.EXPLODE_PARTICLE.get(), (ServerLevel) summon.level(), ModParticles.EXPLODE_PARTICLE.get(),
summon.position(), new Vec3(0, 0, 0), summon.position(), new Vec3(0, 0, 0),
@@ -101,12 +112,14 @@ public class ExplodingBullet extends BulletAmmo {
0.2, getDustCount() 0.2, getDustCount()
); );
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
summon.setPos(blockHitResult.getLocation());
SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position()); SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position());
ParticleUtil.addParticles( ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.EXPLODE_PARTICLE.get(), (ServerLevel) summon.level(), ModParticles.EXPLODE_PARTICLE.get(),
@@ -119,7 +132,10 @@ public class ExplodingBullet extends BulletAmmo {
0.2, getDustCount() 0.2, getDustCount()
); );
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -84,12 +84,16 @@ public class GoldenBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -110,14 +114,18 @@ public class GoldenBullet extends BulletAmmo {
livingEntity.addEffect(effectInstance); livingEntity.addEffect(effectInstance);
} }
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -57,12 +57,16 @@ public class HighVelocityBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -89,10 +93,13 @@ public class HighVelocityBullet extends BulletAmmo {
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
@@ -54,12 +54,16 @@ public class IchorBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -80,14 +84,18 @@ public class IchorBullet extends BulletAmmo {
livingEntity.addEffect(effectInstance); livingEntity.addEffect(effectInstance);
} }
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -2,18 +2,22 @@ package com.lzxnone.terraria.item.ammo;
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior; import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon; import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.particle.DustParticleOptions;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData; import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.CollisionUtil; import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil; import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil; import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.ParticleUtil;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
import java.util.List; import java.util.List;
@@ -46,17 +50,28 @@ public class LuminiteBullet extends BulletAmmo {
return AmmoConfig.readFloat(ID, "damage_decay", DAMAGE_DECAY_DEFAULT, 0.0f, 1.0f); return AmmoConfig.readFloat(ID, "damage_decay", DAMAGE_DECAY_DEFAULT, 0.0f, 1.0f);
} }
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
0.025f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(0.0F, 1.0F, 1.0F),
new Vector3f(0.1F, 0.4F, 1.0F)
}
);
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
@Override @Override
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -77,15 +92,29 @@ public class LuminiteBullet extends BulletAmmo {
hit++; hit++;
customData.putInt("hit", hit); customData.putInt("hit", hit);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
ParticleUtil.addParticles(
(ServerLevel) summon.level(), PARTICLE,
end, new Vec3(0, 0, 0),
0.2, 5
);
} }
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
summon.setPos(blockHitResult.getLocation());
ParticleUtil.addParticles(
(ServerLevel) summon.level(), PARTICLE,
summon.position(), new Vec3(0, 0, 0),
0.2, 10
);
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -85,17 +85,17 @@ public class MeteorShot extends BulletAmmo {
if(summon.isRemoved()) return; if(summon.isRemoved()) return;
double speed = getSpeed(); double speed = getSpeed();
Vec3 motion = summon.getDeltaMovement(); Vec3 motion = summon.getLookAngle().normalize().scale(speed);
if(motion.lengthSqr() < 0.0001) { Vec3 start = summon.position();
motion = summon.getLookAngle().normalize().scale(speed); Vec3 end = start.add(motion);
}else {
motion = motion.normalize().scale(speed); if(summon.level().isClientSide()) {
summon.setPos(end);
return;
} }
summon.setDeltaMovement(motion);
//碰撞检测 //碰撞检测
if(!summon.level().isClientSide()) { AABB hitBox = new AABB(start, end).inflate(0.25);
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -118,10 +118,9 @@ public class MeteorShot extends BulletAmmo {
} }
} }
} }
}
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
if(MeteorShot.incrementHit(summon) >= getMaxHit()) { if(MeteorShot.incrementHit(summon) >= getMaxHit()) {
this.onDied(summon); this.onDied(summon);
@@ -130,9 +129,11 @@ public class MeteorShot extends BulletAmmo {
Vec3 reflectedMotion = MeteorShot.reflect(motion, blockHitResult.getDirection()).normalize().scale(speed); Vec3 reflectedMotion = MeteorShot.reflect(motion, blockHitResult.getDirection()).normalize().scale(speed);
summon.setPos(blockHitResult.getLocation().add(Vec3.atLowerCornerOf(blockHitResult.getDirection().getNormal()).scale(0.05))); summon.setPos(blockHitResult.getLocation().add(Vec3.atLowerCornerOf(blockHitResult.getDirection().getNormal()).scale(0.05)));
summon.setDeltaMovement(reflectedMotion);
MeteorShot.updateRotation(summon, reflectedMotion); MeteorShot.updateRotation(summon, reflectedMotion);
return;
} }
summon.setPos(end);
} }
}; };
@@ -71,12 +71,16 @@ public class MusketBall extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -93,14 +97,18 @@ public class MusketBall extends BulletAmmo {
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -70,17 +70,17 @@ public class NanoBullet extends BulletAmmo {
if(summon.isRemoved()) return; if(summon.isRemoved()) return;
double speed = getSpeed(); double speed = getSpeed();
Vec3 motion = summon.getDeltaMovement(); Vec3 motion = summon.getLookAngle().normalize().scale(speed);
if(motion.lengthSqr() < 0.0001) { Vec3 start = summon.position();
motion = summon.getLookAngle().normalize().scale(speed); Vec3 end = start.add(motion);
}else {
motion = motion.normalize().scale(speed); if(summon.level().isClientSide()) {
summon.setPos(end);
return;
} }
summon.setDeltaMovement(motion);
//碰撞检测 //碰撞检测
if(!summon.level().isClientSide()) { AABB hitBox = new AABB(start, end).inflate(0.25);
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -102,12 +102,12 @@ public class NanoBullet extends BulletAmmo {
livingEntity.addEffect(effectInstance); livingEntity.addEffect(effectInstance);
} }
onDied(summon); onDied(summon);
} return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
if(incrementHit(summon) >= getMaxHit()) { if(incrementHit(summon) >= getMaxHit()) {
this.onDied(summon); this.onDied(summon);
@@ -116,9 +116,11 @@ public class NanoBullet extends BulletAmmo {
Vec3 reflectedMotion = reflect(motion, blockHitResult.getDirection()).normalize().scale(speed); Vec3 reflectedMotion = reflect(motion, blockHitResult.getDirection()).normalize().scale(speed);
summon.setPos(blockHitResult.getLocation().add(Vec3.atLowerCornerOf(blockHitResult.getDirection().getNormal()).scale(0.05))); summon.setPos(blockHitResult.getLocation().add(Vec3.atLowerCornerOf(blockHitResult.getDirection().getNormal()).scale(0.05)));
summon.setDeltaMovement(reflectedMotion);
updateRotation(summon, reflectedMotion); updateRotation(summon, reflectedMotion);
return;
} }
summon.setPos(end);
} }
}; };
@@ -2,12 +2,15 @@ package com.lzxnone.terraria.item.ammo;
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior; import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon; import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.particle.ModParticles;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData; import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.CollisionUtil; import com.lzxnone.terraria.utils.CollisionUtil;
import com.lzxnone.terraria.utils.DamageUtil; import com.lzxnone.terraria.utils.DamageUtil;
import com.lzxnone.terraria.utils.FilterUtil; import com.lzxnone.terraria.utils.FilterUtil;
import com.lzxnone.terraria.utils.ParticleUtil;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
@@ -45,12 +48,16 @@ public class PartyBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -66,15 +73,31 @@ public class PartyBullet extends BulletAmmo {
Entity target = targets.getFirst(); Entity target = targets.getFirst();
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
summon.setPos(end);
ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.PARTY_PARTICLE.get(),
summon.position(), new Vec3(0, 0, 0),
0.2, 5
);
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
summon.setPos(blockHitResult.getLocation());
ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.PARTY_PARTICLE.get(),
summon.position(), new Vec3(0, 0, 0),
0.2, 5
);
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
@@ -84,12 +84,16 @@ public class SilverBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -110,14 +114,18 @@ public class SilverBullet extends BulletAmmo {
if(DamageUtil.rangedAttack(summon, target, sourceStack, finalDamage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, target, sourceStack, finalDamage, knockbackScale)) {
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -71,12 +71,16 @@ public class TungstenBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -93,14 +97,18 @@ public class TungstenBullet extends BulletAmmo {
if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) { if(DamageUtil.rangedAttack(summon, target, sourceStack, getBaseDamage() + damage, knockbackScale)) {
target.invulnerableTime = invulnerableTime; target.invulnerableTime = invulnerableTime;
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -54,12 +54,16 @@ public class VenomBullet extends BulletAmmo {
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
this.checkBeforeTick(summon); this.checkBeforeTick(summon);
Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed()); Vec3 motion = summon.getLookAngle().normalize().scale(getSpeed());
summon.setDeltaMovement(motion); Vec3 start = summon.position();
Vec3 end = start.add(motion);
if(summon.level().isClientSide()) return; if(summon.level().isClientSide()) {
summon.setPos(end);
return;
}
//碰撞检测 //碰撞检测
AABB hitBox = new AABB(summon.position(), summon.position().add(motion)).inflate(0.25); AABB hitBox = new AABB(start, end).inflate(0.25);
List<Entity> targets = summon.level().getEntitiesOfClass( List<Entity> targets = summon.level().getEntitiesOfClass(
Entity.class, Entity.class,
hitBox, hitBox,
@@ -80,14 +84,18 @@ public class VenomBullet extends BulletAmmo {
livingEntity.addEffect(effectInstance); livingEntity.addEffect(effectInstance);
} }
this.onDied(summon); this.onDied(summon);
return;
} }
} }
//方块检测 //方块检测
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, end);
if(blockHitResult.getType() != HitResult.Type.MISS) { if(blockHitResult.getType() != HitResult.Type.MISS) {
this.onDied(summon); this.onDied(summon);
return;
} }
summon.setPos(end);
} }
}; };
} }
@@ -11,6 +11,7 @@ import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
import com.lzxnone.terraria.entity.summon.StaticSummon; import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors; import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.item.ModItems;
import com.lzxnone.terraria.particle.DustParticleOptions;
import com.lzxnone.terraria.particle.ModParticles; import com.lzxnone.terraria.particle.ModParticles;
import com.lzxnone.terraria.ui.config.ConfigFactory; import com.lzxnone.terraria.ui.config.ConfigFactory;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
@@ -135,6 +136,20 @@ public class Seedler extends MeleeWeapon {
CONFIG_DATA CONFIG_DATA
); );
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
0.025f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(0.7F, 0.7F, 0.7F),
}
);
public static final DustParticleOptions PARTICLE2 = new DustParticleOptions(
0.05f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(1.0F, 0.8F, 0.5F),
new Vector3f(1.0F, 0.5F, 0.0F),
new Vector3f(1.0F, 0.9F, 0.0F),
}
);
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
@Override @Override
public void tick(StaticSummon summon) { public void tick(StaticSummon summon) {
@@ -231,12 +246,12 @@ public class Seedler extends MeleeWeapon {
0.05, 1 0.05, 1
); );
ParticleUtil.addParticles( ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.EXPLODE_FLAME_PARTICLE, (ServerLevel) summon.level(), PARTICLE2,
summon.position(), new Vec3(0.2, 0.2, 0.2), summon.position(), new Vec3(0.2, 0.2, 0.2),
0.2, 25 0.2, 25
); );
ParticleUtil.addParticles( ParticleUtil.addParticles(
(ServerLevel) summon.level(), ModParticles.SMOKE_PARTICLE, (ServerLevel) summon.level(), PARTICLE,
summon.position(), new Vec3(0.2, 0.2, 0.2), summon.position(), new Vec3(0.2, 0.2, 0.2),
0.2, 25 0.2, 25
); );
@@ -0,0 +1,166 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.LzxnoneTerraria;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.item.ModItemTags;
import com.lzxnone.terraria.item.weapon.RangedWeapon;
import com.lzxnone.terraria.ui.config.ConfigFactory;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.ConfigUtil;
import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.AmmoUtil;
import com.lzxnone.terraria.utils.SoundUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
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.Tier;
import net.minecraft.world.level.Level;
import org.joml.Vector3f;
import java.util.function.Supplier;
public class BasicGun extends RangedWeapon {
private static final String CONFIG_TRANSLATION_PREFIX = "lzxnoneterraria.configuration.";
private static final float DAMAGE_MIN = 0.0f;
private static final float DAMAGE_MAX = 8388600.0f;
private static final float AMMO_NOT_CONSUME_CHANCE_MIN = 0.0f;
private static final float AMMO_NOT_CONSUME_CHANCE_MAX = 1.0f;
private final String id;
private final Vector3f offset;
private final float damageDefault;
private final boolean hasAmmoNotConsumeChance;
private final float ammoNotConsumeChanceDefault;
private final int useTime;
private final Supplier<SoundEvent> sound;
private final float knockbackScale;
private final int invulnerableTime;
public BasicGun(Tier tier, Properties properties, String id, Vector3f offset, float damageDefault, int useTime,
Supplier<SoundEvent> sound, float knockbackScale, int invulnerableTime) {
this(tier, properties, id, offset, damageDefault, false, 0.0f, useTime, sound, knockbackScale, invulnerableTime);
}
public BasicGun(Tier tier, Properties properties, String id, Vector3f offset, float damageDefault, float ammoNotConsumeChanceDefault,
int useTime, Supplier<SoundEvent> sound, float knockbackScale, int invulnerableTime) {
this(tier, properties, id, offset, damageDefault, true, ammoNotConsumeChanceDefault, useTime, sound, knockbackScale, invulnerableTime);
}
private BasicGun(Tier tier, Properties properties, String id, Vector3f offset, float damageDefault, boolean hasAmmoNotConsumeChance,
float ammoNotConsumeChanceDefault, int useTime, Supplier<SoundEvent> sound,
float knockbackScale, int invulnerableTime) {
super(tier, properties);
this.id = id;
this.offset = offset;
this.damageDefault = damageDefault;
this.hasAmmoNotConsumeChance = hasAmmoNotConsumeChance;
this.ammoNotConsumeChanceDefault = ammoNotConsumeChanceDefault;
this.useTime = useTime;
this.sound = sound;
this.knockbackScale = knockbackScale;
this.invulnerableTime = invulnerableTime;
}
public static IConfigData createConfigData(String id, float damageDefault) {
return new IConfigData() {
@Override
public void onConfigLoad() {
ConfigFactory.loadFloatConfig(damagePath(id), configText(id + "_damage"), configTooltip(id + "_damage"), damageDefault, DAMAGE_MIN, DAMAGE_MAX);
}
};
}
public static IConfigData createConfigData(String id, float damageDefault, float ammoNotConsumeChanceDefault) {
return new IConfigData() {
@Override
public void onConfigLoad() {
ConfigFactory.loadFloatConfig(ammoNotConsumeChancePath(id), configText(id + "_ammo_not_consume_chance"), configTooltip(id + "_ammo_not_consume_chance"), ammoNotConsumeChanceDefault, AMMO_NOT_CONSUME_CHANCE_MIN, AMMO_NOT_CONSUME_CHANCE_MAX);
ConfigFactory.loadFloatConfig(damagePath(id), configText(id + "_damage"), configTooltip(id + "_damage"), damageDefault, DAMAGE_MIN, DAMAGE_MAX);
}
};
}
public static ConfigListItem createConfigListItem(String id, IConfigData configData) {
return new ConfigListItem(
id,
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/" + id + ".png"),
Component.translatable("item.lzxnoneterraria." + id),
configData
);
}
private static String damagePath(String id) {
return "weapon." + id + ".damage";
}
private static String ammoNotConsumeChancePath(String id) {
return "weapon." + id + ".ammo_not_consume_chance";
}
private static Component configText(String key) {
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key);
}
private static Component configTooltip(String key) {
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key + ".tooltip");
}
public float getDamage() {
return Math.clamp(ConfigUtil.readFloat(damagePath(id), damageDefault), DAMAGE_MIN, DAMAGE_MAX);
}
public float getAmmoNotConsumeChance() {
if(!hasAmmoNotConsumeChance) return 0.0f;
return Math.clamp(
ConfigUtil.readFloat(ammoNotConsumeChancePath(id), ammoNotConsumeChanceDefault),
AMMO_NOT_CONSUME_CHANCE_MIN,
AMMO_NOT_CONSUME_CHANCE_MAX
);
}
@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
ItemStack stack = player.getItemInHand(hand);
if(player.getCooldowns().isOnCooldown(stack.getItem()) || !tryShoot(level, player, hand, stack)) return InteractionResultHolder.fail(stack);
player.startUsingItem(hand);
player.getCooldowns().addCooldown(stack.getItem(), Math.max(1, getUseTime(stack, player) / 3));
return InteractionResultHolder.consume(stack);
}
@Override
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
return ammoStack.is(ModItemTags.BULLET_AMMO);
}
@Override
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
return useTime;
}
@Override
public int getAmmoConsumeAmount(ItemStack weaponStack, LivingEntity entity) {
if(!hasAmmoNotConsumeChance) return super.getAmmoConsumeAmount(weaponStack, entity);
return entity.getRandom().nextFloat() < getAmmoNotConsumeChance() ? 0 : 1;
}
@Override
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
SoundUtil.playClientSound(player, sound.get());
if(!level.isClientSide()) {
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, offset);
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
customData.putFloat("damage", getDamage());
customData.putFloat("knockbackScale", knockbackScale);
customData.putInt("invulnerableTime", invulnerableTime);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
level.addFreshEntity(summon);
}
}
}
@@ -0,0 +1,71 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.AmmoUtil;
import com.lzxnone.terraria.utils.MathUtil;
import com.lzxnone.terraria.utils.SoundUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.InteractionHand;
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.Vec3;
import org.joml.Vector3f;
public class Boomstick extends BasicGun {
public static final String ID = "boomstick";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.05f, 1.5f);
public static final float DAMAGE_DEFAULT = 2.0f;
public static final int PROJECTILE_COUNT = 3;
public static final float MAX_SPREAD_DEGREES = 8.0f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Boomstick() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 40, ModSounds.SHOT5, 1.0f, 10);
}
@Override
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
SoundUtil.playClientSound(player, ModSounds.SHOT5.get());
if(level.isClientSide()) return;
for(int i = 0; i < PROJECTILE_COUNT; i++) {
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
applySpread(player, summon);
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
customData.putFloat("damage", getDamage());
customData.putFloat("knockbackScale", 0.8f);
customData.putInt("invulnerableTime", 10);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
level.addFreshEntity(summon);
}
}
private static void applySpread(Player player, StaticSummon summon) {
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
Vec3 forward = MathUtil.toVec3(dirs[0]).normalize();
Vec3 up = MathUtil.toVec3(dirs[1]).normalize();
Vec3 right = MathUtil.toVec3(dirs[2]).normalize();
double yaw = Math.toRadians((player.getRandom().nextFloat() * 2.0f - 1.0f) * MAX_SPREAD_DEGREES);
double pitch = Math.toRadians((player.getRandom().nextFloat() * 2.0f - 1.0f) * MAX_SPREAD_DEGREES);
Vec3 spreadDir = forward
.add(right.scale(Math.tan(yaw)))
.add(up.scale(Math.tan(pitch)))
.normalize();
float[] xyRot = MathUtil.computeXYRot(spreadDir.toVector3f());
summon.setXRot(xyRot[0]);
summon.xRotO = xyRot[0];
summon.setYRot(xyRot[1]);
summon.yRotO = xyRot[1];
}
}
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class FlintlockPistol extends BasicGun {
public static final String ID = "flintlock_pistol";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.05f, 1.5f);
public static final float DAMAGE_DEFAULT = 2.0f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public FlintlockPistol() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 16, ModSounds.SHOT4, 0.25f, 10);
}
}
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class Handgun extends BasicGun {
public static final String ID = "handgun";
public static final Vector3f OFFSET = new Vector3f(-0.3f, 0, 1.5f);
public static final float DAMAGE_DEFAULT = 4.0f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Handgun() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 15, ModSounds.SHOT6, 0.25f, 10);
}
}
@@ -0,0 +1,22 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class Megashark extends BasicGun {
public static final String ID = "megashark";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.15f, 1.5f);
public static final float DAMAGE_DEFAULT = 2.0f;
public static final float AMMO_NOT_CONSUME_CHANCE_DEFAULT = 0.5f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Megashark() {
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 7, ModSounds.SHOT2, 0.1f, 5);
}
}
@@ -0,0 +1,22 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class Minishark extends BasicGun {
public static final String ID = "minishark";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.15f, 1.5f);
public static final float DAMAGE_DEFAULT = 1.0f;
public static final float AMMO_NOT_CONSUME_CHANCE_DEFAULT = 0.33f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Minishark() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 8, ModSounds.SHOT2, 0.1f, 5);
}
}
@@ -0,0 +1,28 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.item.ModItems;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
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 org.joml.Vector3f;
public class Musket extends BasicGun {
public static final String ID = "musket";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.1f, 1.5f);
public static final float DAMAGE_DEFAULT = 3.5f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Musket() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 32, ModSounds.SHOT3, 1.0f, 10);
}
@Override
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
return ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get());
}
}
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class PhoenixBlaster extends BasicGun {
public static final String ID = "phoenix_blaster";
public static final Vector3f OFFSET = new Vector3f(-0.3f, 0, 1.5f);
public static final float DAMAGE_DEFAULT = 5.0f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public PhoenixBlaster() {
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 14, ModSounds.SHOT6, 0.25f, 10);
}
}
@@ -0,0 +1,71 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.AmmoUtil;
import com.lzxnone.terraria.utils.MathUtil;
import com.lzxnone.terraria.utils.SoundUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.InteractionHand;
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.Vec3;
import org.joml.Vector3f;
public class QuadBarrelShotgun extends BasicGun {
public static final String ID = "quad_barrel_shotgun";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.1f, 1.5f);
public static final float DAMAGE_DEFAULT = 2.5f;
public static final int PROJECTILE_COUNT = 4;
public static final float MAX_SPREAD_DEGREES = 12.0f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public QuadBarrelShotgun() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), ID, OFFSET, DAMAGE_DEFAULT, 55, ModSounds.SHOT5, 1.5f, 10);
}
@Override
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
SoundUtil.playClientSound(player, ModSounds.SHOT5.get());
if(level.isClientSide()) return;
for(int i = 0; i < PROJECTILE_COUNT; i++) {
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack, OFFSET);
applySpread(player, summon);
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
customData.putFloat("damage", getDamage());
customData.putFloat("knockbackScale", 0.9f);
customData.putInt("invulnerableTime", 10);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
level.addFreshEntity(summon);
}
}
private static void applySpread(Player player, StaticSummon summon) {
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
Vec3 forward = MathUtil.toVec3(dirs[0]).normalize();
Vec3 up = MathUtil.toVec3(dirs[1]).normalize();
Vec3 right = MathUtil.toVec3(dirs[2]).normalize();
double yaw = Math.toRadians((player.getRandom().nextFloat() * 2.0f - 1.0f) * MAX_SPREAD_DEGREES);
double pitch = Math.toRadians((player.getRandom().nextFloat() * 2.0f - 1.0f) * MAX_SPREAD_DEGREES);
Vec3 spreadDir = forward
.add(right.scale(Math.tan(yaw)))
.add(up.scale(Math.tan(pitch)))
.normalize();
float[] xyRot = MathUtil.computeXYRot(spreadDir.toVector3f());
summon.setXRot(xyRot[0]);
summon.xRotO = xyRot[0];
summon.setYRot(xyRot[1]);
summon.yRotO = xyRot[1];
}
}
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class RedRyder extends BasicGun {
public static final String ID = "red_ryder";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.1f, 1.5f);
public static final float DAMAGE_DEFAULT = 3.5f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public RedRyder() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 38, ModSounds.SHOT2, 1.0f, 10);
}
}
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class Revolver extends BasicGun {
public static final String ID = "revolver";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.05f, 1.5f);
public static final float DAMAGE_DEFAULT = 2.5f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public Revolver() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 22, ModSounds.SHOT6, 0.8f, 10);
}
}
@@ -1,111 +1,22 @@
package com.lzxnone.terraria.item.weapon.ranged; package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.LzxnoneTerraria;
import com.lzxnone.terraria.ModSounds; import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.entity.summon.StaticSummon;
import com.lzxnone.terraria.item.ModItemTags;
import com.lzxnone.terraria.item.weapon.RangedWeapon;
import com.lzxnone.terraria.ui.config.ConfigFactory;
import com.lzxnone.terraria.ui.config.ConfigListItem; import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.ConfigUtil;
import com.lzxnone.terraria.ui.config.IConfigData; import com.lzxnone.terraria.ui.config.IConfigData;
import com.lzxnone.terraria.utils.AmmoUtil;
import com.lzxnone.terraria.utils.SoundUtil;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity; import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers; import net.minecraft.world.item.Tiers;
import net.minecraft.world.level.Level; import org.joml.Vector3f;
public class SDMG extends RangedWeapon { public class SDMG extends BasicGun {
private static final String CONFIG_TRANSLATION_PREFIX = "lzxnoneterraria.configuration."; public static final String ID = "sdmg";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.15f, 1.5f);
public static final String AMMO_NOT_CONSUME_CHANCE_PATH = "weapon.sdmg.ammo_not_consume_chance"; public static final float DAMAGE_DEFAULT = 6.0f;
public static final float AMMO_NOT_CONSUME_CHANCE_DEFAULT = 0.66f; public static final float AMMO_NOT_CONSUME_CHANCE_DEFAULT = 0.66f;
public static final float AMMO_NOT_CONSUME_CHANCE_MIN = 0.0f; public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT);
public static final float AMMO_NOT_CONSUME_CHANCE_MAX = 1.0f; public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public static final String DAMAGE_PATH = "weapon.sdmg.damage";
public static final float DAMAGE_DEFAULT = 1.0f;
public static final float DAMAGE_MIN = 0.0f;
public static final float DAMAGE_MAX = 8388600.0f;
public SDMG() { public SDMG() {
super(Tiers.NETHERITE, new Item.Properties().stacksTo(1).fireResistant().rarity(Rarity.EPIC)); super(Tiers.NETHERITE, new Item.Properties().stacksTo(1).fireResistant().rarity(Rarity.EPIC), ID, OFFSET, DAMAGE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_DEFAULT, 5, ModSounds.SHOT, 0.1f, 5);
}
public static final IConfigData CONFIG_DATA = new IConfigData() {
@Override
public void onConfigLoad() {
ConfigFactory.loadFloatConfig(AMMO_NOT_CONSUME_CHANCE_PATH, configText("sdmg_ammo_not_consume_chance"), configTooltip("sdmg_ammo_not_consume_chance"), AMMO_NOT_CONSUME_CHANCE_DEFAULT, AMMO_NOT_CONSUME_CHANCE_MIN, AMMO_NOT_CONSUME_CHANCE_MAX);
ConfigFactory.loadFloatConfig(DAMAGE_PATH, configText("sdmg_damage"), configTooltip("sdmg_damage"), DAMAGE_DEFAULT, DAMAGE_MIN, DAMAGE_MAX);
}
};
private static Component configText(String key) {
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key);
}
private static Component configTooltip(String key) {
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key + ".tooltip");
}
public static float getAmmoNotConsumeChance() {
return Math.clamp(ConfigUtil.readFloat(AMMO_NOT_CONSUME_CHANCE_PATH, AMMO_NOT_CONSUME_CHANCE_DEFAULT), AMMO_NOT_CONSUME_CHANCE_MIN, AMMO_NOT_CONSUME_CHANCE_MAX);
}
public static float getDamage() {
return Math.clamp(ConfigUtil.readFloat(DAMAGE_PATH, DAMAGE_DEFAULT), DAMAGE_MIN, DAMAGE_MAX);
}
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
"sdmg",
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/sdmg.png"),
Component.translatable("item.lzxnoneterraria.sdmg"),
CONFIG_DATA
);
@Override
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
ItemStack stack = player.getItemInHand(hand);
if(!tryShoot(level, player, hand, stack)) return InteractionResultHolder.fail(stack);
player.startUsingItem(hand);
return InteractionResultHolder.consume(stack);
}
@Override
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
return ammoStack.is(ModItemTags.BULLET_AMMO);
}
@Override
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
return 5;
}
@Override
public int getAmmoConsumeAmount(ItemStack weaponStack, LivingEntity entity) {
return entity.getRandom().nextFloat() < getAmmoNotConsumeChance() ? 0 : 1;
}
@Override
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
SoundUtil.playClientSound(player, ModSounds.SHOT.get());
if(!level.isClientSide()) {
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, hand, stack);
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
customData.putFloat("damage", getDamage());
customData.putFloat("knockbackScale", 0.1f);
customData.putInt("invulnerableTime", 5);
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
level.addFreshEntity(summon);
}
} }
} }
@@ -0,0 +1,21 @@
package com.lzxnone.terraria.item.weapon.ranged;
import com.lzxnone.terraria.ModSounds;
import com.lzxnone.terraria.ui.config.ConfigListItem;
import com.lzxnone.terraria.ui.config.IConfigData;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraft.world.item.Tiers;
import org.joml.Vector3f;
public class TheUndertaker extends BasicGun {
public static final String ID = "the_undertaker";
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.05f, 1.5f);
public static final float DAMAGE_DEFAULT = 3.5f;
public static final IConfigData CONFIG_DATA = createConfigData(ID, DAMAGE_DEFAULT);
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
public TheUndertaker() {
super(Tiers.IRON, new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON), ID, OFFSET, DAMAGE_DEFAULT, 20, ModSounds.SHOT2, 0.5f, 10);
}
}
@@ -1,6 +1,6 @@
package com.lzxnone.terraria.mixin; package com.lzxnone.terraria.mixin;
import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.item.weapon.RangedWeapon;
import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
@@ -29,7 +29,7 @@ public abstract class HumanoidModelMixin<T extends LivingEntity> {
? player.getMainArm() ? player.getMainArm()
: player.getMainArm().getOpposite(); : player.getMainArm().getOpposite();
if(player.getUseItem().is(ModItems.SDMG.get())) { if(player.getUseItem().getItem() instanceof RangedWeapon) {
if(usedArm == HumanoidArm.RIGHT) { if(usedArm == HumanoidArm.RIGHT) {
this.rightArm.xRot = (float) Math.toRadians(player.getXRot() - 90); this.rightArm.xRot = (float) Math.toRadians(player.getXRot() - 90);
}else { }else {
@@ -3,6 +3,7 @@ package com.lzxnone.terraria.mixin;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.item.ModItems;
import com.lzxnone.terraria.item.weapon.RangedWeapon;
import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -20,7 +21,7 @@ public abstract class UseSpeedMixin {
|| usingItem.is(ModItems.TERRAGRIM.get()) || usingItem.is(ModItems.TERRAGRIM.get())
|| usingItem.is(ModItems.MACE.get()) || usingItem.is(ModItems.MACE.get())
|| usingItem.is(ModItems.LAST_PRISM.get()) || usingItem.is(ModItems.LAST_PRISM.get())
|| usingItem.is(ModItems.SDMG.get()); || usingItem.getItem() instanceof RangedWeapon;
} }
@WrapOperation( @WrapOperation(
@@ -0,0 +1,67 @@
package com.lzxnone.terraria.particle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.core.particles.SimpleParticleType;
public class BlackDustParticle extends TextureSheetParticle {
private final float rotSpeed;
private final float baseSize;
protected BlackDustParticle(ClientLevel level, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed, SpriteSet spriteSet) {
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
this.hasPhysics = false;
this.friction = 0.9F;
this.gravity = 0.0F;
this.xd = xSpeed;
this.yd = ySpeed;
this.zd = zSpeed;
this.baseSize = 0.075f + (this.random.nextFloat() * 0.075f);
this.quadSize = baseSize;
this.roll = this.random.nextFloat() * ((float)Math.PI * 2F);
this.oRoll = this.roll;
this.rotSpeed = (this.random.nextFloat() - 0.5F) * 0.5f;
this.lifetime = 30 + this.random.nextInt(15);
this.pickSprite(spriteSet);
}
@Override
public void tick() {
super.tick();
this.oRoll = this.roll;
this.roll += this.rotSpeed;
float lifeRatio = (float) this.age / (float) this.lifetime;
this.quadSize = this.baseSize * (1.0F - lifeRatio);
this.alpha = 1.0F - lifeRatio;
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
}
public static class Provider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet spriteSet;
public Provider(SpriteSet spriteSet) {
this.spriteSet = spriteSet;
}
@Override
public Particle createParticle(SimpleParticleType type, ClientLevel level,
double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) {
return new BlackDustParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
}
}
}
@@ -22,20 +22,6 @@ public class ModParticles {
} }
); );
public static final DustParticleOptions SMOKE_PARTICLE = new DustParticleOptions(
0.025f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(0.7F, 0.7F, 0.7F),
}
);
public static final DustParticleOptions EXPLODE_FLAME_PARTICLE = new DustParticleOptions(
0.05f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(1.0F, 0.8F, 0.5F),
new Vector3f(1.0F, 0.5F, 0.0F),
new Vector3f(1.0F, 0.9F, 0.0F),
}
);
public static final DustParticleOptions COLORFUL_PARTICLE = new DustParticleOptions( public static final DustParticleOptions COLORFUL_PARTICLE = new DustParticleOptions(
0.025f, 0.5f, 40, true, new Vector3f[]{ 0.025f, 0.5f, 40, true, new Vector3f[]{
new Vector3f(0.0F, 1.0F, 1.0F), // 0: 青色 (Cyan) new Vector3f(0.0F, 1.0F, 1.0F), // 0: 青色 (Cyan)
@@ -126,6 +112,8 @@ public class ModParticles {
PARTICLE_TYPES.register("devils_devastation_rune_particle", () -> new SimpleParticleType(true)); PARTICLE_TYPES.register("devils_devastation_rune_particle", () -> new SimpleParticleType(true));
public static final Supplier<SimpleParticleType> DEVILS_DEVASTATION_RUNE_PARTICLE2 = public static final Supplier<SimpleParticleType> DEVILS_DEVASTATION_RUNE_PARTICLE2 =
PARTICLE_TYPES.register("devils_devastation_rune_particle2", () -> new SimpleParticleType(true)); PARTICLE_TYPES.register("devils_devastation_rune_particle2", () -> new SimpleParticleType(true));
public static final Supplier<SimpleParticleType> BLACK_DUST_PARTICLE =
PARTICLE_TYPES.register("black_dust_particle", () -> new SimpleParticleType(true));
public static final Supplier<SimpleParticleType> PARTY_PARTICLE =
PARTICLE_TYPES.register("party_particle", () -> new SimpleParticleType(true));
} }
@@ -0,0 +1,77 @@
package com.lzxnone.terraria.particle;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.core.particles.SimpleParticleType;
import org.joml.Vector3f;
public class PartyParticle extends TextureSheetParticle {
private final float rotSpeed;
private final Vector3f[] COLORS = new Vector3f[]{
new Vector3f(1.0f, 0.0f, 1.0f),
new Vector3f(0.0f, 0.4f, 1.0f),
new Vector3f(1.0f, 0.9f, 0.0f),
new Vector3f(0.6f, 0.1f, 0.8f),
new Vector3f(0.1f, 0.8f, 0.2f)
};
protected PartyParticle(ClientLevel level, double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed, SpriteSet spriteSet) {
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
this.hasPhysics = true;
this.friction = 0.9F;
this.gravity = 0.5F;
this.xd = xSpeed;
this.yd = ySpeed;
this.zd = zSpeed;
this.quadSize = 0.075f + (this.random.nextFloat() * 0.075f);
this.roll = this.random.nextFloat() * ((float)Math.PI * 2F);
this.oRoll = this.roll;
this.rotSpeed = (this.random.nextFloat() - 0.5F) * 0.5f;
this.lifetime = 30 + this.random.nextInt(15);
Vector3f color = COLORS[this.random.nextInt(COLORS.length)];
this.rCol = color.x;
this.gCol = color.y;
this.bCol = color.z;
this.pickSprite(spriteSet);
}
@Override
public void tick() {
super.tick();
this.oRoll = this.roll;
this.roll += this.rotSpeed;
float lifeRatio = (float) this.age / (float) this.lifetime;
this.alpha = 1.0F - lifeRatio;
}
@Override
public ParticleRenderType getRenderType() {
return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
}
public static class Provider implements ParticleProvider<SimpleParticleType> {
private final SpriteSet spriteSet;
public Provider(SpriteSet spriteSet) {
this.spriteSet = spriteSet;
}
@Override
public Particle createParticle(SimpleParticleType type, ClientLevel level,
double x, double y, double z,
double xSpeed, double ySpeed, double zSpeed) {
return new PartyParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
}
}
}
@@ -33,7 +33,7 @@ import com.lzxnone.terraria.item.weapon.melee.TrueExcalibur;
import com.lzxnone.terraria.item.weapon.melee.TrueNightsEdge; import com.lzxnone.terraria.item.weapon.melee.TrueNightsEdge;
import com.lzxnone.terraria.item.weapon.melee.Volcano; import com.lzxnone.terraria.item.weapon.melee.Volcano;
import com.lzxnone.terraria.item.weapon.melee.Zenith; import com.lzxnone.terraria.item.weapon.melee.Zenith;
import com.lzxnone.terraria.item.weapon.ranged.SDMG; import com.lzxnone.terraria.item.weapon.ranged.*;
import com.lzxnone.terraria.item.weapon.summon.Terraprisma; import com.lzxnone.terraria.item.weapon.summon.Terraprisma;
import java.util.HashMap; import java.util.HashMap;
@@ -74,6 +74,17 @@ public class ConfigList {
DevilsDevastation.CONFIG_LIST_ITEM, DevilsDevastation.CONFIG_LIST_ITEM,
Terraprisma.CONFIG_LIST_ITEM, Terraprisma.CONFIG_LIST_ITEM,
LastPrism.CONFIG_LIST_ITEM, LastPrism.CONFIG_LIST_ITEM,
Minishark.CONFIG_LIST_ITEM,
FlintlockPistol.CONFIG_LIST_ITEM,
Boomstick.CONFIG_LIST_ITEM,
Revolver.CONFIG_LIST_ITEM,
RedRyder.CONFIG_LIST_ITEM,
Musket.CONFIG_LIST_ITEM,
TheUndertaker.CONFIG_LIST_ITEM,
QuadBarrelShotgun.CONFIG_LIST_ITEM,
Handgun.CONFIG_LIST_ITEM,
PhoenixBlaster.CONFIG_LIST_ITEM,
Megashark.CONFIG_LIST_ITEM,
SDMG.CONFIG_LIST_ITEM SDMG.CONFIG_LIST_ITEM
}); });
ITEMS.put(EFFECT, new ConfigListItem[]{ ITEMS.put(EFFECT, new ConfigListItem[]{
@@ -18,10 +18,10 @@ import org.joml.Vector3f;
public class AmmoUtil { public class AmmoUtil {
public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.15f, 1.5f); public static final Vector3f OFFSET = new Vector3f(-0.3f, -0.15f, 1.5f);
public static StaticSummon createAmmoSummon(Level level, Player player, InteractionHand hand, ItemStack stack) { public static StaticSummon createAmmoSummon(Level level, Player player, InteractionHand hand, ItemStack stack, Vector3f offset) {
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player); Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
Vec3 eyePos = player.getEyePosition(); Vec3 eyePos = player.getEyePosition();
Vector3f offset = getOffset(hand); offset = getOffset(hand, offset);
Vec3 pos = new Vec3( Vec3 pos = new Vec3(
eyePos.x + dirs[0].x * offset.z + dirs[1].x * offset.y + dirs[2].x * offset.x, 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.y + dirs[0].y * offset.z + dirs[1].y * offset.y + dirs[2].y * offset.x,
@@ -39,6 +39,7 @@ public class AmmoUtil {
summon.setYRot(xyRot[1]); summon.setYRot(xyRot[1]);
summon.xRotO = xyRot[0]; summon.xRotO = xyRot[0];
summon.yRotO = xyRot[1]; summon.yRotO = xyRot[1];
summon.noPhysics = true;
String ammo = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).copyTag().getString(RangedWeapon.AMMO_KEY); String ammo = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).copyTag().getString(RangedWeapon.AMMO_KEY);
if(ammo.equals("lzxnoneterraria:musket_ball")) setMusketBall(summon); if(ammo.equals("lzxnoneterraria:musket_ball")) setMusketBall(summon);
@@ -60,11 +61,11 @@ public class AmmoUtil {
return summon; return summon;
} }
public static Vector3f getOffset(InteractionHand hand) { public static Vector3f getOffset(InteractionHand hand, Vector3f offset) {
return new Vector3f( return new Vector3f(
hand == InteractionHand.OFF_HAND ? -OFFSET.x : OFFSET.x, hand == InteractionHand.OFF_HAND ? -offset.x : offset.x,
OFFSET.y, offset.y,
OFFSET.z offset.z
); );
} }
@@ -33,6 +33,17 @@
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation", "item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
"item.lzxnoneterraria.last_prism": "Last Prism", "item.lzxnoneterraria.last_prism": "Last Prism",
"item.lzxnoneterraria.terraprisma": "Terraprisma", "item.lzxnoneterraria.terraprisma": "Terraprisma",
"item.lzxnoneterraria.musket": "Musket",
"item.lzxnoneterraria.minishark": "Minishark",
"item.lzxnoneterraria.flintlock_pistol": "Flintlock Pistol",
"item.lzxnoneterraria.boomstick": "Boomstick",
"item.lzxnoneterraria.revolver": "Revolver",
"item.lzxnoneterraria.red_ryder": "Red Ryder",
"item.lzxnoneterraria.the_undertaker": "The Undertaker",
"item.lzxnoneterraria.quad_barrel_shotgun": "Quad-Barrel Shotgun",
"item.lzxnoneterraria.handgun": "Handgun",
"item.lzxnoneterraria.phoenix_blaster": "Phoenix Blaster",
"item.lzxnoneterraria.megashark": "Megashark",
"item.lzxnoneterraria.sdmg": "S.D.M.G.", "item.lzxnoneterraria.sdmg": "S.D.M.G.",
"item.lzxnoneterraria.musket_ball": "Musket Ball", "item.lzxnoneterraria.musket_ball": "Musket Ball",
"item.lzxnoneterraria.meteor_shot": "Meteor Shot", "item.lzxnoneterraria.meteor_shot": "Meteor Shot",
@@ -545,6 +556,43 @@
"lzxnoneterraria.configuration.luminite_bullet_speed.tooltip": "Ammo movement speed per tick", "lzxnoneterraria.configuration.luminite_bullet_speed.tooltip": "Ammo movement speed per tick",
"lzxnoneterraria.configuration.luminite_bullet_damage_decay": "Damage Decay Multiplier", "lzxnoneterraria.configuration.luminite_bullet_damage_decay": "Damage Decay Multiplier",
"lzxnoneterraria.configuration.luminite_bullet_damage_decay.tooltip": "Damage multiplier after each extra hit", "lzxnoneterraria.configuration.luminite_bullet_damage_decay.tooltip": "Damage multiplier after each extra hit",
"lzxnoneterraria.configuration.musket_settings": "Musket Settings",
"lzxnoneterraria.configuration.musket_damage": "Damage",
"lzxnoneterraria.configuration.musket_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.flintlock_pistol_settings": "Flintlock Pistol Settings",
"lzxnoneterraria.configuration.flintlock_pistol_damage": "Damage",
"lzxnoneterraria.configuration.flintlock_pistol_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.boomstick_settings": "Boomstick Settings",
"lzxnoneterraria.configuration.boomstick_damage": "Damage",
"lzxnoneterraria.configuration.boomstick_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.revolver_settings": "Revolver Settings",
"lzxnoneterraria.configuration.revolver_damage": "Damage",
"lzxnoneterraria.configuration.revolver_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.red_ryder_settings": "Red Ryder Settings",
"lzxnoneterraria.configuration.red_ryder_damage": "Damage",
"lzxnoneterraria.configuration.red_ryder_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.the_undertaker_settings": "The Undertaker Settings",
"lzxnoneterraria.configuration.the_undertaker_damage": "Damage",
"lzxnoneterraria.configuration.the_undertaker_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.quad_barrel_shotgun_settings": "Quad-Barrel Shotgun Settings",
"lzxnoneterraria.configuration.quad_barrel_shotgun_damage": "Damage",
"lzxnoneterraria.configuration.quad_barrel_shotgun_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.handgun_settings": "Handgun Settings",
"lzxnoneterraria.configuration.handgun_damage": "Damage",
"lzxnoneterraria.configuration.handgun_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.phoenix_blaster_settings": "Phoenix Blaster Settings",
"lzxnoneterraria.configuration.phoenix_blaster_damage": "Damage",
"lzxnoneterraria.configuration.phoenix_blaster_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.minishark_settings": "Minishark Settings",
"lzxnoneterraria.configuration.minishark_ammo_not_consume_chance": "Ammo Not Consume Chance",
"lzxnoneterraria.configuration.minishark_ammo_not_consume_chance.tooltip": "Chance for each shot to avoid consuming ammo, from 0 to 1",
"lzxnoneterraria.configuration.minishark_damage": "Damage",
"lzxnoneterraria.configuration.minishark_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.megashark_settings": "Megashark Settings",
"lzxnoneterraria.configuration.megashark_ammo_not_consume_chance": "Ammo Not Consume Chance",
"lzxnoneterraria.configuration.megashark_ammo_not_consume_chance.tooltip": "Chance for each shot to avoid consuming ammo, from 0 to 1",
"lzxnoneterraria.configuration.megashark_damage": "Damage",
"lzxnoneterraria.configuration.megashark_damage.tooltip": "Damage per hit",
"lzxnoneterraria.configuration.sdmg_settings": "S.D.M.G. Settings", "lzxnoneterraria.configuration.sdmg_settings": "S.D.M.G. Settings",
"lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance": "Ammo Not Consume Chance", "lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance": "Ammo Not Consume Chance",
"lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance.tooltip": "Chance for each shot to avoid consuming ammo, from 0 to 1", "lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance.tooltip": "Chance for each shot to avoid consuming ammo, from 0 to 1",
@@ -33,7 +33,18 @@
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑", "item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
"item.lzxnoneterraria.last_prism": "终极棱镜", "item.lzxnoneterraria.last_prism": "终极棱镜",
"item.lzxnoneterraria.terraprisma": "泰拉棱镜", "item.lzxnoneterraria.terraprisma": "泰拉棱镜",
"item.lzxnoneterraria.sdmg": "S.D.M.G.", "item.lzxnoneterraria.musket": "火枪",
"item.lzxnoneterraria.minishark": "迷你鲨",
"item.lzxnoneterraria.flintlock_pistol": "燧发枪",
"item.lzxnoneterraria.boomstick": "三发猎枪",
"item.lzxnoneterraria.revolver": "左轮手枪",
"item.lzxnoneterraria.red_ryder": "红莱德枪",
"item.lzxnoneterraria.the_undertaker": "夺命枪",
"item.lzxnoneterraria.quad_barrel_shotgun": "四管霰弹枪",
"item.lzxnoneterraria.handgun": "手枪",
"item.lzxnoneterraria.phoenix_blaster": "凤凰爆破枪",
"item.lzxnoneterraria.megashark": "巨兽鲨",
"item.lzxnoneterraria.sdmg": "太空海豚机枪",
"item.lzxnoneterraria.musket_ball": "火枪子弹", "item.lzxnoneterraria.musket_ball": "火枪子弹",
"item.lzxnoneterraria.meteor_shot": "流星弹", "item.lzxnoneterraria.meteor_shot": "流星弹",
"item.lzxnoneterraria.silver_bullet": "银子弹", "item.lzxnoneterraria.silver_bullet": "银子弹",
@@ -544,6 +555,43 @@
"lzxnoneterraria.configuration.luminite_bullet_speed.tooltip": "子弹每刻移动速度", "lzxnoneterraria.configuration.luminite_bullet_speed.tooltip": "子弹每刻移动速度",
"lzxnoneterraria.configuration.luminite_bullet_damage_decay": "伤害衰减倍率", "lzxnoneterraria.configuration.luminite_bullet_damage_decay": "伤害衰减倍率",
"lzxnoneterraria.configuration.luminite_bullet_damage_decay.tooltip": "每次额外命中后的伤害倍率", "lzxnoneterraria.configuration.luminite_bullet_damage_decay.tooltip": "每次额外命中后的伤害倍率",
"lzxnoneterraria.configuration.musket_settings": "火枪 设置",
"lzxnoneterraria.configuration.musket_damage": "伤害",
"lzxnoneterraria.configuration.musket_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.flintlock_pistol_settings": "燧发枪 设置",
"lzxnoneterraria.configuration.flintlock_pistol_damage": "伤害",
"lzxnoneterraria.configuration.flintlock_pistol_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.boomstick_settings": "三发猎枪 设置",
"lzxnoneterraria.configuration.boomstick_damage": "伤害",
"lzxnoneterraria.configuration.boomstick_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.revolver_settings": "左轮手枪 设置",
"lzxnoneterraria.configuration.revolver_damage": "伤害",
"lzxnoneterraria.configuration.revolver_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.red_ryder_settings": "红莱德枪 设置",
"lzxnoneterraria.configuration.red_ryder_damage": "伤害",
"lzxnoneterraria.configuration.red_ryder_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.the_undertaker_settings": "夺命枪 设置",
"lzxnoneterraria.configuration.the_undertaker_damage": "伤害",
"lzxnoneterraria.configuration.the_undertaker_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.quad_barrel_shotgun_settings": "四管霰弹枪 设置",
"lzxnoneterraria.configuration.quad_barrel_shotgun_damage": "伤害",
"lzxnoneterraria.configuration.quad_barrel_shotgun_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.handgun_settings": "手枪 设置",
"lzxnoneterraria.configuration.handgun_damage": "伤害",
"lzxnoneterraria.configuration.handgun_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.phoenix_blaster_settings": "凤凰爆破枪 设置",
"lzxnoneterraria.configuration.phoenix_blaster_damage": "伤害",
"lzxnoneterraria.configuration.phoenix_blaster_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.minishark_settings": "迷你鲨 设置",
"lzxnoneterraria.configuration.minishark_ammo_not_consume_chance": "不消耗弹药概率",
"lzxnoneterraria.configuration.minishark_ammo_not_consume_chance.tooltip": "每次射击不消耗弹药的概率,范围 0~1",
"lzxnoneterraria.configuration.minishark_damage": "伤害",
"lzxnoneterraria.configuration.minishark_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.megashark_settings": "巨兽鲨 设置",
"lzxnoneterraria.configuration.megashark_ammo_not_consume_chance": "不消耗弹药概率",
"lzxnoneterraria.configuration.megashark_ammo_not_consume_chance.tooltip": "每次射击不消耗弹药的概率,范围 0~1",
"lzxnoneterraria.configuration.megashark_damage": "伤害",
"lzxnoneterraria.configuration.megashark_damage.tooltip": "每次命中伤害",
"lzxnoneterraria.configuration.sdmg_settings": "S.D.M.G. 设置", "lzxnoneterraria.configuration.sdmg_settings": "S.D.M.G. 设置",
"lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance": "不消耗弹药概率", "lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance": "不消耗弹药概率",
"lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance.tooltip": "每次射击不消耗弹药的概率,范围 0~1", "lzxnoneterraria.configuration.sdmg_ammo_not_consume_chance.tooltip": "每次射击不消耗弹药的概率,范围 0~1",
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun2",
"textures": {
"layer0": "lzxnoneterraria:item/boomstick"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun4",
"textures": {
"layer0": "lzxnoneterraria:item/flintlock_pistol"
}
}
@@ -0,0 +1,45 @@
{
"parent": "item/handheld",
"display": {
"gui": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1.0, 0.4, 1.0 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 2.0, 0 ],
"scale": [ 1.0, 0.4, 0.5 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 13.0, 7.0 ],
"scale": [ 2, 0.8, 1 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 0.4, 1 ]
},
"thirdperson_righthand": {
"rotation": [0, 90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 0.68, 0.85]
},
"thirdperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 0.68, 0.85]
},
"firstperson_righthand": {
"rotation": [0, 90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.544, 0.68]
},
"firstperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.544, 0.68]
}
}
}
@@ -0,0 +1,45 @@
{
"parent": "item/handheld",
"display": {
"gui": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1.0, 0.333, 1.0 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 2.0, 0 ],
"scale": [ 1.0, 0.333, 0.5 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 13.0, 7.0 ],
"scale": [ 2, 0.667, 1 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 0.333, 1 ]
},
"thirdperson_righthand": {
"rotation": [0, 90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 0.567, 0.85]
},
"thirdperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 0.567, 0.85]
},
"firstperson_righthand": {
"rotation": [0, 90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.453, 0.68]
},
"firstperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.453, 0.68]
}
}
}
@@ -0,0 +1,45 @@
{
"parent": "item/handheld",
"display": {
"gui": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1.0, 0.667, 1.0 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 2.0, 0 ],
"scale": [ 1.0, 0.667, 0.5 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 13.0, 7.0 ],
"scale": [ 2, 1.333, 1 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 0.667, 1 ]
},
"thirdperson_righthand": {
"rotation": [0, 90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 1.133, 0.85]
},
"thirdperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [0, 0, -1],
"scale": [1.7, 1.133, 0.85]
},
"firstperson_righthand": {
"rotation": [0, 90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.907, 0.68]
},
"firstperson_lefthand": {
"rotation": [0, -90, 0],
"translation": [1.13, 4.2, 0.0],
"scale": [1.36, 0.907, 0.68]
}
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun4",
"textures": {
"layer0": "lzxnoneterraria:item/handgun"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun2",
"textures": {
"layer0": "lzxnoneterraria:item/megashark"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun2",
"textures": {
"layer0": "lzxnoneterraria:item/minishark"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun3",
"textures": {
"layer0": "lzxnoneterraria:item/musket"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun4",
"textures": {
"layer0": "lzxnoneterraria:item/phoenix_blaster"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun2",
"textures": {
"layer0": "lzxnoneterraria:item/quad_barrel_shotgun"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun3",
"textures": {
"layer0": "lzxnoneterraria:item/red_ryder"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun2",
"textures": {
"layer0": "lzxnoneterraria:item/revolver"
}
}
@@ -0,0 +1,6 @@
{
"parent": "lzxnoneterraria:item/gun",
"textures": {
"layer0": "lzxnoneterraria:item/the_undertaker"
}
}
@@ -0,0 +1,5 @@
{
"textures": [
"lzxnoneterraria:black_dust_particle"
]
}
@@ -0,0 +1,5 @@
{
"textures": [
"lzxnoneterraria:party_particle"
]
}
@@ -29,6 +29,21 @@
"shot": { "shot": {
"sounds": ["lzxnoneterraria:shot"] "sounds": ["lzxnoneterraria:shot"]
}, },
"shot2": {
"sounds": ["lzxnoneterraria:shot2"]
},
"shot3": {
"sounds": ["lzxnoneterraria:shot3"]
},
"shot4": {
"sounds": ["lzxnoneterraria:shot4"]
},
"shot5": {
"sounds": ["lzxnoneterraria:shot5"]
},
"shot6": {
"sounds": ["lzxnoneterraria:shot6"]
},
"boom": { "boom": {
"sounds": ["lzxnoneterraria:boom"] "sounds": ["lzxnoneterraria:boom"]
}, },
Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

@@ -1,6 +1,17 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"lzxnoneterraria:musket",
"lzxnoneterraria:minishark",
"lzxnoneterraria:flintlock_pistol",
"lzxnoneterraria:boomstick",
"lzxnoneterraria:revolver",
"lzxnoneterraria:red_ryder",
"lzxnoneterraria:the_undertaker",
"lzxnoneterraria:quad_barrel_shotgun",
"lzxnoneterraria:handgun",
"lzxnoneterraria:phoenix_blaster",
"lzxnoneterraria:megashark",
"lzxnoneterraria:sdmg" "lzxnoneterraria:sdmg"
] ]
} }