v1.3.0-pre
No files matched your search
@@ -22,6 +22,19 @@ public class Config {
|
||||
public static final ModConfigSpec.IntValue BLOOD_BUTCHERER_MAX_LEVEL;
|
||||
public static final ModConfigSpec.DoubleValue BLOOD_BUTCHERER_DAMAGE_PER_LEVEL;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue BLADE_OF_GRASS_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue BLADE_OF_GRASS_EFFECT_DURATION;
|
||||
public static final ModConfigSpec.DoubleValue BLADE_OF_GRASS_TARGET_RANGE;
|
||||
public static final ModConfigSpec.IntValue BLADE_OF_GRASS_PROJECTILE_LIFETIME;
|
||||
public static final ModConfigSpec.IntValue BLADE_OF_GRASS_PROJECTILE_MAX_HIT_COUNT;
|
||||
public static final ModConfigSpec.DoubleValue BLADE_OF_GRASS_RADIUS_GROWTH;
|
||||
public static final ModConfigSpec.DoubleValue BLADE_OF_GRASS_ROTATION_SPEED;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue VOLCANO_EXPLOSION_RANGE;
|
||||
public static final ModConfigSpec.DoubleValue VOLCANO_EXPLOSION_DAMAGE;
|
||||
public static final ModConfigSpec.IntValue VOLCANO_EXPLOSION_MAX_HIT_COUNT;
|
||||
public static final ModConfigSpec.IntValue VOLCANO_IGNITE_SECONDS;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue STARFURY_DAMAGE;
|
||||
public static final ModConfigSpec.DoubleValue STARFURY_MAX_RANGE;
|
||||
public static final ModConfigSpec.DoubleValue STARFURY_SPEED;
|
||||
@@ -59,6 +72,11 @@ public class Config {
|
||||
public static final ModConfigSpec.DoubleValue LIGHTS_BANE_SMALL_DAMAGE;
|
||||
public static final ModConfigSpec.DoubleValue LIGHTS_BANE_TARGET_RANGE;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue MURAMASA_BEAM_DAMAGE;
|
||||
|
||||
public static final ModConfigSpec.DoubleValue TERRAGRIM_HIT_RANGE;
|
||||
public static final ModConfigSpec.DoubleValue TERRAGRIM_DAMAGE;
|
||||
|
||||
public static final ModConfigSpec.IntValue EXCALIBUR_ROTATE_RANGE;
|
||||
public static final ModConfigSpec.IntValue EXCALIBUR_MAX_HIT_COUNT;
|
||||
public static final ModConfigSpec.DoubleValue EXCALIBUR_DAMAGE;
|
||||
@@ -108,7 +126,8 @@ public class Config {
|
||||
public static final ModConfigSpec.IntValue TRUE_NIGHTS_EDGE_PROJECTILE_MAX_HIT_COUNT;
|
||||
public static final ModConfigSpec.DoubleValue TRUE_NIGHTS_EDGE_DAMAGE;
|
||||
public static final ModConfigSpec.DoubleValue TRUE_NIGHTS_EDGE_PROJECTILE_DAMAGE;
|
||||
public static final ModConfigSpec.DoubleValue TRUE_NIGHTS_EDGE_PROJECTILE_SPEED;
|
||||
public static final ModConfigSpec.DoubleValue TRUE_NIGHTS_EDGE_PROJECTILE_MAX_SPEED;
|
||||
public static final ModConfigSpec.DoubleValue TRUE_NIGHTS_EDGE_PROJECTILE_ACCELERATION;
|
||||
public static final ModConfigSpec.IntValue TRUE_NIGHTS_EDGE_PROJECTILE_LIFETIME;
|
||||
public static final ModConfigSpec.IntValue TRUE_NIGHTS_EDGE_PROJECTILE_ROTATION_SPEED;
|
||||
|
||||
@@ -124,6 +143,19 @@ public class Config {
|
||||
public static int bloodButchererMaxLevel;
|
||||
public static double bloodButchererDamagePerLevel;
|
||||
|
||||
public static double bladeOfGrassProjectileDamage;
|
||||
public static int bladeOfGrassEffectDuration;
|
||||
public static double bladeOfGrassTargetRange;
|
||||
public static int bladeOfGrassProjectileLifetime;
|
||||
public static int bladeOfGrassProjectileMaxHitCount;
|
||||
public static double bladeOfGrassRadiusGrowth;
|
||||
public static double bladeOfGrassRotationSpeed;
|
||||
|
||||
public static double volcanoExplosionRange;
|
||||
public static double volcanoExplosionDamage;
|
||||
public static int volcanoExplosionMaxHitCount;
|
||||
public static int volcanoIgniteSeconds;
|
||||
|
||||
public static double starfuryDamage;
|
||||
public static double starfuryMaxRange;
|
||||
public static double starfurySpeed;
|
||||
@@ -161,6 +193,11 @@ public class Config {
|
||||
public static double lightsBaneSmallDamage;
|
||||
public static double lightsBaneTargetRange;
|
||||
|
||||
public static double muramasaBeamDamage;
|
||||
|
||||
public static double terragrimHitRange;
|
||||
public static double terragrimDamage;
|
||||
|
||||
public static int excaliburRotateRange;
|
||||
public static int excaliburMaxHitCount;
|
||||
public static double excaliburDamage;
|
||||
@@ -210,7 +247,8 @@ public class Config {
|
||||
public static int trueNightsEdgeProjectileMaxHitCount;
|
||||
public static double trueNightsEdgeDamage;
|
||||
public static double trueNightsEdgeProjectileDamage;
|
||||
public static double trueNightsEdgeProjectileSpeed;
|
||||
public static double trueNightsEdgeProjectileMaxSpeed;
|
||||
public static double trueNightsEdgeProjectileAcceleration;
|
||||
public static int trueNightsEdgeProjectileLifetime;
|
||||
public static int trueNightsEdgeProjectileRotationSpeed;
|
||||
|
||||
@@ -266,6 +304,58 @@ public class Config {
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("blade_of_grass_settings");
|
||||
|
||||
BLADE_OF_GRASS_PROJECTILE_DAMAGE = builder
|
||||
.comment("弹射伤害")
|
||||
.defineInRange("blade_of_grass_projectile_damage", 2.0, 0, 2147483647.0);
|
||||
|
||||
BLADE_OF_GRASS_EFFECT_DURATION = builder
|
||||
.comment("效果持续时间(刻)")
|
||||
.defineInRange("blade_of_grass_effect_duration", 140, 0, 72000);
|
||||
|
||||
BLADE_OF_GRASS_TARGET_RANGE = builder
|
||||
.comment("弹射最大寻敌范围")
|
||||
.defineInRange("blade_of_grass_target_range", 8.0, 1.0, 64.0);
|
||||
|
||||
BLADE_OF_GRASS_PROJECTILE_LIFETIME = builder
|
||||
.comment("弹射持续时间")
|
||||
.defineInRange("blade_of_grass_projectile_lifetime", 60, 1, 600);
|
||||
|
||||
BLADE_OF_GRASS_PROJECTILE_MAX_HIT_COUNT = builder
|
||||
.comment("弹射最大击中数")
|
||||
.defineInRange("blade_of_grass_projectile_max_hit_count", 2, 0, 100);
|
||||
|
||||
BLADE_OF_GRASS_RADIUS_GROWTH = builder
|
||||
.comment("弹射半径增大速度")
|
||||
.defineInRange("blade_of_grass_radius_growth", 0.05, 0, 1.0);
|
||||
|
||||
BLADE_OF_GRASS_ROTATION_SPEED = builder
|
||||
.comment("弹射旋转速度")
|
||||
.defineInRange("blade_of_grass_rotation_speed", 0.2, 0, 1.0);
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("volcano_settings");
|
||||
|
||||
VOLCANO_EXPLOSION_RANGE = builder
|
||||
.comment("爆炸范围")
|
||||
.defineInRange("volcano_explosion_range", 4.0, 1.0, 64.0);
|
||||
|
||||
VOLCANO_EXPLOSION_DAMAGE = builder
|
||||
.comment("爆炸伤害")
|
||||
.defineInRange("volcano_explosion_damage", 6.0, 0, 2147483647.0);
|
||||
|
||||
VOLCANO_EXPLOSION_MAX_HIT_COUNT = builder
|
||||
.comment("爆炸最大击中数")
|
||||
.defineInRange("volcano_explosion_max_hit_count", 2, 0, 100);
|
||||
|
||||
VOLCANO_IGNITE_SECONDS = builder
|
||||
.comment("着火时间(秒)")
|
||||
.defineInRange("volcano_ignite_seconds", 3, 0, 60);
|
||||
|
||||
builder.pop();
|
||||
|
||||
builder.push("starfury_settings");
|
||||
|
||||
STARFURY_DAMAGE = builder
|
||||
@@ -421,6 +511,28 @@ public class Config {
|
||||
builder.pop();
|
||||
|
||||
|
||||
builder.push("muramasa_settings");
|
||||
|
||||
MURAMASA_BEAM_DAMAGE = builder
|
||||
.comment("蓝色光线伤害")
|
||||
.defineInRange("muramasa_beam_damage", 2.5, 0, 2147483647.0);
|
||||
|
||||
builder.pop();
|
||||
|
||||
|
||||
builder.push("terragrim_settings");
|
||||
|
||||
TERRAGRIM_HIT_RANGE = builder
|
||||
.comment("碰撞箱范围")
|
||||
.defineInRange("terragrim_hit_range", 2.5, 0.5, 10.0);
|
||||
|
||||
TERRAGRIM_DAMAGE = builder
|
||||
.comment("伤害")
|
||||
.defineInRange("terragrim_damage", 0.25, 0, 2147483647.0);
|
||||
|
||||
builder.pop();
|
||||
|
||||
|
||||
builder.push("excalibur_settings");
|
||||
|
||||
EXCALIBUR_ROTATE_RANGE = builder
|
||||
@@ -622,9 +734,13 @@ public class Config {
|
||||
.comment("弹射伤害")
|
||||
.defineInRange("true_nights_edge_projectile_damage", 4.0, 0, 2147483647.0);
|
||||
|
||||
TRUE_NIGHTS_EDGE_PROJECTILE_SPEED = builder
|
||||
.comment("弹射速度")
|
||||
.defineInRange("true_nights_edge_projectile_speed", 0.5, 0, 10);
|
||||
TRUE_NIGHTS_EDGE_PROJECTILE_MAX_SPEED = builder
|
||||
.comment("弹射最大速度")
|
||||
.defineInRange("true_nights_edge_projectile_max_speed", 2.0, 0, 10);
|
||||
|
||||
TRUE_NIGHTS_EDGE_PROJECTILE_ACCELERATION = builder
|
||||
.comment("弹射加速度")
|
||||
.defineInRange("true_nights_edge_projectile_acceleration", 0.03, 0, 10.0);
|
||||
|
||||
TRUE_NIGHTS_EDGE_PROJECTILE_LIFETIME = builder
|
||||
.comment("弹射持续时间")
|
||||
@@ -651,6 +767,17 @@ public class Config {
|
||||
bloodButchererEffectDuration = BLOOD_BUTCHERER_EFFECT_DURATION.get();
|
||||
bloodButchererMaxLevel = BLOOD_BUTCHERER_MAX_LEVEL.get();
|
||||
bloodButchererDamagePerLevel = BLOOD_BUTCHERER_DAMAGE_PER_LEVEL.get();
|
||||
bladeOfGrassProjectileDamage = BLADE_OF_GRASS_PROJECTILE_DAMAGE.get();
|
||||
bladeOfGrassEffectDuration = BLADE_OF_GRASS_EFFECT_DURATION.get();
|
||||
bladeOfGrassTargetRange = BLADE_OF_GRASS_TARGET_RANGE.get();
|
||||
bladeOfGrassProjectileLifetime = BLADE_OF_GRASS_PROJECTILE_LIFETIME.get();
|
||||
bladeOfGrassProjectileMaxHitCount = BLADE_OF_GRASS_PROJECTILE_MAX_HIT_COUNT.get();
|
||||
bladeOfGrassRadiusGrowth = BLADE_OF_GRASS_RADIUS_GROWTH.get();
|
||||
bladeOfGrassRotationSpeed = BLADE_OF_GRASS_ROTATION_SPEED.get();
|
||||
volcanoExplosionRange = VOLCANO_EXPLOSION_RANGE.get();
|
||||
volcanoExplosionDamage = VOLCANO_EXPLOSION_DAMAGE.get();
|
||||
volcanoExplosionMaxHitCount = VOLCANO_EXPLOSION_MAX_HIT_COUNT.get();
|
||||
volcanoIgniteSeconds = VOLCANO_IGNITE_SECONDS.get();
|
||||
starfuryDamage = STARFURY_DAMAGE.get();
|
||||
starfuryMaxRange = STARFURY_MAX_RANGE.get();
|
||||
starfurySpeed = STARFURY_SPEED.get();
|
||||
@@ -681,6 +808,9 @@ public class Config {
|
||||
lightsBaneBigDamage = LIGHTS_BANE_BIG_DAMAGE.get();
|
||||
lightsBaneSmallDamage = LIGHTS_BANE_SMALL_DAMAGE.get();
|
||||
lightsBaneTargetRange = LIGHTS_BANE_TARGET_RANGE.get();
|
||||
muramasaBeamDamage = MURAMASA_BEAM_DAMAGE.get();
|
||||
terragrimHitRange = TERRAGRIM_HIT_RANGE.get();
|
||||
terragrimDamage = TERRAGRIM_DAMAGE.get();
|
||||
excaliburRotateRange = EXCALIBUR_ROTATE_RANGE.get();
|
||||
excaliburMaxHitCount = EXCALIBUR_MAX_HIT_COUNT.get();
|
||||
excaliburDamage = EXCALIBUR_DAMAGE.get();
|
||||
@@ -725,7 +855,8 @@ public class Config {
|
||||
trueNightsEdgeProjectileMaxHitCount = TRUE_NIGHTS_EDGE_PROJECTILE_MAX_HIT_COUNT.get();
|
||||
trueNightsEdgeDamage = TRUE_NIGHTS_EDGE_DAMAGE.get();
|
||||
trueNightsEdgeProjectileDamage = TRUE_NIGHTS_EDGE_PROJECTILE_DAMAGE.get();
|
||||
trueNightsEdgeProjectileSpeed = TRUE_NIGHTS_EDGE_PROJECTILE_SPEED.get();
|
||||
trueNightsEdgeProjectileMaxSpeed = TRUE_NIGHTS_EDGE_PROJECTILE_MAX_SPEED.get();
|
||||
trueNightsEdgeProjectileAcceleration = TRUE_NIGHTS_EDGE_PROJECTILE_ACCELERATION.get();
|
||||
trueNightsEdgeProjectileLifetime = TRUE_NIGHTS_EDGE_PROJECTILE_LIFETIME.get();
|
||||
trueNightsEdgeProjectileRotationSpeed = TRUE_NIGHTS_EDGE_PROJECTILE_ROTATION_SPEED.get();
|
||||
}
|
||||
|
||||
@@ -74,5 +74,11 @@ public class LzxnoneTerrariaClient {
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.BLOOD_BUTCHERED_PARTICLE.get(), BloodButcheredParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.LEAF_PARTICLE.get(), LeafParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.SOLAR_EXPLOSION_PARTICLE.get(), SolarExplosionParticle.Provider::new);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,16 @@ public class ModSounds {
|
||||
SOUND_EVENTS.register("cat2",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "cat2")));
|
||||
public static final Supplier<SoundEvent> EXPLOSIVE_TRAP_EXPLODE0 =
|
||||
SOUND_EVENTS.register("explosive_trap_explode0",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "explosive_trap_explode0")));
|
||||
public static final Supplier<SoundEvent> EXPLOSIVE_TRAP_EXPLODE1 =
|
||||
SOUND_EVENTS.register("explosive_trap_explode1",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "explosive_trap_explode1")));
|
||||
public static final Supplier<SoundEvent> EXPLOSIVE_TRAP_EXPLODE2 =
|
||||
SOUND_EVENTS.register("explosive_trap_explode2",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "explosive_trap_explode2")));
|
||||
}
|
||||
@@ -35,5 +35,9 @@ public class ModCreativeModeTabs {
|
||||
output.accept(ModItems.TRUE_NIGHTS_EDGE.get());
|
||||
output.accept(ModItems.LIGHTS_BANE.get());
|
||||
output.accept(ModItems.BLOOD_BUTCHERER.get());
|
||||
output.accept(ModItems.MURAMASA.get());
|
||||
output.accept(ModItems.BLADE_OF_GRASS.get());
|
||||
output.accept(ModItems.VOLCANO.get());
|
||||
output.accept(ModItems.TERRAGRIM.get());
|
||||
}).build());
|
||||
}
|
||||
@@ -16,6 +16,8 @@ public class StaticProjectileBehaviors {
|
||||
public static final String SEEDLER_THORN = "seedler_thorn";
|
||||
public static final String STAR_WRATH_STAR = "star_wrath_star";
|
||||
public static final String ZENITH_PROJECTILE = "zenith_projectile";
|
||||
public static final String MURAMASA_PROJECTILE = "muramasa_projectile";
|
||||
public static final String LEAF_PROJECTILE = "leaf_projectile";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() {
|
||||
@@ -37,6 +39,8 @@ public class StaticProjectileBehaviors {
|
||||
BEHAVIORS.put(SEEDLER_THORN, Seedler.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(STAR_WRATH_STAR, StarWrath.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(ZENITH_PROJECTILE, Zenith.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(MURAMASA_PROJECTILE, Muramasa.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(LEAF_PROJECTILE, BladeOfGrass.PROJECTILE_BEHAVIOR);
|
||||
}
|
||||
|
||||
public static IStaticProjectileBehavior getBehavior(String id) {
|
||||
|
||||
@@ -17,6 +17,7 @@ public class StaticSummonBehaviors {
|
||||
public static final String TRUE_NIGHTS_EDGE_BEAM = "true_nights_edge_beam";
|
||||
public static final String NIGHTS_EDGE_BEAM = "nights_edge_beam";
|
||||
public static final String LIGHTS_BANE_SLASH = "lights_bane_slash";
|
||||
public static final String TERRAGRIM_BEAM = "terragrim_beam";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
||||
@@ -28,6 +29,7 @@ public class StaticSummonBehaviors {
|
||||
BEHAVIORS.put(TRUE_NIGHTS_EDGE_BEAM, TrueNightsEdge.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(NIGHTS_EDGE_BEAM, NightsEdge.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(LIGHTS_BANE_SLASH, LightsBane.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(TERRAGRIM_BEAM, Terragrim.SUMMON_BEHAVIOR);
|
||||
}
|
||||
|
||||
public static IStaticSummonBehavior getBehavior(String id) {
|
||||
|
||||
@@ -2,21 +2,25 @@ package com.lzxnone.terraria.event_handler;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TrueCopperShortsword;
|
||||
import com.lzxnone.terraria.item.weapon.melee.Zenith;
|
||||
import com.lzxnone.terraria.network.payload.ZenithScrollPayload;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.Input;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.InputEvent;
|
||||
import net.neoforged.neoforge.client.event.MovementInputUpdateEvent;
|
||||
import net.neoforged.neoforge.network.PacketDistributor;
|
||||
|
||||
@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT)
|
||||
@@ -56,4 +60,14 @@ public class InputHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMovementInputUpdate(MovementInputUpdateEvent event) {
|
||||
Player player = event.getEntity();
|
||||
if(player.isUsingItem() && player.getUseItem().is(ModItems.TERRAGRIM.get())) {
|
||||
Input input = event.getInput();
|
||||
input.forwardImpulse *= 5.0F;
|
||||
input.leftImpulse *= 5.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ public class ItemWaveBehaviors {
|
||||
public static final String NIGHTS_EDGE = "nights_edge";
|
||||
public static final String LIGHTS_BANE = "lights_bane";
|
||||
public static final String BLOOD_BUTCHERER = "blood_butcherer";
|
||||
public static final String MURAMASA = "muramasa";
|
||||
public static final String VOLCANO = "volcano";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IItemWaveBehavior() {});
|
||||
@@ -30,6 +32,8 @@ public class ItemWaveBehaviors {
|
||||
BEHAVIORS.put(NIGHTS_EDGE, NightsEdge.ITEM_WAVE_BEHAVIOR);
|
||||
BEHAVIORS.put(LIGHTS_BANE, LightsBane.ITEM_WAVE_BEHAVIOR);
|
||||
BEHAVIORS.put(BLOOD_BUTCHERER, BloodButcherer.ITEM_WAVE_BEHAVIOR);
|
||||
BEHAVIORS.put(MURAMASA, Muramasa.ITEM_WAVE_BEHAVIOR);
|
||||
BEHAVIORS.put(VOLCANO, Volcano.ITEM_WAVE_BEHAVIOR);
|
||||
}
|
||||
|
||||
public static IItemWaveBehavior getBehavior(String id) {
|
||||
|
||||
@@ -41,4 +41,5 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> INFLUX_WAVER_BEAM = ITEMS.register("influx_waver_beam", InfluxWaverBeam::new);
|
||||
public static final DeferredItem<Item> STAR_WRATH_STAR = ITEMS.register("star_wrath_star", StarWrathStar::new);
|
||||
public static final DeferredItem<Item> MEOWMERE_PROJECTILE = ITEMS.register("meowmere_projectile", MeowmereProjectile::new);
|
||||
public static final DeferredItem<Item> LEAF_PROJECTILE = ITEMS.register("leaf_projectile", LeafProjectile::new);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.lzxnone.terraria.item.projectile;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
public class LeafProjectile extends Item {
|
||||
public LeafProjectile() {
|
||||
super(new Item.Properties());
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,241 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class BladeOfGrass extends SwordItem {
|
||||
public BladeOfGrass() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 5, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 3, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.6, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/normal_trail.png");
|
||||
public static final Vector3f TRAIL_COLOR = new Vector3f(0.271f, 0.486f, 0.016f);
|
||||
public static final float TRAIL_ALPHA = 0.25f;
|
||||
public static final int MAX_LENGTH = 10;
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||
this.renderItem(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight);
|
||||
|
||||
Vec3 currentPos = projectile.getPosition(partialTick);
|
||||
|
||||
VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucent(RES));
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
|
||||
int quadCount = projectile.trailPositions.size() / 2 - 1;
|
||||
for(int i = 1; i < quadCount;i++) {
|
||||
Vec3 currentPoint1 = projectile.trailPositions.get(i * 2);
|
||||
Vec3 currentPoint2 = projectile.trailPositions.get(i * 2 + 1);
|
||||
Vec3 nextPoint1 = projectile.trailPositions.get(i * 2 + 3);
|
||||
Vec3 nextPoint2 = projectile.trailPositions.get(i * 2 + 2);
|
||||
|
||||
double x1 = currentPoint1.x - currentPos.x;
|
||||
double y1 = currentPoint1.y - currentPos.y;
|
||||
double z1 = currentPoint1.z - currentPos.z;
|
||||
|
||||
double x2 = currentPoint2.x - currentPos.x;
|
||||
double y2 = currentPoint2.y - currentPos.y;
|
||||
double z2 = currentPoint2.z - currentPos.z;
|
||||
|
||||
double x3 = nextPoint1.x - currentPos.x;
|
||||
double y3 = nextPoint1.y - currentPos.y;
|
||||
double z3 = nextPoint1.z - currentPos.z;
|
||||
|
||||
double x4 = nextPoint2.x - currentPos.x;
|
||||
double y4 = nextPoint2.y - currentPos.y;
|
||||
double z4 = nextPoint2.z - currentPos.z;
|
||||
|
||||
float radio1 = (float) i / quadCount;
|
||||
float radio2 = (float) (i + 1) / quadCount;
|
||||
|
||||
vertexConsumer.addVertex(matrix, (float)x1, (float)y1, (float)z1)
|
||||
.setColor(TRAIL_COLOR.x, TRAIL_COLOR.y, TRAIL_COLOR.z, TRAIL_ALPHA).setUv(radio1, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x2, (float)y2, (float)z2)
|
||||
.setColor(TRAIL_COLOR.x, TRAIL_COLOR.y, TRAIL_COLOR.z, TRAIL_ALPHA).setUv(radio1, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x3, (float)y3, (float)z3)
|
||||
.setColor(TRAIL_COLOR.x, TRAIL_COLOR.y, TRAIL_COLOR.z, TRAIL_ALPHA).setUv(radio2, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x4, (float)y4, (float)z4)
|
||||
.setColor(TRAIL_COLOR.x, TRAIL_COLOR.y, TRAIL_COLOR.z, TRAIL_ALPHA).setUv(radio2, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoving(StaticProjectile projectile) {
|
||||
ParticleUtil.addParticle(
|
||||
projectile.level(), ModParticles.LEAF_PARTICLE.get(),
|
||||
projectile.position(), 0.0,
|
||||
new Vec3(0, 0, 0), 0.1
|
||||
);
|
||||
Vector3f originalRight = projectile.getEntityData().get(StaticProjectile.RIGHT);
|
||||
Vec3 right = MathUtil.toVec3(originalRight).normalize();
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(0.1)));
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(-0.1)));
|
||||
while(projectile.trailPositions.size() > MAX_LENGTH) projectile.trailPositions.removeLast();
|
||||
}
|
||||
@Override
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(!projectile.level().isClientSide()) {
|
||||
Entity target = result.getEntity();
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA);
|
||||
if(!customData.contains("hitCount") || customData.getInt("hitCount") >= Config.bladeOfGrassProjectileMaxHitCount) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, (float) Config.bladeOfGrassProjectileDamage)) {
|
||||
int count = customData.getInt("hitCount");
|
||||
count++;
|
||||
if(target instanceof LivingEntity livingEntity && projectile.getRandom().nextInt(4) == 0) {
|
||||
livingEntity.addEffect(new MobEffectInstance(
|
||||
MobEffects.POISON,
|
||||
Config.bladeOfGrassEffectDuration,
|
||||
0
|
||||
));
|
||||
}
|
||||
if(count >= Config.bladeOfGrassProjectileMaxHitCount) onDied(projectile);
|
||||
else customData.putInt("hitCount", count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onHitBlock(StaticProjectile projectile, BlockHitResult result) {
|
||||
if(projectile.level().isClientSide()) return;
|
||||
if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) {
|
||||
Level level = projectile.level();
|
||||
BlockPos pos = result.getBlockPos();
|
||||
BlockState state = level.getBlockState(pos);
|
||||
boolean isFire = state.is(BlockTags.FIRE);
|
||||
boolean isLava = state.getFluidState().is(FluidTags.LAVA);
|
||||
if(isFire || isLava) onDied(projectile);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
|
||||
if(!level.isClientSide()) {
|
||||
List<Monster> targets = player.level().getEntitiesOfClass(
|
||||
Monster.class,
|
||||
AABB.ofSize(player.getBoundingBox().getCenter(), Config.bladeOfGrassTargetRange * 2, Config.bladeOfGrassTargetRange * 2, Config.bladeOfGrassTargetRange * 2),
|
||||
FilterUtil.createMonsterFilter(player)
|
||||
);
|
||||
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(player.position())));
|
||||
|
||||
Vec3 playerPos = player.getEyePosition();
|
||||
|
||||
Vec3 targetPos = playerPos.add(player.getLookAngle().normalize().scale(Math.random() * 4 + 4));
|
||||
if(!targets.isEmpty()) targetPos = targets.getFirst().getBoundingBox().getCenter();
|
||||
Vec3 originalDir = targetPos.subtract(playerPos);
|
||||
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(originalDir.toVector3f(), player.getYRot());
|
||||
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], (int) ((Math.random() * 2 - 1) * 30));
|
||||
|
||||
Vec3 center = playerPos.add(originalDir.scale(0.5).add(MathUtil.toVec3(dirs[1]).scale(Math.random() * 4 + 4)));
|
||||
double radius = playerPos.subtract(center).length();
|
||||
double angleRad = -dirs[0].angle(playerPos.subtract(center).toVector3f());
|
||||
|
||||
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), level);
|
||||
projectile.setOwner(player);
|
||||
Vec3 pos = new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ());
|
||||
projectile.setPos(pos);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.LEAF_PROJECTILE);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(center));
|
||||
projectile.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]);
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.LEAF_PROJECTILE.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_X, 0.5f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Y, 0.5f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Z, 0.5f);
|
||||
projectile.getEntityData().set(StaticProjectile.RXP, -90);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, -90);
|
||||
projectile.getEntityData().set(StaticProjectile.RYPS, 10);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, Config.bladeOfGrassProjectileLifetime);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("(%.3f+%.3f*t)*cos(%.3f*t+%.3f)", radius, Config.bladeOfGrassRadiusGrowth, Config.bladeOfGrassRotationSpeed, angleRad));
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Y, String.format("(%.3f+%.3f*t)*sin(%.3f*t+%.3f)", radius, Config.bladeOfGrassRadiusGrowth, Config.bladeOfGrassRotationSpeed, angleRad));
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
customData.putInt("hitCount", 0);
|
||||
projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData);
|
||||
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
level.addFreshEntity(projectile);
|
||||
}else {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), ModParticles.LEAF_PARTICLE.get(),
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 7);
|
||||
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ import org.joml.Vector3f;
|
||||
|
||||
public class Excalibur extends SwordItem {
|
||||
public Excalibur() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
|
||||
@@ -1,25 +1,232 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.item.IItemWaveBehavior;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class Muramasa extends SwordItem {
|
||||
public Muramasa() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 3, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.05f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(0.1F, 0.4F, 1.0F),
|
||||
new Vector3f(0.0F, 1.0F, 1.0F)
|
||||
}
|
||||
);
|
||||
|
||||
public static final IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() {
|
||||
@Override
|
||||
public void onLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) {
|
||||
Player player = event.getEntity();
|
||||
if(player.level().isClientSide()) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Muramasa) {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) {
|
||||
Player player = event.getEntity();
|
||||
if(player.level().isClientSide()) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Muramasa) {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttackEntity(AttackEntityEvent event) {
|
||||
Player player = event.getEntity();
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Muramasa) {
|
||||
if(!player.level().isClientSide()) {
|
||||
if(!player.getCooldowns().isOnCooldown(item)) {
|
||||
Entity target = event.getTarget();
|
||||
if(target instanceof LivingEntity livingTarget && FilterUtil.createLivingTargetFilter(player).test(livingTarget)) {
|
||||
livingTarget.invulnerableTime = 5;
|
||||
|
||||
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), player.level());
|
||||
projectile.setOwner(player);
|
||||
|
||||
Vec3 start = MathUtil.getRandomPosInRadius(player.position(), 5);
|
||||
Vec3 end = livingTarget.getBoundingBox().getCenter();
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(end.subtract(start).toVector3f(), 0);
|
||||
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], (int) (360 * Math.random()));
|
||||
|
||||
projectile.setPos(start);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.MURAMASA_PROJECTILE);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, start.toVector3f());
|
||||
projectile.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]);
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, 10);
|
||||
|
||||
double dist = start.distanceTo(end);
|
||||
double speed = Math.max(0.1, dist / 10);
|
||||
double height = 1.0 + Math.random() * 4.0;
|
||||
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", speed));
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Y, String.format("%.3f*(t/10)*(1-t/10)", 4.0 * height));
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
|
||||
player.level().addFreshEntity(projectile);
|
||||
}
|
||||
player.getCooldowns().addCooldown(item, 7);
|
||||
}
|
||||
}else {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/muramasa_trail.png");
|
||||
public static final int MAX_LENGTH = 100;
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||
Vec3 currentPos = projectile.getPosition(partialTick);
|
||||
|
||||
VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES));
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
|
||||
int quadCount = projectile.trailPositions.size() / 2 - 1;
|
||||
for(int i = 0; i < quadCount;i++) {
|
||||
Vec3 currentPoint1 = projectile.trailPositions.get(i * 2);
|
||||
Vec3 currentPoint2 = projectile.trailPositions.get(i * 2 + 1);
|
||||
Vec3 nextPoint1 = projectile.trailPositions.get(i * 2 + 3);
|
||||
Vec3 nextPoint2 = projectile.trailPositions.get(i * 2 + 2);
|
||||
|
||||
double x1 = currentPoint1.x - currentPos.x;
|
||||
double y1 = currentPoint1.y - currentPos.y;
|
||||
double z1 = currentPoint1.z - currentPos.z;
|
||||
|
||||
double x2 = currentPoint2.x - currentPos.x;
|
||||
double y2 = currentPoint2.y - currentPos.y;
|
||||
double z2 = currentPoint2.z - currentPos.z;
|
||||
|
||||
double x3 = nextPoint1.x - currentPos.x;
|
||||
double y3 = nextPoint1.y - currentPos.y;
|
||||
double z3 = nextPoint1.z - currentPos.z;
|
||||
|
||||
double x4 = nextPoint2.x - currentPos.x;
|
||||
double y4 = nextPoint2.y - currentPos.y;
|
||||
double z4 = nextPoint2.z - currentPos.z;
|
||||
|
||||
float radio1 = (float) i / quadCount;
|
||||
float radio2 = (float) (i + 1) / quadCount;
|
||||
|
||||
vertexConsumer.addVertex(matrix, (float)x1, (float)y1, (float)z1)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(radio1, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x2, (float)y2, (float)z2)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(radio1, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x3, (float)y3, (float)z3)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(radio2, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer.addVertex(matrix, (float)x4, (float)y4, (float)z4)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(radio2, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoving(StaticProjectile projectile) {
|
||||
ParticleUtil.addParticle(
|
||||
projectile.level(), PARTICLE,
|
||||
projectile.position(), 0,
|
||||
new Vec3(0, 0, 0), 0.1
|
||||
);
|
||||
Vector3f originalRight = projectile.getEntityData().get(StaticProjectile.DIRECTION);
|
||||
Vec3 right = MathUtil.toVec3(originalRight).normalize();
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(0.05)));
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(-0.05)));
|
||||
while(projectile.trailPositions.size() > MAX_LENGTH) projectile.trailPositions.removeLast();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(!projectile.level().isClientSide()) {
|
||||
Entity target = result.getEntity();
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, (float) Config.muramasaBeamDamage)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -50,7 +50,7 @@ import java.util.List;
|
||||
|
||||
public class NightsEdge extends SwordItem {
|
||||
public NightsEdge() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 6.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Seedler extends SwordItem {
|
||||
public Seedler() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 8, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
|
||||
@@ -1,25 +1,222 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Terragrim extends SwordItem {
|
||||
public Terragrim() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 3, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -0.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
|
||||
public static final ResourceLocation[] RES = {
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam0.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam1.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam2.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam3.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam4.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam5.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam6.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam7.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam8.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam9.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam10.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam11.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam12.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam13.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam14.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam15.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam16.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam17.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam18.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam19.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam20.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam21.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam22.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam23.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam24.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam25.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam26.png"),
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam27.png")
|
||||
};
|
||||
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||
public static final float HALF_WIDTH = 32.0f;
|
||||
public static final float HALF_HEIGHT = 30.0f;
|
||||
public static final float SCALE = 0.05f;
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticSummon summon)) return;
|
||||
Entity owner = summon.getOwner();
|
||||
if(owner == null) return;
|
||||
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
if(!customData.contains("idx")) return;
|
||||
|
||||
VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES[Math.min(customData.getInt("idx"), RES.length - 1)]));
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(owner);
|
||||
int rotate = summon.getEntityData().get(StaticSummon.RZP);
|
||||
|
||||
Quaternionf rotation = new Quaternionf()
|
||||
.fromAxisAngleRad(dirs[0], (float) Math.toRadians(Math.abs(dirs[0].y) > 0.999 ? 0 : rotate));
|
||||
poseStack.mulPose(rotation);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1]));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0]));
|
||||
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0F));
|
||||
|
||||
vertexConsumer.addVertex(poseStack.last().pose(), -HALF_WIDTH * SCALE, -HALF_HEIGHT * SCALE, 0)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(0.0f, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer.addVertex(poseStack.last().pose(), HALF_WIDTH * SCALE, -HALF_HEIGHT * SCALE, 0)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(1.0f, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer.addVertex(poseStack.last().pose(), HALF_WIDTH * SCALE, HALF_HEIGHT * SCALE, 0)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(1.0f, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer.addVertex(poseStack.last().pose(), -HALF_WIDTH * SCALE, HALF_HEIGHT * SCALE, 0)
|
||||
.setColor(1.0f, 1.0f, 1.0f, 1.0f).setUv(0.0f, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
this.checkBeforeTick(summon);
|
||||
if(summon.getOwner() != null) {
|
||||
summon.setPos(summon.getOwner().getX(), summon.getOwner().getY() + summon.getOwner().getBbHeight() * 0.5, summon.getOwner().getZ());
|
||||
}
|
||||
summon.setBoundingBox(new AABB(
|
||||
summon.getX() - Config.terragrimHitRange, summon.getY() - Config.terragrimHitRange, summon.getZ() - Config.terragrimHitRange,
|
||||
summon.getX() + Config.terragrimHitRange, summon.getY() + Config.terragrimHitRange, summon.getZ() + Config.terragrimHitRange
|
||||
));
|
||||
if(!summon.level().isClientSide()) {
|
||||
if(summon.getOwner() instanceof Player player) {
|
||||
List<LivingEntity> targets = summon.level().getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
summon.getBoundingBox(),
|
||||
FilterUtil.createLivingTargetFilter(summon, player)
|
||||
);
|
||||
for(LivingEntity target : targets) {
|
||||
AttributeInstance knockbackResist = null;
|
||||
double originalResist = 0.0;
|
||||
knockbackResist = target.getAttribute(Attributes.KNOCKBACK_RESISTANCE);
|
||||
if(knockbackResist != null) {
|
||||
originalResist = knockbackResist.getBaseValue();
|
||||
knockbackResist.setBaseValue(Math.max(0.9, originalResist));
|
||||
}
|
||||
if(DamageUtil.attack(player, target, (float) Config.terragrimDamage)) {
|
||||
target.invulnerableTime = 0;
|
||||
}
|
||||
if(knockbackResist != null) {
|
||||
knockbackResist.setBaseValue(originalResist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
player.startUsingItem(hand);
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putInt("idx", 0));
|
||||
return InteractionResultHolder.consume(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int count) {
|
||||
if(!(livingEntity instanceof Player player)) return;
|
||||
int idx = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag().getInt("idx");
|
||||
if(!level.isClientSide()) {
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||
summon.setOwner(player);
|
||||
Vec3 pos = new Vec3(player.getX(), player.getY() + player.getBbHeight() * 0.5, player.getZ());
|
||||
summon.setPos(pos);
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.TERRAGRIM_BEAM);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
summon.getEntityData().set(StaticSummon.RZP, (int) ((Math.random() * 2 - 1) * 45));
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, 1);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
customData.putInt("idx", idx);
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
|
||||
summon.setNoGravity(true);
|
||||
summon.noPhysics = true;
|
||||
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
|
||||
level.addFreshEntity(summon);
|
||||
}else {
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE.get());
|
||||
}
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putInt("idx", (idx + 1) % RES.length));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseDuration(ItemStack stack, LivingEntity entity) {
|
||||
return 72000;
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import org.joml.Vector3f;
|
||||
|
||||
public class TrueExcalibur extends SwordItem {
|
||||
public TrueExcalibur() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0f, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
|
||||
@@ -50,7 +50,7 @@ import java.util.List;
|
||||
|
||||
public class TrueNightsEdge extends SwordItem {
|
||||
public TrueNightsEdge() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0f, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
@@ -408,6 +408,18 @@ public class TrueNightsEdge extends SwordItem {
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
this.checkBeforeTick(summon);
|
||||
|
||||
//运动逻辑
|
||||
Vec3 motion = summon.getDeltaMovement();
|
||||
double currentSpeed = motion.length();
|
||||
double maxSpeed = Config.trueNightsEdgeProjectileMaxSpeed;
|
||||
double acceleration = Config.trueNightsEdgeProjectileAcceleration;
|
||||
if(currentSpeed < maxSpeed && currentSpeed > 0) {
|
||||
Vec3 dir = motion.normalize();
|
||||
double newSpeed = Math.min(currentSpeed + acceleration, maxSpeed);
|
||||
summon.setDeltaMovement(dir.scale(newSpeed));
|
||||
}
|
||||
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
|
||||
//碰撞箱计算
|
||||
@@ -450,7 +462,7 @@ public class TrueNightsEdge extends SwordItem {
|
||||
);
|
||||
BlockHitResult blockHit = summon.level().clip(context);
|
||||
if(blockHit.getType() != HitResult.Type.MISS) {
|
||||
|
||||
onDied(summon);
|
||||
}
|
||||
|
||||
//粒子
|
||||
@@ -521,7 +533,7 @@ public class TrueNightsEdge extends SwordItem {
|
||||
customData.putFloat("rightZ", dirs[2].z);
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
|
||||
summon.setDeltaMovement(player.getLookAngle().normalize().scale(Config.trueNightsEdgeProjectileSpeed));
|
||||
summon.setDeltaMovement(player.getLookAngle().normalize().scale(Config.trueNightsEdgeProjectileMaxSpeed * 0.1));
|
||||
|
||||
player.level().addFreshEntity(summon);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,158 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.item.IItemWaveBehavior;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class Volcano extends SwordItem {
|
||||
public Volcano() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 8, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 6, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -3.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.075f, 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 IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() {
|
||||
@Override
|
||||
public void onLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) {
|
||||
Player player = event.getEntity();
|
||||
if(player.level().isClientSide()) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Volcano) {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) {
|
||||
Player player = event.getEntity();
|
||||
if(player.level().isClientSide()) {
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Volcano) {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttackEntity(AttackEntityEvent event) {
|
||||
Player player = event.getEntity();
|
||||
ItemStack itemStack = player.getMainHandItem();
|
||||
if(itemStack.isEmpty()) return;
|
||||
Item item = itemStack.getItem();
|
||||
if(item instanceof Volcano) {
|
||||
if(!player.level().isClientSide()) {
|
||||
Entity target = event.getTarget();
|
||||
if(target instanceof LivingEntity livingTarget && FilterUtil.createLivingTargetFilter(player).test(livingTarget)) {
|
||||
if(!player.getCooldowns().isOnCooldown(item)) {
|
||||
List<LivingEntity> targets = player.level().getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
AABB.ofSize(player.getBoundingBox().getCenter(), Config.volcanoExplosionRange * 2, Config.volcanoExplosionRange * 2, Config.volcanoExplosionRange * 2),
|
||||
FilterUtil.createLivingTargetFilter(player)
|
||||
);
|
||||
targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(target.position())));
|
||||
int hitCount = 0;
|
||||
for(LivingEntity livingEntity : targets) {
|
||||
if(livingEntity.getUUID() == target.getUUID()) continue;
|
||||
if(hitCount >= Config.volcanoExplosionMaxHitCount) break;
|
||||
if(DamageUtil.attack(player, livingEntity, (float) Config.volcanoExplosionDamage)) {
|
||||
livingTarget.igniteForSeconds(Config.volcanoIgniteSeconds);
|
||||
hitCount++;
|
||||
}
|
||||
}
|
||||
int randomSound = player.getRandom().nextInt(3);
|
||||
if(randomSound == 0) {
|
||||
SoundUtil.playServerSound(target.level(), ModSounds.EXPLOSIVE_TRAP_EXPLODE0.get(), target.position());
|
||||
}else if(randomSound == 1) {
|
||||
SoundUtil.playServerSound(target.level(), ModSounds.EXPLOSIVE_TRAP_EXPLODE1.get(), target.position());
|
||||
}else {
|
||||
SoundUtil.playServerSound(target.level(), ModSounds.EXPLOSIVE_TRAP_EXPLODE2.get(), target.position());
|
||||
}
|
||||
ParticleUtil.addParticles(
|
||||
(ServerLevel) target.level(), ModParticles.SOLAR_EXPLOSION_PARTICLE.get(),
|
||||
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
|
||||
0, 1
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
(ServerLevel) target.level(), ModParticles.EXPLODE_PARTICLE.get(),
|
||||
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
|
||||
0.2, (int) (4 + Math.random() * 4)
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
(ServerLevel) target.level(), PARTICLE,
|
||||
new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2.0, target.getZ()), new Vec3(0, 0, 0),
|
||||
0.4, 50
|
||||
);
|
||||
player.getCooldowns().addCooldown(item, 20);
|
||||
}
|
||||
if(player.getRandom().nextInt(2) == 0) livingTarget.igniteForSeconds(Config.volcanoIgniteSeconds);
|
||||
}
|
||||
}else {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), PARTICLE,
|
||||
player.getBoundingBox().getCenter(), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
10
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -45,7 +45,7 @@ import java.util.List;
|
||||
|
||||
public class Zenith extends SwordItem {
|
||||
public Zenith() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 20, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.lzxnone.terraria.mixin;
|
||||
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ItemInHandRenderer.class)
|
||||
public class TerragrimRenderMixin {
|
||||
@Shadow
|
||||
private void renderPlayerArm(PoseStack poseStack, MultiBufferSource buffer, int packedLight,
|
||||
float equippedProgress, float swingProgress, HumanoidArm side) {}
|
||||
|
||||
@Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void renderHand(AbstractClientPlayer player, float partialTicks, float pitch,
|
||||
InteractionHand hand, float swingProgress, ItemStack stack,
|
||||
float equippedProgress, PoseStack poseStack,
|
||||
MultiBufferSource buffer, int combinedLight, CallbackInfo ci) {
|
||||
|
||||
if(!player.isScoping()) {
|
||||
if(stack.is(ModItems.TERRAGRIM.get())) {
|
||||
if(player.isUsingItem()) {
|
||||
ItemStack usingStack = player.getUseItem();
|
||||
if(usingStack.is(ModItems.TERRAGRIM.get())) {
|
||||
boolean isMainHand = hand == InteractionHand.MAIN_HAND;
|
||||
HumanoidArm humanoidarm = isMainHand ? player.getMainArm() : player.getMainArm().getOpposite();
|
||||
|
||||
poseStack.pushPose();
|
||||
|
||||
if(!player.isInvisible()) {
|
||||
this.renderPlayerArm(poseStack, buffer, combinedLight, equippedProgress, swingProgress, humanoidarm);
|
||||
}
|
||||
|
||||
poseStack.popPose();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderItem", at = @At("HEAD"), cancellable = true)
|
||||
private void renderTerragrim(LivingEntity entity, ItemStack itemStack, ItemDisplayContext displayContext,
|
||||
boolean leftHand, PoseStack poseStack, MultiBufferSource buffer,
|
||||
int seed, CallbackInfo ci) {
|
||||
|
||||
if(itemStack.is(ModItems.TERRAGRIM.get()) && entity instanceof Player player) {
|
||||
if(player.isUsingItem()) {
|
||||
ItemStack usingStack = player.getUseItem();
|
||||
if(usingStack.is(ModItems.TERRAGRIM.get())) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class LeafParticle extends TextureSheetParticle {
|
||||
private final float rotSpeed;
|
||||
private final float baseSize;
|
||||
|
||||
protected LeafParticle(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.05F + (this.random.nextFloat() * 0.05F);
|
||||
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 = 20 + this.random.nextInt(10);
|
||||
|
||||
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 ModParticleRenderTypes.TRANSLUCENT_EMISSIVE;
|
||||
}
|
||||
|
||||
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 LeafParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,4 +94,8 @@ public class ModParticles {
|
||||
PARTICLE_TYPES.register("true_nights_edge_hit_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> BLOOD_BUTCHERED_PARTICLE =
|
||||
PARTICLE_TYPES.register("blood_butchered_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> LEAF_PARTICLE =
|
||||
PARTICLE_TYPES.register("leaf_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> SOLAR_EXPLOSION_PARTICLE =
|
||||
PARTICLE_TYPES.register("solar_explosion_particle", () -> new SimpleParticleType(true));
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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 SolarExplosionParticle extends TextureSheetParticle {
|
||||
private final SpriteSet spriteSet;
|
||||
private final float baseSize;
|
||||
|
||||
protected SolarExplosionParticle(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.5F;
|
||||
this.quadSize = baseSize;
|
||||
|
||||
this.lifetime = 20;
|
||||
|
||||
this.spriteSet = spriteSet;
|
||||
this.setSpriteFromAge(this.spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
|
||||
this.quadSize = this.baseSize * (1 + lifeRatio * 0.25f);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
|
||||
this.setSpriteFromAge(spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.TRANSLUCENT_EMISSIVE;
|
||||
}
|
||||
|
||||
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 SolarExplosionParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.lzxnone.terraria.utils;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
||||
@@ -24,16 +26,38 @@ public class DamageUtil {
|
||||
finalDamage = Math.max(0.0F, finalDamage);
|
||||
|
||||
DamageSource source = player.level().damageSources().playerAttack(player);
|
||||
|
||||
float knockbackLevel = (float) player.getAttributeValue(Attributes.ATTACK_KNOCKBACK);
|
||||
boolean isSprinting = player.isSprinting();
|
||||
if(isSprinting) {
|
||||
knockbackLevel += 1.0F;
|
||||
}
|
||||
|
||||
if(player.level() instanceof ServerLevel serverLevel) {
|
||||
finalDamage = EnchantmentHelper.modifyDamage(serverLevel, player.getWeaponItem(), target, source, finalDamage);
|
||||
knockbackLevel = EnchantmentHelper.modifyKnockback(serverLevel, player.getWeaponItem(), target, source, knockbackLevel);
|
||||
}
|
||||
finalDamage = Math.max(0.0F, finalDamage);
|
||||
|
||||
boolean hasHurt = target.hurt(source, finalDamage);
|
||||
|
||||
if(hasHurt && player.level() instanceof ServerLevel serverLevel) {
|
||||
if(hasHurt) {
|
||||
if(knockbackLevel > 0.0F && target instanceof LivingEntity livingTarget) {
|
||||
livingTarget.knockback(
|
||||
knockbackLevel * 0.5F,
|
||||
Mth.sin(player.getYRot() * ((float) Math.PI / 180F)),
|
||||
-Mth.cos(player.getYRot() * ((float) Math.PI / 180F))
|
||||
);
|
||||
|
||||
if(isSprinting) {
|
||||
player.setDeltaMovement(player.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
player.setSprinting(false);
|
||||
}
|
||||
}
|
||||
if(player.level() instanceof ServerLevel serverLevel) {
|
||||
EnchantmentHelper.doPostAttackEffects(serverLevel, target, source);
|
||||
}
|
||||
}
|
||||
|
||||
return hasHurt;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,32 @@
|
||||
"lzxnoneterraria.configuration.blood_butcherer_damage_per_level": "Damage Per Level",
|
||||
"lzxnoneterraria.configuration.blood_butcherer_damage_per_level.tooltip": "Damage dealt per butchery level",
|
||||
|
||||
"lzxnoneterraria.configuration.blade_of_grass_settings": "Blade of Grass Settings",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_damage": "Projectile Damage",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_damage.tooltip": "Damage per projectile hit",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_effect_duration": "Effect Duration",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_effect_duration.tooltip": "Poison effect duration in ticks",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_target_range": "Target Acquisition Range",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_target_range.tooltip": "Maximum range to search for enemies",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_lifetime": "Projectile Lifetime",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_lifetime.tooltip": "Projectile duration in ticks",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_max_hit_count": "Projectile Max Hit Count",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_max_hit_count.tooltip": "Maximum entities hit per projectile",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_radius_growth": "Radius Growth Speed",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_radius_growth.tooltip": "Projectile orbit radius growth per tick",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_rotation_speed": "Rotation Speed",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_rotation_speed.tooltip": "Projectile orbit rotation speed per tick",
|
||||
|
||||
"lzxnoneterraria.configuration.volcano_settings": "Volcano Settings",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_range": "Explosion Range",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_range.tooltip": "Explosion radius",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_damage": "Explosion Damage",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_damage.tooltip": "Damage dealt by the explosion",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_max_hit_count": "Max Hit Count",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_max_hit_count.tooltip": "Maximum entities hit per explosion",
|
||||
"lzxnoneterraria.configuration.volcano_ignite_seconds": "Ignite Duration",
|
||||
"lzxnoneterraria.configuration.volcano_ignite_seconds.tooltip": "Duration of the fire effect in seconds",
|
||||
|
||||
"lzxnoneterraria.configuration.starfury_settings": "Starfury Settings",
|
||||
"lzxnoneterraria.configuration.starfury_damage": "Projectile Damage",
|
||||
"lzxnoneterraria.configuration.starfury_damage.tooltip": "Damage per hit",
|
||||
@@ -130,6 +156,16 @@
|
||||
"lzxnoneterraria.configuration.lights_bane_target_range": "Target Acquisition Range",
|
||||
"lzxnoneterraria.configuration.lights_bane_target_range.tooltip": "Range to search for nearby enemies",
|
||||
|
||||
"lzxnoneterraria.configuration.muramasa_settings": "Muramasa Settings",
|
||||
"lzxnoneterraria.configuration.muramasa_beam_damage": "Beam Damage",
|
||||
"lzxnoneterraria.configuration.muramasa_beam_damage.tooltip": "Damage dealt by the blue beam",
|
||||
|
||||
"lzxnoneterraria.configuration.terragrim_settings": "Terragrim Settings",
|
||||
"lzxnoneterraria.configuration.terragrim_hit_range": "Hit Range",
|
||||
"lzxnoneterraria.configuration.terragrim_hit_range.tooltip": "AABB collision box range",
|
||||
"lzxnoneterraria.configuration.terragrim_damage": "Damage",
|
||||
"lzxnoneterraria.configuration.terragrim_damage.tooltip": "Damage per tick",
|
||||
|
||||
"lzxnoneterraria.configuration.excalibur_settings": "Excalibur Settings",
|
||||
"lzxnoneterraria.configuration.excalibur_rotate_range": "Blade Rotate Range",
|
||||
"lzxnoneterraria.configuration.excalibur_rotate_range.tooltip": "Blade rotation angle range",
|
||||
@@ -229,8 +265,10 @@
|
||||
"lzxnoneterraria.configuration.true_nights_edge_damage.tooltip": "Damage dealt by blade",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_damage": "Projectile Damage",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_damage.tooltip": "Damage per hit",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_speed": "Projectile Speed",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_speed.tooltip": "Projectile movement speed",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_max_speed": "Projectile Max Speed",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_max_speed.tooltip": "Maximum projectile movement speed",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_acceleration": "Projectile Acceleration",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_acceleration.tooltip": "Projectile acceleration per tick",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_lifetime": "Projectile Lifetime",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_lifetime.tooltip": "Projectile duration in ticks",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_rotation_speed": "Projectile Rotation Speed",
|
||||
|
||||
@@ -56,6 +56,32 @@
|
||||
"lzxnoneterraria.configuration.blood_butcherer_damage_per_level": "每级伤害",
|
||||
"lzxnoneterraria.configuration.blood_butcherer_damage_per_level.tooltip": "每级血腥屠宰效果造成的伤害",
|
||||
|
||||
"lzxnoneterraria.configuration.blade_of_grass_settings": "草剑 设置",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_damage": "弹射伤害",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_damage.tooltip": "每次弹射命中伤害",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_effect_duration": "效果持续时间",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_effect_duration.tooltip": "中毒效果持续时间(刻)",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_target_range": "寻敌范围",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_target_range.tooltip": "搜索敌人的最大距离",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_lifetime": "弹射持续时间",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_lifetime.tooltip": "弹射物持续时间(刻)",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_max_hit_count": "弹射最大击中数",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_projectile_max_hit_count.tooltip": "弹射物单次最大击中生物数量",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_radius_growth": "半径增大速度",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_radius_growth.tooltip": "弹射轨道半径每刻增大值",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_rotation_speed": "旋转速度",
|
||||
"lzxnoneterraria.configuration.blade_of_grass_rotation_speed.tooltip": "弹射轨道每刻旋转角度",
|
||||
|
||||
"lzxnoneterraria.configuration.volcano_settings": "火山 设置",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_range": "爆炸范围",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_range.tooltip": "爆炸半径",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_damage": "爆炸伤害",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_damage.tooltip": "爆炸造成的伤害",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_max_hit_count": "最大击中数",
|
||||
"lzxnoneterraria.configuration.volcano_explosion_max_hit_count.tooltip": "单次爆炸最大击中生物数量",
|
||||
"lzxnoneterraria.configuration.volcano_ignite_seconds": "着火时间",
|
||||
"lzxnoneterraria.configuration.volcano_ignite_seconds.tooltip": "着火效果持续时间(秒)",
|
||||
|
||||
"lzxnoneterraria.configuration.starfury_settings": "星怒 设置",
|
||||
"lzxnoneterraria.configuration.starfury_damage": "弹射伤害",
|
||||
"lzxnoneterraria.configuration.starfury_damage.tooltip": "每次命中伤害",
|
||||
@@ -130,6 +156,16 @@
|
||||
"lzxnoneterraria.configuration.lights_bane_target_range": "寻敌范围",
|
||||
"lzxnoneterraria.configuration.lights_bane_target_range.tooltip": "搜索附近敌人的距离",
|
||||
|
||||
"lzxnoneterraria.configuration.muramasa_settings": "村正 设置",
|
||||
"lzxnoneterraria.configuration.muramasa_beam_damage": "光线伤害",
|
||||
"lzxnoneterraria.configuration.muramasa_beam_damage.tooltip": "蓝色光线造成的伤害",
|
||||
|
||||
"lzxnoneterraria.configuration.terragrim_settings": "泰拉魔刃 设置",
|
||||
"lzxnoneterraria.configuration.terragrim_hit_range": "碰撞箱范围",
|
||||
"lzxnoneterraria.configuration.terragrim_hit_range.tooltip": "AABB 碰撞箱半边长",
|
||||
"lzxnoneterraria.configuration.terragrim_damage": "伤害",
|
||||
"lzxnoneterraria.configuration.terragrim_damage.tooltip": "每刻造成的伤害",
|
||||
|
||||
"lzxnoneterraria.configuration.excalibur_settings": "断钢剑 设置",
|
||||
"lzxnoneterraria.configuration.excalibur_rotate_range": "刀光偏转角范围",
|
||||
"lzxnoneterraria.configuration.excalibur_rotate_range.tooltip": "刀光旋转角度范围",
|
||||
@@ -229,8 +265,10 @@
|
||||
"lzxnoneterraria.configuration.true_nights_edge_damage.tooltip": "刀光造成的伤害",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_damage": "弹射伤害",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_damage.tooltip": "每次命中伤害",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_speed": "弹射速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_speed.tooltip": "弹射物移动速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_max_speed": "弹射最大速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_max_speed.tooltip": "弹射物最大移动速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_acceleration": "弹射加速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_acceleration.tooltip": "弹射物每刻加速度",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_lifetime": "弹射持续时间",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_lifetime.tooltip": "弹射物持续时间(刻)",
|
||||
"lzxnoneterraria.configuration.true_nights_edge_projectile_rotation_speed": "弹射旋转速度",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/blade_of_grass"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/leaf_projectile"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/muramasa"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"parent": "lzxnoneterraria:item/weapon",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/terragrim"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/volcano"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:leaf_particle"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:solar_explosion_particle0",
|
||||
"lzxnoneterraria:solar_explosion_particle1",
|
||||
"lzxnoneterraria:solar_explosion_particle2",
|
||||
"lzxnoneterraria:solar_explosion_particle3",
|
||||
"lzxnoneterraria:solar_explosion_particle4"
|
||||
]
|
||||
}
|
||||
@@ -28,5 +28,14 @@
|
||||
},
|
||||
"cat2": {
|
||||
"sounds": ["lzxnoneterraria:cat2"]
|
||||
},
|
||||
"explosive_trap_explode0": {
|
||||
"sounds": ["lzxnoneterraria:explosive_trap_explode0"]
|
||||
},
|
||||
"explosive_trap_explode1": {
|
||||
"sounds": ["lzxnoneterraria:explosive_trap_explode1"]
|
||||
},
|
||||
"explosive_trap_explode2": {
|
||||
"sounds": ["lzxnoneterraria:explosive_trap_explode2"]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 193 B |
|
After Width: | Height: | Size: 136 B |
|
After Width: | Height: | Size: 315 B |
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 359 B |
|
After Width: | Height: | Size: 382 B |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 106 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 246 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 214 B |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 237 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 271 B |
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 169 B |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 251 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 259 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 221 B |
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "bettercombat:claymore"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "bettercombat:claymore"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "bettercombat:sword"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "bettercombat:claymore"
|
||||
}
|
||||
@@ -4,7 +4,8 @@
|
||||
"package": "com.lzxnone.terraria.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"ZenithRenderMixin"
|
||||
"ZenithRenderMixin",
|
||||
"TerragrimRenderMixin"
|
||||
],
|
||||
"client": [],
|
||||
"injectors": {
|
||||
|
||||