From 71dcdaa10a82bd54a106322f041b1654a1c575bd Mon Sep 17 00:00:00 2001 From: LZX <1820455493@qq.com> Date: Fri, 3 Jul 2026 19:58:09 +0800 Subject: [PATCH] v1.1-pre1 --- .../com/lzxnone/terraria/LzxnoneTerraria.java | 1 + .../terraria/LzxnoneTerrariaClient.java | 15 +- .../java/com/lzxnone/terraria/ModSounds.java | 12 + .../entity/EntityEmissiveRenderer.java | 69 +++ .../lzxnone/terraria/entity/ModEntities.java | 31 +- .../terraria/entity/TintedVertexConsumer.java | 52 ++ .../entity/beam/ISwordBeamBehavior.java | 239 ++++++++ .../terraria/entity/beam/SwordBeam.java | 252 +++++++++ .../entity/beam/SwordBeamBehaviors.java | 25 + .../entity/beam/SwordBeamRenderer.java | 25 + .../projectile/IProjectileBehavior.java | 15 - .../projectile/IStaticProjectileBehavior.java | 154 +++++ ...eProjectile.java => StaticProjectile.java} | 165 +++--- ...rs.java => StaticProjectileBehaviors.java} | 26 +- .../projectile/StaticProjectileRenderer.java | 38 ++ .../projectile/TextureProjectileRenderer.java | 89 --- .../terraria/entity/summon/BeeSummon.java | 86 ++- .../entity/summon/IStaticSummonBehavior.java | 133 +++++ .../terraria/entity/summon/StaticSummon.java | 200 +++++++ .../entity/summon/StaticSummonBehaviors.java | 30 + .../entity/summon/StaticSummonRenderer.java | 37 ++ .../terraria/item/ItemWaveBehaviors.java | 9 +- .../com/lzxnone/terraria/item/ModItems.java | 35 +- .../item/projectile/InfluxWaverBeam.java | 9 + .../item/projectile/MeowmereProjectile.java | 9 + .../item/projectile/StarWrathStar.java | 9 + .../terraria/item/weapon/melee/BeeKeeper.java | 9 +- .../item/weapon/melee/EnchantedSword.java | 134 ++--- .../item/weapon/melee/InfluxWaver.java | 250 +++++++++ .../terraria/item/weapon/melee/Meowmere.java | 311 +++++++++++ .../terraria/item/weapon/melee/Seedler.java | 331 +++++------ .../terraria/item/weapon/melee/StarWrath.java | 239 ++++++++ .../terraria/item/weapon/melee/Starfury.java | 219 ++++---- .../item/weapon/melee/TerraBlade.java | 524 ++++++++++++++++++ .../item/weapon/melee/TheHorsemansBlade.java | 277 +++++++++ .../lzxnone/terraria/network/ModNetwork.java | 22 + .../network/handler/SwordBeamHandler.java | 16 + .../network/payload/SwordBeamPayload.java | 26 + .../terraria/particle/DustParticle.java | 2 + .../terraria/particle/ExplodeParticle.java | 2 +- .../particle/InfluxWaverDropParticle.java | 152 +++++ .../terraria/particle/ModParticles.java | 2 + .../particle/SeedlerThornParticle.java | 1 + .../terraria/particle/StarParticle.java | 1 + .../lzxnone/terraria/utils/CollisionUtil.java | 67 +++ .../lzxnone/terraria/utils/FilterUtil.java | 48 ++ .../com/lzxnone/terraria/utils/MathUtil.java | 90 ++- .../lzxnone/terraria/utils/ParticleUtil.java | 27 + .../com/lzxnone/terraria/utils/SoundUtil.java | 61 ++ .../assets/lzxnoneterraria/lang/en_us.json | 2 + .../assets/lzxnoneterraria/lang/zh_cn.json | 2 + .../models/item/influx_waver_beam.json | 6 + .../models/item/meowmere_projectile.json | 6 + .../models/item/star_wrath_star.json | 6 + .../lzxnoneterraria/models/item/weapon.json | 2 +- .../particles/influx_waver_drop_particle.json | 7 + .../assets/lzxnoneterraria/sounds.json | 9 + .../assets/lzxnoneterraria/sounds/cat.ogg | Bin 0 -> 21948 bytes .../assets/lzxnoneterraria/sounds/cat2.ogg | Bin 0 -> 14925 bytes .../assets/lzxnoneterraria/sounds/wave2.ogg | Bin 0 -> 11660 bytes .../textures/item/influx_waver_beam.png | Bin 0 -> 529 bytes .../textures/item/meowmere_projectile.png | Bin 0 -> 406 bytes ...ath_projectile.png => star_wrath_star.png} | Bin .../enchanted_sword_beam_particle_arms.png | Bin 124 -> 0 bytes .../enchanted_sword_beam_particle_center.png | Bin 112 -> 0 bytes .../particle/influx_waver_particle0.png | Bin 0 -> 264 bytes .../particle/influx_waver_particle1.png | Bin 0 -> 198 bytes .../particle/influx_waver_particle2.png | Bin 0 -> 167 bytes .../textures/vfx/beam_sparkle.png | Bin 0 -> 443 bytes .../lzxnoneterraria/textures/vfx/rainbow.png | Bin 0 -> 198 bytes .../textures/vfx/terra_beam0.png | Bin 0 -> 2292 bytes .../textures/vfx/terra_beam1.png | Bin 0 -> 771 bytes .../textures/vfx/terra_beam2.png | Bin 0 -> 727 bytes .../textures/vfx/terra_beam3.png | Bin 0 -> 641 bytes .../textures/vfx/terra_beam4.png | Bin 0 -> 982 bytes 75 files changed, 3956 insertions(+), 660 deletions(-) create mode 100644 src/main/java/com/lzxnone/terraria/entity/EntityEmissiveRenderer.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/TintedVertexConsumer.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/beam/ISwordBeamBehavior.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/beam/SwordBeam.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamBehaviors.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamRenderer.java delete mode 100644 src/main/java/com/lzxnone/terraria/entity/projectile/IProjectileBehavior.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/projectile/IStaticProjectileBehavior.java rename src/main/java/com/lzxnone/terraria/entity/projectile/{TextureProjectile.java => StaticProjectile.java} (56%) rename src/main/java/com/lzxnone/terraria/entity/projectile/{ProjectileBehaviors.java => StaticProjectileBehaviors.java} (58%) create mode 100644 src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileRenderer.java delete mode 100644 src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectileRenderer.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/summon/IStaticSummonBehavior.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/summon/StaticSummon.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonBehaviors.java create mode 100644 src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonRenderer.java create mode 100644 src/main/java/com/lzxnone/terraria/item/projectile/InfluxWaverBeam.java create mode 100644 src/main/java/com/lzxnone/terraria/item/projectile/MeowmereProjectile.java create mode 100644 src/main/java/com/lzxnone/terraria/item/projectile/StarWrathStar.java create mode 100644 src/main/java/com/lzxnone/terraria/item/weapon/melee/InfluxWaver.java create mode 100644 src/main/java/com/lzxnone/terraria/item/weapon/melee/Meowmere.java create mode 100644 src/main/java/com/lzxnone/terraria/item/weapon/melee/StarWrath.java create mode 100644 src/main/java/com/lzxnone/terraria/item/weapon/melee/TerraBlade.java create mode 100644 src/main/java/com/lzxnone/terraria/item/weapon/melee/TheHorsemansBlade.java create mode 100644 src/main/java/com/lzxnone/terraria/network/ModNetwork.java create mode 100644 src/main/java/com/lzxnone/terraria/network/handler/SwordBeamHandler.java create mode 100644 src/main/java/com/lzxnone/terraria/network/payload/SwordBeamPayload.java create mode 100644 src/main/java/com/lzxnone/terraria/particle/InfluxWaverDropParticle.java create mode 100644 src/main/java/com/lzxnone/terraria/utils/CollisionUtil.java create mode 100644 src/main/java/com/lzxnone/terraria/utils/FilterUtil.java create mode 100644 src/main/java/com/lzxnone/terraria/utils/ParticleUtil.java create mode 100644 src/main/java/com/lzxnone/terraria/utils/SoundUtil.java create mode 100644 src/main/resources/assets/lzxnoneterraria/models/item/influx_waver_beam.json create mode 100644 src/main/resources/assets/lzxnoneterraria/models/item/meowmere_projectile.json create mode 100644 src/main/resources/assets/lzxnoneterraria/models/item/star_wrath_star.json create mode 100644 src/main/resources/assets/lzxnoneterraria/particles/influx_waver_drop_particle.json create mode 100644 src/main/resources/assets/lzxnoneterraria/sounds/cat.ogg create mode 100644 src/main/resources/assets/lzxnoneterraria/sounds/cat2.ogg create mode 100644 src/main/resources/assets/lzxnoneterraria/sounds/wave2.ogg create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/item/influx_waver_beam.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/item/meowmere_projectile.png rename src/main/resources/assets/lzxnoneterraria/textures/item/{star_wrath_projectile.png => star_wrath_star.png} (100%) delete mode 100644 src/main/resources/assets/lzxnoneterraria/textures/particle/enchanted_sword_beam_particle_arms.png delete mode 100644 src/main/resources/assets/lzxnoneterraria/textures/particle/enchanted_sword_beam_particle_center.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle0.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle1.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle2.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/beam_sparkle.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/rainbow.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam0.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam1.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam2.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam3.png create mode 100644 src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam4.png diff --git a/src/main/java/com/lzxnone/terraria/LzxnoneTerraria.java b/src/main/java/com/lzxnone/terraria/LzxnoneTerraria.java index b1c9cb1..77bd358 100644 --- a/src/main/java/com/lzxnone/terraria/LzxnoneTerraria.java +++ b/src/main/java/com/lzxnone/terraria/LzxnoneTerraria.java @@ -5,6 +5,7 @@ import com.lzxnone.terraria.creative_mode_tab.ModCreativeModeTabs; import com.lzxnone.terraria.effect.ModEffects; import com.lzxnone.terraria.entity.ModEntities; import com.lzxnone.terraria.entity.summon.BeeSummon; +import com.lzxnone.terraria.entity.summon.StaticSummon; import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.particle.ModParticles; import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; diff --git a/src/main/java/com/lzxnone/terraria/LzxnoneTerrariaClient.java b/src/main/java/com/lzxnone/terraria/LzxnoneTerrariaClient.java index 50c274e..7df52c6 100644 --- a/src/main/java/com/lzxnone/terraria/LzxnoneTerrariaClient.java +++ b/src/main/java/com/lzxnone/terraria/LzxnoneTerrariaClient.java @@ -1,7 +1,9 @@ package com.lzxnone.terraria; import com.lzxnone.terraria.entity.ModEntities; -import com.lzxnone.terraria.entity.projectile.TextureProjectileRenderer; +import com.lzxnone.terraria.entity.beam.SwordBeamRenderer; +import com.lzxnone.terraria.entity.projectile.StaticProjectileRenderer; +import com.lzxnone.terraria.entity.summon.StaticSummonRenderer; import com.lzxnone.terraria.particle.*; import net.minecraft.client.renderer.entity.BeeRenderer; import net.neoforged.api.distmarker.Dist; @@ -20,7 +22,13 @@ public class LzxnoneTerrariaClient { //Entity渲染 modEventBus.addListener(EntityRenderersEvent.RegisterRenderers.class, event -> { - event.registerEntityRenderer(ModEntities.TEXTURE_PROJECTILE.get(), TextureProjectileRenderer::new); + event.registerEntityRenderer(ModEntities.STATIC_PROJECTILE.get(), StaticProjectileRenderer::new); + }); + modEventBus.addListener(EntityRenderersEvent.RegisterRenderers.class, event -> { + event.registerEntityRenderer(ModEntities.STATIC_SUMMON.get(), StaticSummonRenderer::new); + }); + modEventBus.addListener(EntityRenderersEvent.RegisterRenderers.class, event -> { + event.registerEntityRenderer(ModEntities.SWORD_BEAM.get(), SwordBeamRenderer::new); }); modEventBus.addListener(EntityRenderersEvent.RegisterRenderers.class, event -> { event.registerEntityRenderer(ModEntities.BEE_SUMMON.get(), BeeRenderer::new); @@ -39,5 +47,8 @@ public class LzxnoneTerrariaClient { modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> { event.registerSpriteSet(ModParticles.SEEDLER_THORN_PARTICLE.get(), SeedlerThornParticle.Provider::new); }); + modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> { + event.registerSpriteSet(ModParticles.INFLUX_WAVER_DROP_PARTICLE.get(), InfluxWaverDropParticle.Provider::new); + }); } } diff --git a/src/main/java/com/lzxnone/terraria/ModSounds.java b/src/main/java/com/lzxnone/terraria/ModSounds.java index 274e896..1222591 100644 --- a/src/main/java/com/lzxnone/terraria/ModSounds.java +++ b/src/main/java/com/lzxnone/terraria/ModSounds.java @@ -23,6 +23,10 @@ public class ModSounds { SOUND_EVENTS.register("wave", () -> SoundEvent.createVariableRangeEvent( ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "wave"))); + public static final Supplier WAVE2 = + SOUND_EVENTS.register("wave2", + () -> SoundEvent.createVariableRangeEvent( + ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "wave2"))); public static final Supplier STAR_FALL = SOUND_EVENTS.register("star_fall", () -> SoundEvent.createVariableRangeEvent( @@ -35,4 +39,12 @@ public class ModSounds { SOUND_EVENTS.register("boom", () -> SoundEvent.createVariableRangeEvent( ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "boom"))); + public static final Supplier CAT = + SOUND_EVENTS.register("cat", + () -> SoundEvent.createVariableRangeEvent( + ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "cat"))); + public static final Supplier CAT2 = + SOUND_EVENTS.register("cat2", + () -> SoundEvent.createVariableRangeEvent( + ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "cat2"))); } diff --git a/src/main/java/com/lzxnone/terraria/entity/EntityEmissiveRenderer.java b/src/main/java/com/lzxnone/terraria/entity/EntityEmissiveRenderer.java new file mode 100644 index 0000000..a87616c --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/EntityEmissiveRenderer.java @@ -0,0 +1,69 @@ +package com.lzxnone.terraria.entity; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.entity.beam.SwordBeam; +import com.lzxnone.terraria.entity.beam.SwordBeamBehaviors; +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.entity.summon.StaticSummonBehaviors; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.RenderLevelStageEvent; + +@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT) +public class EntityEmissiveRenderer { + @SubscribeEvent + public static void onRenderStage(RenderLevelStageEvent event) { + if(event.getStage() != RenderLevelStageEvent.Stage.AFTER_WEATHER) return; + + Minecraft mc = Minecraft.getInstance(); + if(mc.level == null || mc.player == null) return; + + PoseStack poseStack = event.getPoseStack(); + Camera camera = event.getCamera(); + float partialTick = event.getPartialTick().getGameTimeDeltaPartialTick(true); + MultiBufferSource.BufferSource bufferSource = mc.renderBuffers().bufferSource(); + for(Entity entity : mc.level.entitiesForRendering()) { + double x = Mth.lerp(partialTick, entity.xo, entity.getX()); + double y = Mth.lerp(partialTick, entity.yo, entity.getY()); + double z = Mth.lerp(partialTick, entity.zo, entity.getZ()); + float entityYaw = Mth.lerp(partialTick, entity.yRotO, entity.getYRot()); + + double camX = x - camera.getPosition().x(); + double camY = y - camera.getPosition().y(); + double camZ = z - camera.getPosition().z(); + + if(entity instanceof StaticProjectile projectile && projectile.getEntityData().get(StaticProjectile.RENDER_MODE).equals("custom") && projectile.getEntityData().get(StaticProjectile.GLOW)) { + poseStack.pushPose(); + poseStack.translate(camX, camY, camZ); + StaticProjectileBehaviors.getBehavior(projectile.getEntityData().get(StaticProjectile.BEHAVIOR)) + .render(projectile, entityYaw, partialTick, poseStack, bufferSource, 15728880); + + poseStack.popPose(); + }else if(entity instanceof StaticSummon summon && summon.getEntityData().get(StaticSummon.RENDER_MODE).equals("custom") && summon.getEntityData().get(StaticSummon.GLOW)) { + poseStack.pushPose(); + poseStack.translate(camX, camY, camZ); + StaticSummonBehaviors.getBehavior(summon.getEntityData().get(StaticSummon.BEHAVIOR)) + .render(summon, entityYaw, partialTick, poseStack, bufferSource, 15728880); + + poseStack.popPose(); + }else if(entity instanceof SwordBeam beam) { + poseStack.pushPose(); + poseStack.translate(camX, camY, camZ); + SwordBeamBehaviors.getBehavior(beam.getEntityData().get(SwordBeam.BEHAVIOR)) + .render(beam, entityYaw, partialTick, poseStack, bufferSource, 15728880); + + poseStack.popPose(); + } + } + bufferSource.endBatch(); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/ModEntities.java b/src/main/java/com/lzxnone/terraria/entity/ModEntities.java index 613ceed..0a13bb3 100644 --- a/src/main/java/com/lzxnone/terraria/entity/ModEntities.java +++ b/src/main/java/com/lzxnone/terraria/entity/ModEntities.java @@ -1,9 +1,13 @@ package com.lzxnone.terraria.entity; import com.lzxnone.terraria.LzxnoneTerraria; -import com.lzxnone.terraria.entity.projectile.TextureProjectile; +import com.lzxnone.terraria.entity.beam.SwordBeam; +import com.lzxnone.terraria.entity.projectile.StaticProjectile; import com.lzxnone.terraria.entity.summon.BeeSummon; +import com.lzxnone.terraria.entity.summon.StaticSummon; +import com.lzxnone.terraria.entity.summon.StaticSummonRenderer; import net.minecraft.core.registries.Registries; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.neoforged.neoforge.registries.DeferredRegister; @@ -14,13 +18,30 @@ public class ModEntities { public static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(Registries.ENTITY_TYPE, LzxnoneTerraria.MODID); - public static final Supplier> TEXTURE_PROJECTILE = - ENTITY_TYPES.register("texture_projectile", () -> EntityType.Builder.of( - TextureProjectile::new, MobCategory.MISC) + public static final Supplier> STATIC_PROJECTILE = + ENTITY_TYPES.register("static_projectile", () -> EntityType.Builder.of( + StaticProjectile::new, MobCategory.MISC) + .sized(1.0f, 1.0f) + .clientTrackingRange(1024) + .updateInterval(1) + .build("static_projectile") + ); + public static final Supplier> STATIC_SUMMON = + ENTITY_TYPES.register("static_summon", () -> EntityType.Builder.of( + StaticSummon::new, MobCategory.MISC) + .sized(1.0f, 1.0f) + .clientTrackingRange(1024) + .updateInterval(1) + .build("static_summon") + ); + + public static final Supplier> SWORD_BEAM = + ENTITY_TYPES.register("sword_beam", () -> EntityType.Builder.of( + SwordBeam::new, MobCategory.MISC) .sized(0.5f, 0.5f) .clientTrackingRange(1024) .updateInterval(1) - .build("texture_projectile") + .build("sword_beam") ); public static final Supplier> BEE_SUMMON = diff --git a/src/main/java/com/lzxnone/terraria/entity/TintedVertexConsumer.java b/src/main/java/com/lzxnone/terraria/entity/TintedVertexConsumer.java new file mode 100644 index 0000000..f6105df --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/TintedVertexConsumer.java @@ -0,0 +1,52 @@ +package com.lzxnone.terraria.entity; + +import com.mojang.blaze3d.vertex.VertexConsumer; + +public class TintedVertexConsumer implements VertexConsumer { + private VertexConsumer vertexConsumer; + float r, g, b, a; + + public TintedVertexConsumer(VertexConsumer vertexConsumer, float r, float g, float b, float a) { + this.vertexConsumer = vertexConsumer; + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + @Override + public VertexConsumer addVertex(float v, float v1, float v2) { + vertexConsumer.addVertex(v, v1, v2); + return this; + } + + @Override + public VertexConsumer setColor(int i, int i1, int i2, int i3) { + vertexConsumer.setColor((int) (i * r), (int) (i1 * g), (int) (i2 * b), (int) (i3 * a)); + return this; + } + + @Override + public VertexConsumer setUv(float v, float v1) { + vertexConsumer.setUv(v, v1); + return this; + } + + @Override + public VertexConsumer setUv1(int i, int i1) { + vertexConsumer.setUv1(i, i1); + return this; + } + + @Override + public VertexConsumer setUv2(int i, int i1) { + vertexConsumer.setUv2(i, i1); + return this; + } + + @Override + public VertexConsumer setNormal(float v, float v1, float v2) { + vertexConsumer.setNormal(v, v1, v2); + return this; + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/beam/ISwordBeamBehavior.java b/src/main/java/com/lzxnone/terraria/entity/beam/ISwordBeamBehavior.java new file mode 100644 index 0000000..215a50d --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/beam/ISwordBeamBehavior.java @@ -0,0 +1,239 @@ +package com.lzxnone.terraria.entity.beam; + +import com.lzxnone.terraria.entity.ModEntities; +import com.lzxnone.terraria.utils.MathUtil; +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.registries.BuiltInRegistries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +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.Quaternionf; +import org.joml.Vector3f; + +public interface ISwordBeamBehavior { + ResourceLocation RES0 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam0.png"); + ResourceLocation RES1 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam1.png"); + ResourceLocation RES2 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam2.png"); + ResourceLocation RES3 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam3.png"); + ResourceLocation RES4 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam4.png"); + ResourceLocation RES5 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/beam_sparkle.png"); + + float FADE_IN = 0.33f; + float FADE_OUT = 0.67f; + + default void render(Entity entity, float entityYaw, float partialTick, + PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof SwordBeam beam)) return; + Entity owner = beam.getOwner(); + if(owner == null) return; + + int age = beam.getEntityData().get(SwordBeam.AGE); + int lifetime = Math.max(1, beam.getEntityData().get(SwordBeam.LIFETIME)); + + float progress = (age + partialTick) / (float) lifetime; + if(progress > 1.0f) progress = 1.0f; + + Vec3 look = owner.getLookAngle().normalize(); + Vector3f[] dirs = MathUtil.computeDir(MathUtil.toVector3f(look)); + + VertexConsumer vertexConsumer0 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES0)); + VertexConsumer vertexConsumer1 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES0)); + VertexConsumer vertexConsumer2 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES0)); + VertexConsumer vertexConsumer3 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES3)); + VertexConsumer vertexConsumer4 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES4)); + VertexConsumer vertexConsumer5 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES5)); + + Vector3f color0 = entity.getEntityData().get(SwordBeam.COLOR0); + Vector3f color1 = entity.getEntityData().get(SwordBeam.COLOR1); + Vector3f color2 = entity.getEntityData().get(SwordBeam.COLOR2); + Vector3f color3 = entity.getEntityData().get(SwordBeam.COLOR3); + float alpha; + + if(progress <= FADE_IN) { + alpha = 1 - (FADE_IN - progress) / FADE_IN; + }else if(progress >= FADE_OUT) { + alpha = 1 - (progress - FADE_OUT) / (1 - FADE_OUT); + }else { + alpha = 1.0f; + } + + float halfWidth = SwordBeam.HALF_WIDTH * SwordBeam.SCALE; + float halfHeight = SwordBeam.HALF_HEIGHT * SwordBeam.SCALE; + + //左边 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress - 0.1f * (1.0f - progress), SwordBeam.DIST); + this.applyRotate(poseStack, dirs, progress - 0.1f * (1.0f - progress)); + renderQuad(poseStack.last().pose(), vertexConsumer0, + color0.x(), color0.y(), color0.z(), alpha, halfWidth, halfHeight, 0f, 0, -0.01f); + poseStack.popPose(); + + //右边 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress + 0.1f, SwordBeam.DIST); + this.applyRotate(poseStack, dirs, progress + 0.05f); + renderQuad(poseStack.last().pose(), vertexConsumer2, + color2.x(), color2.y(), color2.z(), alpha, halfWidth, halfHeight, 0f, 0, -0.02f); + poseStack.popPose(); + + //中间 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress, SwordBeam.DIST); + this.applyRotate(poseStack, dirs, progress); + renderQuad(poseStack.last().pose(), vertexConsumer1, + color1.x(), color1.y(), color1.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0f); + poseStack.popPose(); + + //三线 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress, SwordBeam.DIST / 1.5f); + this.applyRotate(poseStack, dirs, progress); + poseStack.scale(0.5f, 0.5f, 0.5f); + renderQuad(poseStack.last().pose(), vertexConsumer3, + color3.x(), color3.y(), color3.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress, SwordBeam.DIST / 1.25f); + this.applyRotate(poseStack, dirs, progress); + poseStack.scale(0.75f, 0.75f, 0.75f); + renderQuad(poseStack.last().pose(), vertexConsumer3, + color3.x(), color3.y(), color3.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress, SwordBeam.DIST * 1.15f); + this.applyRotate(poseStack, dirs, progress); + poseStack.scale(0.95f, 0.95f, 0.95f); + renderQuad(poseStack.last().pose(), vertexConsumer3, + color3.x(), color3.y(), color3.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + //边缘高光 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress + 0.05f, SwordBeam.DIST * 1.15f); + this.applyRotate(poseStack, dirs, progress + 0.05f); + poseStack.scale(1.0f, 1.0f, 1.0f); + for(int i = 0;i < 20;i++) { + renderQuad(poseStack.last().pose(), vertexConsumer4, + color1.x(), color1.y(), color1.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.03f); + } + poseStack.popPose(); + + //闪烁 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs, progress + 0.25f, SwordBeam.DIST * 2.25f); + this.applyRotate(poseStack, dirs, progress + 0.25f); + poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F)); + poseStack.scale(1.0f, 1.0f, 1.0f); + for(int i = 0;i < 20;i++) { + renderQuad(poseStack.last().pose(), vertexConsumer5, + color1.x(), color1.y(), color1.z(), alpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f); + } + poseStack.popPose(); + } + + default void applyRotate(PoseStack poseStack, Vector3f[] dirs, float progress) { + Vector3f dir = dirs[0]; + Vector3f up = dirs[1]; + + float angle = (float) ((0.5 - progress) * Math.PI); + Quaternionf rotation = new Quaternionf().fromAxisAngleRad(up, angle); + poseStack.mulPose(rotation); + + float xzLen0 = (float) Math.sqrt(dir.x * dir.x + dir.z * dir.z); + float pitch0 = (float) (Math.atan2(-dir.y, xzLen0) * (180.0 / Math.PI)); + float yaw0 = (float) (Math.atan2(-dir.x, dir.z) * (180.0 / Math.PI)); + poseStack.mulPose(Axis.YP.rotationDegrees(-yaw0)); + poseStack.mulPose(Axis.XP.rotationDegrees(pitch0)); + + poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0F)); + } + + default void applyTranslate(PoseStack poseStack, Vector3f[] dirs, float progress, float dist) { + Vector3f dir = dirs[0]; + Vector3f right = dirs[2]; + + float cos = (float) Math.cos(progress * Math.PI); + float sin = (float) Math.sin(progress * Math.PI); + Vector3f current = new Vector3f( + cos * right.x + sin * dir.x, + cos * right.y + sin * dir.y, + cos * right.z + sin * dir.z + ); + poseStack.translate(current.x * dist, current.y * dist, current.z * dist); + } + + default void renderQuad(Matrix4f matrix, VertexConsumer consumer, float r, float g, float b, float a, float halfWidth, float halfHeight, float offsetX, float offsetY, float offsetZ) { + int ir = (int) (r * 255.0F); + int ig = (int) (g * 255.0F); + int ib = (int) (b * 255.0F); + int ia = (int) (a * 255.0F); + + consumer.addVertex(matrix, -halfWidth, -halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(0.0f, 1.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, halfWidth, -halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(1.0f, 1.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, halfWidth, halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(1.0f, 0.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, -halfWidth, halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(0.0f, 0.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + } + + default void generate(Entity entity, CompoundTag beamData) { + if(entity == null) return; + SwordBeam beam = new SwordBeam(ModEntities.SWORD_BEAM.get(), entity.level()); + beam.setOwner(entity); + Vec3 pos = new Vec3(entity.getX(), entity.getY() + entity.getBbHeight() / 2, entity.getZ()); + beam.setPos(pos); + if(beamData.contains("behavior")) beam.getEntityData().set(SwordBeam.BEHAVIOR, beamData.getString("behavior")); + if(beamData.contains("color0R") && beamData.contains("color0G") && beamData.contains("color0B")) { + beam.getEntityData().set(SwordBeam.COLOR0, new Vector3f(beamData.getFloat("color0R"), beamData.getFloat("color0G"), beamData.getFloat("color0B"))); + } + if(beamData.contains("color1R") && beamData.contains("color1G") && beamData.contains("color1B")) { + beam.getEntityData().set(SwordBeam.COLOR1, new Vector3f(beamData.getFloat("color1R"), beamData.getFloat("color1G"), beamData.getFloat("color1B"))); + } + if(beamData.contains("color2R") && beamData.contains("color2G") && beamData.contains("color2B")) { + beam.getEntityData().set(SwordBeam.COLOR2, new Vector3f(beamData.getFloat("color2R"), beamData.getFloat("color2G"), beamData.getFloat("color2B"))); + } + if(beamData.contains("color3R") && beamData.contains("color3G") && beamData.contains("color3B")) { + beam.getEntityData().set(SwordBeam.COLOR3, new Vector3f(beamData.getFloat("color3R"), beamData.getFloat("color3G"), beamData.getFloat("color3B"))); + } + if(beamData.contains("age")) beam.getEntityData().set(SwordBeam.AGE, beamData.getInt("age")); + if(beamData.contains("lifetime")) beam.getEntityData().set(SwordBeam.LIFETIME, beamData.getInt("lifetime")); + if(beamData.contains("customData")) beam.getEntityData().set(SwordBeam.CUSTOM_DATA, beamData.getCompound("customData").copy()); + if(beamData.contains("behavior") && beamData.contains("cooldown") && entity instanceof Player player) { + ResourceLocation itemKey = ResourceLocation.fromNamespaceAndPath("lzxnoneterraria", beamData.getString("behavior")); + Item item = BuiltInRegistries.ITEM.get(itemKey); + if(item != Items.AIR) player.getCooldowns().addCooldown(item, beamData.getInt("cooldown")); + } + entity.level().addFreshEntity(beam); + } + + default void onMoving(SwordBeam beam) {} + default void onHitEntity(SwordBeam beam, EntityHitResult result) {} + default void onHitBlock(SwordBeam beam, BlockHitResult result) {} + default void onDied(SwordBeam beam) { + if(!beam.level().isClientSide()) { + beam.discard(); + } + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeam.java b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeam.java new file mode 100644 index 0000000..d4b58e9 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeam.java @@ -0,0 +1,252 @@ +package com.lzxnone.terraria.entity.beam; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.utils.FilterUtil; +import com.lzxnone.terraria.utils.MathUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.*; +import org.joml.Quaternionf; +import org.joml.Vector3f; + +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +public class SwordBeam extends Entity { + public static final float HALF_WIDTH = 30.0f; + public static final float HALF_HEIGHT = 72.0f; + public static final float HALF_THICKNESS = 0.25f; + public static final float SCALE = 0.05f; + public static final float DIST = HALF_WIDTH * SCALE; + + public static final EntityDataAccessor BEHAVIOR = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.STRING); + public static final EntityDataAccessor COLOR0 = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.VECTOR3); + public static final EntityDataAccessor COLOR1 = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.VECTOR3); + public static final EntityDataAccessor COLOR2 = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.VECTOR3); + public static final EntityDataAccessor COLOR3 = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.VECTOR3); + public static final EntityDataAccessor AGE = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.INT); + public static final EntityDataAccessor LIFETIME = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.INT); + + public static final EntityDataAccessor> OWNER = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.OPTIONAL_UUID); + public static final EntityDataAccessor CUSTOM_DATA = + SynchedEntityData.defineId(SwordBeam.class, EntityDataSerializers.COMPOUND_TAG); + + private Entity owner = null; + + public Vec3 prevPosition = null; + public Vec3 currentPosition = null; + public Vector3f[] dirs = null; + + public SwordBeam(EntityType type, Level level) { + super(type, level); + this.setNoGravity(true); + this.noPhysics = true; + } + + public void setOwner(Entity entity) { + if(entity == null) return; + this.entityData.set(OWNER, Optional.of(entity.getUUID())); + this.owner = entity; + } + + public Entity getOwner() { + if(owner == null) { + if(this.entityData.get(OWNER).orElse(null) != null) { + UUID uuid = this.entityData.get(OWNER).orElse(null); + if(!this.level().isClientSide()) { + setOwner(((ServerLevel) this.level()).getEntity(uuid)); + }else { + for(Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(64.0))) { + if(entity.getUUID().equals(uuid)) { + setOwner(entity); + } + } + } + } + } + return owner; + } + + @Override + public void tick() { + super.tick(); + + if(!this.level().isClientSide()) { + if(this.getEntityData().get(AGE) >= this.getEntityData().get(LIFETIME)) { + SwordBeamBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onDied(this); + return; + } + this.getEntityData().set(AGE, this.getEntityData().get(AGE) + 1); + } + + if(this.getOwner() != null) { + this.setPos(this.getOwner().getX(), this.getOwner().getY() + this.getOwner().getBbHeight() * 0.5, this.getOwner().getZ()); + }else { + SwordBeamBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onDied(this); + return; + } + + SwordBeamBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onMoving(this); + this.checkCollision(); + } + + public void checkCollision() { + if(owner == null) return; + float progress = (float) this.entityData.get(AGE) / (float) this.entityData.get(LIFETIME); + if(progress > 1.0f) progress = 1.0f; + + Vec3 look = owner.getLookAngle().normalize(); + this.dirs = MathUtil.computeDir(MathUtil.toVector3f(look)); + Vector3f dir = dirs[0]; + Vector3f up = dirs[1]; + Vector3f right = dirs[2]; + + float cos = (float) Math.cos(progress * Math.PI); + float sin = (float) Math.sin(progress * Math.PI); + Vector3f current = new Vector3f( + cos * right.x + sin * dir.x, + cos * right.y + sin * dir.y, + cos * right.z + sin * dir.z + ); + + double centerX = this.getX() + current.x() * DIST; + double centerY = this.getY() + current.y() * DIST; + double centerZ = this.getZ() + current.z() * DIST; + + this.currentPosition = new Vec3(centerX, centerY, centerZ); + + float angle = (float) ((0.5 - progress) * Math.PI); + float xzLen = (float) Math.sqrt(current.x() * current.x() + current.z() * current.z()); + float pitch = (float) (Math.atan2(-current.y(), xzLen) * (180.0 / Math.PI)); + float yaw = (float) (Math.atan2(-current.x(), current.z()) * (180.0 / Math.PI)); + + Quaternionf rotation = new Quaternionf() + .fromAxisAngleRad(up, angle) + .rotateY((float) Math.toRadians(-yaw)) + .rotateX((float) Math.toRadians(pitch)) + .rotateX((float) Math.toRadians(-90.0)) + .rotateZ((float) Math.toRadians(-90.0)); + + Vector3f axisX = new Vector3f(1, 0, 0).rotate(rotation); + Vector3f axisY = new Vector3f(0, 1, 0).rotate(rotation); + Vector3f axisZ = new Vector3f(0, 0, 1).rotate(rotation); + + float extX = HALF_WIDTH * SCALE * Math.abs(axisX.x()) + HALF_HEIGHT * SCALE * Math.abs(axisY.x()) + HALF_THICKNESS * SCALE * Math.abs(axisZ.x()); + float extY = HALF_WIDTH * SCALE * Math.abs(axisX.y()) + HALF_HEIGHT * SCALE * Math.abs(axisY.y()) + HALF_THICKNESS * SCALE * Math.abs(axisZ.y()); + float extZ = HALF_WIDTH * SCALE * Math.abs(axisX.z()) + HALF_HEIGHT * SCALE * Math.abs(axisY.z()) + HALF_THICKNESS * SCALE * Math.abs(axisZ.z()); + + AABB hitBox = new AABB( + centerX - extX, centerY - extY, centerZ - extZ, + centerX + extX, centerY + extY, centerZ + extZ + ); + this.setBoundingBox(hitBox); + + List targets = this.level().getEntities(this, hitBox, FilterUtil.createTargetFilter(this, this.getOwner())); + + for(Entity target : targets) SwordBeamBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitEntity(this, new EntityHitResult(target, currentPosition)); + + if(this.prevPosition == null) return; + + ClipContext context = new ClipContext( + this.prevPosition, + this.currentPosition, + ClipContext.Block.COLLIDER, + ClipContext.Fluid.NONE, + this + ); + + BlockHitResult blockHit = this.level().clip(context); + + if(blockHit.getType() != HitResult.Type.MISS) { + SwordBeamBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitBlock(this, blockHit); + } + + this.prevPosition = this.currentPosition; + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(BEHAVIOR, "default"); + builder.define(COLOR0, new Vector3f(1.0f, 1.0f, 1.0f)); + builder.define(COLOR1, new Vector3f(1.0f, 1.0f, 1.0f)); + builder.define(COLOR2, new Vector3f(1.0f, 1.0f, 1.0f)); + builder.define(COLOR3, new Vector3f(1.0f, 1.0f, 1.0f)); + builder.define(AGE, 0); + builder.define(LIFETIME, 10); + builder.define(OWNER, Optional.empty()); + builder.define(CUSTOM_DATA, new CompoundTag()); + } + + @Override + protected void addAdditionalSaveData(CompoundTag tag) { + tag.putString("behavior", this.entityData.get(BEHAVIOR)); + Vector3f c0 = this.entityData.get(COLOR0); + tag.putFloat("color0R", c0.x); + tag.putFloat("color0G", c0.y); + tag.putFloat("color0B", c0.z); + Vector3f c1 = this.entityData.get(COLOR1); + tag.putFloat("color1R", c1.x); + tag.putFloat("color1G", c1.y); + tag.putFloat("color1B", c1.z); + Vector3f c2 = this.entityData.get(COLOR2); + tag.putFloat("color2R", c2.x); + tag.putFloat("color2G", c2.y); + tag.putFloat("color2B", c2.z); + Vector3f c3 = this.entityData.get(COLOR3); + tag.putFloat("color3R", c3.x); + tag.putFloat("color3G", c3.y); + tag.putFloat("color3B", c3.z); + tag.putInt("age", this.entityData.get(AGE)); + tag.putInt("lifetime", this.entityData.get(LIFETIME)); + if(getOwner() != null) tag.putUUID("owner", getOwner().getUUID()); + tag.put("customData", this.entityData.get(CUSTOM_DATA)); + } + + @Override + protected void readAdditionalSaveData(CompoundTag tag) { + if(tag.contains("behavior")) this.entityData.set(BEHAVIOR, tag.getString("behavior")); + if(tag.contains("color0R")) { + this.entityData.set(COLOR0, new Vector3f( + tag.getFloat("color0R"), tag.getFloat("color0G"), tag.getFloat("color0B") + )); + } + if(tag.contains("color1R")) { + this.entityData.set(COLOR1, new Vector3f( + tag.getFloat("color1R"), tag.getFloat("color1G"), tag.getFloat("color1B") + )); + } + if(tag.contains("color2R")) { + this.entityData.set(COLOR2, new Vector3f( + tag.getFloat("color2R"), tag.getFloat("color2G"), tag.getFloat("color2B") + )); + } + if(tag.contains("color3R")) { + this.entityData.set(COLOR3, new Vector3f( + tag.getFloat("color3R"), tag.getFloat("color3G"), tag.getFloat("color3B") + )); + } + if(tag.contains("age")) this.entityData.set(AGE, tag.getInt("age")); + if(tag.contains("lifetime")) this.entityData.set(LIFETIME, tag.getInt("lifetime")); + if(tag.contains("owner")) { + this.entityData.set(OWNER, Optional.of(tag.getUUID("owner"))); + getOwner(); + } + if(tag.contains("customData")) this.entityData.set(CUSTOM_DATA, tag.getCompound("customData")); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamBehaviors.java b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamBehaviors.java new file mode 100644 index 0000000..1638630 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamBehaviors.java @@ -0,0 +1,25 @@ +package com.lzxnone.terraria.entity.beam; + +import com.lzxnone.terraria.item.weapon.melee.TerraBlade; +import com.lzxnone.terraria.item.weapon.melee.TheHorsemansBlade; + +import java.util.HashMap; +import java.util.Map; + +public class SwordBeamBehaviors { + private static final Map BEHAVIORS = new HashMap<>(); + + public static final String DEFAULT = "default"; + public static final String THE_HORSEMANS_BLADE = "the_horsemans_blade"; + public static final String TERRA_BLADE = "terra_blade"; + + static { + BEHAVIORS.put(DEFAULT, new ISwordBeamBehavior() {}); + BEHAVIORS.put(THE_HORSEMANS_BLADE, TheHorsemansBlade.SWORD_BEAM_BEHAVIOR); + BEHAVIORS.put(TERRA_BLADE, TerraBlade.SWORD_BEAM_BEHAVIOR); + } + + public static ISwordBeamBehavior getBehavior(String id) { + return BEHAVIORS.getOrDefault(id, BEHAVIORS.get(DEFAULT)); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamRenderer.java b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamRenderer.java new file mode 100644 index 0000000..545f68c --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/beam/SwordBeamRenderer.java @@ -0,0 +1,25 @@ +package com.lzxnone.terraria.entity.beam; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; + +public class SwordBeamRenderer extends EntityRenderer { + public SwordBeamRenderer(EntityRendererProvider.Context context) { + super(context); + } + + @Override + public void render(Entity entity, float entityYaw, float partialTick, + PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + } + + @Override + public ResourceLocation getTextureLocation(Entity entity) { + return ResourceLocation.parse("lzxnoneterraria:textures/item/terra_beam.png"); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/IProjectileBehavior.java b/src/main/java/com/lzxnone/terraria/entity/projectile/IProjectileBehavior.java deleted file mode 100644 index 80ee776..0000000 --- a/src/main/java/com/lzxnone/terraria/entity/projectile/IProjectileBehavior.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.lzxnone.terraria.entity.projectile; - -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.EntityHitResult; - -public interface IProjectileBehavior { - default void onMoving(TextureProjectile projectile) {} - default void onHitEntity(TextureProjectile projectile, EntityHitResult result) {} - default void onHitBlock(TextureProjectile projectile, BlockHitResult result) {} - default void onDied(TextureProjectile projectile) { - if(!projectile.level().isClientSide()) { - projectile.discard(); - } - } -} diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/IStaticProjectileBehavior.java b/src/main/java/com/lzxnone/terraria/entity/projectile/IStaticProjectileBehavior.java new file mode 100644 index 0000000..d26429b --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/projectile/IStaticProjectileBehavior.java @@ -0,0 +1,154 @@ +package com.lzxnone.terraria.entity.projectile; + +import com.lzxnone.terraria.entity.TintedVertexConsumer; +import com.lzxnone.terraria.utils.MathUtil; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.Vec3; +import org.joml.Matrix3f; +import org.joml.Quaternionf; +import org.joml.Vector3f; + +public interface IStaticProjectileBehavior { + default void renderItem(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticProjectile proj)) return; + ItemStack stack = proj.getEntityData().get(StaticProjectile.ITEM); + if(stack.isEmpty()) return; + + poseStack.pushPose(); + + //对齐坐标系 + Vec3 velCurrent = entity.getDeltaMovement(); + Vec3 velOld = proj.prevDeltaMovement; + if(velOld == null) velOld = velCurrent; + + Vector3f velForRot; + if(velCurrent.lengthSqr() > 0.0001) { + velForRot = new Vector3f( + (float) Mth.lerp(partialTick, velOld.x, velCurrent.x), + (float) Mth.lerp(partialTick, velOld.y, velCurrent.y), + (float) Mth.lerp(partialTick, velOld.z, velCurrent.z) + ); + }else { + velForRot = new Vector3f(proj.getEntityData().get(StaticProjectile.DIRECTION)); + } + + Vector3f[] dirs = MathUtil.computeDir(velForRot); + + Matrix3f rotMatrix = new Matrix3f().set(dirs[2], dirs[1], dirs[0]); + poseStack.mulPose(new Quaternionf().setFromNormalized(rotMatrix)); + + //旋转 + poseStack.mulPose(Axis.XP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RXP) + proj.getEntityData().get(StaticProjectile.RXPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + poseStack.mulPose(Axis.YP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RYP) + proj.getEntityData().get(StaticProjectile.RYPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + poseStack.mulPose(Axis.ZP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RZP) + proj.getEntityData().get(StaticProjectile.RZPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + + //缩放 + poseStack.scale( + proj.getEntityData().get(StaticProjectile.SCALE_X), + proj.getEntityData().get(StaticProjectile.SCALE_Y), + proj.getEntityData().get(StaticProjectile.SCALE_Z) + ); + + Minecraft.getInstance().getItemRenderer().renderStatic( + stack, + ItemDisplayContext.NONE, + proj.getEntityData().get(StaticProjectile.GLOW) ? LightTexture.FULL_BRIGHT : packedLight, + OverlayTexture.NO_OVERLAY, + poseStack, + renderType -> { + VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType); + return new TintedVertexConsumer(vertexConsumer, + proj.getEntityData().get(StaticProjectile.COLOR_R), + proj.getEntityData().get(StaticProjectile.COLOR_G), + proj.getEntityData().get(StaticProjectile.COLOR_B), + proj.getEntityData().get(StaticProjectile.COLOR_A)); + }, + entity.level(), + 0 + ); + + poseStack.popPose(); + } + + default void renderBlock(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticProjectile proj)) return; + BlockState blockState = proj.getEntityData().get(StaticProjectile.BLOCK); + if(blockState == Blocks.AIR.defaultBlockState()) return; + + //对齐坐标系 + Vec3 velCurrent = entity.getDeltaMovement(); + Vec3 velOld = proj.prevDeltaMovement; + if(velOld == null) velOld = velCurrent; + + Vector3f velForRot; + if(velCurrent.lengthSqr() > 0.0001) { + velForRot = new Vector3f( + (float) Mth.lerp(partialTick, velOld.x, velCurrent.x), + (float) Mth.lerp(partialTick, velOld.y, velCurrent.y), + (float) Mth.lerp(partialTick, velOld.z, velCurrent.z) + ); + }else { + velForRot = new Vector3f(proj.getEntityData().get(StaticProjectile.DIRECTION)); + } + + Vector3f[] dirs = MathUtil.computeDir(velForRot); + + Matrix3f rotMatrix = new Matrix3f().set(dirs[2], dirs[1], dirs[0]); + poseStack.mulPose(new Quaternionf().setFromNormalized(rotMatrix)); + + //旋转 + poseStack.mulPose(Axis.XP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RXP) + proj.getEntityData().get(StaticProjectile.RXPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + poseStack.mulPose(Axis.YP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RYP) + proj.getEntityData().get(StaticProjectile.RYPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + poseStack.mulPose(Axis.ZP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RZP) + proj.getEntityData().get(StaticProjectile.RZPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick))); + + //缩放 + poseStack.scale( + proj.getEntityData().get(StaticProjectile.SCALE_X), + proj.getEntityData().get(StaticProjectile.SCALE_Y), + proj.getEntityData().get(StaticProjectile.SCALE_Z) + ); + + Minecraft.getInstance().getBlockRenderer().renderSingleBlock( + blockState, + poseStack, + renderType -> { + VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType); + return new TintedVertexConsumer(vertexConsumer, + proj.getEntityData().get(StaticProjectile.COLOR_R), + proj.getEntityData().get(StaticProjectile.COLOR_G), + proj.getEntityData().get(StaticProjectile.COLOR_B), + proj.getEntityData().get(StaticProjectile.COLOR_A)); + }, + proj.getEntityData().get(StaticProjectile.GLOW) ? LightTexture.FULL_BRIGHT : packedLight, + OverlayTexture.NO_OVERLAY, + net.neoforged.neoforge.client.model.data.ModelData.EMPTY, + null + ); + + poseStack.popPose(); + } + + default void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {} + default void onMoving(StaticProjectile projectile) {} + default void onHitEntity(StaticProjectile projectile, EntityHitResult result) {} + default void onHitBlock(StaticProjectile projectile, BlockHitResult result) {} + default void onDied(StaticProjectile projectile) { + if(!projectile.level().isClientSide()) { + projectile.discard(); + } + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectile.java b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectile.java similarity index 56% rename from src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectile.java rename to src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectile.java index 24efb0d..0c06287 100644 --- a/src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectile.java +++ b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectile.java @@ -1,69 +1,85 @@ package com.lzxnone.terraria.entity.projectile; +import com.lzxnone.terraria.entity.summon.StaticSummon; +import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.*; import net.objecthunter.exp4j.Expression; import net.objecthunter.exp4j.ExpressionBuilder; import org.joml.Vector3f; -public class TextureProjectile extends Projectile { +public class StaticProjectile extends Projectile { public static final EntityDataAccessor BEHAVIOR = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.STRING); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.STRING); + public static final EntityDataAccessor RENDER_MODE = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.STRING); public static final EntityDataAccessor ITEM = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.ITEM_STACK); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.ITEM_STACK); + public static final EntityDataAccessor BLOCK = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.BLOCK_STATE); public static final EntityDataAccessor ORIGIN = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.VECTOR3); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.VECTOR3); public static final EntityDataAccessor DIRECTION = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.VECTOR3); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.VECTOR3); public static final EntityDataAccessor UP = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.VECTOR3); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.VECTOR3); public static final EntityDataAccessor RIGHT = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.VECTOR3); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.VECTOR3); public static final EntityDataAccessor SCALE_X = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.FLOAT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor SCALE_Y = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.FLOAT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor SCALE_Z = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor RXP = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor RYP = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor RZP = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor RXPS = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor RYPS = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor RZPS = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); + public static final EntityDataAccessor COLOR_R = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_G = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_B = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_A = + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor GLOW = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.BOOLEAN); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor AGE = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor LIFETIME = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.INT); + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.INT); public static final EntityDataAccessor EXPRESSION_X = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.STRING); //右 + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.STRING); //右 public static final EntityDataAccessor EXPRESSION_Y = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.STRING); //上 + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.STRING); //上 public static final EntityDataAccessor EXPRESSION_Z = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.STRING); //前 + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.STRING); //前 public static final EntityDataAccessor CUSTOM_DATA = - SynchedEntityData.defineId(TextureProjectile.class, EntityDataSerializers.COMPOUND_TAG); - + SynchedEntityData.defineId(StaticProjectile.class, EntityDataSerializers.COMPOUND_TAG); public boolean isInit = false; @@ -76,7 +92,7 @@ public class TextureProjectile extends Projectile { public boolean positionOverridden = false; - public TextureProjectile(EntityType type, Level level) { + public StaticProjectile(EntityType type, Level level) { super(type, level); this.setNoGravity(true); } @@ -84,19 +100,26 @@ public class TextureProjectile extends Projectile { @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { builder.define(BEHAVIOR, "default"); + builder.define(RENDER_MODE, "custom"); builder.define(ITEM, ItemStack.EMPTY); + builder.define(BLOCK, Blocks.AIR.defaultBlockState()); builder.define(ORIGIN, new Vector3f(0, 0, 0)); builder.define(DIRECTION, new Vector3f(0, 0, 1)); builder.define(UP, new Vector3f(0, 1, 0)); builder.define(RIGHT, new Vector3f(1, 0, 0)); builder.define(SCALE_X, 1.0f); builder.define(SCALE_Y, 1.0f); + builder.define(SCALE_Z, 1.0f); builder.define(RXP, 0); builder.define(RYP, 0); builder.define(RZP, 0); builder.define(RXPS, 0); builder.define(RYPS, 0); builder.define(RZPS, 0); + builder.define(COLOR_R, 1.0f); + builder.define(COLOR_G, 1.0f); + builder.define(COLOR_B, 1.0f); + builder.define(COLOR_A, 1.0f); builder.define(GLOW, false); builder.define(AGE, 0); builder.define(LIFETIME, 60); @@ -110,34 +133,34 @@ public class TextureProjectile extends Projectile { public void onSyncedDataUpdated(EntityDataAccessor key) { super.onSyncedDataUpdated(key); if(!isInit) return; - if(key.equals(TextureProjectile.EXPRESSION_Y) && exprY != null) { - this.exprY = new ExpressionBuilder(this.entityData.get(TextureProjectile.EXPRESSION_Y)).variables("t").build(); - }else if (key.equals(TextureProjectile.EXPRESSION_Z) && exprZ != null) { - this.exprZ = new ExpressionBuilder(this.entityData.get(TextureProjectile.EXPRESSION_Z)).variables("t").build(); - }else if (key.equals(TextureProjectile.EXPRESSION_X) && exprX != null) { - this.exprX = new ExpressionBuilder(this.entityData.get(TextureProjectile.EXPRESSION_X)).variables("t").build(); + if(key.equals(StaticProjectile.EXPRESSION_Y) && exprY != null) { + this.exprY = new ExpressionBuilder(this.entityData.get(StaticProjectile.EXPRESSION_Y)).variables("t").build(); + }else if (key.equals(StaticProjectile.EXPRESSION_Z) && exprZ != null) { + this.exprZ = new ExpressionBuilder(this.entityData.get(StaticProjectile.EXPRESSION_Z)).variables("t").build(); + }else if (key.equals(StaticProjectile.EXPRESSION_X) && exprX != null) { + this.exprX = new ExpressionBuilder(this.entityData.get(StaticProjectile.EXPRESSION_X)).variables("t").build(); } } @Override public void tick() { super.tick(); - if(!isInit) { - this.exprX = new ExpressionBuilder(this.entityData.get(EXPRESSION_X)).variables("t").build(); - this.exprY = new ExpressionBuilder(this.entityData.get(EXPRESSION_Y)).variables("t").build(); - this.exprZ = new ExpressionBuilder(this.entityData.get(EXPRESSION_Z)).variables("t").build(); - isInit = true; + if(!this.isInit) { + this.exprX = new ExpressionBuilder(this.getEntityData().get(StaticProjectile.EXPRESSION_X)).variables("t").build(); + this.exprY = new ExpressionBuilder(this.getEntityData().get(StaticProjectile.EXPRESSION_Y)).variables("t").build(); + this.exprZ = new ExpressionBuilder(this.getEntityData().get(StaticProjectile.EXPRESSION_Z)).variables("t").build(); + this.isInit = true; } this.prevPos = this.position(); this.prevDeltaMovement = this.getDeltaMovement(); - double valX = this.exprX.setVariable("t", this.entityData.get(AGE)).evaluate(); - double valY = this.exprY.setVariable("t", this.entityData.get(AGE)).evaluate(); - double valZ = this.exprZ.setVariable("t", this.entityData.get(AGE)).evaluate(); - Vector3f origin = this.entityData.get(ORIGIN); - Vector3f right = this.entityData.get(RIGHT); - Vector3f up = this.entityData.get(UP); - Vector3f dir = this.entityData.get(DIRECTION); + double valX = this.exprX.setVariable("t", this.getEntityData().get(StaticProjectile.AGE)).evaluate(); + double valY = this.exprY.setVariable("t", this.getEntityData().get(StaticProjectile.AGE)).evaluate(); + double valZ = this.exprZ.setVariable("t", this.getEntityData().get(StaticProjectile.AGE)).evaluate(); + Vector3f origin = this.getEntityData().get(StaticProjectile.ORIGIN); + Vector3f right = this.getEntityData().get(StaticProjectile.RIGHT); + Vector3f up = this.getEntityData().get(StaticProjectile.UP); + Vector3f dir = this.getEntityData().get(StaticProjectile.DIRECTION); double newX = origin.x + (valX * right.x) + (valY * up.x) + (valZ * dir.x); double newY = origin.y + (valX * right.y) + (valY * up.y) + (valZ * dir.y); double newZ = origin.z + (valX * right.z) + (valY * up.z) + (valZ * dir.z); @@ -145,19 +168,20 @@ public class TextureProjectile extends Projectile { Vec3 nextPos = new Vec3(newX, newY, newZ); this.setDeltaMovement(nextPos.subtract(this.position())); + if(!this.positionOverridden) { + this.setPos(nextPos); + } + this.positionOverridden = false; + + StaticProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onMoving(this); + HitResult hitResult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); if(hitResult.getType() != HitResult.Type.MISS) { this.onHit(hitResult); } - if(!this.positionOverridden) { - this.setPos(nextPos); - } - this.positionOverridden = false; - ProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onMoving(this); - if(this.entityData.get(AGE) > this.entityData.get(LIFETIME)) { - ProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onDied(this); + StaticProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onDied(this); } this.entityData.set(AGE, this.entityData.get(AGE) + 1); } @@ -165,8 +189,10 @@ public class TextureProjectile extends Projectile { @Override protected void addAdditionalSaveData(CompoundTag tag) { tag.putString("behavior", this.entityData.get(BEHAVIOR)); + tag.putString("renderMode", this.entityData.get(RENDER_MODE)); ItemStack stack = this.entityData.get(ITEM); if(!stack.isEmpty()) tag.put("item", stack.save(this.level().registryAccess())); + tag.put("block", NbtUtils.writeBlockState(this.entityData.get(BLOCK))); tag.putFloat("originX", this.entityData.get(ORIGIN).x); tag.putFloat("originY", this.entityData.get(ORIGIN).y); tag.putFloat("originZ", this.entityData.get(ORIGIN).z); @@ -181,12 +207,17 @@ public class TextureProjectile extends Projectile { tag.putFloat("rightZ", this.entityData.get(RIGHT).z); tag.putFloat("scaleX", this.entityData.get(SCALE_X)); tag.putFloat("scaleY", this.entityData.get(SCALE_Y)); + tag.putFloat("scaleZ", this.entityData.get(SCALE_Z)); tag.putInt("rxp", this.entityData.get(RXP)); tag.putInt("ryp", this.entityData.get(RYP)); tag.putInt("rzp", this.entityData.get(RZP)); tag.putInt("rxps", this.entityData.get(RXPS)); tag.putInt("ryps", this.entityData.get(RYPS)); tag.putInt("rzps", this.entityData.get(RZPS)); + tag.putFloat("colorR", this.entityData.get(COLOR_R)); + tag.putFloat("colorG", this.entityData.get(COLOR_G)); + tag.putFloat("colorB", this.entityData.get(COLOR_B)); + tag.putFloat("colorA", this.entityData.get(COLOR_A)); tag.putBoolean("glow", this.entityData.get(GLOW)); tag.putInt("age", this.entityData.get(AGE)); tag.putInt("lifetime", this.entityData.get(LIFETIME)); @@ -199,10 +230,18 @@ public class TextureProjectile extends Projectile { @Override protected void readAdditionalSaveData(CompoundTag tag) { if(tag.contains("behavior")) this.entityData.set(BEHAVIOR, tag.getString("behavior")); + if(tag.contains("renderMode")) this.entityData.set(RENDER_MODE, tag.getString("renderMode")); if(tag.contains("item")) { ItemStack.parse(this.level().registryAccess(), tag.getCompound("item")) .ifPresent(stack -> this.entityData.set(ITEM, stack)); } + if(tag.contains("block")) { + BlockState blockState = NbtUtils.readBlockState( + this.level().holderLookup(Registries.BLOCK), + tag.getCompound("block") + ); + this.entityData.set(BLOCK, blockState); + } Vector3f origin = new Vector3f(); if(tag.contains("originX")) origin.x = tag.getFloat("originX"); if(tag.contains("originY")) origin.y = tag.getFloat("originY"); @@ -214,23 +253,28 @@ public class TextureProjectile extends Projectile { if(tag.contains("dirZ")) dir.z = tag.getFloat("dirZ"); this.entityData.set(DIRECTION, dir); Vector3f up = this.entityData.get(UP); - tag.putFloat("upX", up.x); - tag.putFloat("upY", up.y); - tag.putFloat("upZ", up.z); + if(tag.contains("upX")) up.x = tag.getFloat("upX"); + if(tag.contains("upY")) up.y = tag.getFloat("upY"); + if(tag.contains("upZ")) up.z = tag.getFloat("upZ"); this.entityData.set(UP, up); Vector3f right = this.entityData.get(RIGHT); - tag.putFloat("rightX", right.x); - tag.putFloat("rightY", right.y); - tag.putFloat("rightZ", right.z); + if(tag.contains("rightX")) right.x = tag.getFloat("rightX"); + if(tag.contains("rightY")) right.y = tag.getFloat("rightY"); + if(tag.contains("rightZ")) right.z = tag.getFloat("rightZ"); this.entityData.set(RIGHT, right); if(tag.contains("scaleX")) this.entityData.set(SCALE_X, tag.getFloat("scaleX")); if(tag.contains("scaleY")) this.entityData.set(SCALE_Y, tag.getFloat("scaleY")); + if(tag.contains("scaleZ")) this.entityData.set(SCALE_Z, tag.getFloat("scaleZ")); if(tag.contains("rxp")) this.entityData.set(RXP, tag.getInt("rxp")); if(tag.contains("ryp")) this.entityData.set(RYP, tag.getInt("ryp")); if(tag.contains("rzp")) this.entityData.set(RZP, tag.getInt("rzp")); if(tag.contains("rxps")) this.entityData.set(RXPS, tag.getInt("rxps")); if(tag.contains("ryps")) this.entityData.set(RYPS, tag.getInt("ryps")); if(tag.contains("rzps")) this.entityData.set(RZPS, tag.getInt("rzps")); + if(tag.contains("colorR")) this.entityData.set(COLOR_R, tag.getFloat("colorR")); + if(tag.contains("colorG")) this.entityData.set(COLOR_G, tag.getFloat("colorG")); + if(tag.contains("colorB")) this.entityData.set(COLOR_B, tag.getFloat("colorB")); + if(tag.contains("colorA")) this.entityData.set(COLOR_A, tag.getFloat("colorA")); if(tag.contains("glow")) this.entityData.set(GLOW, tag.getBoolean("glow")); if(tag.contains("age")) this.entityData.set(AGE, tag.getInt("age")); if(tag.contains("lifetime")) this.entityData.set(LIFETIME, tag.getInt("lifetime")); @@ -246,15 +290,12 @@ public class TextureProjectile extends Projectile { @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); - Entity target = result.getEntity(); - Entity owner = this.getOwner(); - if(owner != null && target.getUUID().equals(owner.getUUID())) return; - ProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitEntity(this, result); + StaticProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitEntity(this, result); } @Override protected void onHitBlock(BlockHitResult result) { super.onHitBlock(result); - ProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitBlock(this, result); + StaticProjectileBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).onHitBlock(this, result); } } diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/ProjectileBehaviors.java b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileBehaviors.java similarity index 58% rename from src/main/java/com/lzxnone/terraria/entity/projectile/ProjectileBehaviors.java rename to src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileBehaviors.java index e744c85..48f55cb 100644 --- a/src/main/java/com/lzxnone/terraria/entity/projectile/ProjectileBehaviors.java +++ b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileBehaviors.java @@ -1,49 +1,45 @@ package com.lzxnone.terraria.entity.projectile; -import com.lzxnone.terraria.item.weapon.melee.EnchantedSword; -import com.lzxnone.terraria.item.weapon.melee.Seedler; -import com.lzxnone.terraria.item.weapon.melee.Starfury; +import com.lzxnone.terraria.item.weapon.melee.*; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import java.util.HashMap; import java.util.Map; -public class ProjectileBehaviors { - private static final Map BEHAVIORS = new HashMap<>(); +public class StaticProjectileBehaviors { + private static final Map BEHAVIORS = new HashMap<>(); public static final String DEFAULT = "default"; public static final String ENCHANTED_SWORD_BEAM = "enchanted_sword_beam"; public static final String STARFURY_STAR = "starfury_star"; public static final String SEEDLER_NUT = "seedler_nut"; public static final String SEEDLER_THORN = "seedler_thorn"; + public static final String INFLUX_WAVER_BEAM = "influx_waver"; + public static final String STAR_WRATH_STAR = "star_wrath_star"; static { - BEHAVIORS.put(DEFAULT, new IProjectileBehavior() { + BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() { @Override - public void onHitEntity(TextureProjectile projectile, EntityHitResult result) { + public void onHitEntity(StaticProjectile projectile, EntityHitResult result) { if(projectile.level().isClientSide()) return; projectile.discard(); } @Override - public void onHitBlock(TextureProjectile projectile, BlockHitResult result) { + public void onHitBlock(StaticProjectile projectile, BlockHitResult result) { if(projectile.level().isClientSide()) return; if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { projectile.discard(); } } - @Override - public void onDied(TextureProjectile projectile) { - projectile.discard(); - } }); BEHAVIORS.put(ENCHANTED_SWORD_BEAM, EnchantedSword.PROJECTILE_BEHAVIOR); BEHAVIORS.put(STARFURY_STAR, Starfury.PROJECTILE_BEHAVIOR); - BEHAVIORS.put(SEEDLER_NUT, Seedler.NUT_PROJECTILE_BEHAVIOR); - BEHAVIORS.put(SEEDLER_THORN, Seedler.THORN_PROJECTILE_BEHAVIOR); + BEHAVIORS.put(SEEDLER_THORN, Seedler.PROJECTILE_BEHAVIOR); + BEHAVIORS.put(STAR_WRATH_STAR, StarWrath.PROJECTILE_BEHAVIOR); } - public static IProjectileBehavior getBehavior(String id) { + public static IStaticProjectileBehavior getBehavior(String id) { return BEHAVIORS.getOrDefault(id, BEHAVIORS.get(DEFAULT)); } } \ No newline at end of file diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileRenderer.java b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileRenderer.java new file mode 100644 index 0000000..1988536 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/projectile/StaticProjectileRenderer.java @@ -0,0 +1,38 @@ +package com.lzxnone.terraria.entity.projectile; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; + +public class StaticProjectileRenderer extends EntityRenderer { + + public StaticProjectileRenderer(EntityRendererProvider.Context context) { + super(context); + } + + @Override + public void render(Entity entity, float entityYaw, float partialTick, + PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticProjectile proj)) return; + if(!proj.isInit) return; + if(proj.getEntityData().get(StaticProjectile.RENDER_MODE).equals("item") && proj.getEntityData().get(StaticProjectile.ITEM) != ItemStack.EMPTY) { + StaticProjectileBehaviors.getBehavior(proj.getEntityData().get(StaticProjectile.BEHAVIOR)).renderItem(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + }else if(proj.getEntityData().get(StaticProjectile.RENDER_MODE).equals("block") && proj.getEntityData().get(StaticProjectile.BLOCK) != Blocks.AIR.defaultBlockState()) { + StaticProjectileBehaviors.getBehavior(proj.getEntityData().get(StaticProjectile.BEHAVIOR)).renderBlock(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + }else if(!proj.getEntityData().get(StaticProjectile.GLOW)) { + StaticProjectileBehaviors.getBehavior(proj.getEntityData().get(StaticProjectile.BEHAVIOR)).render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + } + super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + } + + @Override + public ResourceLocation getTextureLocation(Entity entity) { + return InventoryMenu.BLOCK_ATLAS; + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectileRenderer.java b/src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectileRenderer.java deleted file mode 100644 index 7db77ef..0000000 --- a/src/main/java/com/lzxnone/terraria/entity/projectile/TextureProjectileRenderer.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.lzxnone.terraria.entity.projectile; - -import com.lzxnone.terraria.utils.MathUtil; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Axis; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LightTexture; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.item.ItemDisplayContext; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.Vec3; -import org.joml.Matrix3f; -import org.joml.Quaternionf; -import org.joml.Vector3f; - -public class TextureProjectileRenderer extends EntityRenderer { - - public TextureProjectileRenderer(EntityRendererProvider.Context context) { - super(context); - } - - @Override - public void render(Entity entity, float entityYaw, float partialTick, - PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { - if(!(entity instanceof TextureProjectile proj)) return; - if(!proj.isInit || proj.getEntityData().get(TextureProjectile.AGE) < 2) return; - - ItemStack stack = proj.getEntityData().get(TextureProjectile.ITEM); - if(stack.isEmpty()) return; - - float scaleX = proj.getEntityData().get(TextureProjectile.SCALE_X); - float scaleY = proj.getEntityData().get(TextureProjectile.SCALE_Y); - - poseStack.pushPose(); - - // 缩放 - poseStack.scale(scaleX, scaleY, scaleX); - - // 朝飞行方向旋转 - Vec3 velCurrent = entity.getDeltaMovement(); - Vec3 velOld = proj.prevDeltaMovement; - - Vector3f velForRot; - if(velCurrent.lengthSqr() > 0.0001) { - velForRot = new Vector3f( - (float) Mth.lerp(partialTick, velOld.x, velCurrent.x), - (float) Mth.lerp(partialTick, velOld.y, velCurrent.y), - (float) Mth.lerp(partialTick, velOld.z, velCurrent.z) - ); - } else { - velForRot = new Vector3f(proj.getEntityData().get(TextureProjectile.DIRECTION)); - } - - Vector3f[] dirs = MathUtil.computeProjectileDir(velForRot); - - Matrix3f rotMatrix = new Matrix3f().set(dirs[2], dirs[1], dirs[0]); - poseStack.mulPose(new Quaternionf().setFromNormalized(rotMatrix)); - - poseStack.mulPose(Axis.XP.rotationDegrees(proj.getEntityData().get(TextureProjectile.RXP) + proj.getEntityData().get(TextureProjectile.RXPS) * proj.getEntityData().get(TextureProjectile.AGE))); - poseStack.mulPose(Axis.YP.rotationDegrees(proj.getEntityData().get(TextureProjectile.RYP) + proj.getEntityData().get(TextureProjectile.RYPS) * proj.getEntityData().get(TextureProjectile.AGE))); - poseStack.mulPose(Axis.ZP.rotationDegrees(proj.getEntityData().get(TextureProjectile.RZP) + proj.getEntityData().get(TextureProjectile.RZPS) * proj.getEntityData().get(TextureProjectile.AGE))); - - Minecraft.getInstance().getItemRenderer().renderStatic( - stack, - ItemDisplayContext.NONE, - proj.getEntityData().get(TextureProjectile.GLOW) ? LightTexture.FULL_BRIGHT : packedLight, - OverlayTexture.NO_OVERLAY, - poseStack, - bufferSource, - entity.level(), - 0 - ); - - poseStack.popPose(); - - super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); - } - - @Override - public ResourceLocation getTextureLocation(Entity entity) { - return ResourceLocation.parse("lzxnoneterraria:textures/particle/enchanted_sword_beam.png"); - } -} diff --git a/src/main/java/com/lzxnone/terraria/entity/summon/BeeSummon.java b/src/main/java/com/lzxnone/terraria/entity/summon/BeeSummon.java index b84f669..6cba290 100644 --- a/src/main/java/com/lzxnone/terraria/entity/summon/BeeSummon.java +++ b/src/main/java/com/lzxnone/terraria/entity/summon/BeeSummon.java @@ -1,6 +1,8 @@ package com.lzxnone.terraria.entity.summon; +import com.lzxnone.terraria.utils.MathUtil; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -17,22 +19,25 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; -import java.util.UUID; - public class BeeSummon extends Bee { - public static final int LIFETIME = 1200; public static final int MAX_ATTACK_COUNT = 2; + + public static final double RANGE = 32.0; + public static final double SPEED = 1; + public static final double FRICTION = 0.25; + public int customAge = 0; public int customAttackCount = 0; - public UUID owner = null; + public LivingEntity owner = null; public BeeSummon(EntityType entityType, Level level) { super(entityType, level); - this.moveControl = new FlyingMoveControl(this, 45, true); - this.lookControl = new LookControl(this); - this.navigation = createNavigation(level); + this.setNoGravity(true); + //this.moveControl = new FlyingMoveControl(this, 45, true); + //this.lookControl = new LookControl(this); + //this.navigation = createNavigation(level); } public static AttributeSupplier.@NotNull Builder createAttributes() { @@ -47,26 +52,26 @@ public class BeeSummon extends Bee { public void tick() { super.tick(); if(!this.level().isClientSide()) { - if(owner == null || this.level().getPlayerByUUID(owner) == null) { + if(owner == null) { discard(); + return; } this.customAge++; if(this.customAge >= LIFETIME) { this.discard(); } - Player player = this.level().getPlayerByUUID(owner); LivingEntity target = null; - if(player != null) { - LivingEntity playerAttackTarget = player.getLastHurtMob(); - if(playerAttackTarget != null && playerAttackTarget.isAlive() && this.distanceToSqr(playerAttackTarget) <= 1024) { + if(owner != null) { + LivingEntity playerAttackTarget = owner.getLastHurtMob(); + if(playerAttackTarget != null && playerAttackTarget.isAlive() && this.distanceToSqr(playerAttackTarget) <= RANGE * RANGE) { target = playerAttackTarget; } if(target == null) { - LivingEntity playerAttacker = player.getLastHurtByMob(); - if(playerAttacker != null && playerAttacker.isAlive() && this.distanceToSqr(playerAttacker) <= 1024) { + LivingEntity playerAttacker = owner.getLastHurtByMob(); + if(playerAttacker != null && playerAttacker.isAlive() && this.distanceToSqr(playerAttacker) <= RANGE * RANGE) { target = playerAttacker; } } @@ -79,40 +84,28 @@ public class BeeSummon extends Bee { target = this.getTarget(); if(target != null && target.isAlive()) { double dist = this.distanceToSqr(target); - if(dist > 256) { - flyTowards(target.getBoundingBox().getCenter(), 1, 0.5); - }else if(dist > 64) { - flyTowards(target.getBoundingBox().getCenter(), 0.75, 0.5); - }else if(dist > 4) { - flyTowards(target.getBoundingBox().getCenter(), 0.5, 0.5); + if(dist > 4) { + Vec3 targetPos = new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ()); + this.setDeltaMovement(targetPos.subtract(this.position()).normalize().scale(SPEED)); }else { + this.setDeltaMovement(this.getDeltaMovement().normalize().scale(FRICTION)); this.doHurtTarget(target); } - }else if(player != null) { - Vec3 hoverPos = player.position().add(0, 1.5, 0); - if(this.distanceToSqr(player) > 64) { - flyTowards(hoverPos, 0.75, 0.5); - }else { - this.setDeltaMovement(this.getDeltaMovement().scale(0.8)); + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(this.getDeltaMovement())); + this.setXRot(xyRot[0]); + this.setYRot(xyRot[1]); + }else { + if(this.tickCount % 40 == 0) { + Vec3 targetPos = MathUtil.getRandomPosInRadius(this.position(), 16); + this.setDeltaMovement(targetPos.subtract(this.position()).normalize().scale(SPEED / 4)); + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(this.getDeltaMovement())); + this.setXRot(xyRot[0]); + this.setYRot(xyRot[1]); } } } } - private void flyTowards(Vec3 destination, double acceleration, double friction) { - Vec3 myPos = this.getBoundingBox().getCenter(); - Vec3 dir = destination.subtract(myPos); - - if(dir.lengthSqr() > 0.05) { - dir = dir.normalize().scale(acceleration); - Vec3 newMovement = this.getDeltaMovement().add(dir).scale(friction); - this.setDeltaMovement(newMovement); - - this.getLookControl().setLookAt(destination.x, destination.y, destination.z, 30.0F, 30.0F); - this.setYRot((float)(Math.atan2(newMovement.z, newMovement.x) * (180F / Math.PI)) - 90.0F); - } - } - @Override protected void registerGoals() { super.registerGoals(); @@ -124,9 +117,7 @@ public class BeeSummon extends Bee { @Override public boolean doHurtTarget(Entity target) { if(owner == null) return false; - Player player = this.level().getPlayerByUUID(owner); - if(player == null) return false; - DamageSource damageSource = this.damageSources().mobAttack(player); + DamageSource damageSource = this.damageSources().mobAttack(owner); boolean isHurt = target.hurt(damageSource, (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE)); if(isHurt) { @@ -162,7 +153,7 @@ public class BeeSummon extends Bee { @Override public boolean isPushable() { - return false; + return true; } @Override @@ -170,7 +161,7 @@ public class BeeSummon extends Bee { super.addAdditionalSaveData(tag); tag.putInt("customAttackCount", this.customAttackCount); tag.putInt("customAge", this.customAge); - if(this.owner != null) tag.putUUID("owner", this.owner); + if(this.owner != null) tag.putUUID("owner", this.owner.getUUID()); } @Override @@ -178,7 +169,10 @@ public class BeeSummon extends Bee { super.readAdditionalSaveData(tag); if(tag.contains("customAttackCount")) this.customAttackCount = tag.getInt("customAttackCount"); if(tag.contains("customAge")) this.customAge = tag.getInt("customAge"); - if(tag.contains("owner")) this.owner = tag.getUUID("owner"); + if(tag.contains("owner") && this.level() instanceof ServerLevel level) { + Entity entity = level.getEntity(tag.getUUID("owner")); + if(entity instanceof LivingEntity livingEntity) this.owner = livingEntity; + } } } diff --git a/src/main/java/com/lzxnone/terraria/entity/summon/IStaticSummonBehavior.java b/src/main/java/com/lzxnone/terraria/entity/summon/IStaticSummonBehavior.java new file mode 100644 index 0000000..7698841 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/summon/IStaticSummonBehavior.java @@ -0,0 +1,133 @@ +package com.lzxnone.terraria.entity.summon; + +import com.lzxnone.terraria.entity.TintedVertexConsumer; +import com.lzxnone.terraria.entity.projectile.StaticProjectile; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import java.util.UUID; + +public interface IStaticSummonBehavior { + default void renderItem(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticSummon summon)) return; + ItemStack itemStack = summon.getEntityData().get(StaticSummon.ITEM); + if(itemStack == ItemStack.EMPTY) return; + + poseStack.pushPose(); + + //旋转(方向修正) + poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTick, summon.yRotO, summon.getYRot()))); + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTick, summon.xRotO, summon.getXRot()))); + + //旋转(自修正) + poseStack.mulPose(Axis.XP.rotationDegrees(summon.getEntityData().get(StaticSummon.RXP) + summon.getEntityData().get(StaticSummon.RXPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + poseStack.mulPose(Axis.YP.rotationDegrees(summon.getEntityData().get(StaticSummon.RYP) + summon.getEntityData().get(StaticSummon.RYPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + poseStack.mulPose(Axis.ZP.rotationDegrees(summon.getEntityData().get(StaticSummon.RZP) + summon.getEntityData().get(StaticSummon.RZPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + + //缩放 + poseStack.scale( + summon.getEntityData().get(StaticSummon.SCALE_X), + summon.getEntityData().get(StaticSummon.SCALE_Y), + summon.getEntityData().get(StaticSummon.SCALE_Z) + ); + + Minecraft.getInstance().getItemRenderer().renderStatic( + itemStack, + ItemDisplayContext.NONE, + summon.getEntityData().get(StaticSummon.GLOW) ? LightTexture.FULL_BRIGHT : packedLight, + OverlayTexture.NO_OVERLAY, + poseStack, + renderType -> { + VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType); + return new TintedVertexConsumer(vertexConsumer, + summon.getEntityData().get(StaticSummon.COLOR_R), + summon.getEntityData().get(StaticSummon.COLOR_G), + summon.getEntityData().get(StaticSummon.COLOR_B), + summon.getEntityData().get(StaticSummon.COLOR_A)); + }, + entity.level(), + 0 + ); + poseStack.popPose(); + } + + default void renderBlock(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticSummon summon)) return; + BlockState blockState = summon.getEntityData().get(StaticSummon.BLOCK); + if(blockState == Blocks.AIR.defaultBlockState()) return; + + poseStack.pushPose(); + + //旋转(方向修正) + poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTick, summon.yRotO, summon.getYRot()))); + poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTick, summon.xRotO, summon.getXRot()))); + + //旋转(自修正) + poseStack.mulPose(Axis.XP.rotationDegrees(summon.getEntityData().get(StaticSummon.RXP) + summon.getEntityData().get(StaticSummon.RXPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + poseStack.mulPose(Axis.YP.rotationDegrees(summon.getEntityData().get(StaticSummon.RYP) + summon.getEntityData().get(StaticSummon.RYPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + poseStack.mulPose(Axis.ZP.rotationDegrees(summon.getEntityData().get(StaticSummon.RZP) + summon.getEntityData().get(StaticSummon.RZPS) * (summon.getEntityData().get(StaticSummon.AGE) + partialTick))); + + //缩放 + poseStack.scale( + summon.getEntityData().get(StaticSummon.SCALE_X), + summon.getEntityData().get(StaticSummon.SCALE_Y), + summon.getEntityData().get(StaticSummon.SCALE_Z) + ); + + //位移(中心对齐) + poseStack.translate(-0.5D, -0.5D, -0.5D); + + Minecraft.getInstance().getBlockRenderer().renderSingleBlock( + blockState, + poseStack, + renderType -> { + VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType); + return new TintedVertexConsumer(vertexConsumer, + summon.getEntityData().get(StaticSummon.COLOR_R), + summon.getEntityData().get(StaticSummon.COLOR_G), + summon.getEntityData().get(StaticSummon.COLOR_B), + summon.getEntityData().get(StaticSummon.COLOR_A)); + }, + summon.getEntityData().get(StaticSummon.GLOW) ? LightTexture.FULL_BRIGHT : packedLight, + OverlayTexture.NO_OVERLAY, + net.neoforged.neoforge.client.model.data.ModelData.EMPTY, + null + ); + poseStack.popPose(); + } + + default void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {} + + default void checkBeforeTick(StaticSummon summon) { + if(summon.level().isClientSide()) return; + if(summon.getOwner() == null) { + onDied(summon); + return; + } + if(summon.getEntityData().get(StaticSummon.AGE) > summon.getEntityData().get(StaticSummon.LIFETIME)) { + onDied(summon); + }else { + summon.getEntityData().set(StaticSummon.AGE, summon.getEntityData().get(StaticSummon.AGE) + 1); + } + } + + default void tick(StaticSummon summon) { + checkBeforeTick(summon); + } + + default void onDied(StaticSummon summon) { + if(!summon.level().isClientSide()) summon.discard(); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummon.java b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummon.java new file mode 100644 index 0000000..b1da385 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummon.java @@ -0,0 +1,200 @@ +package com.lzxnone.terraria.entity.summon; + +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; + +import java.util.*; + +public class StaticSummon extends Entity { + public static final EntityDataAccessor BEHAVIOR = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.STRING); + public static final EntityDataAccessor RENDER_MODE = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.STRING); + public static final EntityDataAccessor ITEM = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.ITEM_STACK); + public static final EntityDataAccessor BLOCK = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.BLOCK_STATE); + public static final EntityDataAccessor SCALE_X = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor SCALE_Y = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor SCALE_Z = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor RXP = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor RYP = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor RZP = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor RXPS = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor RYPS = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor RZPS = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor COLOR_R = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_G = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_B = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor COLOR_A = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor GLOW = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor AGE = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + public static final EntityDataAccessor LIFETIME = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.INT); + + public static final EntityDataAccessor> OWNER = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.OPTIONAL_UUID); + public static final EntityDataAccessor CUSTOM_DATA = + SynchedEntityData.defineId(StaticSummon.class, EntityDataSerializers.COMPOUND_TAG); + + public LinkedList trailPositions = new LinkedList<>(); + + private Entity owner = null; + + public StaticSummon(EntityType entityType, Level level) { + super(entityType, level); + } + + public void setOwner(Entity entity) { + if(entity == null) return; + this.entityData.set(OWNER, Optional.of(entity.getUUID())); + this.owner = entity; + } + + public Entity getOwner() { + if(owner == null) { + if(this.entityData.get(OWNER).orElse(null) != null) { + UUID uuid = this.entityData.get(OWNER).orElse(null); + if(!this.level().isClientSide()) { + setOwner(((ServerLevel) this.level()).getEntity(uuid)); + }else { + for(Entity entity : this.level().getEntities(this, this.getBoundingBox().inflate(64.0))) { + if(entity.getUUID().equals(uuid)) { + setOwner(entity); + } + } + } + } + } + return owner; + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(BEHAVIOR, "default"); + builder.define(RENDER_MODE, "custom"); + builder.define(ITEM, ItemStack.EMPTY); + builder.define(BLOCK, Blocks.AIR.defaultBlockState()); + builder.define(SCALE_X, 1.0f); + builder.define(SCALE_Y, 1.0f); + builder.define(SCALE_Z, 1.0f); + builder.define(RXP, 0); + builder.define(RYP, 0); + builder.define(RZP, 0); + builder.define(RXPS, 0); + builder.define(RYPS, 0); + builder.define(RZPS, 0); + builder.define(COLOR_R, 1.0f); + builder.define(COLOR_G, 1.0f); + builder.define(COLOR_B, 1.0f); + builder.define(COLOR_A, 1.0f); + builder.define(GLOW, false); + builder.define(AGE, 0); + builder.define(LIFETIME, 100); + builder.define(OWNER, Optional.empty()); + builder.define(CUSTOM_DATA, new CompoundTag()); + } + + @Override + public void tick() { + super.tick(); + this.owner = getOwner(); + StaticSummonBehaviors.getBehavior(this.entityData.get(BEHAVIOR)).tick(this); + this.move(MoverType.SELF, this.getDeltaMovement()); + } + + @Override + public void addAdditionalSaveData(CompoundTag tag) { + tag.putString("behavior", this.entityData.get(BEHAVIOR)); + tag.putString("renderMode", this.entityData.get(RENDER_MODE)); + ItemStack stack = this.entityData.get(ITEM); + if(!stack.isEmpty()) tag.put("item", stack.save(this.level().registryAccess())); + tag.put("block", NbtUtils.writeBlockState(this.entityData.get(BLOCK))); + tag.putFloat("scaleX", this.entityData.get(SCALE_X)); + tag.putFloat("scaleY", this.entityData.get(SCALE_Y)); + tag.putFloat("scaleZ", this.entityData.get(SCALE_Z)); + tag.putInt("rxp", this.entityData.get(RXP)); + tag.putInt("ryp", this.entityData.get(RYP)); + tag.putInt("rzp", this.entityData.get(RZP)); + tag.putInt("rxps", this.entityData.get(RXPS)); + tag.putInt("ryps", this.entityData.get(RYPS)); + tag.putInt("rzps", this.entityData.get(RZPS)); + tag.putFloat("colorR", this.entityData.get(COLOR_R)); + tag.putFloat("colorG", this.entityData.get(COLOR_G)); + tag.putFloat("colorB", this.entityData.get(COLOR_B)); + tag.putFloat("colorA", this.entityData.get(COLOR_A)); + tag.putBoolean("glow", this.entityData.get(GLOW)); + tag.putInt("age", this.entityData.get(AGE)); + tag.putInt("lifetime", this.entityData.get(LIFETIME)); + if(getOwner() != null) tag.putUUID("owner", getOwner().getUUID()); + tag.put("customData", this.entityData.get(CUSTOM_DATA)); + } + + @Override + public void readAdditionalSaveData(CompoundTag tag) { + if(tag.contains("behavior")) this.entityData.set(BEHAVIOR, tag.getString("behavior")); + if(tag.contains("renderMode")) this.entityData.set(RENDER_MODE, tag.getString("renderMode")); + if(tag.contains("item")) { + ItemStack.parse(this.level().registryAccess(), tag.getCompound("item")) + .ifPresent(stack -> this.entityData.set(ITEM, stack)); + } + if(tag.contains("block")) { + BlockState blockState = NbtUtils.readBlockState( + this.level().holderLookup(Registries.BLOCK), + tag.getCompound("block") + ); + this.entityData.set(BLOCK, blockState); + } + if(tag.contains("scaleX")) this.entityData.set(SCALE_X, tag.getFloat("scaleX")); + if(tag.contains("scaleY")) this.entityData.set(SCALE_Y, tag.getFloat("scaleY")); + if(tag.contains("scaleZ")) this.entityData.set(SCALE_Z, tag.getFloat("scaleZ")); + if(tag.contains("rxp")) this.entityData.set(RXP, tag.getInt("rxp")); + if(tag.contains("ryp")) this.entityData.set(RYP, tag.getInt("ryp")); + if(tag.contains("rzp")) this.entityData.set(RZP, tag.getInt("rzp")); + if(tag.contains("rxps")) this.entityData.set(RXPS, tag.getInt("rxps")); + if(tag.contains("ryps")) this.entityData.set(RYPS, tag.getInt("ryps")); + if(tag.contains("rzps")) this.entityData.set(RZPS, tag.getInt("rzps")); + if(tag.contains("colorR")) this.entityData.set(COLOR_R, tag.getFloat("colorR")); + if(tag.contains("colorG")) this.entityData.set(COLOR_G, tag.getFloat("colorG")); + if(tag.contains("colorB")) this.entityData.set(COLOR_B, tag.getFloat("colorB")); + if(tag.contains("colorA")) this.entityData.set(COLOR_A, tag.getFloat("colorA")); + if(tag.contains("glow")) this.entityData.set(GLOW, tag.getBoolean("glow")); + if(tag.contains("age")) this.entityData.set(AGE, tag.getInt("age")); + if(tag.contains("lifetime")) this.entityData.set(LIFETIME, tag.getInt("lifetime")); + if(tag.contains("owner")) { + this.entityData.set(OWNER, Optional.of(tag.getUUID("owner"))); + getOwner(); + } + if(tag.contains("customData")) this.entityData.set(CUSTOM_DATA, tag.getCompound("customData")); + } + +} diff --git a/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonBehaviors.java b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonBehaviors.java new file mode 100644 index 0000000..d17c0d5 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonBehaviors.java @@ -0,0 +1,30 @@ +package com.lzxnone.terraria.entity.summon; + +import com.lzxnone.terraria.item.weapon.melee.*; + +import java.util.HashMap; +import java.util.Map; + +public class StaticSummonBehaviors { + private static final Map BEHAVIORS = new HashMap<>(); + + public static final String DEFAULT = "default"; + public static final String SEEDLER_NUT = "seedler_nut"; + public static final String THE_HORSEMANS_BLADE_JACK = "the_horsemans_blade_jack"; + public static final String INFLUX_WAVER_BEAM = "influx_waver_beam"; + public static final String MEOWMERE_PROJECTILE = "meowmere_projectile"; + public static final String TERRA_BLADE_BEAM = "terra_blade_beam"; + + static { + BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {}); + BEHAVIORS.put(SEEDLER_NUT, Seedler.SUMMON_BEHAVIOR); + BEHAVIORS.put(THE_HORSEMANS_BLADE_JACK, TheHorsemansBlade.SUMMON_BEHAVIOR); + BEHAVIORS.put(INFLUX_WAVER_BEAM, InfluxWaver.SUMMON_BEHAVIOR); + BEHAVIORS.put(MEOWMERE_PROJECTILE, Meowmere.SUMMON_BEHAVIOR); + BEHAVIORS.put(TERRA_BLADE_BEAM, TerraBlade.SUMMON_BEHAVIOR); + } + + public static IStaticSummonBehavior getBehavior(String id) { + return BEHAVIORS.getOrDefault(id, BEHAVIORS.get(DEFAULT)); + } +} diff --git a/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonRenderer.java b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonRenderer.java new file mode 100644 index 0000000..ad07262 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/entity/summon/StaticSummonRenderer.java @@ -0,0 +1,37 @@ +package com.lzxnone.terraria.entity.summon; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; + +public class StaticSummonRenderer extends EntityRenderer { + public StaticSummonRenderer(EntityRendererProvider.Context context) { + super(context); + } + + @Override + public void render(Entity entity, float entityYaw, float partialTick, + PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticSummon summon)) return; + if(summon.getEntityData().get(StaticSummon.RENDER_MODE).equals("item") && summon.getEntityData().get(StaticSummon.ITEM) != ItemStack.EMPTY) { + StaticSummonBehaviors.getBehavior(summon.getEntityData().get(StaticSummon.BEHAVIOR)).renderItem(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + }else if(summon.getEntityData().get(StaticSummon.RENDER_MODE).equals("block") && summon.getEntityData().get(StaticSummon.BLOCK) != Blocks.AIR.defaultBlockState()) { + StaticSummonBehaviors.getBehavior(summon.getEntityData().get(StaticSummon.BEHAVIOR)).renderBlock(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + }else if(!summon.getEntityData().get(StaticSummon.GLOW)) { + StaticSummonBehaviors.getBehavior(summon.getEntityData().get(StaticSummon.BEHAVIOR)).render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + } + super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + } + + @Override + public ResourceLocation getTextureLocation(Entity entity) { + return InventoryMenu.BLOCK_ATLAS; + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/ItemWaveBehaviors.java b/src/main/java/com/lzxnone/terraria/item/ItemWaveBehaviors.java index 0d5c8f2..c174222 100644 --- a/src/main/java/com/lzxnone/terraria/item/ItemWaveBehaviors.java +++ b/src/main/java/com/lzxnone/terraria/item/ItemWaveBehaviors.java @@ -1,6 +1,8 @@ package com.lzxnone.terraria.item; import com.lzxnone.terraria.item.weapon.melee.BeeKeeper; +import com.lzxnone.terraria.item.weapon.melee.TerraBlade; +import com.lzxnone.terraria.item.weapon.melee.TheHorsemansBlade; import java.util.HashMap; import java.util.Map; @@ -10,11 +12,14 @@ public class ItemWaveBehaviors { public static final String DEFAULT = "default"; public static final String BEE_KEEPER = "bee_keeper"; + public static final String THE_HORSEMANS_BLADE = "the_horsemans_blade"; + public static final String TERRA_BLADE = "terra_blade"; static { - BEHAVIORS.put(DEFAULT, new IItemWaveBehavior() { - }); + BEHAVIORS.put(DEFAULT, new IItemWaveBehavior() {}); BEHAVIORS.put(BEE_KEEPER, BeeKeeper.ITEM_WAVE_BEHAVIOR); + BEHAVIORS.put(THE_HORSEMANS_BLADE, TheHorsemansBlade.ITEM_WAVE_BEHAVIOR); + BEHAVIORS.put(TERRA_BLADE, TerraBlade.ITEM_WAVE_BEHAVIOR); } public static IItemWaveBehavior getBehavior(String id) { diff --git a/src/main/java/com/lzxnone/terraria/item/ModItems.java b/src/main/java/com/lzxnone/terraria/item/ModItems.java index 901607c..8457250 100644 --- a/src/main/java/com/lzxnone/terraria/item/ModItems.java +++ b/src/main/java/com/lzxnone/terraria/item/ModItems.java @@ -1,10 +1,7 @@ package com.lzxnone.terraria.item; import com.lzxnone.terraria.LzxnoneTerraria; -import com.lzxnone.terraria.item.projectile.EnchantedSwordBeam; -import com.lzxnone.terraria.item.projectile.SeedlerNut; -import com.lzxnone.terraria.item.projectile.SeedlerThorn; -import com.lzxnone.terraria.item.projectile.StarfuryStar; +import com.lzxnone.terraria.item.projectile.*; import com.lzxnone.terraria.item.weapon.melee.*; import net.minecraft.world.item.Item; import net.neoforged.neoforge.registries.DeferredItem; @@ -13,28 +10,26 @@ import net.neoforged.neoforge.registries.DeferredRegister; public class ModItems { public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(LzxnoneTerraria.MODID); - public static final DeferredItem COPPER_SHORTSWORD = ITEMS.register("copper_shortsword", CopperShortsword::new); - public static final DeferredItem ENCHANTED_SWORD = ITEMS.register("enchanted_sword", EnchantedSword::new); + public static final DeferredItem COPPER_SHORTSWORD = ITEMS.register("copper_shortsword", CopperShortsword::new); + public static final DeferredItem ENCHANTED_SWORD = ITEMS.register("enchanted_sword", EnchantedSword::new); public static final DeferredItem BEE_KEEPER = ITEMS.register("bee_keeper", BeeKeeper::new); public static final DeferredItem STARFURY = ITEMS.register("starfury", Starfury::new); public static final DeferredItem SEEDLER = ITEMS.register("seedler", Seedler::new); + public static final DeferredItem THE_HORSEMANS_BLADE = ITEMS.register("the_horsemans_blade", TheHorsemansBlade::new); + public static final DeferredItem INFLUX_WAVER = ITEMS.register("influx_waver", InfluxWaver::new); + public static final DeferredItem STAR_WRATH = ITEMS.register("star_wrath", StarWrath::new); + public static final DeferredItem MEOWMERE = ITEMS.register("meowmere", Meowmere::new); + public static final DeferredItem TERRA_BLADE = ITEMS.register("terra_blade", TerraBlade::new); - public static final DeferredItem INFLUX_WAVER = ITEMS.register("influx_waver", - () -> new Item(new Item.Properties())); - public static final DeferredItem MEOWMERE = ITEMS.register("meowmere", - () -> new Item(new Item.Properties())); - public static final DeferredItem STAR_WRATH = ITEMS.register("star_wrath", - () -> new Item(new Item.Properties())); - public static final DeferredItem TERRA_BLADE = ITEMS.register("terra_blade", - () -> new Item(new Item.Properties())); - public static final DeferredItem THE_HORSEMANS_BLADE = ITEMS.register("the_horsemans_blade", - () -> new Item(new Item.Properties())); public static final DeferredItem ZENITH = ITEMS.register("zenith", () -> new Item(new Item.Properties())); //弹射物 - public static final DeferredItem ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new); - public static final DeferredItem STARFURY_STAR = ITEMS.register("starfury_star", StarfuryStar::new); - public static final DeferredItem SEEDLER_NUT = ITEMS.register("seedler_nut", SeedlerNut::new); - public static final DeferredItem SEEDLER_THORN = ITEMS.register("seedler_thorn", SeedlerThorn::new); + public static final DeferredItem ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new); + public static final DeferredItem STARFURY_STAR = ITEMS.register("starfury_star", StarfuryStar::new); + public static final DeferredItem SEEDLER_NUT = ITEMS.register("seedler_nut", SeedlerNut::new); + public static final DeferredItem SEEDLER_THORN = ITEMS.register("seedler_thorn", SeedlerThorn::new); + public static final DeferredItem INFLUX_WAVER_BEAM = ITEMS.register("influx_waver_beam", InfluxWaverBeam::new); + public static final DeferredItem STAR_WRATH_STAR = ITEMS.register("star_wrath_star", StarWrathStar::new); + public static final DeferredItem MEOWMERE_PROJECTILE = ITEMS.register("meowmere_projectile", MeowmereProjectile::new); } diff --git a/src/main/java/com/lzxnone/terraria/item/projectile/InfluxWaverBeam.java b/src/main/java/com/lzxnone/terraria/item/projectile/InfluxWaverBeam.java new file mode 100644 index 0000000..2a2d3ba --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/projectile/InfluxWaverBeam.java @@ -0,0 +1,9 @@ +package com.lzxnone.terraria.item.projectile; + +import net.minecraft.world.item.Item; + +public class InfluxWaverBeam extends Item { + public InfluxWaverBeam() { + super(new Item.Properties()); + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/projectile/MeowmereProjectile.java b/src/main/java/com/lzxnone/terraria/item/projectile/MeowmereProjectile.java new file mode 100644 index 0000000..1bc97fb --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/projectile/MeowmereProjectile.java @@ -0,0 +1,9 @@ +package com.lzxnone.terraria.item.projectile; + +import net.minecraft.world.item.Item; + +public class MeowmereProjectile extends Item { + public MeowmereProjectile() { + super(new Item.Properties()); + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/projectile/StarWrathStar.java b/src/main/java/com/lzxnone/terraria/item/projectile/StarWrathStar.java new file mode 100644 index 0000000..03977ab --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/projectile/StarWrathStar.java @@ -0,0 +1,9 @@ +package com.lzxnone.terraria.item.projectile; + +import net.minecraft.world.item.Item; + +public class StarWrathStar extends Item { + public StarWrathStar() { + super(new Item.Properties()); + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/BeeKeeper.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/BeeKeeper.java index d8b76e5..97e1998 100644 --- a/src/main/java/com/lzxnone/terraria/item/weapon/melee/BeeKeeper.java +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/BeeKeeper.java @@ -5,6 +5,8 @@ import com.lzxnone.terraria.effect.ModEffects; import com.lzxnone.terraria.entity.ModEntities; import com.lzxnone.terraria.entity.summon.BeeSummon; import com.lzxnone.terraria.item.IItemWaveBehavior; +import com.lzxnone.terraria.utils.FilterUtil; +import com.lzxnone.terraria.utils.MathUtil; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -18,6 +20,7 @@ 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.Vec3; import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; public class BeeKeeper extends SwordItem { @@ -43,7 +46,7 @@ public class BeeKeeper extends SwordItem { Item item = itemStack.getItem(); if(item instanceof BeeKeeper && !player.getCooldowns().isOnCooldown(item)) { Entity target = event.getTarget(); - if(target instanceof LivingEntity livingTarget) { + if(target instanceof LivingEntity livingTarget && FilterUtil.createLivingTargetFilter(player).test(livingTarget)) { livingTarget.addEffect(new MobEffectInstance( ModEffects.CONFUSED, 40, @@ -54,8 +57,8 @@ public class BeeKeeper extends SwordItem { while(count-- > 0) { BeeSummon bee = ModEntities.BEE_SUMMON.get().create(player.level()); if(bee != null) { - bee.owner = player.getUUID(); - bee.setPos(target.position()); + bee.owner = player; + bee.setPos(new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ())); player.level().addFreshEntity(bee); } } diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/EnchantedSword.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/EnchantedSword.java index d9450db..932a706 100644 --- a/src/main/java/com/lzxnone/terraria/item/weapon/melee/EnchantedSword.java +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/EnchantedSword.java @@ -3,19 +3,23 @@ package com.lzxnone.terraria.item.weapon.melee; import com.lzxnone.terraria.LzxnoneTerraria; import com.lzxnone.terraria.ModSounds; import com.lzxnone.terraria.entity.ModEntities; -import com.lzxnone.terraria.entity.projectile.IProjectileBehavior; -import com.lzxnone.terraria.entity.projectile.ProjectileBehaviors; -import com.lzxnone.terraria.entity.projectile.TextureProjectile; +import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior; +import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors; +import com.lzxnone.terraria.entity.projectile.StaticProjectile; import com.lzxnone.terraria.item.ModItems; -import com.lzxnone.terraria.particle.DustParticleOptions; import com.lzxnone.terraria.particle.ModParticles; +import com.lzxnone.terraria.utils.FilterUtil; import com.lzxnone.terraria.utils.MathUtil; +import com.lzxnone.terraria.utils.ParticleUtil; +import com.lzxnone.terraria.utils.SoundUtil; import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; 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.AttributeModifier; @@ -49,39 +53,38 @@ public class EnchantedSword extends SwordItem { )); } - - - public static final IProjectileBehavior PROJECTILE_BEHAVIOR = new IProjectileBehavior() { + public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() { @Override - public void onMoving(TextureProjectile projectile) { - projectile.level().addParticle( - ModParticles.COLORFUL_PARTICLE, - projectile.getX(), projectile.getY(), projectile.getZ(), - (Math.random() * 2 - 1) * 0.1, (Math.random() * 2 - 1) * 0.1, (Math.random() * 2 - 1) * 0.1 + public void onMoving(StaticProjectile projectile) { + ParticleUtil.addParticle( + projectile.level(), ModParticles.COLORFUL_PARTICLE, + projectile.position(), 0.0, + new Vec3(0, 0, 0), 0.1 ); } @Override - public void onHitEntity(TextureProjectile projectile, EntityHitResult result) { + public void onHitEntity(StaticProjectile projectile, EntityHitResult result) { if(!projectile.level().isClientSide()) { if(result.getEntity() instanceof LivingEntity target) { - if(target.hurt(projectile.damageSources().thrown(projectile, projectile.getOwner()), 5.5f)) { - ((ServerLevel) projectile.level()).sendParticles( - ModParticles.COLORFUL_PARTICLE, - projectile.getX(), projectile.getY(), projectile.getZ(), - 25, - 0.2, 0.2, 0.2, - 0.2 + Entity owner = projectile.getOwner(); + if(owner == null) return; + if(!FilterUtil.createLivingTargetFilter(owner).test(target) || !(owner instanceof Player player)) return; + if(target.hurt(projectile.damageSources().playerAttack(player), 5.5f)) { + ParticleUtil.addParticles( + (ServerLevel) projectile.level(), ModParticles.COLORFUL_PARTICLE, + projectile.position(), new Vec3(0.2, 0.2, 0.2), + 0.2, 25 ); - projectile.discard(); + onDied(projectile); } } } } @Override - public void onHitBlock(TextureProjectile projectile, BlockHitResult result) { + public void onHitBlock(StaticProjectile projectile, BlockHitResult result) { if(projectile.level().isClientSide()) return; if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { - projectile.discard(); + onDied(projectile); } } }; @@ -93,38 +96,38 @@ public class EnchantedSword extends SwordItem { if(!level.isClientSide()) { Vec3 lookVec = player.getLookAngle(); - Vector3f[] dirs = MathUtil.computeProjectileDir( + Vector3f[] dirs = MathUtil.computeDir( MathUtil.toVector3f(lookVec) ); - TextureProjectile projectile = new TextureProjectile(ModEntities.TEXTURE_PROJECTILE.get(), level); + 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(TextureProjectile.BEHAVIOR, ProjectileBehaviors.ENCHANTED_SWORD_BEAM); - projectile.getEntityData().set(TextureProjectile.ORIGIN, MathUtil.toVector3f(pos)); - projectile.getEntityData().set(TextureProjectile.DIRECTION, dirs[0]); - projectile.getEntityData().set(TextureProjectile.UP, dirs[1]); - projectile.getEntityData().set(TextureProjectile.RIGHT, dirs[2]); - projectile.getEntityData().set(TextureProjectile.ITEM, new ItemStack(ModItems.ENCHANTED_SWORD_BEAM.get())); - projectile.getEntityData().set(TextureProjectile.SCALE_X, 0.5f); - projectile.getEntityData().set(TextureProjectile.SCALE_Y, 0.5f); - projectile.getEntityData().set(TextureProjectile.RXP, 90); - projectile.getEntityData().set(TextureProjectile.RZP, 45); - projectile.getEntityData().set(TextureProjectile.RYPS, 10); - projectile.getEntityData().set(TextureProjectile.GLOW, true); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Z, "t"); + projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM); + projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "item"); + projectile.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(pos)); + 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.ENCHANTED_SWORD_BEAM.get())); + projectile.getEntityData().set(StaticProjectile.SCALE_X, 0.5f); + projectile.getEntityData().set(StaticProjectile.SCALE_Y, 0.5f); + projectile.getEntityData().set(StaticProjectile.RXP, 90); + projectile.getEntityData().set(StaticProjectile.RZP, 45); + projectile.getEntityData().set(StaticProjectile.RYPS, 10); + projectile.getEntityData().set(StaticProjectile.GLOW, true); + projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, "t"); projectile.setDeltaMovement(MathUtil.toVec3(dirs[0])); level.addFreshEntity(projectile); - - ((ServerLevel) player.level()).sendParticles( - ModParticles.COLORFUL_PARTICLE, - player.getX(), player.getY() + 0.5, player.getZ(), - 25, - 0.2, 0.2, 0.2, - 0.2 + }else { + ParticleUtil.addParticles( + player.level(), ModParticles.COLORFUL_PARTICLE, + new Vec3(player.getX(), player.getY() + 0.5, player.getZ()), 0.2, + new Vec3(0, 0, 0), 0.2, + 25 ); - player.level().playSound(null, player, ModSounds.BEAM.get(), SoundSource.PLAYERS, 4.0F, 1.0F); + SoundUtil.playClientSound(player, ModSounds.BEAM.get()); } player.getCooldowns().addCooldown(stack.getItem(), 15); @@ -134,27 +137,28 @@ public class EnchantedSword extends SwordItem { @Override public void inventoryTick(ItemStack stack, Level level, net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) { super.inventoryTick(stack, level, entity, slotId, isSelected); - if(isSelected && entity instanceof Player player) { - boolean currentlyOnCooldown = player.getCooldowns().isOnCooldown(this); - boolean wasOnCooldown = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) - .copyTag().getBoolean("WasOnCooldown"); - - if(wasOnCooldown && !currentlyOnCooldown) { - if(level.isClientSide()) { - player.playSound(ModSounds.MAX_MANA.get(), 4.0F, 1.0F); - }else { - ((ServerLevel) player.level()).sendParticles( - ModParticles.MAX_MANA_PARTICLE, - player.getX(), player.getY() + 0.5, player.getZ(), - 5, - 0.2, 0.2, 0.2, - 0.2 - ); + if(entity instanceof Player player) { + if(isSelected) { + boolean current = player.getCooldowns().isOnCooldown(this); + boolean prev = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) + .copyTag().getBoolean("onCooldown"); + if(prev && !current) { + if(level.isClientSide()) { + SoundUtil.playClientSound(player, ModSounds.MAX_MANA.get()); + ParticleUtil.addParticles( + player.level(), ModParticles.MAX_MANA_PARTICLE, + new Vec3(player.getX(), player.getY() + 1.0, player.getZ()), 0.05, + new Vec3(0, 0, 0), 0.05, + 5 + ); + } } + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putBoolean("onCooldown", current)); + }else { + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putBoolean("onCooldown", false)); } - - CustomData.update(DataComponents.CUSTOM_DATA, stack, - tag -> tag.putBoolean("WasOnCooldown", currentlyOnCooldown)); } } } diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/InfluxWaver.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/InfluxWaver.java new file mode 100644 index 0000000..a9c930b --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/InfluxWaver.java @@ -0,0 +1,250 @@ +package com.lzxnone.terraria.item.weapon.melee; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.ModSounds; +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.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.particle.ModParticles; +import com.lzxnone.terraria.utils.CollisionUtil; +import com.lzxnone.terraria.utils.FilterUtil; +import com.lzxnone.terraria.utils.MathUtil; +import com.lzxnone.terraria.utils.ParticleUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundSource; +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.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; +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.Blocks; +import net.minecraft.world.phys.*; +import net.objecthunter.exp4j.ExpressionBuilder; +import org.joml.Vector3f; + +import java.util.Comparator; +import java.util.List; +import java.util.Locale; + +public class InfluxWaver extends SwordItem { + public InfluxWaver() { + super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder() + .add(Attributes.ATTACK_DAMAGE, + new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 11, 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), + EquipmentSlotGroup.MAINHAND) + .build() + )); + } + + public static final int MAX_SUMMON_COUNT = 2; + public static final double SPEED = 1.0; + public static final float FADE_OUT = 0.1f; + public static final float FRICTION = 0.1f; + public static final float SUMMON_RADIUS = 8.0f; + public static final float SEARCH_RADIUS = 24.0f; + + public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { + @Override + public void tick(StaticSummon summon) { + this.checkBeforeTick(summon); + + CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); + if(!customData.contains("idx")) return; + int idx = customData.getInt("idx"); + + boolean checkBlock = true; + boolean checkEntity = true; + + //粒子 + if(summon.level().isClientSide()) { + ParticleUtil.addParticle( + summon.level(), ModParticles.INFLUX_WAVER_DROP_PARTICLE.get(), + summon.position(), 0.0, + new Vec3(0, idx == 0 ? -0.1 : 0, 0), 0.00 + ); + } + + //运动逻辑 + if(customData.contains("dead")) { + if(customData.getBoolean("dead")) { + Vec3 currentMovement = summon.getDeltaMovement(); + double speed = currentMovement.length(); + + if(speed <= FRICTION) { + summon.setDeltaMovement(Vec3.ZERO); + }else { + Vec3 newMovement = currentMovement.scale((speed - FRICTION) / speed); + summon.setDeltaMovement(newMovement); + } + } + float alpha = summon.getEntityData().get(StaticSummon.COLOR_A) - FADE_OUT; + summon.getEntityData().set(StaticSummon.COLOR_A, alpha); + if(alpha < 0.001f) { + this.onDied(summon); + return; + } + checkBlock = false; + checkEntity = false; + }else { + if(idx == 0) { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(SPEED)); + }else { + checkBlock = false; + if(customData.contains("target")) { + Entity target = summon.level().getEntity(customData.getInt("target")); + if(target == null || !target.isAlive()) { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(SPEED)); + checkEntity = false; + }else { + Vec3 targetPos = new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ()); + summon.setDeltaMovement(targetPos.subtract(summon.position()).normalize().scale(SPEED)); + } + }else { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(SPEED)); + checkEntity = false; + } + } + } + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(summon.getDeltaMovement())); + summon.setXRot(xyRot[0]); + summon.xRotO = xyRot[0]; + summon.setYRot(xyRot[1]); + summon.yRotO = xyRot[1]; + + //碰撞逻辑 + if(!summon.level().isClientSide()) { + Vec3 motion = summon.getDeltaMovement(); + if(checkBlock) { + BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); + if(blockHitResult.getType() != HitResult.Type.MISS) { + customData.putBoolean("dead", true); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + return; + } + } + if(checkEntity) { + EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion)); + if(entityHitResult != null) { + Entity hitTarget = entityHitResult.getEntity(); + Entity target = customData.contains("target") ? summon.level().getEntity(customData.getInt("target")) : null; + if(target != null && !hitTarget.getUUID().equals(target.getUUID())) return; + if(hitTarget instanceof LivingEntity livingEntity && summon.getOwner() instanceof Player player && FilterUtil.createLivingTargetFilter(player).test(livingEntity)) { + if(livingEntity.hurt(summon.damageSources().playerAttack(player), 12.0f)) { + customData.putBoolean("dead", false); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + return; + } + } + } + } + } + } + + @Override + public void onDied(StaticSummon summon) { + if(!summon.level().isClientSide()) { + CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); + if(customData.contains("dead") && !customData.getBoolean("dead") && customData.contains("idx") && customData.getInt("idx") < MAX_SUMMON_COUNT) { + if(summon.getOwner() instanceof Player player) { + Entity target = InfluxWaver.search(player, summon.position()); + if(target != null) { + Vec3 targetPos = new Vec3(target.getX(), target.getY() + target.getBbHeight() / 2, target.getZ()); + Vec3 summonPos = MathUtil.getRandomPosOnRadius(targetPos, SUMMON_RADIUS); + InfluxWaver.summon(player, summonPos, targetPos.subtract(summonPos).normalize(), target, customData.getInt("idx") + 1); + } + } + } + summon.discard(); + } + } + }; + + public static void summon(Player player, Vec3 pos, Vec3 dir, Entity target, int idx) { + if(player == null) return; + StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), player.level()); + summon.setOwner(player); + summon.setPos(pos); + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(dir)); + summon.setXRot(xyRot[0]); + summon.xRotO = xyRot[0]; + summon.setYRot(xyRot[1]); + summon.yRotO = xyRot[1]; + + summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.INFLUX_WAVER_BEAM); + summon.getEntityData().set(StaticSummon.RENDER_MODE, "item"); + summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.INFLUX_WAVER_BEAM.get())); + summon.getEntityData().set(StaticSummon.SCALE_X, 1.25f); + summon.getEntityData().set(StaticSummon.SCALE_Y, 1.25f); + summon.getEntityData().set(StaticSummon.RXP, -90); + summon.getEntityData().set(StaticSummon.RZP, -135); + summon.getEntityData().set(StaticSummon.GLOW, true); + summon.setNoGravity(true); + summon.noPhysics = true; + + CompoundTag customData = new CompoundTag(); + if(target != null) customData.putInt("target", target.getId()); + customData.putInt("idx", idx); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + player.level().addFreshEntity(summon); + } + + public static Entity search(Player player, Vec3 pos) { + AABB searchBox = new AABB( + pos.x - SEARCH_RADIUS, pos.y - SEARCH_RADIUS, pos.z - SEARCH_RADIUS, + pos.x + SEARCH_RADIUS, pos.y + SEARCH_RADIUS, pos.z + SEARCH_RADIUS + ); + List entities = player.level().getEntitiesOfClass( + Monster.class, + searchBox, + FilterUtil.createMonsterFilter(player) + ); + Monster target = null; + entities.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos))); + if(!entities.isEmpty()) target = entities.getFirst(); + return target; + } + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack stack = player.getItemInHand(hand); + + if(!level.isClientSide()) { + summon(player, new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ()), player.getLookAngle(), null, 0); + }else { + ParticleUtil.addParticles( + level, ModParticles.INFLUX_WAVER_DROP_PARTICLE.get(), + player.position(), 1.0, + new Vec3(0, 0, 0), 0, + 25 + ); + } + + player.getCooldowns().addCooldown(stack.getItem(), 8); + return InteractionResultHolder.sidedSuccess(stack, level.isClientSide()); + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/Meowmere.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Meowmere.java new file mode 100644 index 0000000..51c9b29 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Meowmere.java @@ -0,0 +1,311 @@ +package com.lzxnone.terraria.item.weapon.melee; + +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.particle.DustParticleOptions; +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.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +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.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.*; +import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.*; +import org.joml.Matrix4f; +import org.joml.Vector3f; + +import java.util.List; + +public class Meowmere extends SwordItem { + public Meowmere() { + super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder() + .add(Attributes.ATTACK_DAMAGE, + new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 19, 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), + EquipmentSlotGroup.MAINHAND) + .build() + )); + } + + public static final DustParticleOptions PARTICLE = new DustParticleOptions( + 0.05f, 0.5f, 40, true, new Vector3f[]{ + new Vector3f(1.00f, 0.50f, 0.50f), // 淡红 (柔粉红) + new Vector3f(1.00f, 0.75f, 0.50f), // 淡橙 (奶油橘) + new Vector3f(1.00f, 1.00f, 0.50f), // 淡黄 (米黄色) + new Vector3f(0.50f, 1.00f, 0.50f), // 淡绿 (薄荷绿) + new Vector3f(0.50f, 1.00f, 1.00f), // 淡青 (冰蓝色) + new Vector3f(0.50f, 0.50f, 1.00f), // 淡蓝 (天蓝色) + new Vector3f(0.75f, 0.50f, 1.00f) // 淡紫 (薰衣草) + } + ); + + public static final DustParticleOptions PARTICLE2 = new DustParticleOptions( + 0.2f, 0.5f, 40, true, new Vector3f[]{ + new Vector3f(1.00f, 0.50f, 0.50f), // 淡红 (柔粉红) + new Vector3f(1.00f, 0.75f, 0.50f), // 淡橙 (奶油橘) + new Vector3f(1.00f, 1.00f, 0.50f), // 淡黄 (米黄色) + new Vector3f(0.50f, 1.00f, 0.50f), // 淡绿 (薄荷绿) + new Vector3f(0.50f, 1.00f, 1.00f), // 淡青 (冰蓝色) + new Vector3f(0.50f, 0.50f, 1.00f), // 淡蓝 (天蓝色) + new Vector3f(0.75f, 0.50f, 1.00f) // 淡紫 (薰衣草) + } + ); + + public static final double GRAVITY = 0.025; //重力 + public static final double VZ = 1.5; + + public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { + public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/rainbow.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 StaticSummon summon)) return; + + this.renderItem(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + + Vec3 currentPos = summon.getPosition(partialTick); + + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES)); + Matrix4f matrix = poseStack.last().pose(); + + int quadCount = summon.trailPositions.size() / 2 - 1; + for(int i = 0; i < quadCount;i++) { + Vec3 currentPoint1 = summon.trailPositions.get(i * 2); + Vec3 currentPoint2 = summon.trailPositions.get(i * 2 + 1); + Vec3 nextPoint1 = summon.trailPositions.get(i * 2 + 3); + Vec3 nextPoint2 = summon.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 alpha1 = 1.0F - (float) i / quadCount; + float alpha2 = 1.0F - (float) (i + 1) / quadCount; + + vertexConsumer.addVertex(matrix, (float)x1, (float)y1, (float)z1) + .setColor(1.0f, 1.0f, 1.0f, alpha1).setUv(0.0f, 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, alpha1).setUv(0.0f, 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, alpha2).setUv(1.0f, 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, alpha2).setUv(1.0f, 0.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0); + } + } + + @Override + public void tick(StaticSummon summon) { + this.checkBeforeTick(summon); + Vec3 motion = summon.getDeltaMovement(); + motion = motion.add(0, -GRAVITY, 0); + Vec3 up = MathUtil.toVec3(MathUtil.computeDir(MathUtil.toVector3f(motion))[1]).normalize(); + + summon.trailPositions.addFirst(summon.position().add(up.scale(0.5))); + summon.trailPositions.addFirst(summon.position().add(up.scale(-0.5))); + while(summon.trailPositions.size() > MAX_LENGTH) summon.trailPositions.removeLast(); + + CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); + + EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion)); + if(entityHitResult != null) { + Entity target = entityHitResult.getEntity(); + if(summon.getOwner() instanceof Player player && target instanceof LivingEntity livingEntity) { + if(livingEntity.hurt(summon.damageSources().playerAttack(player), 20.0f)) { + if(customData.contains("hitEntity") && customData.getInt("hitEntity") < 4) { + customData.putInt("hitEntity", customData.getInt("hitEntity") + 1); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + }else { + onDied(summon); + return; + } + } + } + return; + } + + BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); + if(blockHitResult.getType() != HitResult.Type.MISS) { + if(customData.contains("hitBlock")) { + int hitBlock = customData.getInt("hitBlock"); + + int soundIndex = summon.getRandom().nextInt(2); + if(soundIndex == 0) SoundUtil.playServerSound(summon.level(), ModSounds.CAT.get(), summon.position()); + else SoundUtil.playServerSound(summon.level(), ModSounds.CAT2.get(), summon.position()); + + if(summon.level().isClientSide()) { + Vec3 dir = summon.getDeltaMovement(); + Vector3f[] dirs = MathUtil.computeDir(MathUtil.toVector3f(dir)); + int count = (hitBlock + 1) * 15; + double deltaAngle = 360.0 / count; + for(int i = 0;i < count;i++) { + double angle = i * deltaAngle; + double cos = Math.cos(Math.toRadians(angle)); + double sin = Math.sin(Math.toRadians(angle)); + Vec3 speed = new Vec3( + dirs[1].x * cos + dirs[2].x * sin, + dirs[1].y * cos + dirs[2].y * sin, + dirs[1].z * cos + dirs[2].z * sin + ); + ParticleUtil.addParticle( + summon.level(), PARTICLE2, + summon.position(), 0.0, + speed.scale(0.05 * (hitBlock + 1)), 0.0 + ); + } + }else { + if(summon.getOwner() instanceof Player player) { + List hitEntities = summon.level().getEntitiesOfClass( + LivingEntity.class, + new AABB( + summon.getX() - 0.25 * (hitBlock + 1), summon.getY() - 0.25 * (hitBlock + 1), summon.getZ() - 0.25 * (hitBlock + 1), + summon.getX() + 0.25 * (hitBlock + 1), summon.getY() + 0.25 * (hitBlock + 1), summon.getZ() + 0.25 * (hitBlock + 1) + ), + FilterUtil.createLivingTargetFilter(summon.getOwner()) + ); + for(LivingEntity livingEntity : hitEntities) livingEntity.hurt(summon.damageSources().playerAttack(player), 20.0f); + } + } + + if(hitBlock < 4) { + customData.putInt("hitBlock", hitBlock + 1); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + Direction face = blockHitResult.getDirection(); + + double mx = motion.x; + double my = motion.y; + double mz = motion.z; + + switch(face.getAxis()) { + case X -> mx = -mx; + case Y -> my = -my; + case Z -> mz = -mz; + } + + if(face == Direction.UP && Math.abs(my) < 0.1) { + my = 0; + } + + motion = new Vec3(mx, my, mz); + + Vec3 hitVec = blockHitResult.getLocation(); + summon.setPos( + hitVec.x + face.getStepX() * 0.05, + hitVec.y + face.getStepY() * 0.05, + hitVec.z + face.getStepZ() * 0.05 + ); + }else { + onDied(summon); + return; + } + }else { + onDied(summon); + return; + } + } + summon.setDeltaMovement(motion); + } + + @Override + public void onDied(StaticSummon summon) { + if(!summon.level().isClientSide()) { + for(int i = 0;i < summon.trailPositions.size();i += 2) { + Vec3 pos1 = summon.trailPositions.get(i); + Vec3 pos2 = summon.trailPositions.get(i + 1); + Vec3 mid = new Vec3( + (pos1.x + pos2.x) / 2, + (pos1.y + pos2.y) / 2, + (pos1.z + pos2.z) / 2 + ); + ParticleUtil.addParticles( + (ServerLevel) summon.level(), PARTICLE, + mid, new Vec3(0, 0, 0), 0, 1 + ); + } + summon.discard(); + } + } + }; + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack stack = player.getItemInHand(hand); + + if(!level.isClientSide()) { + StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level); + summon.setOwner(player); + Vec3 pos = new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ()); + summon.setPos(pos); + summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.MEOWMERE_PROJECTILE); + summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom"); + summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.MEOWMERE_PROJECTILE.get())); + summon.getEntityData().set(StaticSummon.RYP, -90); + summon.getEntityData().set(StaticSummon.RZP, -90); + summon.getEntityData().set(StaticSummon.LIFETIME, 200); + summon.getEntityData().set(StaticSummon.GLOW, true); + + CompoundTag customData = new CompoundTag(); + customData.putInt("hitBlock", 0); + customData.putInt("hitEntity", 0); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + summon.setNoGravity(true); + summon.noPhysics = true; + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(player.getLookAngle())); + summon.setXRot(xyRot[0]); + summon.setYRot(xyRot[1]); + summon.setDeltaMovement(player.getLookAngle().normalize().scale(VZ)); + level.addFreshEntity(summon); + }else { + ParticleUtil.addParticles( + player.level(), PARTICLE, + player.position(), 2.0, + new Vec3(0, 0, 0), 0.1, + 25 + ); + } + + player.getCooldowns().addCooldown(stack.getItem(), 3); + return InteractionResultHolder.sidedSuccess(stack, level.isClientSide()); + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/Seedler.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Seedler.java index 761ce6a..d62332f 100644 --- a/src/main/java/com/lzxnone/terraria/item/weapon/melee/Seedler.java +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Seedler.java @@ -3,16 +3,18 @@ package com.lzxnone.terraria.item.weapon.melee; import com.lzxnone.terraria.LzxnoneTerraria; import com.lzxnone.terraria.ModSounds; import com.lzxnone.terraria.entity.ModEntities; -import com.lzxnone.terraria.entity.projectile.IProjectileBehavior; -import com.lzxnone.terraria.entity.projectile.ProjectileBehaviors; -import com.lzxnone.terraria.entity.projectile.TextureProjectile; +import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior; +import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors; +import com.lzxnone.terraria.entity.projectile.StaticProjectile; +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.particle.ModParticles; -import com.lzxnone.terraria.utils.MathUtil; -import net.minecraft.nbt.CompoundTag; +import com.lzxnone.terraria.utils.*; +import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; @@ -20,6 +22,7 @@ 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; @@ -27,16 +30,11 @@ import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.Tiers; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.level.Level; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.Vec3; -import net.objecthunter.exp4j.ExpressionBuilder; +import net.minecraft.world.phys.*; import org.joml.Vector3f; import java.util.Comparator; import java.util.List; -import java.util.Locale; public class Seedler extends SwordItem { public Seedler() { @@ -51,200 +49,142 @@ public class Seedler extends SwordItem { )); } - public static final double GRAVITY = 0.1; //重力 - public static final double NORMAL_DAMPING = 0.6; - public static final double TANGENT_DAMPING = 0.9; + public static final double GRAVITY = 0.075; //重力 + public static final double BOUNCINESS = 0.5; + public static final double VZ = 0.75; - public static final IProjectileBehavior NUT_PROJECTILE_BEHAVIOR = new IProjectileBehavior() { + public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { @Override - public void onHitBlock(TextureProjectile projectile, BlockHitResult result) { - if(projectile.level().isClientSide()) return; + public void tick(StaticSummon summon) { + this.checkBeforeTick(summon); + Vec3 motion = summon.getDeltaMovement(); + motion = motion.add(0, -GRAVITY, 0); - int age = projectile.getEntityData().get(TextureProjectile.AGE); - int currentLifetime = projectile.getEntityData().get(TextureProjectile.LIFETIME); - int remainingLifetime = currentLifetime - age; - if(remainingLifetime <= 0) { - this.onDied(projectile); + EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, summon.position().add(motion)); + if(entityHitResult != null) { + Entity target = entityHitResult.getEntity(); + if(summon.getOwner() instanceof Player player && target instanceof LivingEntity livingEntity) livingEntity.hurt(summon.damageSources().playerAttack(player), 7.0f); + onDied(summon); return; } - CompoundTag customData = projectile.getEntityData().get(TextureProjectile.CUSTOM_DATA); - double oldVy = customData.getDouble("vy"); - double vz = customData.getDouble("vz"); - double vy = oldVy - GRAVITY * age; + BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, summon.position().add(motion)); + if(blockHitResult.getType() != HitResult.Type.MISS) { + Direction face = blockHitResult.getDirection(); - Vector3f dir = projectile.getEntityData().get(TextureProjectile.DIRECTION); - Vector3f up = projectile.getEntityData().get(TextureProjectile.UP); + double mx = motion.x; + double my = motion.y; + double mz = motion.z; - Vec3 velocity = new Vec3( - vy * up.x() + vz * dir.x(), - vy * up.y() + vz * dir.y(), - vy * up.z() + vz * dir.z() - ); + switch(face.getAxis()) { + case X -> mx = -mx * BOUNCINESS; + case Y -> my = -my * BOUNCINESS; + case Z -> mz = -mz * BOUNCINESS; + } - Vec3 normal = Vec3.atLowerCornerOf(result.getDirection().getNormal()); - Vec3 reflected = velocity.subtract(normal.scale(2 * velocity.dot(normal))); - double normalMag = reflected.dot(normal); - Vec3 tangentDir = reflected.subtract(normal.scale(normalMag)); - double tangentMag = tangentDir.length(); - Vec3 finalVelocity = normal.scale(normalMag * NORMAL_DAMPING); - if(tangentMag > 0.0001) { - finalVelocity = finalVelocity.add(tangentDir.normalize().scale(tangentMag * TANGENT_DAMPING)); + if(face == Direction.UP && Math.abs(my) < 0.1) { + my = 0; + mx *= BOUNCINESS; + mz *= BOUNCINESS; + } + + motion = new Vec3(mx, my, mz); + + Vec3 hitVec = blockHitResult.getLocation(); + summon.setPos( + hitVec.x + face.getStepX() * 0.05, + hitVec.y + face.getStepY() * 0.05, + hitVec.z + face.getStepZ() * 0.05 + ); } - double newVz = Math.sqrt(finalVelocity.x * finalVelocity.x + finalVelocity.z * finalVelocity.z); - double newVy = finalVelocity.y; - - boolean isBounced = false; - - //竖直弹射时 - if(newVy < 0.1 && newVy > 0.0001) { - newVy = 0; - String newExprY = String.format(Locale.US, "-%.4f*t*t", GRAVITY * 0.5); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Y, newExprY); - projectile.exprY = new ExpressionBuilder(newExprY).variables("t").build(); - }else if(newVy >= 0.1) { - String newExprY = String.format(Locale.US, "%.3f*t - %.4f*t*t", newVy, GRAVITY * 0.5); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Y, newExprY); - projectile.exprY = new ExpressionBuilder(newExprY).variables("t").build(); - } - if(Math.abs(normal.y) >= 0.999 && newVy >= 0.1) isBounced = true; - - - //水平弹射时 - if(newVz < 0.1 && newVz > 0.0001) { - newVz = 0; - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Z, "0"); - projectile.exprZ = new ExpressionBuilder("0").variables("t").build(); - Vec3 reflectedH = new Vec3(reflected.x, 0, reflected.z).normalize(); - Vector3f[] newDirs = MathUtil.computeProjectileDir(MathUtil.toVector3f(reflectedH)); - projectile.getEntityData().set(TextureProjectile.DIRECTION, newDirs[0]); - projectile.getEntityData().set(TextureProjectile.RIGHT, newDirs[2]); - }else if(newVz >= 0.1) { - String newExprZ = String.format(Locale.US, "%.3f*t", newVz); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Z, newExprZ); - projectile.exprZ = new ExpressionBuilder(newExprZ).variables("t").build(); - Vec3 reflectedH = new Vec3(reflected.x, 0, reflected.z).normalize(); - Vector3f[] newDirs = MathUtil.computeProjectileDir(MathUtil.toVector3f(reflectedH)); - projectile.getEntityData().set(TextureProjectile.DIRECTION, newDirs[0]); - projectile.getEntityData().set(TextureProjectile.RIGHT, newDirs[2]); - } - if((Math.abs(normal.x) >= 0.999 || Math.abs(normal.z) >= 0.999) && newVz >= 0.1) isBounced = true; - - Vec3 hitPos = result.getLocation(); - Vec3 offsetPos = hitPos.add(normal.scale(isBounced ? 0.1 : 0)); - - projectile.getEntityData().set(TextureProjectile.ORIGIN, MathUtil.toVector3f(offsetPos)); - projectile.getEntityData().set(TextureProjectile.AGE, 0); - projectile.getEntityData().set(TextureProjectile.LIFETIME, remainingLifetime); - - customData.putDouble("vz", newVz); - customData.putDouble("vy", newVy); - projectile.getEntityData().set(TextureProjectile.CUSTOM_DATA, customData); - - projectile.setPos(offsetPos); - projectile.positionOverridden = true; + summon.setDeltaMovement(motion); } @Override - public void onDied(TextureProjectile projectile) { - if(!projectile.level().isClientSide()) { - Vec3 pos = projectile.position(); - Level level = projectile.level(); - - ((ServerLevel) level).sendParticles( - ModParticles.EXPLODE_PARTICLE.get(), - pos.x, pos.y, pos.z, 1, 0.2, 0.2, 0.2, 0.2 - ); - ((ServerLevel) level).sendParticles( - ModParticles.EXPLODE_FLAME_PARTICLE, - pos.x, pos.y, pos.z, 10, 0.2, 0.2, 0.2, 0.2 - ); - ((ServerLevel) level).sendParticles( - ModParticles.SMOKE_PARTICLE, - pos.x, pos.y, pos.z, 10, 0.2, 0.2, 0.2, 0.2 + public void onDied(StaticSummon summon) { + if(!summon.level().isClientSide()) { + List targets = summon.level().getEntitiesOfClass( + Monster.class, + AABB.ofSize(summon.position(), 64, 64, 64), + FilterUtil.createMonsterFilter(summon.getOwner()) ); + targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position()))); - level.playSound(null, pos.x, pos.y, pos.z, - ModSounds.BOOM.get(), SoundSource.PLAYERS, 4.0F, 1.0F); - - Entity owner = projectile.getOwner(); - List targets = level.getEntitiesOfClass( - LivingEntity.class, - AABB.ofSize(pos, 64, 64, 64), - e -> e.isAlive() && e != owner && !e.isSpectator() - ); - targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(pos))); - - int count = projectile.getRandom().nextInt(4) + 4; + int count = summon.getRandom().nextInt(4) + 4; for(int i = 0; i < count; i++) { - Vec3 dir; - if(i < targets.size()) { - Vec3 tPos = targets.get(i).getEyePosition(); - dir = new Vec3(tPos.x - pos.x, tPos.y - pos.y, tPos.z - pos.z).normalize(); - }else { - float yaw = projectile.getRandom().nextFloat() * (float)Math.PI * 2; - float pitch = (projectile.getRandom().nextFloat() - 0.5f) * 0.5f; - dir = new Vec3(-Math.sin(yaw) * Math.cos(pitch), Math.sin(pitch), - Math.cos(yaw) * Math.cos(pitch)); - } + Vec3 tPos = i < targets.size() ? new Vec3(targets.get(i).getX(), targets.get(i).getEyeY(), targets.get(i).getZ()) : MathUtil.getRandomPosInRadius(summon.position(), 4); + Vec3 dir = new Vec3(tPos.x - summon.getX(), tPos.y - summon.getY(), tPos.z - summon.getZ()).normalize(); - Vector3f[] dirs = MathUtil.computeProjectileDir(MathUtil.toVector3f(dir)); + Vector3f[] dirs = MathUtil.computeDir(MathUtil.toVector3f(dir)); - TextureProjectile proj = new TextureProjectile(ModEntities.TEXTURE_PROJECTILE.get(), level); - proj.setOwner(owner); - proj.setPos(pos); - proj.getEntityData().set(TextureProjectile.BEHAVIOR, ProjectileBehaviors.SEEDLER_THORN); - proj.getEntityData().set(TextureProjectile.ORIGIN, MathUtil.toVector3f(pos)); - proj.getEntityData().set(TextureProjectile.DIRECTION, dirs[0]); - proj.getEntityData().set(TextureProjectile.UP, dirs[1]); - proj.getEntityData().set(TextureProjectile.RIGHT, dirs[2]); - proj.getEntityData().set(TextureProjectile.ITEM, new ItemStack(ModItems.SEEDLER_THORN.get())); - proj.getEntityData().set(TextureProjectile.SCALE_X, 0.5f); - proj.getEntityData().set(TextureProjectile.SCALE_Y, 0.5f); - proj.getEntityData().set(TextureProjectile.RXP, 90); - proj.getEntityData().set(TextureProjectile.LIFETIME, 30); - proj.getEntityData().set(TextureProjectile.EXPRESSION_Z, "t*2"); + StaticProjectile proj = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), summon.level()); + proj.setOwner(summon.getOwner()); + proj.setPos(summon.position()); + proj.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.SEEDLER_THORN); + proj.getEntityData().set(StaticProjectile.RENDER_MODE, "item"); + proj.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(summon.position())); + proj.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]); + proj.getEntityData().set(StaticProjectile.UP, dirs[1]); + proj.getEntityData().set(StaticProjectile.RIGHT, dirs[2]); + proj.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.SEEDLER_THORN.get())); + proj.getEntityData().set(StaticProjectile.SCALE_X, 0.5f); + proj.getEntityData().set(StaticProjectile.SCALE_Y, 0.5f); + proj.getEntityData().set(StaticProjectile.RXP, 90); + proj.getEntityData().set(StaticProjectile.LIFETIME, 30); + proj.getEntityData().set(StaticProjectile.EXPRESSION_Z, "t*2"); proj.setDeltaMovement(MathUtil.toVec3(dirs[0])); - level.addFreshEntity(proj); + summon.level().addFreshEntity(proj); } - projectile.discard(); - } - } - @Override - public void onHitEntity(TextureProjectile projectile, EntityHitResult result) { - if(!projectile.level().isClientSide()) { - if(result.getEntity() instanceof LivingEntity target) { - this.onDied(projectile); - } + ParticleUtil.addParticles( + (ServerLevel) summon.level(), ModParticles.EXPLODE_PARTICLE.get(), + summon.position(), new Vec3(0.2, 0.2, 0.2), + 0.05, 1 + ); + ParticleUtil.addParticles( + (ServerLevel) summon.level(), ModParticles.EXPLODE_FLAME_PARTICLE, + summon.position(), new Vec3(0.2, 0.2, 0.2), + 0.2, 25 + ); + ParticleUtil.addParticles( + (ServerLevel) summon.level(), ModParticles.SMOKE_PARTICLE, + summon.position(), new Vec3(0.2, 0.2, 0.2), + 0.2, 25 + ); + SoundUtil.playServerSound(summon.level(), ModSounds.BOOM.get(), summon.position()); + + summon.discard(); } } }; - public static final IProjectileBehavior THORN_PROJECTILE_BEHAVIOR = new IProjectileBehavior() { + public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() { @Override - public void onMoving(TextureProjectile projectile) { - projectile.level().addParticle( - ModParticles.SEEDLER_THORN_PARTICLE.get(), - projectile.getX(), projectile.getY(), projectile.getZ(), - 0, 0, 0 + public void onMoving(StaticProjectile projectile) { + ParticleUtil.addParticle( + projectile.level(), ModParticles.SEEDLER_THORN_PARTICLE.get(), + projectile.position(), 0, + new Vec3(0, 0, 0), 0 ); } @Override - public void onHitEntity(TextureProjectile projectile, EntityHitResult result) { + public void onHitEntity(StaticProjectile projectile, EntityHitResult result) { if(!projectile.level().isClientSide()) { if(result.getEntity() instanceof LivingEntity target) { - if(target.hurt(projectile.damageSources().thrown(projectile, projectile.getOwner()), 7f)) projectile.discard(); + Entity owner = projectile.getOwner(); + if(owner == null) return; + if(!FilterUtil.createLivingTargetFilter(owner).test(target) || !(owner instanceof Player player)) return; + if(target.hurt(projectile.damageSources().playerAttack(player), 7f)) onDied(projectile); } } } @Override - public void onHitBlock(TextureProjectile projectile, BlockHitResult result) { + public void onHitBlock(StaticProjectile projectile, BlockHitResult result) { if(projectile.level().isClientSide()) return; if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { - projectile.discard(); + onDied(projectile); } } }; @@ -254,47 +194,26 @@ public class Seedler extends SwordItem { ItemStack stack = player.getItemInHand(hand); if(!level.isClientSide()) { - Vec3 lookVec = player.getLookAngle(); - - float yaw = player.getYRot(); - Vec3 horizontalDir = new Vec3( - -Math.sin(yaw * Math.PI / 180), - 0, - Math.cos(yaw * Math.PI / 180) - ); - Vector3f[] dirs = MathUtil.computeProjectileDir( - MathUtil.toVector3f(horizontalDir) - ); - - double vz = Math.sqrt(lookVec.x * lookVec.x + lookVec.z * lookVec.z) * 1.5; - double vy = lookVec.y * 1.5; - String exprZ = String.format(Locale.US, "%.3f*t", vz); - String exprY = String.format(Locale.US, "%.3f*t - %.4f*t*t", vy, GRAVITY * 0.5); - - CompoundTag customData = new CompoundTag(); - customData.putDouble("vz", vz); - customData.putDouble("vy", vy); - - TextureProjectile projectile = new TextureProjectile(ModEntities.TEXTURE_PROJECTILE.get(), level); - projectile.setOwner(player); + StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level); + summon.setOwner(player); Vec3 pos = new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ()); - projectile.setPos(pos); - projectile.getEntityData().set(TextureProjectile.BEHAVIOR, ProjectileBehaviors.SEEDLER_NUT); - projectile.getEntityData().set(TextureProjectile.ORIGIN, MathUtil.toVector3f(pos)); - projectile.getEntityData().set(TextureProjectile.DIRECTION, dirs[0]); - projectile.getEntityData().set(TextureProjectile.UP, dirs[1]); - projectile.getEntityData().set(TextureProjectile.RIGHT, dirs[2]); - projectile.getEntityData().set(TextureProjectile.ITEM, new ItemStack(ModItems.SEEDLER_NUT.get())); - projectile.getEntityData().set(TextureProjectile.SCALE_X, 0.5f); - projectile.getEntityData().set(TextureProjectile.SCALE_Y, 0.5f); - projectile.getEntityData().set(TextureProjectile.RXPS, 10); - projectile.getEntityData().set(TextureProjectile.LIFETIME, (int) (7 + Math.random() * 36)); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Z, exprZ); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Y, exprY); - projectile.getEntityData().set(TextureProjectile.CUSTOM_DATA, customData); + summon.setPos(pos); + summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.SEEDLER_NUT); + summon.getEntityData().set(StaticSummon.RENDER_MODE, "item"); + summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.SEEDLER_NUT.get())); + summon.getEntityData().set(StaticSummon.SCALE_X, 0.5f); + summon.getEntityData().set(StaticSummon.SCALE_Y, 0.5f); + summon.getEntityData().set(StaticSummon.RXPS, 10); + summon.getEntityData().set(StaticSummon.LIFETIME, (int) (7 + Math.random() * 36)); - projectile.setDeltaMovement(MathUtil.toVec3(dirs[0])); - level.addFreshEntity(projectile); + summon.setNoGravity(true); + summon.noPhysics = true; + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(player.getLookAngle())); + summon.setXRot(xyRot[0]); + summon.setYRot(xyRot[1]); + summon.setDeltaMovement(player.getLookAngle().normalize().scale(VZ)); + level.addFreshEntity(summon); } player.getCooldowns().addCooldown(stack.getItem(), 10); diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/StarWrath.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/StarWrath.java new file mode 100644 index 0000000..91f20bf --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/StarWrath.java @@ -0,0 +1,239 @@ +package com.lzxnone.terraria.item.weapon.melee; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.ModSounds; +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.DustParticleOptions; +import com.lzxnone.terraria.particle.ModParticles; +import com.lzxnone.terraria.utils.*; +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.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.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.*; +import org.joml.Vector3f; + +public class StarWrath extends SwordItem { + public StarWrath() { + super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder() + .add(Attributes.ATTACK_DAMAGE, + new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 15, 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), + EquipmentSlotGroup.MAINHAND) + .build() + )); + } + + public static final DustParticleOptions 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 PARTICLE2 = new DustParticleOptions( + 0.2f, 0.5f, 40, true, new Vector3f[]{ + new Vector3f(1.0F, 0.0F, 1.0F), + new Vector3f(1.0F, 0.6F, 0.8F), + new Vector3f(0.7F, 0.7F, 0.7F) + } + ); + + public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() { + @Override + public void onMoving(StaticProjectile projectile) { + if(projectile.tickCount % 3 == 0) { + ParticleUtil.addParticle( + projectile.level(), ModParticles.STAR_PARTICLE.get(), + projectile.position(), 1.0, + new Vec3(0, 0, 0), 0.1 + ); + } + ParticleUtil.addParticles( + projectile.level(), PARTICLE, + projectile.position(), 1.0, + new Vec3(0, 0, 0), 0.1, + 3 + ); + } + @Override + public void onHitEntity(StaticProjectile projectile, EntityHitResult result) { + if(!projectile.level().isClientSide()) { + if(result.getEntity() instanceof LivingEntity target) { + Entity owner = projectile.getOwner(); + if(!FilterUtil.createLivingTargetFilter(owner).test(target) || !(owner instanceof Player player)) return; + target.hurt(projectile.damageSources().playerAttack(player), 16f); + } + } + } + @Override + public void onHitBlock(StaticProjectile projectile, BlockHitResult result) { + CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA); + if(!customData.contains("targetLifetime")) return; + + int targetLifetime = customData.getInt("targetLifetime"); + int age = projectile.getEntityData().get(StaticProjectile.AGE); + + if(!projectile.level().isClientSide()) { + if(age < targetLifetime + 1) { + EntityHitResult entityHit = CollisionUtil.checkEntityHit(projectile); + if(entityHit != null) { + this.onHitEntity(projectile, entityHit); + } + }else { + if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { + onDied(projectile); + } + } + } + } + + @Override + public void onDied(StaticProjectile projectile) { + if(!projectile.level().isClientSide()) { + ParticleUtil.addParticles( + (ServerLevel) projectile.level(), ModParticles.STAR_PARTICLE.get(), + projectile.position(), new Vec3(0.5, 0.5, 0.5), + 0.2, 10 + ); + ParticleUtil.addParticles( + (ServerLevel) projectile.level(), PARTICLE, + projectile.position(), new Vec3(0.5, 0.5, 0.5), + 0.2, 10 + ); + ParticleUtil.addParticles( + (ServerLevel) projectile.level(), PARTICLE2, + projectile.position(), new Vec3(0.5, 0.5, 0.5), + 0.2, 30 + ); + SoundUtil.playServerSound(projectile.level(), ModSounds.STAR_COLLIDE.get(), projectile.position()); + projectile.discard(); + } + } + }; + + public static final double MAX_RANGE = 48.0; + public static final double HEIGHT = 20.0; + public static final double DELTA_HEIGHT = 10.0; + public static final double SPAWN_OFFSET = 10.0; + public static final double HIT_OFFSET = 1.5; + public static final int SPAWN_COUNT = 3; + + @Override + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemstack = player.getItemInHand(hand); + if(!level.isClientSide()) { + for(int i = 0;i < SPAWN_COUNT;i++) { + Vec3 targetPos = MathUtil.getCrosshairPos(player, level, MAX_RANGE); + + Vec3 spawnPos = new Vec3( + targetPos.x + SPAWN_OFFSET * (Math.random() * 2 - 1), + targetPos.y + HEIGHT + i * DELTA_HEIGHT, + targetPos.z + SPAWN_OFFSET * (Math.random() * 2 - 1) + ); + + Vec3 hitPos = new Vec3( + targetPos.x + HIT_OFFSET * (Math.random() * 2 - 1), + targetPos.y, + targetPos.z + HIT_OFFSET * (Math.random() * 2 - 1) + ); + + Vector3f[] dirs = MathUtil.computeDir( + MathUtil.toVector3f(new Vec3(hitPos.x - spawnPos.x, hitPos.y - spawnPos.y, hitPos.z - spawnPos.z)) + ); + + StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), level); + projectile.setOwner(player); + projectile.setPos(spawnPos); + projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.STAR_WRATH_STAR); + projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "item"); + projectile.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(spawnPos)); + projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.STAR_WRATH_STAR.get())); + projectile.getEntityData().set(StaticProjectile.LIFETIME, 300); + 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.SCALE_X, 2f); + projectile.getEntityData().set(StaticProjectile.SCALE_Y, 1f); + projectile.getEntityData().set(StaticProjectile.GLOW, true); + projectile.getEntityData().set(StaticProjectile.RXP, 90); + projectile.getEntityData().set(StaticProjectile.RZP, 90); + projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, "t*2"); + + CompoundTag customData = new CompoundTag(); + customData.putInt("targetLifetime", (int) Math.round(targetPos.distanceTo(spawnPos) / 2.0D)); + projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData); + + projectile.setDeltaMovement(MathUtil.toVec3(dirs[0])); + level.addFreshEntity(projectile); + + CustomData.update(DataComponents.CUSTOM_DATA, itemstack, + tag -> tag.putInt("playSoundCount", 3 + player.level().random.nextInt(3))); + } + }else { + ParticleUtil.addParticles( + player.level(), ModParticles.STAR_PARTICLE.get(), + new Vec3(player.getX(), player.getY() + 0.5, player.getZ()), 0.2, + new Vec3(0, 0, 0), 0.2, + 10 + ); + ParticleUtil.addParticles( + player.level(), PARTICLE, + new Vec3(player.getX(), player.getY() + 0.5, player.getZ()), 0.2, + new Vec3(0, 0, 0), 0.2, + 10 + ); + SoundUtil.playClientSound(player, ModSounds.WAVE2.get()); + } + + player.getCooldowns().addCooldown(this, 3); + return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide()); + } + + @Override + public void inventoryTick(ItemStack stack, Level level, net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) { + super.inventoryTick(stack, level, entity, slotId, isSelected); + if(entity instanceof Player player) { + if(isSelected) { + if(player.tickCount % 4 == 0) { + int count = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) + .copyTag().getInt("playSoundCount"); + if(count > 0) { + SoundUtil.playClientSound(player, ModSounds.STAR_FALL.get()); + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putInt("playSoundCount", count - 1)); + } + } + }else { + int count = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) + .copyTag().getInt("playSoundCount"); + if(count > 0) { + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putInt("playSoundCount", 0)); + } + } + } + } +} diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/Starfury.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Starfury.java index 7e7daa1..9695b5e 100644 --- a/src/main/java/com/lzxnone/terraria/item/weapon/melee/Starfury.java +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/Starfury.java @@ -3,19 +3,21 @@ package com.lzxnone.terraria.item.weapon.melee; import com.lzxnone.terraria.LzxnoneTerraria; import com.lzxnone.terraria.ModSounds; import com.lzxnone.terraria.entity.ModEntities; -import com.lzxnone.terraria.entity.projectile.IProjectileBehavior; -import com.lzxnone.terraria.entity.projectile.ProjectileBehaviors; -import com.lzxnone.terraria.entity.projectile.TextureProjectile; +import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior; +import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors; +import com.lzxnone.terraria.entity.projectile.StaticProjectile; import com.lzxnone.terraria.item.ModItems; import com.lzxnone.terraria.particle.ModParticles; -import com.lzxnone.terraria.utils.MathUtil; +import com.lzxnone.terraria.utils.*; 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.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; 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.AttributeModifier; @@ -46,179 +48,144 @@ public class Starfury extends SwordItem { )); } - public static final IProjectileBehavior PROJECTILE_BEHAVIOR = new IProjectileBehavior() { + public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() { @Override - public void onMoving(TextureProjectile projectile) { - projectile.level().addParticle( - ModParticles.STAR_PARTICLE.get(), - projectile.getX(), projectile.getY(), projectile.getZ(), - (Math.random() * 2 - 1) * 0.1, (Math.random() * 2 - 1) * 0.1, (Math.random() * 2 - 1) * 0.1 + public void onMoving(StaticProjectile projectile) { + ParticleUtil.addParticle( + projectile.level(), ModParticles.STAR_PARTICLE.get(), + projectile.position(), 1.0, + new Vec3(0, 0, 0), 0.1 ); } @Override - public void onHitEntity(TextureProjectile projectile, EntityHitResult result) { + public void onHitEntity(StaticProjectile projectile, EntityHitResult result) { if(!projectile.level().isClientSide()) { if(result.getEntity() instanceof LivingEntity target) { - target.hurt(projectile.damageSources().thrown(projectile, projectile.getOwner()), 8f); + Entity owner = projectile.getOwner(); + if(owner == null) return; + if(!FilterUtil.createLivingTargetFilter(owner).test(target) || !(owner instanceof Player player)) return; + target.hurt(projectile.damageSources().playerAttack(player), 8f); } } } @Override - public void onHitBlock(TextureProjectile projectile, BlockHitResult result) { - if(projectile.level().isClientSide()) return; - - CompoundTag customData = projectile.getEntityData().get(TextureProjectile.CUSTOM_DATA); + public void onHitBlock(StaticProjectile projectile, BlockHitResult result) { + CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA); if(!customData.contains("targetLifetime")) return; int targetLifetime = customData.getInt("targetLifetime"); - int age = projectile.getEntityData().get(TextureProjectile.AGE); - if(age < targetLifetime + 1) { - EntityHitResult entityHit = ProjectileUtil.getEntityHitResult( - projectile.level(), - projectile, - projectile.position(), - projectile.position().add(projectile.getDeltaMovement()), - projectile.getBoundingBox() - .expandTowards(projectile.getDeltaMovement()) - .inflate(1.0), - entity -> !entity.isSpectator() && entity.isPickable() && entity != projectile.getOwner() - ); - if(entityHit != null) { - this.onHitEntity(projectile, entityHit); - } - return; - } + int age = projectile.getEntityData().get(StaticProjectile.AGE); - if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { - ((ServerLevel) projectile.level()).sendParticles( - ModParticles.STAR_PARTICLE.get(), - projectile.getX(), projectile.getY(), projectile.getZ(), - 25, - 0.2, 0.2, 0.2, - 0.2 - ); - projectile.level().playSound(null, projectile, ModSounds.STAR_COLLIDE.get(), SoundSource.PLAYERS, 4.0F, 1.0F); - projectile.discard(); + if(!projectile.level().isClientSide()) { + if(age < targetLifetime + 1) { + EntityHitResult entityHit = CollisionUtil.checkEntityHit(projectile); + if(entityHit != null) { + this.onHitEntity(projectile, entityHit); + } + }else { + if(!projectile.level().getBlockState(result.getBlockPos()).getCollisionShape(projectile.level(), result.getBlockPos()).isEmpty()) { + onDied(projectile); + } + } } } @Override - public void onDied(TextureProjectile projectile) { + public void onDied(StaticProjectile projectile) { if(!projectile.level().isClientSide()) { - projectile.level().playSound(null, projectile, ModSounds.STAR_COLLIDE.get(), SoundSource.PLAYERS, 4.0F, 1.0F); + ParticleUtil.addParticles( + (ServerLevel) projectile.level(), ModParticles.STAR_PARTICLE.get(), + projectile.position(), new Vec3(0.5, 0.5, 0.5), + 0.2, 25 + ); + SoundUtil.playServerSound(projectile.level(), ModSounds.STAR_COLLIDE.get(), projectile.position()); projectile.discard(); } } }; + public static final double MAX_RANGE = 24.0; + public static final double HEIGHT = 20.0; + public static final double SPAWN_OFFSET = 5.0; + @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); - if(!level.isClientSide() && level instanceof ServerLevel serverLevel) { - Vec3 targetPos = getTargetPosition(player, serverLevel, 24.0D); - double spawnHeight = 20.0D; - double slantOffset = 2.0D; + if(!level.isClientSide()) { + Vec3 targetPos = MathUtil.getCrosshairPos(player, level, MAX_RANGE); Vec3 spawnPos = new Vec3( - targetPos.x + slantOffset * (Math.random() * 2 - 1), - targetPos.y + spawnHeight, - targetPos.z + slantOffset * (Math.random() * 2 - 1) + targetPos.x + SPAWN_OFFSET * (Math.random() * 2 - 1), + targetPos.y + HEIGHT, + targetPos.z + SPAWN_OFFSET * (Math.random() * 2 - 1) ); - Vector3f[] dirs = MathUtil.computeProjectileDir( + + Vector3f[] dirs = MathUtil.computeDir( MathUtil.toVector3f(new Vec3(targetPos.x - spawnPos.x, targetPos.y - spawnPos.y, targetPos.z - spawnPos.z)) ); - TextureProjectile projectile = new TextureProjectile(ModEntities.TEXTURE_PROJECTILE.get(), level); + StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), level); projectile.setOwner(player); projectile.setPos(spawnPos); - projectile.getEntityData().set(TextureProjectile.BEHAVIOR, ProjectileBehaviors.STARFURY_STAR); - projectile.getEntityData().set(TextureProjectile.ORIGIN, MathUtil.toVector3f(spawnPos)); - projectile.getEntityData().set(TextureProjectile.ITEM, new ItemStack(ModItems.STARFURY_STAR.get())); - projectile.getEntityData().set(TextureProjectile.LIFETIME, 300); - projectile.getEntityData().set(TextureProjectile.DIRECTION, dirs[0]); - projectile.getEntityData().set(TextureProjectile.UP, dirs[1]); - projectile.getEntityData().set(TextureProjectile.RIGHT, dirs[2]); - projectile.getEntityData().set(TextureProjectile.SCALE_X, 1f); - projectile.getEntityData().set(TextureProjectile.SCALE_Y, 2f); - projectile.getEntityData().set(TextureProjectile.GLOW, true); - projectile.getEntityData().set(TextureProjectile.RXP, 90); - projectile.getEntityData().set(TextureProjectile.RZP, 90); - projectile.getEntityData().set(TextureProjectile.EXPRESSION_Z, "t*2"); + projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.STARFURY_STAR); + projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "item"); + projectile.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(spawnPos)); + projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.STARFURY_STAR.get())); + projectile.getEntityData().set(StaticProjectile.LIFETIME, 300); + 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.SCALE_X, 2f); + projectile.getEntityData().set(StaticProjectile.SCALE_Y, 1f); + projectile.getEntityData().set(StaticProjectile.GLOW, true); + projectile.getEntityData().set(StaticProjectile.RXP, 90); + projectile.getEntityData().set(StaticProjectile.RZP, 90); + projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, "t*2"); CompoundTag customData = new CompoundTag(); - customData.putInt("targetLifetime", (int) Math.floor(targetPos.distanceTo(spawnPos) / 2.0D)); - projectile.getEntityData().set(TextureProjectile.CUSTOM_DATA, customData); + customData.putInt("targetLifetime", (int) Math.round(targetPos.distanceTo(spawnPos) / 2.0D)); + projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData); projectile.setDeltaMovement(MathUtil.toVec3(dirs[0])); level.addFreshEntity(projectile); - - ((ServerLevel) player.level()).sendParticles( - ModParticles.STAR_PARTICLE.get(), - player.getX(), player.getY() + 0.5, player.getZ(), - 25, - 0.2, 0.2, 0.2, - 0.2 + }else { + ParticleUtil.addParticles( + player.level(), ModParticles.STAR_PARTICLE.get(), + new Vec3(player.getX(), player.getY() + 0.5, player.getZ()), 0.2, + new Vec3(0, 0, 0), 0.2, + 25 ); - player.level().playSound(null, player, ModSounds.STAR_FALL.get(), SoundSource.PLAYERS, 4.0F, 1.0F); + SoundUtil.playClientSound(player, ModSounds.STAR_FALL.get()); } player.getCooldowns().addCooldown(this, 13); return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide()); } - private Vec3 getTargetPosition(Player player, Level level, double maxRange) { - Vec3 eyePos = player.getEyePosition(1.0F); - Vec3 lookVec = player.getLookAngle(); - Vec3 maxRangeEnd = eyePos.add(lookVec.scale(maxRange)); - - BlockHitResult blockHit = level.clip(new ClipContext( - eyePos, maxRangeEnd, - ClipContext.Block.COLLIDER, - ClipContext.Fluid.NONE, - player - )); - - Vec3 finalTarget = maxRangeEnd; - if(blockHit.getType() != HitResult.Type.MISS) { - finalTarget = blockHit.getLocation(); - } - - AABB searchBox = player.getBoundingBox().expandTowards(lookVec.scale(maxRange)).inflate(1.0D); - EntityHitResult entityHit = ProjectileUtil.getEntityHitResult( - level, player, eyePos, finalTarget, searchBox, - entity -> !entity.isSpectator() && entity.isPickable() && entity != player - ); - - if(entityHit != null) { - finalTarget = entityHit.getLocation(); - } - - return finalTarget; - } - @Override public void inventoryTick(ItemStack stack, Level level, net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) { super.inventoryTick(stack, level, entity, slotId, isSelected); - if(isSelected && entity instanceof Player player) { - boolean currentlyOnCooldown = player.getCooldowns().isOnCooldown(this); - boolean wasOnCooldown = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) - .copyTag().getBoolean("WasOnCooldown"); - - if(wasOnCooldown && !currentlyOnCooldown) { - if(level.isClientSide()) { - player.playSound(ModSounds.MAX_MANA.get(), 4.0F, 1.0F); - }else { - ((ServerLevel) player.level()).sendParticles( - ModParticles.MAX_MANA_PARTICLE, - player.getX(), player.getY() + 0.5, player.getZ(), - 5, - 0.2, 0.2, 0.2, - 0.2 - ); + if(entity instanceof Player player) { + if(isSelected) { + boolean current = player.getCooldowns().isOnCooldown(this); + boolean prev = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) + .copyTag().getBoolean("onCooldown"); + if(prev && !current) { + if(level.isClientSide()) { + SoundUtil.playClientSound(player, ModSounds.MAX_MANA.get()); + ParticleUtil.addParticles( + player.level(), ModParticles.MAX_MANA_PARTICLE, + new Vec3(player.getX(), player.getY() + 1.0, player.getZ()), 0.05, + new Vec3(0, 0, 0), 0.05, + 5 + ); + } } + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putBoolean("onCooldown", current)); + }else { + CustomData.update(DataComponents.CUSTOM_DATA, stack, + tag -> tag.putBoolean("onCooldown", false)); } - - CustomData.update(DataComponents.CUSTOM_DATA, stack, - tag -> tag.putBoolean("WasOnCooldown", currentlyOnCooldown)); } } } diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/TerraBlade.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/TerraBlade.java new file mode 100644 index 0000000..fb8502f --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/TerraBlade.java @@ -0,0 +1,524 @@ +package com.lzxnone.terraria.item.weapon.melee; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.ModSounds; +import com.lzxnone.terraria.entity.ModEntities; +import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior; +import com.lzxnone.terraria.entity.beam.SwordBeam; +import com.lzxnone.terraria.entity.beam.SwordBeamBehaviors; +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.IItemWaveBehavior; +import com.lzxnone.terraria.network.payload.SwordBeamPayload; +import com.lzxnone.terraria.particle.DustParticleOptions; +import com.lzxnone.terraria.utils.*; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.Util; +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.nbt.CompoundTag; +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.level.ClipContext; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.*; +import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import net.neoforged.neoforge.network.PacketDistributor; +import org.joml.Matrix4f; +import org.joml.Quaternionf; +import org.joml.Vector3f; + +import java.util.List; + +public class TerraBlade extends SwordItem { + public TerraBlade() { + super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder() + .add(Attributes.ATTACK_DAMAGE, + new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 10, 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), + EquipmentSlotGroup.MAINHAND) + .build() + )); + } + + public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> { + tag.putString("behavior", "terra_blade"); + tag.putInt("cooldown", 8); + tag.putFloat("color0R", 0.173f); + tag.putFloat("color0G", 0.482f); + tag.putFloat("color0B", 0.796f); + tag.putFloat("color1R", 0.431f); + tag.putFloat("color1G", 0.729f); + tag.putFloat("color1B", 0.396f); + tag.putFloat("color2R", 0.478f); + tag.putFloat("color2G", 0.663f); + tag.putFloat("color2B", 0.220f); + + CompoundTag customData = new CompoundTag(); + customData.putInt("hitEntityCount", 0); + tag.put("customData", customData); + }); + + public static final DustParticleOptions PARTICLE = new DustParticleOptions( + 0.075f, 0.5f, 40, true, new Vector3f[]{ + new Vector3f(0.5F, 1.0F, 0.5F), + new Vector3f(0.0F, 1.0F, 0.2F), + new Vector3f(0.7F, 0.7F, 0.7F) + } + ); + + public static final ISwordBeamBehavior SWORD_BEAM_BEHAVIOR = new ISwordBeamBehavior() { + public static final int MAX_HIT_ENTITY_COUNT = 3; + + @Override + public void onMoving(SwordBeam beam) { + if(beam.currentPosition == null) return; + ParticleUtil.addParticle( + beam.level(), PARTICLE, + beam.currentPosition, 0.2, + new Vec3(0, 0, 0), 0.2 + ); + } + + @Override + public void onHitEntity(SwordBeam beam, EntityHitResult result) { + if(!beam.level().isClientSide()) { + if(result.getEntity() instanceof LivingEntity target && beam.getOwner() instanceof Player player && FilterUtil.createLivingTargetFilter(player).test(target)) { + CompoundTag custom_data = beam.getEntityData().get(SwordBeam.CUSTOM_DATA); + if(custom_data.contains("hitEntityCount")) { + int count = custom_data.getInt("hitEntityCount"); + if(count < MAX_HIT_ENTITY_COUNT) { + if(target.hurt(beam.level().damageSources().playerAttack(player), 11.0f)) { + count++; + custom_data.putInt("hitEntityCount", count); + beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data); + } + } + } + } + } + } + + @Override + public void generate(Entity entity, CompoundTag beamData) { + ISwordBeamBehavior.super.generate(entity, beamData); + if(entity instanceof Player player) summon(player); + } + }; + + public static final Vector3f COLOR0 = new Vector3f(0.255f, 0.420f, 0.302f); + public static final Vector3f COLOR1 = new Vector3f(0.173f, 0.482f, 0.796f); + public static final Vector3f COLOR2 = new Vector3f(0.431f, 0.729f, 0.396f); + + public static final ResourceLocation RES0 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam0.png"); + public static final ResourceLocation RES1 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam3.png"); + public static final ResourceLocation RES2 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/terra_beam4.png"); + public static final ResourceLocation RES3 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/beam_sparkle.png"); + + public static final float FADE_IN = 0.33f; + public static final float FADE_OUT = 0.67f; + + public static final double SPEED = 1.5; + public static final float DAMAGE = 11; + public static final float DAMAGE_PUNISHMENT = 0.75f; + + + public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { + @Override + public void render(Entity entity, float entityYaw, float partialTick, + PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { + if(!(entity instanceof StaticSummon summon)) return; + + VertexConsumer vertexConsumer0 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES0)); + VertexConsumer vertexConsumer1 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES1)); + VertexConsumer vertexConsumer2 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES2)); + VertexConsumer vertexConsumer3 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES3)); + + float halfWidth = SwordBeam.HALF_WIDTH * SwordBeam.SCALE; + float halfHeight = SwordBeam.HALF_HEIGHT * SwordBeam.SCALE; + + float progress = (summon.getEntityData().get(StaticSummon.AGE) + partialTick) / (float) summon.getEntityData().get(StaticSummon.LIFETIME); + + float alpha; + if(progress <= FADE_IN) { + alpha = 1 - (FADE_IN - progress) / FADE_IN; + }else if(progress >= FADE_OUT) { + alpha = 1 - (progress - FADE_OUT) / (1 - FADE_OUT); + }else { + alpha = 1.0f; + } + + if(alpha < 0.01f) return; + + Quaternionf rotationX = new Quaternionf().fromAxisAngleRad(MathUtil.toVector3f(summon.getLookAngle()), (float) Math.toRadians(summon.getEntityData().get(StaticSummon.RZP))); + Vector3f[] dirs = MathUtil.computeDir( + MathUtil.toVector3f(summon.getLookAngle()), + MathUtil.computeDir(MathUtil.toVector3f(summon.getLookAngle()))[2].rotate(rotationX) + ); + + poseStack.pushPose(); + + float size = 1.0f - 0.25f * progress; + poseStack.scale(size, size, size); + + //左边 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 18 * (1.0f - progress), SwordBeam.DIST); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 18 * (1.0f - progress)); + renderQuad(poseStack.last().pose(), vertexConsumer0, + COLOR0.x(), COLOR0.y(), COLOR0.z(), alpha, halfWidth, halfHeight, 0f, 0, -0.01f); + poseStack.popPose(); + + //中间 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + renderQuad(poseStack.last().pose(), vertexConsumer0, + COLOR1.x(), COLOR1.y(), COLOR1.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0f); + poseStack.popPose(); + + //右边 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 108, SwordBeam.DIST); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], -9 * (1.0f - progress)); + renderQuad(poseStack.last().pose(), vertexConsumer0, + COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0, 0.01f); + poseStack.popPose(); + + //三线 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST / 1.5f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + poseStack.scale(0.5f, 0.5f, 0.5f); + renderQuad(poseStack.last().pose(), vertexConsumer1, + 1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST / 1.25f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + poseStack.scale(0.75f, 0.75f, 0.75f); + renderQuad(poseStack.last().pose(), vertexConsumer1, + 1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST * 1.15f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + poseStack.scale(0.95f, 0.95f, 0.95f); + renderQuad(poseStack.last().pose(), vertexConsumer1, + 1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f); + poseStack.popPose(); + + //边缘高光 + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 100, SwordBeam.DIST * 1.15f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + poseStack.scale(1.0f, 1.0f, 1.0f); + for(int i = 0;i < 5;i++) { + renderQuad(poseStack.last().pose(), vertexConsumer2, + COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.03f); + } + poseStack.popPose(); + + float sparkleAlpha; + if(progress < FADE_IN) { + sparkleAlpha = 0; + }else if(progress > FADE_OUT) { + sparkleAlpha = 1.0f - (progress - FADE_OUT) / (1.0f - FADE_OUT); + }else { + sparkleAlpha = (progress - FADE_IN) / (FADE_OUT - FADE_IN); + } + + //闪烁(外层) + poseStack.pushPose(); + for(int k = 0;k < 2;k++) { + poseStack.pushPose(); + if(k == 0) { + this.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 60.0 * progress, SwordBeam.DIST * 2f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 60 * progress); + }else { + this.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 60.0 * progress, SwordBeam.DIST * 2f + 0.5f * progress); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], -60 * progress); + } + for(int j = 0; j < 2; j++) { + poseStack.pushPose(); + if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F)); + else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F)); + poseStack.scale(0.5f, 0.5f, 0.5f); + for(int i = 0; i < 5; i++) { + renderQuad(poseStack.last().pose(), vertexConsumer3, + COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f); + } + poseStack.popPose(); + } + poseStack.popPose(); + } + poseStack.popPose(); + + //闪烁(中层) + poseStack.pushPose(); + for(int k = 0;k < 2;k++) { + poseStack.pushPose(); + if(k == 0) { + this.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 30.0 * progress, SwordBeam.DIST * 2f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 30 * progress); + }else { + this.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 30.0 * progress, SwordBeam.DIST * 2.1f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], -30 * progress); + } + for(int j = 0; j < 2; j++) { + poseStack.pushPose(); + if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F)); + else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F)); + poseStack.scale(0.75f, 0.75f, 0.75f); + for(int i = 0; i < 5; i++) { + renderQuad(poseStack.last().pose(), vertexConsumer3, + COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f); + } + poseStack.popPose(); + } + poseStack.popPose(); + } + poseStack.popPose(); + + //闪烁(内层) + poseStack.pushPose(); + this.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST * 2f); + this.applyRotate(summon, poseStack, dirs[0], dirs[1], 0); + for(int j = 0; j < 2; j++) { + poseStack.pushPose(); + if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F)); + else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F)); + poseStack.scale(1.0f, 1.0f, 1.0f); + for(int i = 0; i < 5; i++) { + renderQuad(poseStack.last().pose(), vertexConsumer3, + COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f); + } + poseStack.popPose(); + } + poseStack.popPose(); + + + poseStack.popPose(); + } + + public void applyRotate(StaticSummon summon, PoseStack poseStack, Vector3f dir, Vector3f up, double angle) { + Quaternionf rotation = new Quaternionf().fromAxisAngleRad(up, (float) Math.toRadians(angle)); + poseStack.mulPose(rotation); + + float[] xyRot = MathUtil.computeXYRot(dir); + poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1])); + poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0])); + + poseStack.mulPose(Axis.ZP.rotationDegrees(summon.getEntityData().get(StaticSummon.RZP))); + poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0F)); + } + + public void applyTranslate(PoseStack poseStack, Vector3f dir, Vector3f right, double angle, double dist) { + float cos = (float) Math.cos(Math.toRadians(angle)); + float sin = (float) Math.sin(Math.toRadians(angle)); + Vector3f current = new Vector3f( + cos * right.x + sin * dir.x, + cos * right.y + sin * dir.y, + cos * right.z + sin * dir.z + ); + poseStack.translate(current.x * dist, current.y * dist, current.z * dist); + } + + public void renderQuad(Matrix4f matrix, VertexConsumer consumer, float r, float g, float b, float a, float halfWidth, float halfHeight, float offsetX, float offsetY, float offsetZ) { + int ir = (int) (r * 255.0F); + int ig = (int) (g * 255.0F); + int ib = (int) (b * 255.0F); + int ia = (int) (a * 255.0F); + + consumer.addVertex(matrix, -halfWidth, -halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(0.0f, 1.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, halfWidth, -halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(1.0f, 1.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, halfWidth, halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).setUv(1.0f, 0.0f) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f); + consumer.addVertex(matrix, -halfWidth, halfHeight + offsetY, offsetZ) + .setColor(ir, ig, ib, ia).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); + CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); + + //运动逻辑 + if(!customData.contains("dead")) { + float progress = summon.getEntityData().get(StaticSummon.AGE) / (float) summon.getEntityData().get(StaticSummon.LIFETIME); + if(progress > FADE_IN) { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(SPEED - SPEED * (progress - FADE_IN) / (1.0f - FADE_IN))); + }else { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(SPEED)); + } + }else { + summon.setDeltaMovement(summon.getLookAngle().normalize().scale(0.5)); + return; + } + + //碰撞箱计算 + Vec3 center = summon.position().add(summon.getLookAngle().normalize().scale(SwordBeam.DIST)); + if(customData.contains("extX") && customData.contains("extY") && customData.contains("extZ")) { + summon.setBoundingBox(new AABB( + center.x - customData.getInt("extX"), center.y - customData.getInt("extY"), center.z - customData.getInt("extZ"), + center.x + customData.getInt("extX"), center.y + customData.getInt("extY"), center.z + customData.getInt("extZ") + )); + } + + //碰撞计算 + if(!summon.level().isClientSide() && customData.contains("hitCount") && summon.getOwner() instanceof Player player) { + int count = customData.getInt("hitCount"); + LzxnoneTerraria.LOGGER.info("11w111"); + List targets = summon.level().getEntitiesOfClass(LivingEntity.class, summon.getBoundingBox(), FilterUtil.createTargetFilter(summon, summon.getOwner())); + for(LivingEntity target : targets) { + if(target.hurt(summon.damageSources().playerAttack(player), DAMAGE * (float) Math.pow(DAMAGE_PUNISHMENT, count))) { + count++; + //粒子效果 + } + } + if(!targets.isEmpty()) customData.putInt("hitCount", count); + } + + ClipContext context = new ClipContext( + summon.position(), + summon.position().add(summon.getDeltaMovement()), + ClipContext.Block.COLLIDER, + ClipContext.Fluid.NONE, + summon + ); + BlockHitResult blockHit = summon.level().clip(context); + if(blockHit.getType() != HitResult.Type.MISS) { + customData.putBoolean("dead", true); + } + + //粒子 + if(summon.level().isClientSide() && summon.tickCount % 4 == 0) { + Quaternionf rotationX = new Quaternionf().fromAxisAngleRad(MathUtil.toVector3f(summon.getLookAngle()), (float) Math.toRadians(summon.getEntityData().get(StaticSummon.RZP))); + Vector3f[] dirs = MathUtil.computeDir( + MathUtil.toVector3f(summon.getLookAngle()), + MathUtil.computeDir(MathUtil.toVector3f(summon.getLookAngle()))[2].rotate(rotationX) + ); + Vec3 right = MathUtil.toVec3(dirs[2]).normalize(); + Vec3 speed = MathUtil.toVec3(dirs[0]).normalize().scale(summon.getDeltaMovement().length() / 2); + for(int i = 0;i < 5;i++) { + Vec3 delta = right.scale((Math.random() - 0.5) * 4); + ParticleUtil.addParticle( + summon.level(), PARTICLE, + summon.position().add(delta), 0.0, + speed, 0.0 + ); + } + } + + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + } + }; + + public static void summon(Player player) { + StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), player.level()); + summon.setOwner(player); + Vec3 pos = new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ()); + summon.setPos(pos); + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(player.getLookAngle())); + summon.setXRot(xyRot[0]); + summon.xRotO = xyRot[0]; + summon.setYRot(xyRot[1]); + summon.yRotO = xyRot[1]; + + int randomAngle = (int) ((Math.random() * 2 - 1) * 60); + + summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.TERRA_BLADE_BEAM); + summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom"); + summon.getEntityData().set(StaticSummon.LIFETIME, 40); + summon.getEntityData().set(StaticSummon.RZP, randomAngle); + summon.getEntityData().set(StaticSummon.GLOW, true); + summon.setNoGravity(true); + summon.noPhysics = true; + + CompoundTag customData = new CompoundTag(); + + Quaternionf rotation = new Quaternionf() + .rotateY((float) Math.toRadians(-xyRot[1])) + .rotateX((float) Math.toRadians(xyRot[0])) + .rotateZ((float) Math.toRadians(randomAngle)) + .rotateX((float) Math.toRadians(-90.0)) + .rotateZ((float) Math.toRadians(-90.0)); + + Vector3f axisX = new Vector3f(1, 0, 0).rotate(rotation); + Vector3f axisY = new Vector3f(0, 1, 0).rotate(rotation); + Vector3f axisZ = new Vector3f(0, 0, 1).rotate(rotation); + + float extX = SwordBeam.HALF_WIDTH * SwordBeam.SCALE * Math.abs(axisX.x()) + SwordBeam.HALF_HEIGHT * SwordBeam.SCALE * Math.abs(axisY.x()) + SwordBeam.HALF_THICKNESS * SwordBeam.SCALE * Math.abs(axisZ.x()); + float extY = SwordBeam.HALF_WIDTH * SwordBeam.SCALE * Math.abs(axisX.y()) + SwordBeam.HALF_HEIGHT * SwordBeam.SCALE * Math.abs(axisY.y()) + SwordBeam.HALF_THICKNESS * SwordBeam.SCALE * Math.abs(axisZ.y()); + float extZ = SwordBeam.HALF_WIDTH * SwordBeam.SCALE * Math.abs(axisX.z()) + SwordBeam.HALF_HEIGHT * SwordBeam.SCALE * Math.abs(axisY.z()) + SwordBeam.HALF_THICKNESS * SwordBeam.SCALE * Math.abs(axisZ.z()); + + customData.putInt("hitCount", 0); + customData.putFloat("extX", extX); + customData.putFloat("extY", extY); + customData.putFloat("extZ", extZ); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + summon.setDeltaMovement(player.getLookAngle().normalize().scale(SPEED)); + + player.level().addFreshEntity(summon); + } + + public static final IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() { + public void onLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) { + Player player = event.getEntity(); + ItemStack itemStack = player.getMainHandItem(); + if(itemStack.isEmpty()) return; + Item item = itemStack.getItem(); + if(item instanceof TerraBlade && !player.getCooldowns().isOnCooldown(item)) { + PacketDistributor.sendToServer(new SwordBeamPayload("terra_blade", BEAM_DATA)); + SoundUtil.playClientSound(player, ModSounds.WAVE.get()); + summon(player); + } + } + public void onAttackEntity(AttackEntityEvent event) { + Player player = event.getEntity(); + ItemStack itemStack = player.getMainHandItem(); + if(itemStack.isEmpty()) return; + Item item = itemStack.getItem(); + if(item instanceof TerraBlade && !player.getCooldowns().isOnCooldown(item)) { + if(!player.level().isClientSide()) { + SwordBeamBehaviors.getBehavior("terra_blade").generate(player, BEAM_DATA); + summon(player); + }else { + SoundUtil.playClientSound(player, ModSounds.WAVE.get()); + } + } + event.setCanceled(true); + } + }; +} diff --git a/src/main/java/com/lzxnone/terraria/item/weapon/melee/TheHorsemansBlade.java b/src/main/java/com/lzxnone/terraria/item/weapon/melee/TheHorsemansBlade.java new file mode 100644 index 0000000..6db76c1 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/item/weapon/melee/TheHorsemansBlade.java @@ -0,0 +1,277 @@ +package com.lzxnone.terraria.item.weapon.melee; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.ModSounds; +import com.lzxnone.terraria.entity.ModEntities; +import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior; +import com.lzxnone.terraria.entity.beam.SwordBeam; +import com.lzxnone.terraria.entity.beam.SwordBeamBehaviors; +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.IItemWaveBehavior; +import com.lzxnone.terraria.network.payload.SwordBeamPayload; +import com.lzxnone.terraria.particle.DustParticleOptions; +import com.lzxnone.terraria.particle.ModParticles; +import com.lzxnone.terraria.utils.FilterUtil; +import com.lzxnone.terraria.utils.MathUtil; +import com.lzxnone.terraria.utils.ParticleUtil; +import com.lzxnone.terraria.utils.SoundUtil; +import net.minecraft.Util; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.damagesource.DamageTypes; +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.ai.targeting.TargetingConditions; +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.level.block.Blocks; +import net.minecraft.world.phys.AABB; +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 net.neoforged.neoforge.network.PacketDistributor; +import org.joml.Vector3f; + +import java.util.Comparator; +import java.util.List; + +public class TheHorsemansBlade extends SwordItem { + public TheHorsemansBlade() { + super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder() + .add(Attributes.ATTACK_DAMAGE, + new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 14, 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), + EquipmentSlotGroup.MAINHAND) + .build() + )); + } + + public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> { + tag.putString("behavior", "the_horsemans_blade"); + tag.putInt("cooldown", 10); + tag.putFloat("color0R", 0.741f); + tag.putFloat("color0G", 0.133f); + tag.putFloat("color0B", 0.133f); + tag.putFloat("color1R", 0.937f); + tag.putFloat("color1G", 0.408f); + tag.putFloat("color1B", 0.149f); + tag.putFloat("color2R", 0.765f); + tag.putFloat("color2G", 0.471f); + tag.putFloat("color2B", 0.212f); + + CompoundTag customData = new CompoundTag(); + customData.putInt("hitEntityCount", 0); + tag.put("customData", customData); + }); + + 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 ISwordBeamBehavior SWORD_BEAM_BEHAVIOR = new ISwordBeamBehavior() { + public static final int MAX_HIT_ENTITY_COUNT = 3; + public static final float RANGE = 16.0f; + + @Override + public void onMoving(SwordBeam beam) { + if(beam.currentPosition == null) return; + ParticleUtil.addParticle( + beam.level(), PARTICLE, + beam.currentPosition, 0.2, + new Vec3(0, 0, 0), 0.2 + ); + } + + @Override + public void onHitEntity(SwordBeam beam, EntityHitResult result) { + if(!beam.level().isClientSide()) { + if(result.getEntity() instanceof LivingEntity target && beam.getOwner() instanceof Player player && FilterUtil.createLivingTargetFilter(player).test(target)) { + CompoundTag custom_data = beam.getEntityData().get(SwordBeam.CUSTOM_DATA); + if(custom_data.contains("hitEntityCount")) { + int count = custom_data.getInt("hitEntityCount"); + if(count < MAX_HIT_ENTITY_COUNT) { + if(target.hurt(beam.level().damageSources().playerAttack(player), 15.0f)) { + count++; + custom_data.putInt("hitEntityCount", count); + beam.getEntityData().set(SwordBeam.CUSTOM_DATA, custom_data); + + StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), beam.level()); + Entity entity = beam.getOwner(); + if(entity == null) return; + summon.setOwner(entity); + Vec3 pos = MathUtil.getRandomPosInRadius(entity.position(), RANGE); + summon.setPos(pos); + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(target.position().subtract(pos))); + summon.setXRot(xyRot[0]); + summon.xRotO = xyRot[0]; + summon.setYRot(xyRot[1]); + summon.yRotO = xyRot[1]; + + summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.THE_HORSEMANS_BLADE_JACK); + summon.getEntityData().set(StaticSummon.RENDER_MODE, "block"); + summon.getEntityData().set(StaticSummon.BLOCK, Blocks.JACK_O_LANTERN.defaultBlockState()); + summon.getEntityData().set(StaticSummon.LIFETIME, 300); + summon.getEntityData().set(StaticSummon.SCALE_X, 0.5f); + summon.getEntityData().set(StaticSummon.SCALE_Y, 0.5f); + summon.getEntityData().set(StaticSummon.SCALE_Z, 0.5f); + summon.getEntityData().set(StaticSummon.RYP, 180); + summon.getEntityData().set(StaticSummon.GLOW, true); + summon.setNoGravity(true); + summon.noPhysics = true; + + CompoundTag customData = new CompoundTag(); + customData.putInt("target", target.getId()); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + + beam.level().addFreshEntity(summon); + } + } + } + } + } + } + }; + + public static final IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() { + public void onLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) { + Player player = event.getEntity(); + ItemStack itemStack = player.getMainHandItem(); + if(itemStack.isEmpty()) return; + Item item = itemStack.getItem(); + if(item instanceof TheHorsemansBlade && !player.getCooldowns().isOnCooldown(item)) { + PacketDistributor.sendToServer(new SwordBeamPayload("the_horsemans_blade", BEAM_DATA)); + SoundUtil.playClientSound(player, ModSounds.WAVE.get()); + } + } + public void onAttackEntity(AttackEntityEvent event) { + Player player = event.getEntity(); + ItemStack itemStack = player.getMainHandItem(); + if(itemStack.isEmpty()) return; + Item item = itemStack.getItem(); + if(item instanceof TheHorsemansBlade && !player.getCooldowns().isOnCooldown(item)) { + if(!player.level().isClientSide()) { + SwordBeamBehaviors.getBehavior("the_horsemans_blade").generate(player, BEAM_DATA); + }else { + SoundUtil.playClientSound(player, ModSounds.WAVE.get()); + } + } + event.setCanceled(true); + } + }; + + public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() { + public static final double SPEED = 0.5; + public static final float DAMAGE = 15.0f; + public static final float RANGE = 32.0f; + @Override + public void tick(StaticSummon summon) { + this.checkBeforeTick(summon); + + CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); + LivingEntity target = null; + + if(customData.contains("target")) { + Entity entity = summon.level().getEntity(customData.getInt("target")); + if(entity instanceof LivingEntity le && le.isAlive()) { + target = le; + } + } + + if(!summon.level().isClientSide()) { + if(target == null) { + List targets = summon.level().getEntitiesOfClass( + Monster.class, + AABB.ofSize(summon.position(), RANGE * 2, RANGE * 2, RANGE * 2), + FilterUtil.createMonsterFilter(summon.getOwner()) + ); + targets.sort(Comparator.comparingDouble(e -> e.distanceToSqr(summon.position()))); + if(!targets.isEmpty()) target = targets.getFirst(); + if(target != null) { + customData.putInt("target", target.getId()); + summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData); + } + } + } + + if(target != null) { + Vec3 targetPos = target.position().add(0, target.getBbHeight() / 2.0D, 0); + Vec3 selfPos = summon.position(); + Vec3 dir = targetPos.subtract(selfPos).normalize(); + + summon.setDeltaMovement(dir.scale(SPEED)); + + float[] xyRot = MathUtil.computeXYRot(MathUtil.toVector3f(dir)); + summon.setXRot(xyRot[0]); + summon.setYRot(xyRot[1]); + + if(selfPos.distanceToSqr(targetPos) < 2.0D) { + if(summon.getOwner() instanceof Player player && FilterUtil.createLivingTargetFilter(player).test(target) && target.hurt(summon.damageSources().playerAttack(player), DAMAGE)) onDied(summon); + } + }else { + Vec3 dir = summon.getLookAngle().normalize(); + summon.setDeltaMovement(dir.scale(SPEED)); + } + + if(!summon.level().isClientSide()) { + Vec3 pos = summon.position(); + AABB box = new AABB( + pos.x - 0.25, pos.y - 0.25, pos.z - 0.25, + pos.x + 0.25, pos.y + 0.25, pos.z + 0.25 + ); + summon.setBoundingBox(box); + + List hitEntities = summon.level().getEntitiesOfClass( + Monster.class, + summon.getBoundingBox().inflate(0.2D), + FilterUtil.createMonsterFilter(summon.getOwner()) + ); + + if(!hitEntities.isEmpty()) { + for(Entity hitEntity : hitEntities) { + if(target != null && hitEntity.getUUID() == target.getUUID()) continue; + if(summon.getOwner() instanceof Player player) hitEntity.hurt(summon.damageSources().playerAttack(player), DAMAGE); + } + } + }else { + ParticleUtil.addParticles( + summon.level(), PARTICLE, + summon.position(), 0.1, + new Vec3(0, 0, 0), 0.1, + 2 + ); + } + } + + @Override + public void onDied(StaticSummon summon) { + if(!summon.level().isClientSide()) { + ParticleUtil.addParticles( + (ServerLevel) summon.level(), PARTICLE, + summon.position(), new Vec3(0.1, 0.1, 0.1), + 0.1, 50 + ); + summon.discard(); + } + } + }; +} diff --git a/src/main/java/com/lzxnone/terraria/network/ModNetwork.java b/src/main/java/com/lzxnone/terraria/network/ModNetwork.java new file mode 100644 index 0000000..7d30a73 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/network/ModNetwork.java @@ -0,0 +1,22 @@ +package com.lzxnone.terraria.network; + +import com.lzxnone.terraria.LzxnoneTerraria; +import com.lzxnone.terraria.network.handler.SwordBeamHandler; +import com.lzxnone.terraria.network.payload.SwordBeamPayload; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; +import net.neoforged.neoforge.network.registration.PayloadRegistrar; + +@EventBusSubscriber(modid = LzxnoneTerraria.MODID) +public class ModNetwork { + @SubscribeEvent + public static void register(final RegisterPayloadHandlersEvent event) { + final PayloadRegistrar registrar = event.registrar("1.0.0"); + registrar.playToServer( + SwordBeamPayload.TYPE, + SwordBeamPayload.CODEC, + SwordBeamHandler::handle + ); + } +} diff --git a/src/main/java/com/lzxnone/terraria/network/handler/SwordBeamHandler.java b/src/main/java/com/lzxnone/terraria/network/handler/SwordBeamHandler.java new file mode 100644 index 0000000..7a69bf8 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/network/handler/SwordBeamHandler.java @@ -0,0 +1,16 @@ +package com.lzxnone.terraria.network.handler; + +import com.lzxnone.terraria.entity.beam.SwordBeamBehaviors; +import com.lzxnone.terraria.network.payload.SwordBeamPayload; +import net.minecraft.world.level.Level; +import net.neoforged.neoforge.network.handling.IPayloadContext; + +public class SwordBeamHandler { + public static void handle(final SwordBeamPayload payload, final IPayloadContext context) { + context.enqueueWork(() -> { + Level level = context.player().level(); + if(level.isClientSide()) return; + SwordBeamBehaviors.getBehavior(payload.id()).generate(context.player(), payload.beamData()); + }); + } +} diff --git a/src/main/java/com/lzxnone/terraria/network/payload/SwordBeamPayload.java b/src/main/java/com/lzxnone/terraria/network/payload/SwordBeamPayload.java new file mode 100644 index 0000000..1cbb355 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/network/payload/SwordBeamPayload.java @@ -0,0 +1,26 @@ +package com.lzxnone.terraria.network.payload; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; + +public record SwordBeamPayload (String id, CompoundTag beamData) implements CustomPacketPayload { + public static final Type TYPE = new Type<>( + ResourceLocation.fromNamespaceAndPath("lzxnoneterraria", "sword_beam_payload") + ); + + public static final StreamCodec CODEC = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, SwordBeamPayload::id, + ByteBufCodecs.COMPOUND_TAG, SwordBeamPayload::beamData, + SwordBeamPayload::new + ); + + @Override + public Type type() { + return TYPE; + } + +} diff --git a/src/main/java/com/lzxnone/terraria/particle/DustParticle.java b/src/main/java/com/lzxnone/terraria/particle/DustParticle.java index 288a306..de8410c 100644 --- a/src/main/java/com/lzxnone/terraria/particle/DustParticle.java +++ b/src/main/java/com/lzxnone/terraria/particle/DustParticle.java @@ -24,6 +24,8 @@ public class DustParticle extends TextureSheetParticle { double xSpeed, double ySpeed, double zSpeed, DustParticleOptions options, SpriteSet spriteSet) { super(level, x, y, z, xSpeed, ySpeed, zSpeed); + this.hasPhysics = false; + this.sprites = spriteSet; this.friction = 0.9F; diff --git a/src/main/java/com/lzxnone/terraria/particle/ExplodeParticle.java b/src/main/java/com/lzxnone/terraria/particle/ExplodeParticle.java index 6ee7405..cfdf5d8 100644 --- a/src/main/java/com/lzxnone/terraria/particle/ExplodeParticle.java +++ b/src/main/java/com/lzxnone/terraria/particle/ExplodeParticle.java @@ -2,7 +2,6 @@ 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 ExplodeParticle extends TextureSheetParticle { @@ -12,6 +11,7 @@ public class ExplodeParticle extends TextureSheetParticle { protected ExplodeParticle(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; diff --git a/src/main/java/com/lzxnone/terraria/particle/InfluxWaverDropParticle.java b/src/main/java/com/lzxnone/terraria/particle/InfluxWaverDropParticle.java new file mode 100644 index 0000000..e9cb0e2 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/particle/InfluxWaverDropParticle.java @@ -0,0 +1,152 @@ +package com.lzxnone.terraria.particle; + +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.*; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.util.Mth; +import org.joml.Quaternionf; +import org.joml.Vector3f; + +public class InfluxWaverDropParticle extends TextureSheetParticle { + private final float rotSpeed; + private final float baseSize; + private final double dropSpeed; + private final int canDrop; + + private static final double DROP_RADIO = 0.25; + private static final double ACCELERATION = -0.5; + + private static final double MAX_DIST = 0.1; + private static final int COUNT = 15; + + protected InfluxWaverDropParticle(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.0F; + this.gravity = 0.0F; + this.dropSpeed = ySpeed; + + if(Math.abs(dropSpeed) < 0.001) this.canDrop = 1; + else this.canDrop = this.random.nextInt(5); + + 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.025f; + + this.lifetime = 40 + this.random.nextInt(40 / 2); + this.setSprite(spriteSet.get(this.random)); + } + + @Override + public void tick() { + super.tick(); + + this.oRoll = this.roll; + this.roll += this.rotSpeed; + + float lifeRatio = (float) this.age / (float) this.lifetime; + + if(this.canDrop == 0 && lifeRatio > DROP_RADIO) { + this.yd = dropSpeed + (lifeRatio - DROP_RADIO) / (1.0 - DROP_RADIO) * ACCELERATION; + } + + this.quadSize = this.baseSize * (1.0F - lifeRatio); + this.alpha = 1.0F - lifeRatio; + } + + @Override + public void render(VertexConsumer buffer, Camera camera, float partialTick) { + if (this.alpha <= 0.01F) return; + + float lifeRatio = (this.age + partialTick) / (float) this.lifetime; + double progress = (lifeRatio - DROP_RADIO) / (1.0 - DROP_RADIO); + + if(progress <= 0 || canDrop != 0) { + super.render(buffer, camera, partialTick); + return; + } + + float dist = (float) (progress * MAX_DIST); + + Quaternionf quaternion = new Quaternionf(); + this.getFacingCameraMode().setRotation(quaternion, camera, partialTick); + if(this.roll != 0.0F) { + quaternion.rotateZ(Mth.lerp(partialTick, this.oRoll, this.roll)); + } + + float baseX = (float) (Mth.lerp(partialTick, this.xo, this.x) - camera.getPosition().x); + float baseY = (float) (Mth.lerp(partialTick, this.yo, this.y) - camera.getPosition().y); + float baseZ = (float) (Mth.lerp(partialTick, this.zo, this.z) - camera.getPosition().z); + + float u0 = this.getU0(); + float u1 = this.getU1(); + float v0 = this.getV0(); + float v1 = this.getV1(); + + Vector3f[] baseVertices = new Vector3f[]{ + new Vector3f(1.0F, -1.0F, 0.0F), + new Vector3f(1.0F, 1.0F, 0.0F), + new Vector3f( -1.0F, 1.0F, 0.0F), + new Vector3f( -1.0F, -1.0F, 0.0F) + }; + + float[][] uvs = new float[][]{ + new float[]{u1, v1}, + new float[]{u1, v0}, + new float[]{u0, v0}, + new float[]{u0, v1} + }; + + for(int i = 0; i < COUNT; i++) { + float sizeRatio = 1.0F - ((float) i / (COUNT - 1)); + float currentQuadSize = this.quadSize * sizeRatio; + + if(currentQuadSize <= 0.001F) continue; + + float offsetY = i * dist; + + for(int j = 0; j < 4; j++) { + Vector3f vertex = new Vector3f(baseVertices[j]); + vertex.rotate(quaternion).mul(currentQuadSize).add(baseX, baseY + offsetY, baseZ); + + buffer.addVertex(vertex.x(), vertex.y(), vertex.z()) + .setUv(uvs[j][0], uvs[j][1]) + .setColor(this.rCol, this.gCol, this.bCol, this.alpha) + .setLight(LightTexture.FULL_BRIGHT); + } + } + } + + @Override + public int getLightColor(float partialTick) { + return LightTexture.FULL_BRIGHT; + } + + @Override + public ParticleRenderType getRenderType() { + return ModParticleRenderTypes.TRANSLUCENT_EMISSIVE; + } + + public static class Provider implements ParticleProvider { + 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 InfluxWaverDropParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet); + } + } +} diff --git a/src/main/java/com/lzxnone/terraria/particle/ModParticles.java b/src/main/java/com/lzxnone/terraria/particle/ModParticles.java index 0182264..f798cc9 100644 --- a/src/main/java/com/lzxnone/terraria/particle/ModParticles.java +++ b/src/main/java/com/lzxnone/terraria/particle/ModParticles.java @@ -69,4 +69,6 @@ public class ModParticles { PARTICLE_TYPES.register("explode_particle", () -> new SimpleParticleType(true)); public static final Supplier SEEDLER_THORN_PARTICLE = PARTICLE_TYPES.register("seedler_thorn_particle", () -> new SimpleParticleType(true)); + public static final Supplier INFLUX_WAVER_DROP_PARTICLE = + PARTICLE_TYPES.register("influx_waver_drop_particle", () -> new SimpleParticleType(true)); } \ No newline at end of file diff --git a/src/main/java/com/lzxnone/terraria/particle/SeedlerThornParticle.java b/src/main/java/com/lzxnone/terraria/particle/SeedlerThornParticle.java index e9b5ee7..62cbec8 100644 --- a/src/main/java/com/lzxnone/terraria/particle/SeedlerThornParticle.java +++ b/src/main/java/com/lzxnone/terraria/particle/SeedlerThornParticle.java @@ -10,6 +10,7 @@ public class SeedlerThornParticle extends TextureSheetParticle { protected SeedlerThornParticle(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; diff --git a/src/main/java/com/lzxnone/terraria/particle/StarParticle.java b/src/main/java/com/lzxnone/terraria/particle/StarParticle.java index 2a470df..d62e29a 100644 --- a/src/main/java/com/lzxnone/terraria/particle/StarParticle.java +++ b/src/main/java/com/lzxnone/terraria/particle/StarParticle.java @@ -19,6 +19,7 @@ public class StarParticle extends TextureSheetParticle { protected StarParticle(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; diff --git a/src/main/java/com/lzxnone/terraria/utils/CollisionUtil.java b/src/main/java/com/lzxnone/terraria/utils/CollisionUtil.java new file mode 100644 index 0000000..a7c5758 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/utils/CollisionUtil.java @@ -0,0 +1,67 @@ +package com.lzxnone.terraria.utils; + +import com.lzxnone.terraria.entity.projectile.StaticProjectile; +import com.lzxnone.terraria.entity.summon.StaticSummon; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.Vec3; + +public class CollisionUtil { + public static EntityHitResult checkEntityHit(StaticProjectile projectile, double inflate) { + EntityHitResult result = ProjectileUtil.getEntityHitResult( + projectile.level(), + projectile, + projectile.position(), + projectile.position().add(projectile.getDeltaMovement()), + projectile.getBoundingBox() + .expandTowards(projectile.getDeltaMovement()) + .inflate(inflate), + FilterUtil.createTargetFilter(projectile, projectile.getOwner()) + ); + return result; + } + + public static EntityHitResult checkEntityHit(StaticProjectile projectile) { + return checkEntityHit(projectile, 1.0); + } + + public static BlockHitResult checkBlockHit(StaticProjectile projectile) { + BlockHitResult result = projectile.level().clip(new ClipContext( + projectile.position(), projectile.position().add(projectile.getDeltaMovement()), + ClipContext.Block.COLLIDER, + ClipContext.Fluid.NONE, + projectile + )); + return result; + } + + public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos, double inflate) { + EntityHitResult result = ProjectileUtil.getEntityHitResult( + summon.level(), + summon, + summon.position(), + nextPos, + summon.getBoundingBox() + .expandTowards(nextPos) + .inflate(inflate), + FilterUtil.createTargetFilter(summon, summon.getOwner()) + ); + return result; + } + + public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos) { + return checkEntityHit(summon, nextPos, 1.0); + } + + public static BlockHitResult checkBlockHit(StaticSummon summon, Vec3 nextPos) { + BlockHitResult result = summon.level().clip(new ClipContext( + summon.position(), nextPos, + ClipContext.Block.COLLIDER, + ClipContext.Fluid.NONE, + summon + )); + return result; + } +} diff --git a/src/main/java/com/lzxnone/terraria/utils/FilterUtil.java b/src/main/java/com/lzxnone/terraria/utils/FilterUtil.java new file mode 100644 index 0000000..119b4c1 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/utils/FilterUtil.java @@ -0,0 +1,48 @@ +package com.lzxnone.terraria.utils; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Monster; + +import javax.annotation.Nullable; +import java.util.function.Predicate; + +public class FilterUtil { + public static final Predicate BASE_FILTER = entity -> + entity != null + && entity.isAlive() + && entity.isPickable() + && !entity.isInvulnerable() + && !entity.isSpectator(); + + + public static Predicate createLivingTargetFilter(@Nullable Entity owner) { + return target -> + BASE_FILTER.test(target) + && (owner == null || (target != owner && !target.isAlliedTo(owner))); + } + + public static Predicate createLivingTargetFilter(Entity attacker, @Nullable Entity owner) { + return target -> + createLivingTargetFilter(owner).test(target) + && target != attacker; + } + + public static Predicate createTargetFilter(@Nullable Entity owner) { + return target -> + BASE_FILTER.test(target) + && (owner == null || (target != owner && !target.isAlliedTo(owner))); + } + + public static Predicate createTargetFilter(Entity attacker, @Nullable Entity owner) { + return target -> + createTargetFilter(owner).test(target) + && target != attacker; + } + + public static Predicate createMonsterFilter(@Nullable Entity owner) { + return monster -> + BASE_FILTER.test(monster) + && (owner == null || (monster != owner && !monster.isAlliedTo(owner))); + } +} diff --git a/src/main/java/com/lzxnone/terraria/utils/MathUtil.java b/src/main/java/com/lzxnone/terraria/utils/MathUtil.java index 7815b0d..c2be520 100644 --- a/src/main/java/com/lzxnone/terraria/utils/MathUtil.java +++ b/src/main/java/com/lzxnone/terraria/utils/MathUtil.java @@ -1,10 +1,14 @@ package com.lzxnone.terraria.utils; -import net.minecraft.world.phys.Vec3; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.*; import org.joml.Vector3f; public class MathUtil { - public static Vector3f[] computeProjectileDir(Vector3f tempDir) { + public static Vector3f[] computeDir(Vector3f tempDir) { Vector3f dir = new Vector3f(tempDir.x, tempDir.y, tempDir.z).normalize(); // 方向接近垂直时用 X 轴,否则用 Y 轴做参考向量 @@ -19,6 +23,88 @@ public class MathUtil { return new Vector3f[]{dir, up, right}; } + public static Vector3f[] computeDir(Vector3f tempDir, Vector3f tempRight) { + Vector3f dir = new Vector3f(tempDir.x, tempDir.y, tempDir.z).normalize(); + Vector3f right = new Vector3f(tempRight.x, tempRight.y, tempRight.z).normalize(); + + Vector3f up = new Vector3f(); + dir.cross(right, up).normalize(); + + up.cross(dir, right).normalize(); + + return new Vector3f[]{dir, up, right}; + } + + public static float[] computeXYRot(Vector3f dir) { + float xzLen = (float) Math.sqrt(dir.x() * dir.x() + dir.z() * dir.z()); + float pitch = (float) (Math.atan2(-dir.y(), xzLen) * (180.0 / Math.PI)); + float yaw = (float) (Math.atan2(-dir.x(), dir.z()) * (180.0 / Math.PI)); + return new float[]{pitch, yaw}; + } + + public static Vec3 getRandomPosForRadius(Vec3 pos, double radius, boolean on) { + double u = Math.random(); + double v = Math.random(); + double w = Math.random(); + + double r = on ? radius : radius * Math.cbrt(u); + double cosPhi = 2.0 * v - 1.0; + double sinPhi = Math.sqrt(1.0 - cosPhi * cosPhi); + double theta = w * Math.PI * 2.0; + + double offsetX = r * sinPhi * Math.cos(theta); + double offsetY = r * cosPhi; + double offsetZ = r * sinPhi * Math.sin(theta); + + return new Vec3(pos.x + offsetX, pos.y + offsetY, pos.z + offsetZ); + } + + public static Vec3 getRandomPosOnRadius(Vec3 pos, double radius) { + return getRandomPosForRadius(pos, radius, true); + } + + public static Vec3 getRandomPosInRadius(Vec3 pos, double radius) { + return getRandomPosForRadius(pos, radius, false); + } + + public static Vec3 getCrosshairPos(Player player, Level level, double range, boolean checkBlock, boolean checkEntity) { + Vec3 eyePos = player.getEyePosition(1.0F); + Vec3 lookVec = player.getLookAngle().normalize(); + Vec3 maxRangeEnd = eyePos.add(lookVec.scale(range)); + Vec3 finalTarget = maxRangeEnd; + + if(checkBlock) { + BlockHitResult blockHit = level.clip(new ClipContext( + eyePos, maxRangeEnd, + ClipContext.Block.COLLIDER, + ClipContext.Fluid.NONE, + player + )); + + if(blockHit.getType() != HitResult.Type.MISS) { + finalTarget = blockHit.getLocation(); + } + } + + if(checkEntity) { + AABB searchBox = player.getBoundingBox().expandTowards(lookVec.scale(range)).inflate(1.0D); + EntityHitResult entityHit = ProjectileUtil.getEntityHitResult( + level, player, eyePos, finalTarget, searchBox, + entity -> !entity.isSpectator() && entity.isPickable() && entity != player + ); + + if(entityHit != null) { + finalTarget = entityHit.getLocation(); + } + } + + return finalTarget; + } + + public static Vec3 getCrosshairPos(Player player, Level level, double range) { + return getCrosshairPos(player, level, range, true, true); + } + public static Vector3f toVector3f(Vec3 vec3) { return new Vector3f((float) vec3.x, (float) vec3.y, (float) vec3.z); } diff --git a/src/main/java/com/lzxnone/terraria/utils/ParticleUtil.java b/src/main/java/com/lzxnone/terraria/utils/ParticleUtil.java new file mode 100644 index 0000000..894eea0 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/utils/ParticleUtil.java @@ -0,0 +1,27 @@ +package com.lzxnone.terraria.utils; + +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + + +public class ParticleUtil { + public static void addParticle(Level level, ParticleOptions particleData, Vec3 pos, double randomRadius, Vec3 speed, double randomSpeed) { + if(level.isClientSide()) { + level.addParticle(particleData, true, + pos.x + (Math.random() * 2 - 1) * randomRadius, pos.y + (Math.random() * 2 - 1) * randomRadius, pos.z + (Math.random() * 2 - 1) * randomRadius, + speed.x + (Math.random() * 2 - 1) * randomSpeed, speed.y + (Math.random() * 2 - 1) * randomSpeed, speed.z + (Math.random() * 2 - 1) * randomSpeed); + } + } + + public static void addParticles(Level level, ParticleOptions particleData, Vec3 pos, double randomRadius, Vec3 speed, double randomSpeed, int count) { + if(level.isClientSide()) { + while(count-- > 0) addParticle(level, particleData, pos, randomRadius, speed, randomSpeed); + } + } + + public static void addParticles(ServerLevel level, ParticleOptions particleData, Vec3 pos, Vec3 offset, double speed, int count) { + level.sendParticles(particleData, pos.x, pos.y, pos.z, count, offset.x, offset.y, offset.z, speed); + } +} diff --git a/src/main/java/com/lzxnone/terraria/utils/SoundUtil.java b/src/main/java/com/lzxnone/terraria/utils/SoundUtil.java new file mode 100644 index 0000000..fa726c4 --- /dev/null +++ b/src/main/java/com/lzxnone/terraria/utils/SoundUtil.java @@ -0,0 +1,61 @@ +package com.lzxnone.terraria.utils; + +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +public class SoundUtil { + public static void playClientSound(Player player, SoundEvent event) { + if(player.level().isClientSide()) { + player.playSound(event, 4.0f, 1.0f); + } + } + + public static void playClientSound(Player player, SoundEvent event, float volume, float pitch) { + if(player.level().isClientSide()) { + player.playSound(event, volume, pitch); + } + } + + public static void playServerSound(Level level, SoundEvent event, Vec3 pos) { + if(!level.isClientSide()) { + level.playSound( + null, + pos.x, pos.y, pos.z, + event, + SoundSource.PLAYERS, + 4.0f, + 1.0f + ); + } + } + + public static void playServerSound(Level level, SoundEvent event, Vec3 pos, float volume, float pitch) { + if(!level.isClientSide()) { + level.playSound( + null, + pos.x, pos.y, pos.z, + event, + SoundSource.PLAYERS, + volume, + pitch + ); + } + } + + public static void playServerSound(Entity entity, SoundEvent event, float volume, float pitch) { + if(!entity.level().isClientSide()) { + entity.level().playSound( + null, + entity, + event, + SoundSource.PLAYERS, + volume, + pitch + ); + } + } +} diff --git a/src/main/resources/assets/lzxnoneterraria/lang/en_us.json b/src/main/resources/assets/lzxnoneterraria/lang/en_us.json index cb7ca61..35809eb 100644 --- a/src/main/resources/assets/lzxnoneterraria/lang/en_us.json +++ b/src/main/resources/assets/lzxnoneterraria/lang/en_us.json @@ -14,6 +14,8 @@ "item.lzxnoneterraria.the_horsemans_blade": "The Horseman's Blade", "item.lzxnoneterraria.zenith": "Zenith", + "entity.lzxnoneterraria.static_projectile": "Projectile", + "entity.lzxnoneterraria.static_summon": "Summon", "entity.lzxnoneterraria.bee_summon": "Bee", "effect.lzxnoneterraria.confused": "Confused" diff --git a/src/main/resources/assets/lzxnoneterraria/lang/zh_cn.json b/src/main/resources/assets/lzxnoneterraria/lang/zh_cn.json index 3af2d81..276a98f 100644 --- a/src/main/resources/assets/lzxnoneterraria/lang/zh_cn.json +++ b/src/main/resources/assets/lzxnoneterraria/lang/zh_cn.json @@ -14,6 +14,8 @@ "item.lzxnoneterraria.the_horsemans_blade": "无头骑士剑", "item.lzxnoneterraria.zenith": "天顶剑", + "entity.lzxnoneterraria.static_projectile": "弹射物", + "entity.lzxnoneterraria.static_summon": "召唤物", "entity.lzxnoneterraria.bee_summon": "蜜蜂", "effect.lzxnoneterraria.confused": "困惑" diff --git a/src/main/resources/assets/lzxnoneterraria/models/item/influx_waver_beam.json b/src/main/resources/assets/lzxnoneterraria/models/item/influx_waver_beam.json new file mode 100644 index 0000000..951bae0 --- /dev/null +++ b/src/main/resources/assets/lzxnoneterraria/models/item/influx_waver_beam.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "lzxnoneterraria:item/influx_waver_beam" + } +} diff --git a/src/main/resources/assets/lzxnoneterraria/models/item/meowmere_projectile.json b/src/main/resources/assets/lzxnoneterraria/models/item/meowmere_projectile.json new file mode 100644 index 0000000..f547415 --- /dev/null +++ b/src/main/resources/assets/lzxnoneterraria/models/item/meowmere_projectile.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "lzxnoneterraria:item/meowmere_projectile" + } +} diff --git a/src/main/resources/assets/lzxnoneterraria/models/item/star_wrath_star.json b/src/main/resources/assets/lzxnoneterraria/models/item/star_wrath_star.json new file mode 100644 index 0000000..41dd821 --- /dev/null +++ b/src/main/resources/assets/lzxnoneterraria/models/item/star_wrath_star.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "lzxnoneterraria:item/star_wrath_star" + } +} diff --git a/src/main/resources/assets/lzxnoneterraria/models/item/weapon.json b/src/main/resources/assets/lzxnoneterraria/models/item/weapon.json index 89e1470..cc3d1ae 100644 --- a/src/main/resources/assets/lzxnoneterraria/models/item/weapon.json +++ b/src/main/resources/assets/lzxnoneterraria/models/item/weapon.json @@ -18,7 +18,7 @@ }, "firstperson_lefthand": { "rotation": [0, -90, -25], - "translation": [1.13, 3.2, 3.0], + "translation": [1.13, 6.2, 0.0], "scale": [0.68, 0.68, 0.68] } } diff --git a/src/main/resources/assets/lzxnoneterraria/particles/influx_waver_drop_particle.json b/src/main/resources/assets/lzxnoneterraria/particles/influx_waver_drop_particle.json new file mode 100644 index 0000000..65cf15b --- /dev/null +++ b/src/main/resources/assets/lzxnoneterraria/particles/influx_waver_drop_particle.json @@ -0,0 +1,7 @@ +{ + "textures": [ + "lzxnoneterraria:influx_waver_particle0", + "lzxnoneterraria:influx_waver_particle1", + "lzxnoneterraria:influx_waver_particle2" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/lzxnoneterraria/sounds.json b/src/main/resources/assets/lzxnoneterraria/sounds.json index 4b35374..fe4f996 100644 --- a/src/main/resources/assets/lzxnoneterraria/sounds.json +++ b/src/main/resources/assets/lzxnoneterraria/sounds.json @@ -2,6 +2,9 @@ "wave": { "sounds": ["lzxnoneterraria:wave"] }, + "wave2": { + "sounds": ["lzxnoneterraria:wave2"] + }, "max_mana": { "sounds": ["lzxnoneterraria:max_mana"] }, @@ -16,5 +19,11 @@ }, "boom": { "sounds": ["lzxnoneterraria:boom"] + }, + "cat": { + "sounds": ["lzxnoneterraria:cat"] + }, + "cat2": { + "sounds": ["lzxnoneterraria:cat2"] } } diff --git a/src/main/resources/assets/lzxnoneterraria/sounds/cat.ogg b/src/main/resources/assets/lzxnoneterraria/sounds/cat.ogg new file mode 100644 index 0000000000000000000000000000000000000000..fd369d61dea3f9c02b499239d24a273f4f6ab783 GIT binary patch literal 21948 zcmeFXby$^8*C;%Dv+0m-VS}_FjbOkg1*AhtN?IDE6mWymA>G~Gps1wMEg~QY2q+>T zNayC<=1YMfOQY9y^Q) z=IQMAz|Q@m0xnl^@ec~Fe}P}Y)GvDeJ6!aHL8a0)ACnZ7gBG)AlmXZ+GMQaf$*!`~rDPlRu%YFQcFU2lQxh*n;)ZK3NZ@zwaacGNH5A!94Rf>O5gTAblLsh8mLN*4i{wEl zOE4{zgfP1GvJ_{y5%84c1QH1KBA=-UtroNjkG}Dft6@}zkgwr`vWnouJ&URq z9AjViVTqNDe-ivZ^FTu1B7;L`Nh*VPF?=X@QHmQh)Zb|#0UDYnxD!jMR7*Kf%Q!T~ zroPRqNg+BWEU&GjstW}VV?9r+Nl%YSPd|f{Afs1)2CssQrh<$Qg3M`y|A~iw^9L94 z&(x7HkaI;MX^A_Jl|FA#A`k0%a0MJ#UXTQdAI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XbK>-nmCklrzk7tFt0Be1R4Q*00 zRh3MW1S9|e%a6v}y^qcDS8x2&FdjW{vVS(T{o0+DAoJa@QuHg`OzPY}|8BEOC1&=|;y+np$8a?KSz{*Gf1E2GUFkeod1qw|INb9&EG$#HL87R-fnhf zfqQ2%^?l6u-r<>=6gZi6YSzi*!^0y+`C&coaXilB-P+vzztDXg51jXL@a~;=9$eu+ zIG>kX@c~>hbPrAQcEdFEz}pSeoU3;}*6*7D&D+oe1I{P!$hng9*}00000000000000E4(m)%P5=M^ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/sounds/cat2.ogg b/src/main/resources/assets/lzxnoneterraria/sounds/cat2.ogg new file mode 100644 index 0000000000000000000000000000000000000000..e40bf8e084149e6faad44be8578f911b9fd45af3 GIT binary patch literal 14925 zcmeHud03NIx9@&K0wD}dAc+x>h5!;ESR#X<)+RuZQ4>gF0I?wmGOHk3s??(>}I{&zQT-t2j2uf5h@ zzqR&e`I{ z^9E?q1?<6pyy&j0DF9#r%GBRcbJsuNoaY*v-HueHXZ$jc19Uxw;D)Du->bRNDfJ!o zi7DsoZSh87I5>I0@w3VyhiG3ixm7L=zP4MW4p|-8mr8I@E3*jmhv?ga=0B({S+?+j zx@O11hs=%hEP<)ps0%Mt7%YMzJ#xjyn2Q_JFK*l#R-O}a zWNX-woQSEM$TvArwA{a+Ket|gqkTS2osIydwP)Eadlkb>HSMX=$R>Q z7QaGjggA|*x~)k2`eIt}MMw%QMgGqr^Ao?oiC9&}mL;Hgm!haoWIk;U-#R`Yh%=Y2=XIR=-)5&uS zAGMq$dK6cj7IT`L)R~iyvU-wy};G)u37jboGe-e`1^3>Dz z2cT5^>%u*^IZv81`Y+G<-z@|tw(uF9?-c6twMZyhu`xMpclwpXIgwN8*Dr3pezEY| zS-JntSpSq90EH&|lT4P%3fQOiZCmE0|9OG`Avx>Gr*>NWy3;1G%_jH)>+B2H;805BC?$Q28WZXsIp!8KCW@KZ7;~vBCgSkcu&%!a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;$@ADv{x@g0}DI z)(y<0o^Kjy#Wkyc=lF&QrqG${1+>?tLQKE0amgOZFbQ6Afr92zf||Kg8+k^Jg~yLq zHW%sxS^QL7N&L3(DHgTNT|yBh)<-qaBxZ6-<75)q)Q#LqfetWAbM5f3vqCgSqgx~I z-F3QheBaR|+^ECCbhW}kSNdo&WuDP@tduha{KO}W)E$o_(4UPR#PEVai`vXuG#!R8S^9JPh7jU;r#W% zdbeM)t4yZ@@fAlp*I>Xk9`^3sUq3dTH4l-6X4lVSI4|&jy(aluk;z_$>zvg;86CA| zuP5b`7I_fcx6#<`~eT(n&*6ta@K zV&f%>a%z3tBj=P#8P5>~^n;PNnK#=Lzun!?dF{6-NoVW?Umy^W>vJJ*PQg_oj(@DzTf*WWh~a;Z;wMI{q7BV zS6y4m;;Z-W1srbe&DgWtnQsiPK}y6do_B9k+P-$&A2FHpZmswHW$&$hPRg$gYLicTp5)YTb5=}EW4cT7DcCEMa$JskH%;(EP&R4z+9w~X z&(=f+UO9ex%UL_m(CzDvIh=56ZHlm5(NQS>^F`56_DkX2-1~m@cSeeh(gsa$9^b-< z-_smju`yz4@}G0PlWsL7ePCd89pE%kWJoOwI@9DSJ8=iQ>WLs dU$4CSmGrOv$Y;14iK*A;e7&x39fk~y{}%>AygdK_ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/sounds/wave2.ogg b/src/main/resources/assets/lzxnoneterraria/sounds/wave2.ogg new file mode 100644 index 0000000000000000000000000000000000000000..d7b43c4b16d4f0abc9d4e9a74fafac8a867e7f78 GIT binary patch literal 11660 zcmaiabzD_VxA3M@q)R}$RT>UR_n{9QDe00H5D*Zgn?rXuC?PG4bV+xLbc09;3g5=( zecpTTU*G&@&t7}g%&b{!X6=2Bnw6C%fDHVnyc7uyy9aY0ct#`9Ah|g@n_9cvBamdu z?r#9#D}?m-{uxQ_Uh==?Uh&`aXYku52Ze*1(ZQRW=4Jm^#F9p z4pm?$Cu_KWH`iyQsnE0lMgA+w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nLd0xzHaNLmr_BQ-4Eh0Ni^s*QnxpF)~n;f&T}~ C5_P@+ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/item/influx_waver_beam.png b/src/main/resources/assets/lzxnoneterraria/textures/item/influx_waver_beam.png new file mode 100644 index 0000000000000000000000000000000000000000..b0ab5dac97ed6e4b12d7b2b046c515873430cfc4 GIT binary patch literal 529 zcmV+s0`C2ZP)Px#1ZP1_K>z@;j|==^1poj54^T{0MF0Q*B7nMn16Rw}XE)U|r)qqQ!>(`%~QHz08 zNciqz5$7a(`|uvsB~P~@@%ic{D$ilC7)Zr+o2KM}HBa(T45WeqH)%C_5(iBlih-_u z-X-r6SBinIeV%hBuIu-Xd<~Fn>RQybPLgfA4JP^CpPm7dq+h$W$bCR^pp#VJfz;of zt^w^Hx+b|#yN~;RZ`)l`$=87E25Jbj>yZ4=Ci0&HYC`)w=p+S<@O;}o-$ecfNSukO z1~hr?Lhc=cVxX=T64RX&(EkAgsXMB!OwWLuw9s}()s^WO&~F}KqJnmtp-oJ05-aYj zweN}R$j^XF-X+NWz;i?I10Wv*B-ykVZbFSfc?S%$zLNhh@-YBoNghUSpsIcVCzN1x Tc)()V00000NkvXXu0mjfYsK=z literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/item/meowmere_projectile.png b/src/main/resources/assets/lzxnoneterraria/textures/item/meowmere_projectile.png new file mode 100644 index 0000000000000000000000000000000000000000..75e3a8532f78f3fbbd37ca13623944a2357c5aff GIT binary patch literal 406 zcmV;H0crk;P)Px#1ZP1_K>z@;j|==^1poj57*I@9MF0Q*IyxwLWp(M;=-WFQk*S!w)-GEu;>V>eLDWP;K(10?$Z=5jl2UogM0xEM?aCOLrV z!RG_?uwL4;6-;vpaYJZf2n_@7{-$6W=97W*0nFtv7sCK9mw$Wv6-=YY1zopr0Dw9lRsaA1 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/particle/enchanted_sword_beam_particle_center.png b/src/main/resources/assets/lzxnoneterraria/textures/particle/enchanted_sword_beam_particle_center.png deleted file mode 100644 index 67a264bd45cb1fb784be6085968d45fcde49ef59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqoCO|{#S9GG!XV7ZFl&wkP*BO! z#W6%;YVx1||LvLW4zz?%lVSb8a7Kl2#DyO{BD)!x85rzRS^3sjox258&EVPwoEp^pGU6*XTuw0+{vb2B$ ztAtmfMPvW+6??w^+vE2p?jg&hVu484&w>k#3w-~oGP|C7)}VCZa#2pS8RwnLejdfP zMSDGu&TYIKvDs+1!@m2UMYnpilsgvlg{a+IX+8JW-u-C~J*KPE#6#wM-xhJ|tG%n> z3rV9l3Q_5eryCwfI^_!-=BzMgNOw&&t@O1Ta JS?83{1OVr2V(|a~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle1.png b/src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle1.png new file mode 100644 index 0000000000000000000000000000000000000000..8367ecd8e5e5d0272569e89e6144861499cba88a GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWNC|Kd? z;usRq`gV#V*8u|#mh1bp&!6A_MsvcpWg9~-2t41xVx*^JXl!E{Q}5p>;?bze%5{LX zB4&MHo?ZfPrvJz5FSQ(Im2Z^J2)>@(R&91_cg_vBGi*yv{{L{zzopr00X~9GXMYp literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle2.png b/src/main/resources/assets/lzxnoneterraria/textures/particle/influx_waver_particle2.png new file mode 100644 index 0000000000000000000000000000000000000000..9794a85e310a1f055cf09e3930d62e2e6da26844 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWNC>ZJK z;usRq`u3_J-vI?4=Ro$tHFEpEa|tu&D5wN~t!9@CTjG*-YGzWcEKo56!ySedyV>P4 zZzQc3vHpHTy5nl8&HtKnS;F_T7d+o@TwwJLWFG@VgX{%{TbG55n^d)zf%u-TelF{r G5}E*?I58mr literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/vfx/beam_sparkle.png b/src/main/resources/assets/lzxnoneterraria/textures/vfx/beam_sparkle.png new file mode 100644 index 0000000000000000000000000000000000000000..b7441c4ffaa6cda08f2c6441e4f14f6e51e2bb94 GIT binary patch literal 443 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGooCO|{#S9GG!XV7ZFl&wk0|R5O zr;B4q#hkZy4stach_GHv|MG^7dvt=ZwyusTxyyUdN3tTh+5&%RY(_sag$48aHQR##+A*vpiE``|mf`-&H8 zzi_{*Y^Zg9UVofp*Y9cn%wLo!XKee$E5$l9>+tV1mKVRpQeN@C_x>YWu=QZz?D(mi z8$v+Nn$A^V^7`?!`cSHL_y!skL2c9qiOWk`e XCU&auF^4EHHW)lz{an^LB{Ts5DW#aI literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/vfx/rainbow.png b/src/main/resources/assets/lzxnoneterraria/textures/vfx/rainbow.png new file mode 100644 index 0000000000000000000000000000000000000000..dbfeb038339505a45f0cab2c60a3f8f3da79aa9a GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^_8`o`1SD_Rws!!jUQZXtkcv5PuOH+*U?6fhpmyS3 zYln8f_7{pApVSQYNt{2e=6!034-Dn($S&=g;yDwF)_#h(_%046>2vDYx~qmkYN=4P y?bP+IvhN7K+3$rYX1&{P`Hj>e`Px-u1Q2eRCr$9UG0+FFbGUKbAA8k?akC3TUIO~J{E-HT<=fsVkB4=5SHxp`8a>R zw{6>h{dzv1^|Md?cQ^1bHt_QTw*%fM`TYX`^Efd#m~6V3$8-jG$r}OzPG$aPrJh73Tna5-Sq z5F)p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git a/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam2.png b/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam2.png new file mode 100644 index 0000000000000000000000000000000000000000..e8e7844893ffecfac79859cba94b8f858c11ae28 GIT binary patch literal 727 zcmeAS@N?(olHy`uVBq!ia0vp^4nRDCgAGXT2+#cpq&N#aB8wRq#8g3;(KATp0|Nt7 zr>Bc!NX4ADbI;}-HsEP~o>=>z{hi|8GY8ZTO!%*IN^Jk*ZAVzndUZB~Qm{D2u=;g#GS3F37~T~bn{A_oBbZrC7<3uVZe)A&itD)4hVI9_5x$2$vaJ!i z))20FGg~23`t-}8Qb?;v+JKl?Tun9MaJvci5*Ju4spN8)Z zi>uq#ShEX1uua&KH^GkaF58=3lP;e-EUSFZ=Q=~=S@-h#%)1A)Szii6e6v&BVXdeE z<1P6NW8uQ7=`3mq-#Js``@hL6tN0vPC+s>mkykC@OT)c&1zt**)En3qur7GHj&bep zfA=0QI>fSOp29Dl@Kt{AWW`K`FT8rbd8@PKb zE}&$oh+SM815Bo0an8u_!P82|;`X8z<7POx?O pGIz;K;R`j7Q^cTt_RK%PKFLSYN-<5^3z$+FJYD@<);T3K0RV8cF(m*1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam3.png b/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam3.png new file mode 100644 index 0000000000000000000000000000000000000000..76c159b3711d126753f06ff5c5bae5558af0f5ac GIT binary patch literal 641 zcmeAS@N?(olHy`uVBq!ia0vp^4nRDCgAGXT2+#cpq&N#aB8wRq#8g3;(KATp0|Nt- zv8Rh;NX4ADb592zF%V!)&Ejkk>1dj;a{^NfL*<);F*BHhpWd4PR4)3ixnG@)sj|4v zr7!<}+HSvg>-Ou@SJ)EfJ+F_qceFfJPKsRM=BBN_K)Mo0`v8s4~ym zWgB58=rr&-BqJ+51~UmoN%4>UJU=-na)S(mtFXMtSXKD8eiC1P1IRHTql$OLKDcJ= z+Gc(LW{l+-y@K~QlMYKK0BxCd_k4r)5{RtMp=i!Qh=!`g;ygrP1DRzg64J7o4d+5VrlsZ@CEv z(hr1b?{8rX;9pl{y_YTL?*T1s`HTZ${HwNoYGnIT=Wul@f1CLO@is@cbvJeR{s7Yy NgQu&X%Q~loCIAzs|Dyl^ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam4.png b/src/main/resources/assets/lzxnoneterraria/textures/vfx/terra_beam4.png new file mode 100644 index 0000000000000000000000000000000000000000..cf9a7457730ada238b6fe7960404d228842bb44d GIT binary patch literal 982 zcmV;{11bE8P)?>qk3;E-4F{~mqjLdXlhipBz52niz~t{^4EoP<~AGfK$*{(aGejO~{Li!j$L zauGlg=ZhmEf&;3O@~`oGM&0&9EyHR#VGyw|gM?^%*s0fHTl4O90XqY7+#SUf>vjrSc5RD+& zL~umFFhxRc-)>TFNR3sM9CbXN%smLN$$j$slc z3P>ftArd4CI3T*o?r?U4ccco|wR@Bt0aKcSWC1z4NsumJ_-IhN03d$>_59$1lVHq{ zq^KbRhN4Np2K2v#)+FGd=Kx9DbByi<))oQX2S?fj0C@@3A~XsBIu4Mu3IIAa2h9Sy zpk2V@+i2Pa0Cxd8(cCRs5s>0G4_Fe=6a|(9G_eG57oaoMgCc7JQY0mq z6;OKD$gF@;EDEUV4lN1*Ku*FU^MF|ar8z*;lc8FQrstZCfKrwK?gEVFE*Dr9P}Ch- z769P>QJQ%Hz^NHrdIswPZkvI10RZyNz=Z%H-5ag;J-pIWpJgdT7Hral5{`g{t_5zuApKlKp+JX>Q_YXo%L_)%j7blvq* zn}B$-!{enjH3>K>-*ahQEdqvA9?&5mHOHsR%Cgc04Buu$vVcqFN2~)bb#3v>PPU(d zcHePAas&VvllVd;3YfZUtuz6TuI*b8nFENhAGX_!6al$2KXj`dQB7cW4%u^2vJveEL(B2^#V=z@VDoV;uFpxAfCU=x(WO29FTo~ zhl5!WaEiN8S9UE-jQ~k!{>$hH5PRmojEsQkS9UG@2k70c%KUNZ-T(jq07*qoM6N<$ Eg6@u)2LJ#7 literal 0 HcmV?d00001