v1.4.2
No files matched your search
@@ -38,3 +38,7 @@ run/
|
||||
**/src/generated/**/.cache/
|
||||
repo/
|
||||
!**/src/**/repo/
|
||||
|
||||
.reasonix
|
||||
reasonix.toml
|
||||
|
||||
@@ -32,7 +32,7 @@ mod_name=Lzxnone Terraria
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.4.0
|
||||
mod_version=1.4.2
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lzxnone.terraria;
|
||||
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.block.ModBlocks;
|
||||
import com.lzxnone.terraria.creative_mode_tab.ModCreativeModeTabs;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
@@ -34,6 +35,7 @@ public class LzxnoneTerraria {
|
||||
ModParticles.PARTICLE_TYPES.register(modEventBus);
|
||||
ModSounds.SOUND_EVENTS.register(modEventBus);
|
||||
ModCreativeModeTabs.CREATIVE_MODE_TABS.register(modEventBus);
|
||||
ModAttachments.ATTACHMENT_TYPES.register(modEventBus);
|
||||
|
||||
//实体属性创建
|
||||
modEventBus.addListener(this::onEntityAttributeCreation);
|
||||
|
||||
@@ -41,6 +41,12 @@ public class LzxnoneTerrariaClient {
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.ZENITH_TRAIL_PARTICLE.get(), ZenithTrailParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.IRON_SPARK_PARTICLE.get(), IronSparkParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.CIRCLE_PARTICLE.get(), CircleParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.STAR_PARTICLE.get(), StarParticle.Provider::new);
|
||||
});
|
||||
@@ -77,5 +83,11 @@ public class LzxnoneTerrariaClient {
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.SOLAR_EXPLOSION_PARTICLE.get(), SolarExplosionParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE.get(), DevilsDevastationRuneParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE2.get(), DevilsDevastationRuneParticle2.Provider::new);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.lzxnone.terraria;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT)
|
||||
public class ModKeyBindings {
|
||||
public static final KeyMapping KILL_MODE = new KeyMapping(
|
||||
"key.lzxnoneterraria.kill_mode",
|
||||
InputConstants.Type.MOUSE,
|
||||
GLFW.GLFW_MOUSE_BUTTON_MIDDLE,
|
||||
"key.categories.lzxnoneterraria"
|
||||
);
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerKeys(RegisterKeyMappingsEvent event) {
|
||||
event.register(KILL_MODE);
|
||||
}
|
||||
}
|
||||
@@ -67,4 +67,12 @@ public class ModSounds {
|
||||
SOUND_EVENTS.register("dig",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "dig")));
|
||||
public static final Supplier<SoundEvent> DEMON_SWORD_SWING =
|
||||
SOUND_EVENTS.register("demon_sword_swing",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "demon_sword_swing")));
|
||||
public static final Supplier<SoundEvent> DEMON_SWORD_IMPACT =
|
||||
SOUND_EVENTS.register("demon_sword_impact",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "demon_sword_impact")));
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.lzxnone.terraria.attachment;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.neoforged.neoforge.attachment.AttachmentType;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModAttachments {
|
||||
public static final DeferredRegister<AttachmentType<?>> ATTACHMENT_TYPES =
|
||||
DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, "lzxnoneterraria");
|
||||
|
||||
public static final Supplier<AttachmentType<List<UUID>>> STUCK_DEVILS_DEVASTATION_PROJECTILE =
|
||||
ATTACHMENT_TYPES.register("stuck_devils_devastation_projectile", () -> AttachmentType.<List<UUID>>builder((Supplier<List<UUID>>) ArrayList::new).serialize(Codec.list(Codec.STRING.xmap(UUID::fromString, UUID::toString))).build());
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
public class ModCreativeModeTabs {
|
||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, LzxnoneTerraria.MODID);
|
||||
|
||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> WEAPON_TAB = CREATIVE_MODE_TABS.register("weapon_tab", () -> CreativeModeTab.builder()
|
||||
.title(Component.translatable("itemGroup.lzxnoneterraria.weapon"))
|
||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> MELEE_TAB = CREATIVE_MODE_TABS.register("melee_tab", () -> CreativeModeTab.builder()
|
||||
.title(Component.translatable("itemGroup.lzxnoneterraria.melee"))
|
||||
.withTabsBefore(CreativeModeTabs.COMBAT)
|
||||
.icon(() -> ModItems.TERRA_BLADE.get().getDefaultInstance())
|
||||
.displayItems((parameters, output) -> {
|
||||
@@ -42,4 +42,12 @@ public class ModCreativeModeTabs {
|
||||
output.accept(ModItems.FIRST_FRACTAL.get());
|
||||
output.accept(ModItems.MACE.get());
|
||||
}).build());
|
||||
|
||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> CALAMITY_MELEE_TAB = CREATIVE_MODE_TABS.register("calamity_melee_tab", () -> CreativeModeTab.builder()
|
||||
.title(Component.translatable("itemGroup.lzxnoneterraria.calamity_melee"))
|
||||
.withTabsBefore(CreativeModeTabs.COMBAT)
|
||||
.icon(() -> ModItems.DEVILS_DEVASTATION.get().getDefaultInstance())
|
||||
.displayItems((parameters, output) -> {
|
||||
output.accept(ModItems.DEVILS_DEVASTATION.get());
|
||||
}).build());
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class MEntityLuminance implements EntityLuminance {
|
||||
public @Range(from = 0, to = 15) int getLuminance(@NonNull ItemLightSourceManager itemLightSourceManager, @NonNull Entity entity) {
|
||||
if(entity instanceof StaticProjectile projectile) {
|
||||
switch(projectile.getEntityData().get(StaticProjectile.BEHAVIOR)) {
|
||||
case StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM, StaticProjectileBehaviors.STARFURY_STAR, StaticProjectileBehaviors.STAR_WRATH_STAR, StaticProjectileBehaviors.ZENITH_PROJECTILE, StaticProjectileBehaviors.MURAMASA_PROJECTILE -> {
|
||||
case StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM, StaticProjectileBehaviors.STARFURY_STAR, StaticProjectileBehaviors.STAR_WRATH_STAR, StaticProjectileBehaviors.ZENITH_PROJECTILE, StaticProjectileBehaviors.MURAMASA_PROJECTILE, StaticProjectileBehaviors.DEVILS_DEVASTATION_PROJECTILE -> {
|
||||
return 15;
|
||||
}
|
||||
default -> {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
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.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||
@@ -95,6 +93,7 @@ public class StaticProjectile extends Projectile {
|
||||
public boolean positionOverridden = false;
|
||||
|
||||
public LinkedList<Vec3> trailPositions = new LinkedList<>();
|
||||
public LinkedList<Vec3> trailPositions2 = new LinkedList<>();
|
||||
|
||||
public StaticProjectile(EntityType<StaticProjectile> type, Level level) {
|
||||
super(type, level);
|
||||
|
||||
@@ -19,6 +19,8 @@ public class StaticProjectileBehaviors {
|
||||
public static final String MURAMASA_PROJECTILE = "muramasa_projectile";
|
||||
public static final String LEAF_PROJECTILE = "leaf_projectile";
|
||||
public static final String MACE_PROJECTILE = "mace_projectile";
|
||||
public static final String DEVILS_DEVASTATION_PROJECTILE = "devils_devastation_projectile";
|
||||
public static final String DEVILS_DEVASTATION_PROJECTILE2 = "devils_devastation_projectile2";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() {
|
||||
@@ -43,6 +45,8 @@ public class StaticProjectileBehaviors {
|
||||
BEHAVIORS.put(MURAMASA_PROJECTILE, Muramasa.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(LEAF_PROJECTILE, BladeOfGrass.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(MACE_PROJECTILE, Mace.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_PROJECTILE, DevilsDevastation.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_PROJECTILE2, DevilsDevastation.PROJECTILE_BEHAVIOR2);
|
||||
}
|
||||
|
||||
public static IStaticProjectileBehavior getBehavior(String id) {
|
||||
|
||||
@@ -114,7 +114,7 @@ public interface IStaticSummonBehavior {
|
||||
|
||||
default void checkBeforeTick(StaticSummon summon) {
|
||||
if(summon.level().isClientSide()) return;
|
||||
if(summon.getOwner() == null) {
|
||||
if(summon.getOwner() == null || !summon.getOwner().isAlive()) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ public class StaticSummonBehaviors {
|
||||
public static final String TERRAGRIM_BEAM = "terragrim_beam";
|
||||
public static final String FIRST_FRACTAL_PROJECTILE = "first_fractal_projectile";
|
||||
public static final String MACE_PROJECTILE = "mace_projectile";
|
||||
public static final String DEVILS_DEVASTATION_PROJECTILE = "devils_devastation_projectile";
|
||||
public static final String DEVILS_DEVASTATION_LIGHTNING = "devils_devastation_lightning";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
||||
@@ -36,6 +38,8 @@ public class StaticSummonBehaviors {
|
||||
BEHAVIORS.put(TERRAGRIM_BEAM, Terragrim.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(FIRST_FRACTAL_PROJECTILE, FirstFractal.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(MACE_PROJECTILE, Mace.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_PROJECTILE, DevilsDevastation.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR2);
|
||||
}
|
||||
|
||||
public static IStaticSummonBehavior getBehavior(String id) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.lzxnone.terraria.event;
|
||||
/*
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.renderer.StuckDevilsDevastationProjectileRenderer;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
||||
|
||||
@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT)
|
||||
public class AddLayers {
|
||||
@SubscribeEvent
|
||||
public static void onAddLayers(EntityRenderersEvent.AddLayers event) {
|
||||
// 以给原版僵尸添加为例
|
||||
LivingEntityRenderer renderer = event.getRenderer(EntityType.ZOMBIE);
|
||||
if (renderer != null) {
|
||||
renderer.addLayer(new StuckDevilsDevastationProjectileRenderer<>(event.getContext(), renderer));
|
||||
}
|
||||
|
||||
// 如果想给玩家添加,需要分别获取 default 和 slim 模型
|
||||
LivingEntityRenderer playerRenderer = event.getSkin("default");
|
||||
if (playerRenderer != null) {
|
||||
playerRenderer.addLayer(new StuckDevilsDevastationProjectileRenderer<>(event.getContext(), playerRenderer));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -2,6 +2,7 @@ package com.lzxnone.terraria.event;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModKeyBindings;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.melee.FirstFractal;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TrueCopperShortsword;
|
||||
@@ -10,19 +11,17 @@ import com.lzxnone.terraria.network.payload.FirstFractalScrollPayload;
|
||||
import com.lzxnone.terraria.network.payload.ZenithScrollPayload;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.Input;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
||||
import net.neoforged.neoforge.client.event.InputEvent;
|
||||
import net.neoforged.neoforge.client.event.MovementInputUpdateEvent;
|
||||
import net.neoforged.neoforge.network.PacketDistributor;
|
||||
|
||||
@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT)
|
||||
@@ -87,4 +86,14 @@ public class InputHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onClientTick(ClientTickEvent.Post event) {
|
||||
while(ModKeyBindings.KILL_MODE.consumeClick()) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if(mc.player != null) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> TRUE_COPPER_SHORTSWORD = ITEMS.register("true_copper_shortsword", TrueCopperShortsword::new);
|
||||
public static final DeferredItem<Item> FIRST_FRACTAL = ITEMS.register("first_fractal", FirstFractal::new);
|
||||
public static final DeferredItem<Item> MACE = ITEMS.register("mace", Mace::new);
|
||||
public static final DeferredItem<Item> DEVILS_DEVASTATION = ITEMS.register("devils_devastation", DevilsDevastation::new);
|
||||
|
||||
//弹射物
|
||||
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new);
|
||||
|
||||
@@ -0,0 +1,593 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.Config;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.ModRenderTypes;
|
||||
import com.lzxnone.terraria.entity.TintedVertexConsumer;
|
||||
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.CircleParticleOptions;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
import com.lzxnone.terraria.particle.IronSparkParticleOptions;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
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.client.Minecraft;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.*;
|
||||
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 org.checkerframework.checker.units.qual.C;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
public class DevilsDevastation extends SwordItem {
|
||||
public DevilsDevastation() {
|
||||
super(Tiers.NETHERITE, new Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 30, 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()
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/devils_devastation_lightning.png");
|
||||
public static final ResourceLocation RES2 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/circular_smear_smokey.png");
|
||||
public static final ResourceLocation RES3 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/circular_smear_fire3.png");
|
||||
|
||||
public static final float PROJECTILE_MOVING_RADIUS = 0.25F;
|
||||
|
||||
public static final float PROJECTILE_HIT_RADIUS = 1.0F;
|
||||
public static final float PROJECTILE_HIT_LENGTH = 32F;
|
||||
public static final int PROJECTILE_HIT_DEPTH = 1;
|
||||
public static final float PROJECTILE_HIT_JITTER = 0.45F;
|
||||
public static final int PROJECTILE_HIT_RING = 8;
|
||||
|
||||
//右键生成的弹射
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||
renderItem(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight);
|
||||
VertexConsumer buffer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES));
|
||||
Vec3 entWorldPos = new Vec3(
|
||||
Mth.lerp(partialTick, projectile.xo, projectile.getX()),
|
||||
Mth.lerp(partialTick, projectile.yo, projectile.getY()),
|
||||
Mth.lerp(partialTick, projectile.zo, projectile.getZ())
|
||||
);
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions, PROJECTILE_MOVING_RADIUS * 1.0F, 1.0f, 1,1,1);
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions, PROJECTILE_MOVING_RADIUS * 1.25F, 1.0f * 0.5F, 0.7F,0.15F,0.55F);
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions, PROJECTILE_MOVING_RADIUS * 1.5F, 1.0f * 0.2F, 0.5F,0.1F,0.4F);
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions2, PROJECTILE_MOVING_RADIUS * 1.0F, 1.0f, 1,1,1);
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions2, PROJECTILE_MOVING_RADIUS * 1.25F, 1.0f * 0.5F, 0.7F,0.15F,0.55F);
|
||||
renderTube(buffer, matrix, entWorldPos, projectile.trailPositions2, PROJECTILE_MOVING_RADIUS * 1.5F, 1.0f * 0.2F, 0.5F,0.1F,0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoving(StaticProjectile projectile) {
|
||||
Vec3 right = MathUtil.toVec3(projectile.getEntityData().get(StaticProjectile.RIGHT));
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(PROJECTILE_MOVING_RADIUS / 2 * 1.5f)));
|
||||
projectile.trailPositions2.addFirst(projectile.position().add(right.scale(-PROJECTILE_MOVING_RADIUS / 2 * 1.5f)));
|
||||
while(projectile.trailPositions.size() > 10) projectile.trailPositions.removeLast();
|
||||
while(projectile.trailPositions2.size() > 10) projectile.trailPositions2.removeLast();
|
||||
if(projectile.level().isClientSide()) {
|
||||
if(projectile.getRandom().nextInt(2) == 0) {
|
||||
ParticleUtil.addParticle(
|
||||
projectile.level(), ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE2.get(),
|
||||
projectile.position(), 0.5,
|
||||
new Vec3(0, 0, 0), 0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(!projectile.level().isClientSide()) {
|
||||
Entity target = result.getEntity();
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, 20.0f)) {
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
|
||||
summon.setOwner(target);
|
||||
Vec3 pos = projectile.position();
|
||||
summon.setPos(pos);
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_PROJECTILE);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "item");
|
||||
summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
summon.getEntityData().set(StaticSummon.SCALE_X, 4.0f);
|
||||
summon.getEntityData().set(StaticSummon.SCALE_Y, 4.0f);
|
||||
summon.getEntityData().set(StaticSummon.SCALE_Z, 4.0f);
|
||||
summon.getEntityData().set(StaticSummon.RXP, -90);
|
||||
summon.getEntityData().set(StaticSummon.RZP, -135);
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, 200);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
Vec3 deltaPos = pos.subtract(target.position());
|
||||
customData.putDouble("dx", deltaPos.x);
|
||||
customData.putDouble("dy", deltaPos.y);
|
||||
customData.putDouble("dz", deltaPos.z);
|
||||
customData.putUUID("uuid", player.getUUID());
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(projectile.getEntityData().get(StaticProjectile.DIRECTION), projectile.getEntityData().get(StaticProjectile.UP));
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
summon.xRotO = xyRot[0];
|
||||
summon.yRotO = xyRot[1];
|
||||
|
||||
summon.level().addFreshEntity(summon);
|
||||
|
||||
StaticSummon lightning = new StaticSummon(ModEntities.STATIC_SUMMON.get(), projectile.level());
|
||||
lightning.setOwner(owner);
|
||||
lightning.setPos(pos);
|
||||
lightning.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.DEVILS_DEVASTATION_LIGHTNING);
|
||||
lightning.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
Vector3f dirVec = projectile.getEntityData().get(StaticProjectile.DIRECTION);
|
||||
CompoundTag lightningData = new CompoundTag();
|
||||
lightningData.putDouble("dirX", dirVec.x());
|
||||
lightningData.putDouble("dirY", dirVec.y());
|
||||
lightningData.putDouble("dirZ", dirVec.z());
|
||||
lightningData.putLong("seed", projectile.getRandom().nextLong());
|
||||
lightning.getEntityData().set(StaticSummon.CUSTOM_DATA, lightningData);
|
||||
lightning.getEntityData().set(StaticSummon.LIFETIME, 10);
|
||||
lightning.level().addFreshEntity(lightning);
|
||||
|
||||
target.invulnerableTime = 5;
|
||||
List<UUID> uuids = new ArrayList<>(target.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE));
|
||||
if(uuids.size() >= 5) {
|
||||
Entity stuckProjectile = ((ServerLevel) projectile.level()).getEntity(uuids.getFirst());
|
||||
if(stuckProjectile != null && stuckProjectile.isAlive() && stuckProjectile instanceof StaticSummon stuckStaticProjectile) summonStuckProjectile(stuckStaticProjectile);
|
||||
uuids.removeFirst();
|
||||
}
|
||||
uuids.add(summon.getUUID());
|
||||
target.setData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE, uuids);
|
||||
|
||||
for(int i = 0;i < 20;i++) {
|
||||
Vec3 dir = MathUtil.toVec3(projectile.getEntityData().get(StaticProjectile.DIRECTION));
|
||||
dir = spreadDir(dir, new Random(), 0.5f).normalize();
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(dir.toVector3f(), 0);
|
||||
IronSparkParticleOptions ironSparkParticleOptions;
|
||||
CircleParticleOptions circleParticleOptions;
|
||||
if(projectile.getRandom().nextInt(2) == 0) {
|
||||
ironSparkParticleOptions = new IronSparkParticleOptions(
|
||||
1.0f, 40, 4.0f, new Vector3f(0.729f, 0.396f, 0.345f), dirs[0].mul(0.2f), dirs[2]
|
||||
);
|
||||
circleParticleOptions = new CircleParticleOptions(
|
||||
0.1f, 40, new Vector3f(0.729f, 0.396f, 0.345f)
|
||||
);
|
||||
}else {
|
||||
ironSparkParticleOptions = new IronSparkParticleOptions(
|
||||
1.0f, 40, 4.0f, new Vector3f(0.8f, 0.176f, 0.78f), dirs[0].mul(0.2f), dirs[2]
|
||||
);
|
||||
circleParticleOptions = new CircleParticleOptions(
|
||||
0.1f, 40, new Vector3f(0.8f, 0.176f, 0.78f)
|
||||
);
|
||||
}
|
||||
ParticleUtil.addParticles(
|
||||
(ServerLevel) (projectile.level()), ironSparkParticleOptions,
|
||||
projectile.position().add(dir.scale(3.0f)), new Vec3(0, 0, 0),
|
||||
0, 1
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
(ServerLevel) (projectile.level()), circleParticleOptions,
|
||||
projectile.position().add(dir.scale(3.0f)), new Vec3(0, 0, 0),
|
||||
0.2, 1
|
||||
);
|
||||
}
|
||||
SoundUtil.playServerSound(projectile.level(), ModSounds.DEMON_SWORD_IMPACT.get(), projectile.position());
|
||||
onDied(projectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitBlock(StaticProjectile projectile, BlockHitResult result) {}
|
||||
};
|
||||
|
||||
//弹出的弹射
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR2 = new IStaticProjectileBehavior() {
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||
ItemStack stack = projectile.getEntityData().get(StaticProjectile.ITEM);
|
||||
if(stack.isEmpty()) return;
|
||||
|
||||
float scaleX = 0.05f;
|
||||
float scaleY = 0.05f;
|
||||
float scaleZ = 0.05f;
|
||||
|
||||
float age = projectile.getEntityData().get(StaticProjectile.AGE) + partialTick;
|
||||
Vector3f dir = projectile.getEntityData().get(StaticProjectile.DIRECTION);
|
||||
Vector3f up = projectile.getEntityData().get(StaticProjectile.UP);
|
||||
int rotate = projectile.getEntityData().get(StaticProjectile.RZP);
|
||||
|
||||
poseStack.pushPose();
|
||||
//旋转
|
||||
RenderUtil.applyRotate(poseStack, dir, up, age * 30 + 60, rotate);
|
||||
|
||||
//缩放
|
||||
poseStack.scale(4.0f, 4.0f, 4.0f);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||
stack,
|
||||
ItemDisplayContext.NONE,
|
||||
LightTexture.FULL_BRIGHT,
|
||||
OverlayTexture.NO_OVERLAY,
|
||||
poseStack,
|
||||
bufferSource,
|
||||
entity.level(),
|
||||
0
|
||||
);
|
||||
poseStack.popPose();
|
||||
|
||||
poseStack.pushPose();
|
||||
//旋转
|
||||
RenderUtil.applyRotate(poseStack, dir, up, age * 30 + 180, rotate);
|
||||
|
||||
//缩放
|
||||
poseStack.scale(scaleX, scaleY, scaleZ);
|
||||
|
||||
VertexConsumer buffer0 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES2));
|
||||
RenderUtil.renderQuad(poseStack.last().pose(), buffer0, 0.729f, 0.396f, 0.345f, 1.0f, 78, 78, 0, 0, 0);
|
||||
poseStack.popPose();
|
||||
|
||||
poseStack.pushPose();
|
||||
//旋转
|
||||
RenderUtil.applyRotate(poseStack, dir, up, age * 30, rotate);
|
||||
|
||||
//缩放
|
||||
poseStack.scale(scaleX, scaleY, scaleZ);
|
||||
|
||||
VertexConsumer buffer1 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES3));
|
||||
RenderUtil.renderQuad(poseStack.last().pose(), buffer1, 0.8f, 0.176f, 0.78f, 1.0f, 78, 78, 0, 0, 0);
|
||||
poseStack.popPose();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoving(StaticProjectile projectile) {
|
||||
if(projectile.level().isClientSide()) {
|
||||
ParticleUtil.addParticle(
|
||||
projectile.level(), ModParticles.DEVILS_DEVASTATION_RUNE_PARTICLE2.get(),
|
||||
projectile.position(), 0.5,
|
||||
new Vec3(0, 0, 0), 0.0
|
||||
);
|
||||
int age = projectile.getEntityData().get(StaticProjectile.AGE);
|
||||
Vector3f dir = projectile.getEntityData().get(StaticProjectile.DIRECTION);
|
||||
Vector3f up = projectile.getEntityData().get(StaticProjectile.UP);
|
||||
Vector3f right = projectile.getEntityData().get(StaticProjectile.RIGHT);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(dir, up);
|
||||
Quaternionf rotation = new Quaternionf().fromAxisAngleRad(up, (float) Math.toRadians(age * 30)).rotateY((float) Math.toRadians(-xyRot[1])).rotateX((float) Math.toRadians(xyRot[0]));
|
||||
Vector3f pos = new Vector3f(0, 0, 4);
|
||||
pos.rotate(rotation);
|
||||
|
||||
IronSparkParticleOptions ironSparkParticleOptions;
|
||||
if(projectile.getRandom().nextInt(2) == 0) {
|
||||
ironSparkParticleOptions = new IronSparkParticleOptions(
|
||||
1.0f, 40, 4.0f, new Vector3f(0.729f, 0.396f, 0.345f), dir.mul(0.2f), right
|
||||
);
|
||||
}else {
|
||||
ironSparkParticleOptions = new IronSparkParticleOptions(
|
||||
1.0f, 40, 4.0f, new Vector3f(0.8f, 0.176f, 0.78f), dir.mul(0.2f), right
|
||||
);
|
||||
}
|
||||
ParticleUtil.addParticle(
|
||||
projectile.level(), ironSparkParticleOptions,
|
||||
MathUtil.toVec3(pos), 0.5,
|
||||
new Vec3(0, 0, 0), 0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(!projectile.level().isClientSide()) {
|
||||
Entity target = result.getEntity();
|
||||
Entity owner = projectile.getOwner();
|
||||
if(owner == null) return;
|
||||
if(!FilterUtil.createTargetFilter(owner).test(target) || !(owner instanceof Player player)) return;
|
||||
if(DamageUtil.attack(player, target, 20.0f)) {
|
||||
target.invulnerableTime = 5;
|
||||
onDied(projectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitBlock(StaticProjectile projectile, BlockHitResult result) {}
|
||||
};
|
||||
|
||||
//弹出弹射然后生成新的旋转弹射
|
||||
public static void summonStuckProjectile(StaticSummon stuckProjectile) {
|
||||
if(stuckProjectile == null || !stuckProjectile.isAlive()) return;
|
||||
CompoundTag customData = stuckProjectile.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
if(!customData.contains("uuid")) return;
|
||||
if(stuckProjectile.level() instanceof ServerLevel serverLevel) {
|
||||
UUID uuid = customData.getUUID("uuid");
|
||||
Entity entity = serverLevel.getEntity(uuid);
|
||||
if(!(entity instanceof Player player)) return;
|
||||
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(stuckProjectile);
|
||||
int rotate = (int) ((Math.random() * 2 - 1) * 90);
|
||||
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], rotate);
|
||||
|
||||
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), serverLevel);
|
||||
projectile.setOwner(player);
|
||||
Vec3 pos = stuckProjectile.position();
|
||||
projectile.setPos(pos);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.DEVILS_DEVASTATION_PROJECTILE2);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, pos.toVector3f());
|
||||
projectile.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]);
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, rotate);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, 40);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", 3.0));
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
|
||||
serverLevel.addFreshEntity(projectile);
|
||||
stuckProjectile.discard();
|
||||
}
|
||||
}
|
||||
|
||||
//依附在实体上的剑
|
||||
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("dx") || !customData.contains("dy") || !customData.contains("dz")) { onDied(summon); return; }
|
||||
Vec3 deltaPos = new Vec3(customData.getDouble("dx"), customData.getDouble("dy"), customData.getDouble("dz"));
|
||||
Entity entity = summon.getOwner();
|
||||
if(entity == null) { onDied(summon); return; }
|
||||
summon.setPos(entity.position().add(deltaPos));
|
||||
}
|
||||
@Override
|
||||
public void onDied(StaticSummon summon) {
|
||||
if(!summon.level().isClientSide()) {
|
||||
Entity entity = summon.getOwner();
|
||||
if(entity != null && entity.isAlive()) {
|
||||
List<UUID> uuids = new ArrayList<>(entity.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE));
|
||||
uuids.remove(summon.getUUID());
|
||||
entity.setData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE, uuids);
|
||||
}
|
||||
summon.discard();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//弹射击中实体产生的闪电
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR2 = new IStaticSummonBehavior() {
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticSummon summon)) return;
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
if(!customData.contains("dirX") || !customData.contains("dirY") || !customData.contains("dirZ") || !customData.contains("seed")) return;
|
||||
Vec3 dir = new Vec3(customData.getDouble("dirX"), customData.getDouble("dirY"), customData.getDouble("dirZ")).normalize();
|
||||
long seed = customData.getLong("seed");
|
||||
int age = summon.getEntityData().get(StaticSummon.AGE);
|
||||
int lifetime = summon.getEntityData().get(StaticSummon.LIFETIME);
|
||||
if(lifetime <= 0) return;
|
||||
float lifeRatio = Mth.clamp((age + partialTick) / (float) lifetime, 0.0F, 1.0F);
|
||||
if(lifeRatio > 0.999f) return;
|
||||
float radius = PROJECTILE_HIT_RADIUS * (1.0f - lifeRatio);
|
||||
float alpha = 1.0f - lifeRatio;
|
||||
|
||||
Vec3 entWorldPos = new Vec3(
|
||||
Mth.lerp(partialTick, summon.xo, summon.getX()),
|
||||
Mth.lerp(partialTick, summon.yo, summon.getY()),
|
||||
Mth.lerp(partialTick, summon.zo, summon.getZ())
|
||||
);
|
||||
VertexConsumer buffer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES));
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
|
||||
Random rand0 = new Random(seed);
|
||||
Vec3 start0 = entWorldPos.add(dir.scale(4.0));
|
||||
Vec3 end0 = start0.add(dir.scale(PROJECTILE_HIT_LENGTH));
|
||||
List<Vec3> branch0 = generateBranch(start0, end0, rand0);
|
||||
|
||||
Random rand1 = new Random(seed + 1);
|
||||
Vec3 end1 = start0.add(spreadDir(dir, rand1, 0.4F).scale(PROJECTILE_HIT_LENGTH * 0.7F));
|
||||
List<Vec3> branch1 = generateBranch(start0, end1, rand1);
|
||||
|
||||
Random rand2 = new Random(seed + 2);
|
||||
Vec3 start2 = branch0.get(1);
|
||||
Vec3 end2 = start2.add(spreadDir(dir, rand2, 0.4F).scale(PROJECTILE_HIT_LENGTH * 0.5F));
|
||||
List<Vec3> branch2 = generateBranch(start2, end2, rand2);
|
||||
|
||||
|
||||
for(List<Vec3> branch : new List[]{branch0, branch1, branch2}) {
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 1.0F, alpha, 1,1,1);
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 1.25F, alpha * 0.5F, 0.7F,0.15F,0.55F);
|
||||
renderTube(buffer, matrix, entWorldPos, branch, radius * 0.75F, alpha * 0.2F, 0.5F,0.1F,0.4F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB getBoundingBoxForCulling(StaticSummon summon) {
|
||||
double m = PROJECTILE_HIT_LENGTH + 8.0;
|
||||
Vec3 p = summon.position();
|
||||
return new AABB(p.x - m, p.y - m, p.z - m, p.x + m, p.y + m, p.z + m);
|
||||
}
|
||||
};
|
||||
|
||||
public static List<Vec3> generateBranch(Vec3 start, Vec3 end, Random rand) {
|
||||
List<Vec3> branch = new ArrayList<>();
|
||||
branch.add(start);
|
||||
subdivide(start, end, PROJECTILE_HIT_DEPTH, rand, branch);
|
||||
branch.add(end);
|
||||
return branch;
|
||||
}
|
||||
|
||||
public static Vec3 spreadDir(Vec3 dir, Random rand, float maxAngle) {
|
||||
float angle = (rand.nextFloat() - 0.5F) * 2.0F * maxAngle;
|
||||
Vec3 axisV = new Vec3(rand.nextDouble() - 0.5, rand.nextDouble() - 0.5, rand.nextDouble() - 0.5).normalize();
|
||||
if(axisV.lengthSqr() < 0.01D) axisV = new Vec3(1, 0, 0);
|
||||
axisV = axisV.cross(dir).normalize();
|
||||
if(axisV.lengthSqr() < 0.01D) axisV = new Vec3(0, 0, 1);
|
||||
Vector3f d = dir.toVector3f().normalize();
|
||||
new Quaternionf().fromAxisAngleRad(axisV.toVector3f().normalize(), angle).transform(d);
|
||||
return new Vec3(d.x(), d.y(), d.z());
|
||||
}
|
||||
private static void subdivide(Vec3 start, Vec3 end, int depth, Random rand, List<Vec3> out) {
|
||||
if(depth <= 0) return;
|
||||
Vec3 mid = start.add(end).scale(0.5);
|
||||
Vec3 seg = end.subtract(start);
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(seg.toVector3f(), 0);
|
||||
mid = getSurfaceRandomPosInRadius(mid, MathUtil.toVec3(dirs[2]), MathUtil.toVec3(dirs[1]), seg.length() * PROJECTILE_HIT_JITTER, rand);
|
||||
subdivide(start, mid, depth - 1, rand, out);
|
||||
out.add(mid);
|
||||
subdivide(mid, end, depth - 1, rand, out);
|
||||
}
|
||||
|
||||
public static Vec3 getSurfaceRandomPosInRadius(Vec3 pos, Vec3 axisX, Vec3 axisY, double radius, Random random) {
|
||||
double s = Math.sqrt(random.nextDouble());
|
||||
axisX = axisX.normalize().scale(radius).scale(s);
|
||||
axisY = axisY.normalize().scale(radius).scale(s);
|
||||
double rad = Math.PI * 2 * random.nextDouble();
|
||||
double cos = Math.cos(rad);
|
||||
double sin = Math.sin(rad);
|
||||
return new Vec3(
|
||||
pos.x + cos * axisX.x + sin * axisY.x,
|
||||
pos.y + cos * axisX.y + sin * axisY.y,
|
||||
pos.z + cos * axisX.z + sin * axisY.z
|
||||
);
|
||||
}
|
||||
|
||||
public static void renderTube(VertexConsumer buffer, Matrix4f matrix, Vec3 entityWorldPos,
|
||||
List<Vec3> points, float radius, float alpha, float colorR, float colorG, float colorB) {
|
||||
int n = points.size();
|
||||
if(n < 2) return;
|
||||
|
||||
Vector3f[][] oriDirs = new Vector3f[n][3];
|
||||
Vec3[] dir = new Vec3[n], up = new Vec3[n], right = new Vec3[n];
|
||||
for(int i = 0;i < n;i++) {
|
||||
if(i == n - 1) oriDirs[i] = MathUtil.computeCoordinateSystem(points.get(n - 1).subtract(points.get(n - 2)).toVector3f(), 0);
|
||||
else oriDirs[i] = MathUtil.computeCoordinateSystem(points.get(i + 1).subtract(points.get(i)).toVector3f(), 0);
|
||||
dir[i] = MathUtil.toVec3(oriDirs[i][0]);
|
||||
up[i] = MathUtil.toVec3(oriDirs[i][1]);
|
||||
right[i] = MathUtil.toVec3(oriDirs[i][2]);
|
||||
}
|
||||
|
||||
for(int i = 0;i < n - 1;i++) {
|
||||
float r0 = radius * (1.0F - (float) i / (float) (n - 1));
|
||||
float r1 = radius * (1.0F - (float) (i + 1) / (float) (n - 1));
|
||||
if(r0 <= 0.001F && r1 <= 0.001F) continue;
|
||||
Vec3 N = right[i], B = up[i], N1 = right[i + 1], B1 = up[i + 1];
|
||||
Vec3 P = points.get(i), P1 = points.get(i + 1);
|
||||
for(int j = 0;j < PROJECTILE_HIT_RING;j++) {
|
||||
float a0 = (float) (2.0 * Math.PI * j / PROJECTILE_HIT_RING);
|
||||
float a1 = (float) (2.0 * Math.PI * (j + 1) / PROJECTILE_HIT_RING);
|
||||
Vec3 d0 = computeRingDir(N, B, a0);
|
||||
Vec3 d1 = computeRingDir(N1, B1, a0);
|
||||
Vec3 d0b = computeRingDir(N, B, a1);
|
||||
Vec3 d1b = computeRingDir(N1, B1, a1);
|
||||
Vec3 v0 = P.add(d0.scale(r0));
|
||||
Vec3 v1 = P1.add(d1.scale(r1));
|
||||
Vec3 v2 = P1.add(d1b.scale(r1));
|
||||
Vec3 v3 = P.add(d0b.scale(r0));
|
||||
for(int k = 0;k < 3;k++) {
|
||||
writeVert(buffer, matrix, entityWorldPos, v0, alpha, colorR, colorG, colorB);
|
||||
writeVert(buffer, matrix, entityWorldPos, v1, alpha, colorR, colorG, colorB);
|
||||
writeVert(buffer, matrix, entityWorldPos, v2, alpha, colorR, colorG, colorB);
|
||||
writeVert(buffer, matrix, entityWorldPos, v3, alpha, colorR, colorG, colorB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Vec3 computeRingDir(Vec3 n, Vec3 b, float ang) {
|
||||
return n.scale(Math.cos(ang)).add(b.scale(Math.sin(ang)));
|
||||
}
|
||||
|
||||
public static void writeVert(VertexConsumer buffer, Matrix4f matrix, Vec3 entityWorldPos,
|
||||
Vec3 worldPos, float alpha, float colorR, float colorG, float colorB) {
|
||||
double lx = worldPos.x - entityWorldPos.x;
|
||||
double ly = worldPos.y - entityWorldPos.y;
|
||||
double lz = worldPos.z - entityWorldPos.z;
|
||||
|
||||
buffer.addVertex(matrix, (float)lx, (float)ly, (float)lz)
|
||||
.setColor(colorR, colorG, colorB, alpha)
|
||||
.setUv(0.5F, 0.5F)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
if(!level.isClientSide()) {
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), level);
|
||||
projectile.setOwner(player);
|
||||
Vec3 pos = player.getBoundingBox().getCenter();
|
||||
projectile.setPos(pos);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.DEVILS_DEVASTATION_PROJECTILE);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, pos.toVector3f());
|
||||
projectile.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]);
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.DEVILS_DEVASTATION.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_X, 4.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Y, 4.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Z, 4.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.RXP, -90);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, -135);
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, 40);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*t", 3.0));
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
level.addFreshEntity(projectile);
|
||||
}
|
||||
SoundUtil.playClientSound(player, ModSounds.DEMON_SWORD_SWING.get());
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 10);
|
||||
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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.core.particles.ParticleOptions;
|
||||
|
||||
public class CircleParticle extends EmissiveBloomParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected CircleParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed,
|
||||
CircleParticleOptions options, SpriteSet spriteSet) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.hasPhysics = false;
|
||||
|
||||
this.friction = 0.9F;
|
||||
this.gravity = 0.0F;
|
||||
this.xd = xSpeed;
|
||||
this.yd = ySpeed;
|
||||
this.zd = zSpeed;
|
||||
|
||||
this.rCol = options.color.x;
|
||||
this.gCol = options.color.y;
|
||||
this.bCol = options.color.z;
|
||||
|
||||
this.baseSize = options.initSize + (this.random.nextFloat() * options.initSize * 0.5f);
|
||||
this.quadSize = baseSize;
|
||||
|
||||
this.lifetime = options.initLifetime + this.random.nextInt(Math.max(1, options.initLifetime / 2));
|
||||
|
||||
this.pickSprite(spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
|
||||
this.quadSize = this.baseSize * (1.0F - lifeRatio);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(VertexConsumer buffer, Camera camera, float partialTick) {
|
||||
for(int i = 0;i < 10;i++) super.render(buffer, camera, partialTick);
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<CircleParticleOptions> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(CircleParticleOptions type, ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new CircleParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, type, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class CircleParticleOptions implements ParticleOptions {
|
||||
public final float initSize;
|
||||
public final int initLifetime;
|
||||
public final Vector3f color;
|
||||
|
||||
public CircleParticleOptions(float initSize, int initLifetime, Vector3f color) {
|
||||
this.initSize = initSize;
|
||||
this.initLifetime = initLifetime;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public CircleParticleOptions() {
|
||||
this(0.25f, 20, new Vector3f(1.0F, 1.0F, 1.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleType<?> getType() {
|
||||
return ModParticles.CIRCLE_PARTICLE.get();
|
||||
}
|
||||
|
||||
private static final Codec<Vector3f> VEC3_CODEC =
|
||||
Codec.FLOAT.listOf().xmap(
|
||||
l -> new Vector3f(l.get(0), l.get(1), l.get(2)),
|
||||
c -> java.util.List.of(c.x, c.y, c.z)
|
||||
);
|
||||
|
||||
public static final MapCodec<CircleParticleOptions> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
Codec.FLOAT.optionalFieldOf("initSize", 0.25f).forGetter(o -> o.initSize),
|
||||
Codec.INT.optionalFieldOf("initLifetime", 20).forGetter(o -> o.initLifetime),
|
||||
VEC3_CODEC.optionalFieldOf("color", new Vector3f(1.0F, 1.0F, 1.0F)).forGetter(o -> o.color)
|
||||
).apply(instance, CircleParticleOptions::new)
|
||||
);
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, CircleParticleOptions> STREAM_CODEC =
|
||||
new StreamCodec<>() {
|
||||
@Override
|
||||
public CircleParticleOptions decode(RegistryFriendlyByteBuf buf) {
|
||||
float size = buf.readFloat();
|
||||
int lifetime = buf.readInt();
|
||||
Vector3f col = new Vector3f(buf.readFloat(), buf.readFloat(), buf.readFloat());
|
||||
return new CircleParticleOptions(size, lifetime, col);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(RegistryFriendlyByteBuf buf, CircleParticleOptions opts) {
|
||||
buf.writeFloat(opts.initSize);
|
||||
buf.writeInt(opts.initLifetime);
|
||||
buf.writeFloat(opts.color.x);
|
||||
buf.writeFloat(opts.color.y);
|
||||
buf.writeFloat(opts.color.z);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class DevilsDevastationRuneParticle extends EmissiveBloomParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected DevilsDevastationRuneParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed, SpriteSet spriteSet) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.hasPhysics = false;
|
||||
|
||||
this.friction = 0.9F;
|
||||
this.gravity = 0.0F;
|
||||
this.xd = xSpeed;
|
||||
this.yd = ySpeed;
|
||||
this.zd = zSpeed;
|
||||
|
||||
if(this.random.nextInt(2) == 0) {
|
||||
this.rCol = 0.8f;
|
||||
this.gCol = 0.176f;
|
||||
this.bCol = 0.78f;
|
||||
}else {
|
||||
this.rCol = 0.729f;
|
||||
this.gCol = 0.396f;
|
||||
this.bCol = 0.345f;
|
||||
}
|
||||
|
||||
this.baseSize = 0.15F + this.random.nextFloat() * 0.05F;
|
||||
this.quadSize = baseSize;
|
||||
|
||||
this.roll = this.random.nextFloat() * ((float)Math.PI * 2F);
|
||||
this.oRoll = this.roll;
|
||||
|
||||
this.lifetime = 20;
|
||||
|
||||
this.pickSprite(spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
|
||||
this.quadSize = this.baseSize * (1.0F - lifeRatio);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(SimpleParticleType type, ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new DevilsDevastationRuneParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class DevilsDevastationRuneParticle2 extends EmissiveBloomParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected DevilsDevastationRuneParticle2(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed, SpriteSet spriteSet) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.hasPhysics = false;
|
||||
|
||||
this.friction = 0.9F;
|
||||
this.gravity = 0.0F;
|
||||
this.xd = xSpeed;
|
||||
this.yd = ySpeed;
|
||||
this.zd = zSpeed;
|
||||
|
||||
this.rCol = 0.8f;
|
||||
this.gCol = 0.176f;
|
||||
this.bCol = 0.78f;
|
||||
|
||||
this.baseSize = 0.3F + this.random.nextFloat() * 0.1F;
|
||||
this.quadSize = baseSize;
|
||||
|
||||
this.roll = this.random.nextFloat() * ((float)Math.PI * 2F);
|
||||
this.oRoll = this.roll;
|
||||
|
||||
this.lifetime = 20;
|
||||
|
||||
this.pickSprite(spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
|
||||
this.quadSize = this.baseSize * (1.0F - lifeRatio);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(SimpleParticleType type, ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new DevilsDevastationRuneParticle2(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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.ParticleRenderType;
|
||||
import net.minecraft.client.particle.TextureSheetParticle;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class EmissiveBloomParticle extends TextureSheetParticle {
|
||||
|
||||
protected EmissiveBloomParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(VertexConsumer buffer, Camera camera, float partialTick) {
|
||||
if (this.alpha <= 0.01F) return;
|
||||
|
||||
float f = (float) (Mth.lerp(partialTick, this.xo, this.x) - camera.getPosition().x);
|
||||
float f1 = (float) (Mth.lerp(partialTick, this.yo, this.y) - camera.getPosition().y);
|
||||
float f2 = (float) (Mth.lerp(partialTick, this.zo, this.z) - camera.getPosition().z);
|
||||
|
||||
// 相机朝向 billboard,叠加 roll 旋转
|
||||
Quaternionf quaternion = new Quaternionf(camera.rotation());
|
||||
quaternion.rotateZ(Mth.lerp(partialTick, this.oRoll, this.roll));
|
||||
|
||||
float size = this.quadSize;
|
||||
|
||||
float u0 = this.getU0();
|
||||
float u1 = this.getU1();
|
||||
float v0 = this.getV0();
|
||||
float v1 = this.getV1();
|
||||
|
||||
float[][] uvs = {
|
||||
{u1, v1},
|
||||
{u1, v0},
|
||||
{u0, v0},
|
||||
{u0, v1}
|
||||
};
|
||||
|
||||
Vector3f[] corners = {
|
||||
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)
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Vector3f vertex = corners[i];
|
||||
vertex.rotate(quaternion);
|
||||
vertex.mul(size);
|
||||
vertex.add(f, f1, f2);
|
||||
|
||||
buffer.addVertex(vertex.x(), vertex.y(), vertex.z())
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setUv(uvs[i][0], uvs[i][1])
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
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.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class IronSparkParticle extends TextureSheetParticle {
|
||||
private final float baseSize;
|
||||
private final float sparkLength;
|
||||
private final Vector3f dir;
|
||||
private final Vector3f right;
|
||||
private final Vector3f normal;
|
||||
|
||||
protected IronSparkParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed,
|
||||
IronSparkParticleOptions options, SpriteSet spriteSet) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.hasPhysics = false;
|
||||
|
||||
this.friction = 0.9F;
|
||||
this.gravity = 0.0F;
|
||||
|
||||
this.rCol = options.color.x;
|
||||
this.gCol = options.color.y;
|
||||
this.bCol = options.color.z;
|
||||
|
||||
this.baseSize = options.initSize + (this.random.nextFloat() * options.initSize * 0.5f);
|
||||
this.quadSize = baseSize;
|
||||
this.sparkLength = options.sparkLength;
|
||||
|
||||
this.lifetime = options.initLifetime + this.random.nextInt(options.initLifetime / 2);
|
||||
|
||||
this.dir = new Vector3f(options.dir).normalize();
|
||||
this.right = new Vector3f(options.right).normalize();
|
||||
this.normal = new Vector3f(this.dir).cross(this.right).normalize();
|
||||
|
||||
this.xd = dir.x;
|
||||
this.yd = dir.y;
|
||||
this.zd = dir.z;
|
||||
|
||||
this.pickSprite(spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
|
||||
this.quadSize = this.baseSize * (1.0F - lifeRatio * 0.8f);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(VertexConsumer buffer, Camera camera, float partialTick) {
|
||||
if (this.alpha <= 0.01F) return;
|
||||
|
||||
float cx = (float) (Mth.lerp(partialTick, this.xo, this.x) - camera.getPosition().x);
|
||||
float cy = (float) (Mth.lerp(partialTick, this.yo, this.y) - camera.getPosition().y);
|
||||
float cz = (float) (Mth.lerp(partialTick, this.zo, this.z) - camera.getPosition().z);
|
||||
|
||||
float size = this.quadSize;
|
||||
float halfLen = size * this.sparkLength;
|
||||
float halfWidth = size * 0.01f;
|
||||
|
||||
float u0 = this.getU0();
|
||||
float u1 = this.getU1();
|
||||
float v0 = this.getV0();
|
||||
float v1 = this.getV1();
|
||||
|
||||
Vector3f dirVec = new Vector3f(this.dir);
|
||||
Vector3f rightVec = new Vector3f(this.right);
|
||||
|
||||
float[][] verts = {
|
||||
{cx + dirVec.x * halfLen - rightVec.x * halfWidth, cy + dirVec.y * halfLen - rightVec.y * halfWidth, cz + dirVec.z * halfLen - rightVec.z * halfWidth, u1, v1},
|
||||
{cx + dirVec.x * halfLen + rightVec.x * halfWidth, cy + dirVec.y * halfLen + rightVec.y * halfWidth, cz + dirVec.z * halfLen + rightVec.z * halfWidth, u1, v0},
|
||||
{cx - dirVec.x * halfLen + rightVec.x * halfWidth, cy - dirVec.y * halfLen + rightVec.y * halfWidth, cz - dirVec.z * halfLen + rightVec.z * halfWidth, u0, v0},
|
||||
{cx - dirVec.x * halfLen - rightVec.x * halfWidth, cy - dirVec.y * halfLen - rightVec.y * halfWidth, cz - dirVec.z * halfLen - rightVec.z * halfWidth, u0, v1}
|
||||
};
|
||||
|
||||
for(int k = 0;k < 10;k++) {
|
||||
for(int j = 0; j < 4; j++) {
|
||||
float[] v = verts[j];
|
||||
buffer.addVertex(v[0], v[1], v[2])
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setUv(v[3], v[4])
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(this.normal.x(), this.normal.y(), this.normal.z());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<IronSparkParticleOptions> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(IronSparkParticleOptions type, ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new IronSparkParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, type, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class IronSparkParticleOptions implements ParticleOptions {
|
||||
public final float initSize;
|
||||
public final int initLifetime;
|
||||
public final float sparkLength;
|
||||
public final Vector3f color;
|
||||
public final Vector3f dir;
|
||||
public final Vector3f right;
|
||||
|
||||
public IronSparkParticleOptions(float initSize, int initLifetime, float sparkLength, Vector3f color, Vector3f dir, Vector3f right) {
|
||||
this.initSize = initSize;
|
||||
this.initLifetime = initLifetime;
|
||||
this.sparkLength = sparkLength;
|
||||
this.color = color;
|
||||
this.dir = dir;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public IronSparkParticleOptions() {
|
||||
this(0.05f, 30, 4.0f, new Vector3f(1.0F, 0.8F, 0.3F), new Vector3f(0.0F, 1.0F, 0.0F), new Vector3f(1.0F, 0.0F, 0.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleType<?> getType() {
|
||||
return ModParticles.IRON_SPARK_PARTICLE.get();
|
||||
}
|
||||
|
||||
private static final Codec<Vector3f> VEC3_CODEC =
|
||||
Codec.FLOAT.listOf().xmap(
|
||||
l -> new Vector3f(l.get(0), l.get(1), l.get(2)),
|
||||
c -> java.util.List.of(c.x, c.y, c.z)
|
||||
);
|
||||
|
||||
public static final MapCodec<IronSparkParticleOptions> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
Codec.FLOAT.optionalFieldOf("initSize", 0.05f).forGetter(o -> o.initSize),
|
||||
Codec.INT.optionalFieldOf("initLifetime", 40).forGetter(o -> o.initLifetime),
|
||||
Codec.FLOAT.optionalFieldOf("sparkLength", 4.0f).forGetter(o -> o.sparkLength),
|
||||
VEC3_CODEC.optionalFieldOf("color", new Vector3f(1.0F, 1.0F, 1.0F)).forGetter(o -> o.color),
|
||||
VEC3_CODEC.optionalFieldOf("dir", new Vector3f(0.0F, 1.0F, 0.0F)).forGetter(o -> o.dir),
|
||||
VEC3_CODEC.optionalFieldOf("right", new Vector3f(1.0F, 0.0F, 0.0F)).forGetter(o -> o.right)
|
||||
).apply(instance, IronSparkParticleOptions::new)
|
||||
);
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, IronSparkParticleOptions> STREAM_CODEC =
|
||||
new StreamCodec<>() {
|
||||
@Override
|
||||
public IronSparkParticleOptions decode(RegistryFriendlyByteBuf buf) {
|
||||
float size = buf.readFloat();
|
||||
int lifetime = buf.readInt();
|
||||
float length = buf.readFloat();
|
||||
Vector3f col = new Vector3f(buf.readFloat(), buf.readFloat(), buf.readFloat());
|
||||
Vector3f d = new Vector3f(buf.readFloat(), buf.readFloat(), buf.readFloat());
|
||||
Vector3f r = new Vector3f(buf.readFloat(), buf.readFloat(), buf.readFloat());
|
||||
return new IronSparkParticleOptions(size, lifetime, length, col, d, r);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(RegistryFriendlyByteBuf buf, IronSparkParticleOptions opts) {
|
||||
buf.writeFloat(opts.initSize);
|
||||
buf.writeInt(opts.initLifetime);
|
||||
buf.writeFloat(opts.sparkLength);
|
||||
buf.writeFloat(opts.color.x);
|
||||
buf.writeFloat(opts.color.y);
|
||||
buf.writeFloat(opts.color.z);
|
||||
buf.writeFloat(opts.dir.x);
|
||||
buf.writeFloat(opts.dir.y);
|
||||
buf.writeFloat(opts.dir.z);
|
||||
buf.writeFloat(opts.right.x);
|
||||
buf.writeFloat(opts.right.y);
|
||||
buf.writeFloat(opts.right.z);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.ParticleRenderType;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
|
||||
public final class ModParticleRenderTypes {
|
||||
@@ -26,5 +31,30 @@ public final class ModParticleRenderTypes {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ParticleRenderType EMISSIVE_BLOOM = new ParticleRenderType() {
|
||||
@Override
|
||||
public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) {
|
||||
Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer();
|
||||
// 走与实体发光相同的着色器(rendertype_entity_translucent_emissive),
|
||||
// Iris 会将其写入泛光缓冲区并做高斯模糊泛光。
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.setShader(GameRenderer::getRendertypeEntityTranslucentEmissiveShader);
|
||||
RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES);
|
||||
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.NEW_ENTITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "lzxnoneterraria:emissive_bloom";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTranslucent() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private ModParticleRenderTypes() {}
|
||||
}
|
||||
@@ -74,6 +74,28 @@ public class ModParticles {
|
||||
return ZenithTrailParticleOptions.STREAM_CODEC;
|
||||
}
|
||||
});
|
||||
public static final Supplier<ParticleType<IronSparkParticleOptions>> IRON_SPARK_PARTICLE =
|
||||
PARTICLE_TYPES.register("iron_spark_particle", () -> new ParticleType<>(false) {
|
||||
@Override
|
||||
public MapCodec<IronSparkParticleOptions> codec() {
|
||||
return IronSparkParticleOptions.CODEC;
|
||||
}
|
||||
@Override
|
||||
public StreamCodec<? super RegistryFriendlyByteBuf, IronSparkParticleOptions> streamCodec() {
|
||||
return IronSparkParticleOptions.STREAM_CODEC;
|
||||
}
|
||||
});
|
||||
public static final Supplier<ParticleType<CircleParticleOptions>> CIRCLE_PARTICLE =
|
||||
PARTICLE_TYPES.register("circle_particle", () -> new ParticleType<>(false) {
|
||||
@Override
|
||||
public MapCodec<CircleParticleOptions> codec() {
|
||||
return CircleParticleOptions.CODEC;
|
||||
}
|
||||
@Override
|
||||
public StreamCodec<? super RegistryFriendlyByteBuf, CircleParticleOptions> streamCodec() {
|
||||
return CircleParticleOptions.STREAM_CODEC;
|
||||
}
|
||||
});
|
||||
public static final Supplier<SimpleParticleType> STAR_PARTICLE =
|
||||
PARTICLE_TYPES.register("star_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> EXPLODE_PARTICLE =
|
||||
@@ -98,4 +120,10 @@ public class ModParticles {
|
||||
PARTICLE_TYPES.register("leaf_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> SOLAR_EXPLOSION_PARTICLE =
|
||||
PARTICLE_TYPES.register("solar_explosion_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> DEVILS_DEVASTATION_RUNE_PARTICLE =
|
||||
PARTICLE_TYPES.register("devils_devastation_rune_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> DEVILS_DEVASTATION_RUNE_PARTICLE2 =
|
||||
PARTICLE_TYPES.register("devils_devastation_rune_particle2", () -> new SimpleParticleType(true));
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lzxnone.terraria.entity;
|
||||
package com.lzxnone.terraria.renderer;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.entity.IrisCompat;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeam;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeamBehaviors;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lzxnone.terraria.renderer;
|
||||
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.model.EntityModel;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.StuckInBodyLayer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
/*
|
||||
public class StuckDevilsDevastationProjectileRenderer<T extends LivingEntity, M extends EntityModel<T>> extends StuckInBodyLayer<T, M> {
|
||||
private final ItemRenderer itemRenderer;
|
||||
private final ItemStack stack = new ItemStack(ModItems.DEVILS_DEVASTATION.get()); // 替换成你自己的剑
|
||||
|
||||
public StuckDevilsDevastationProjectileRenderer(EntityRendererProvider.Context context, LivingEntityRenderer<T, M> renderer) {
|
||||
super(renderer);
|
||||
this.itemRenderer = context.getItemRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int numStuck(T entity) {
|
||||
return entity.getData(ModAttachments.STUCK_DEVILS_DEVASTATION_PROJECTILE).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderStuckItem(PoseStack poseStack, MultiBufferSource buffer, int packedLight,
|
||||
Entity entity, float x, float y, float z, float partialTick) {
|
||||
poseStack.pushPose();
|
||||
|
||||
// 计算法线长度
|
||||
float f = Mth.sqrt(x * x + z * z);
|
||||
|
||||
// 偏转角度,对齐生物体表法线(模仿原版箭矢计算)
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees((float)(Math.atan2(x, z) * (180F / Math.PI))));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees((float)(Math.atan2(y, f) * (180F / Math.PI))));
|
||||
|
||||
// 调整物品的倾斜度,确保是剑尖插进身体,而不是平躺
|
||||
// 原版物品在 FIXED 模式下是直立的,旋转 90 度并倾斜 45 度通常能指向 Z 轴正/负方向
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(-45.0F));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
|
||||
// 平移,让剑尖没入模型内部
|
||||
poseStack.translate(0.0D, 0.0D, -0.3D);
|
||||
|
||||
// 缩小比例,让插在身上的剑显得自然
|
||||
poseStack.scale(0.8F, 0.8F, 0.8F);
|
||||
|
||||
// 调用 ItemRenderer 直接渲染物品模型
|
||||
this.itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED,
|
||||
LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, poseStack, buffer, entity.level(), 0);
|
||||
|
||||
poseStack.popPose();
|
||||
}
|
||||
}*/
|
||||
@@ -96,6 +96,32 @@ public class MathUtil {
|
||||
return getRandomPosForRadius(pos, radius, false);
|
||||
}
|
||||
|
||||
|
||||
public static Vec3 getSurfaceRandomPosForRadius(Vec3 pos, Vec3 axisX, Vec3 axisY, double radius, boolean on) {
|
||||
axisX = axisX.normalize().scale(radius);
|
||||
axisY = axisY.normalize().scale(radius);
|
||||
if(!on) {
|
||||
double s = Math.sqrt(Math.random());
|
||||
axisX = axisX.scale(s);
|
||||
axisY = axisY.scale(s);
|
||||
}
|
||||
double rad = Math.PI * 2 * Math.random();
|
||||
double cos = Math.cos(rad);
|
||||
double sin = Math.sin(rad);
|
||||
return new Vec3(
|
||||
pos.x + cos * axisX.x + sin * axisY.x,
|
||||
pos.y + cos * axisX.y + sin * axisY.y,
|
||||
pos.z + cos * axisX.z + sin * axisY.z
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec3 getSurfaceRandomPosOnRadius(Vec3 pos, Vec3 axisX, Vec3 axisY, double radius) {
|
||||
return getSurfaceRandomPosForRadius(pos, axisX, axisY, radius, true);
|
||||
}
|
||||
|
||||
public static Vec3 getSurfaceRandomPosInRadius(Vec3 pos, Vec3 axisX, Vec3 axisY, double radius) {
|
||||
return getSurfaceRandomPosForRadius(pos, axisX, axisY, 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();
|
||||
|
||||
@@ -43,33 +43,19 @@ public class RenderUtil {
|
||||
int ib = (int) (b * 255.0F);
|
||||
int ia = (int) (a * 255.0F);
|
||||
|
||||
consumer.addVertex(matrix, -halfWidth, -halfHeight + offsetY, offsetZ)
|
||||
consumer.addVertex(matrix, -halfWidth + offsetX, -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)
|
||||
consumer.addVertex(matrix, halfWidth + offsetX, -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)
|
||||
consumer.addVertex(matrix, halfWidth + offsetX, 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)
|
||||
consumer.addVertex(matrix, -halfWidth + offsetX, 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);
|
||||
}
|
||||
|
||||
public static void renderGlow(Matrix4f matrix, VertexConsumer consumer,
|
||||
float r, float g, float b, float baseAlpha,
|
||||
float halfWidth, float halfHeight,
|
||||
int layers, float scaleStep, float alphaDecay,
|
||||
float offsetX, float offsetY, float offsetZ) {
|
||||
float scale = 1.0f;
|
||||
float a = baseAlpha;
|
||||
for (int i = 0; i < layers; i++) {
|
||||
renderQuad(matrix, consumer, r, g, b, a,
|
||||
halfWidth * scale, halfHeight * scale,
|
||||
offsetX, offsetY, offsetZ);
|
||||
scale += scaleStep;
|
||||
a *= alphaDecay;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"itemGroup.lzxnoneterraria.weapon": "Terraria Weapon",
|
||||
"itemGroup.lzxnoneterraria.melee": "Terraria Melee",
|
||||
"itemGroup.lzxnoneterraria.block": "Terraria Block",
|
||||
|
||||
"itemGroup.lzxnoneterraria.calamity_melee": "Terraria Calamity Melee",
|
||||
|
||||
"item.lzxnoneterraria.bee_keeper": "Bee Keeper",
|
||||
"item.lzxnoneterraria.copper_shortsword": "Copper Shortsword",
|
||||
"item.lzxnoneterraria.enchanted_sword": "Enchanted Sword",
|
||||
@@ -26,6 +28,7 @@
|
||||
"item.lzxnoneterraria.true_copper_shortsword": "True Copper Shortsword",
|
||||
"item.lzxnoneterraria.first_fractal": "First Fractal",
|
||||
"item.lzxnoneterraria.mace": "Mace",
|
||||
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
||||
|
||||
"entity.lzxnoneterraria.static_projectile": "Projectile",
|
||||
"entity.lzxnoneterraria.static_summon": "Summon",
|
||||
@@ -34,6 +37,9 @@
|
||||
"effect.lzxnoneterraria.confused": "Confused",
|
||||
"effect.lzxnoneterraria.blood_butchered": "Blood Butchered",
|
||||
|
||||
"key.lzxnoneterraria.kill_mode": "Kill Mode",
|
||||
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
||||
|
||||
"lzxnoneterraria.configuration.enchanted_sword_settings": "Enchanted Sword Settings",
|
||||
"lzxnoneterraria.configuration.enchanted_sword_damage": "Projectile Damage",
|
||||
"lzxnoneterraria.configuration.enchanted_sword_damage.tooltip": "Damage per hit",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"itemGroup.lzxnoneterraria.weapon": "泰拉瑞亚 武器",
|
||||
"itemGroup.lzxnoneterraria.melee": "泰拉瑞亚 近战武器",
|
||||
"itemGroup.lzxnoneterraria.block": "泰拉瑞亚 方块",
|
||||
|
||||
"itemGroup.lzxnoneterraria.calamity_melee": "泰拉瑞亚灾厄 近战武器",
|
||||
|
||||
"item.lzxnoneterraria.bee_keeper": "养蜂人",
|
||||
"item.lzxnoneterraria.copper_shortsword": "铜短剑",
|
||||
"item.lzxnoneterraria.enchanted_sword": "附魔剑",
|
||||
@@ -26,6 +28,7 @@
|
||||
"item.lzxnoneterraria.true_copper_shortsword": "真铜短剑",
|
||||
"item.lzxnoneterraria.first_fractal": "第一分形",
|
||||
"item.lzxnoneterraria.mace": "链锤",
|
||||
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
||||
|
||||
"entity.lzxnoneterraria.static_projectile": "弹射物",
|
||||
"entity.lzxnoneterraria.static_summon": "召唤物",
|
||||
@@ -34,6 +37,9 @@
|
||||
"effect.lzxnoneterraria.confused": "困惑",
|
||||
"effect.lzxnoneterraria.blood_butchered": "血腥屠宰",
|
||||
|
||||
"key.lzxnoneterraria.kill_mode": "进入杀戮模式",
|
||||
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
||||
|
||||
"lzxnoneterraria.configuration.enchanted_sword_settings": "附魔剑 设置",
|
||||
"lzxnoneterraria.configuration.enchanted_sword_damage": "弹射伤害",
|
||||
"lzxnoneterraria.configuration.enchanted_sword_damage.tooltip": "每次命中伤害",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/bee_keeper"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/blade_of_grass"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/blood_butcherer"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon",
|
||||
"parent": "lzxnoneterraria:item/sword",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/copper_shortsword"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/devils_devastation"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon2",
|
||||
"parent": "lzxnoneterraria:item/sword2",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/enchanted_sword"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/excalibur"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/first_fractal"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/influx_waver"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon2",
|
||||
"parent": "lzxnoneterraria:item/sword2",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/lights_bane"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/meowmere"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/muramasa"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/nights_edge"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/seedler"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/star_wrath"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon2",
|
||||
"parent": "lzxnoneterraria:item/sword2",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/starfury"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/terra_blade"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon",
|
||||
"parent": "lzxnoneterraria:item/sword",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/terragrim"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/the_horsemans_blade"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon",
|
||||
"parent": "lzxnoneterraria:item/sword",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/true_copper_shortsword"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/true_excalibur"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/true_nights_edge"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/volcano"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/weapon3",
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/zenith"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:circle_particle"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:rune"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:rune2"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"textures": [
|
||||
"lzxnoneterraria:iron_spark_particle"
|
||||
]
|
||||
}
|
||||
@@ -40,5 +40,11 @@
|
||||
},
|
||||
"dig": {
|
||||
"sounds": ["lzxnoneterraria:dig"]
|
||||
},
|
||||
"demon_sword_swing": {
|
||||
"sounds": ["lzxnoneterraria:demon_sword_swing", "lzxnoneterraria:demon_sword_swing2"]
|
||||
},
|
||||
"demon_sword_impact": {
|
||||
"sounds": ["lzxnoneterraria:demon_sword_impact", "lzxnoneterraria:demon_sword_impact2"]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 237 B |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 212 B |