v1.6.0
This commit is contained in:
1 parent
fff35f2473
commit
426cb569f1
19 files changed
+763
-39
No files matched your search
@@ -15,6 +15,10 @@ public class ModSounds {
|
|||||||
SOUND_EVENTS.register("beam",
|
SOUND_EVENTS.register("beam",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "beam")));
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "beam")));
|
||||||
|
public static final Supplier<SoundEvent> BEAM2 =
|
||||||
|
SOUND_EVENTS.register("beam2",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "beam2")));
|
||||||
public static final Supplier<SoundEvent> MAX_MANA =
|
public static final Supplier<SoundEvent> MAX_MANA =
|
||||||
SOUND_EVENTS.register("max_mana",
|
SOUND_EVENTS.register("max_mana",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
|||||||
@@ -47,4 +47,11 @@ public class ModCreativeModeTabs {
|
|||||||
.displayItems((parameters, output) -> {
|
.displayItems((parameters, output) -> {
|
||||||
output.accept(ModItems.DEVILS_DEVASTATION.get());
|
output.accept(ModItems.DEVILS_DEVASTATION.get());
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
|
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> MAGIC_TAB = CREATIVE_MODE_TABS.register("lzxnoneterraria_magic_0", () -> CreativeModeTab.builder()
|
||||||
|
.title(Component.translatable("itemGroup.lzxnoneterraria.magic"))
|
||||||
|
.icon(() -> ModItems.LAST_PRISM.get().getDefaultInstance())
|
||||||
|
.displayItems((parameters, output) -> {
|
||||||
|
output.accept(ModItems.LAST_PRISM.get());
|
||||||
|
}).build());
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,9 @@ public class MEntityLuminance implements EntityLuminance {
|
|||||||
StaticSummonBehaviors.DEVILS_DEVASTATION_STUCK_PROJECTILE,
|
StaticSummonBehaviors.DEVILS_DEVASTATION_STUCK_PROJECTILE,
|
||||||
StaticSummonBehaviors.DEVILS_DEVASTATION_LIGHTNING,
|
StaticSummonBehaviors.DEVILS_DEVASTATION_LIGHTNING,
|
||||||
StaticSummonBehaviors.DEVILS_DEVASTATION_MARK,
|
StaticSummonBehaviors.DEVILS_DEVASTATION_MARK,
|
||||||
StaticSummonBehaviors.DEVILS_DEVASTATION_MARK_LIGHTNING -> {
|
StaticSummonBehaviors.DEVILS_DEVASTATION_MARK_LIGHTNING,
|
||||||
|
StaticSummonBehaviors.LAST_PRISM_TRI,
|
||||||
|
StaticSummonBehaviors.LAST_PRISM_BEAM -> {
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
default -> {
|
default -> {
|
||||||
|
|||||||
@@ -40,6 +40,48 @@ public class ModRenderTypes {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RenderType entityTranslucentEmissiveTriangles(ResourceLocation texture) {
|
||||||
|
return RenderType.create(
|
||||||
|
"m_entity_translucent_emissive_triangles",
|
||||||
|
DefaultVertexFormat.NEW_ENTITY,
|
||||||
|
VertexFormat.Mode.TRIANGLES,
|
||||||
|
1536,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
RenderType.CompositeState.builder()
|
||||||
|
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER)
|
||||||
|
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||||
|
.setTransparencyState(RenderStateShard.TRANSLUCENT_TRANSPARENCY)
|
||||||
|
.setCullState(RenderStateShard.NO_CULL)
|
||||||
|
.setLightmapState(RenderStateShard.NO_LIGHTMAP)
|
||||||
|
.setOverlayState(RenderStateShard.OVERLAY)
|
||||||
|
.setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
|
||||||
|
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
|
||||||
|
.createCompositeState(true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RenderType entitySolidEmissiveTriangles(ResourceLocation texture) {
|
||||||
|
return RenderType.create(
|
||||||
|
"m_entity_solid_emissive_triangles",
|
||||||
|
DefaultVertexFormat.NEW_ENTITY,
|
||||||
|
VertexFormat.Mode.TRIANGLES,
|
||||||
|
1536,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
RenderType.CompositeState.builder()
|
||||||
|
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER)
|
||||||
|
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||||
|
.setTransparencyState(RenderStateShard.NO_TRANSPARENCY)
|
||||||
|
.setCullState(RenderStateShard.NO_CULL)
|
||||||
|
.setLightmapState(RenderStateShard.NO_LIGHTMAP)
|
||||||
|
.setOverlayState(RenderStateShard.OVERLAY)
|
||||||
|
.setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
|
||||||
|
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
|
||||||
|
.createCompositeState(true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static RenderType entityAdditiveEmissive(ResourceLocation texture) {
|
public static RenderType entityAdditiveEmissive(ResourceLocation texture) {
|
||||||
return RenderType.create(
|
return RenderType.create(
|
||||||
"m_entity_additive_emissive",
|
"m_entity_additive_emissive",
|
||||||
@@ -61,6 +103,27 @@ public class ModRenderTypes {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RenderType entityAdditiveEmissiveTriangles(ResourceLocation texture) {
|
||||||
|
return RenderType.create(
|
||||||
|
"m_entity_additive_emissive_triangles",
|
||||||
|
DefaultVertexFormat.NEW_ENTITY,
|
||||||
|
VertexFormat.Mode.TRIANGLES,
|
||||||
|
1536,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
RenderType.CompositeState.builder()
|
||||||
|
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER)
|
||||||
|
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||||
|
.setTransparencyState(ADDITIVE_TRANSPARENCY)
|
||||||
|
.setCullState(RenderStateShard.NO_CULL)
|
||||||
|
.setLightmapState(RenderStateShard.NO_LIGHTMAP)
|
||||||
|
.setOverlayState(RenderStateShard.OVERLAY)
|
||||||
|
.setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
|
||||||
|
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
|
||||||
|
.createCompositeState(true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static RenderType entityTranslucent(ResourceLocation texture) {
|
public static RenderType entityTranslucent(ResourceLocation texture) {
|
||||||
return RenderType.create(
|
return RenderType.create(
|
||||||
"m_entity_translucent",
|
"m_entity_translucent",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.lzxnone.terraria.entity.summon;
|
package com.lzxnone.terraria.entity.summon;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -25,6 +26,8 @@ public class StaticSummonBehaviors {
|
|||||||
public static final String DEVILS_DEVASTATION_LIGHTNING = "devils_devastation_lightning";
|
public static final String DEVILS_DEVASTATION_LIGHTNING = "devils_devastation_lightning";
|
||||||
public static final String DEVILS_DEVASTATION_MARK = "devils_devastation_mark";
|
public static final String DEVILS_DEVASTATION_MARK = "devils_devastation_mark";
|
||||||
public static final String DEVILS_DEVASTATION_MARK_LIGHTNING = "devils_devastation_mark_lightning";
|
public static final String DEVILS_DEVASTATION_MARK_LIGHTNING = "devils_devastation_mark_lightning";
|
||||||
|
public static final String LAST_PRISM_TRI = "last_prism_tri";
|
||||||
|
public static final String LAST_PRISM_BEAM = "last_prism_beam";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
||||||
@@ -44,6 +47,8 @@ public class StaticSummonBehaviors {
|
|||||||
BEHAVIORS.put(DEVILS_DEVASTATION_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR2);
|
BEHAVIORS.put(DEVILS_DEVASTATION_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR2);
|
||||||
BEHAVIORS.put(DEVILS_DEVASTATION_MARK, DevilsDevastation.SUMMON_BEHAVIOR3);
|
BEHAVIORS.put(DEVILS_DEVASTATION_MARK, DevilsDevastation.SUMMON_BEHAVIOR3);
|
||||||
BEHAVIORS.put(DEVILS_DEVASTATION_MARK_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR4);
|
BEHAVIORS.put(DEVILS_DEVASTATION_MARK_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR4);
|
||||||
|
BEHAVIORS.put(LAST_PRISM_TRI, LastPrism.SUMMON_BEHAVIOR);
|
||||||
|
BEHAVIORS.put(LAST_PRISM_BEAM, LastPrism.SUMMON_BEHAVIOR2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStaticSummonBehavior getBehavior(String id) {
|
public static IStaticSummonBehavior getBehavior(String id) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class GuiRenderHandler {
|
|||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if(stack.is(ModItems.DEVILS_DEVASTATION.get()) && player.getEffect(ModEffects.KILL_MODE) != null) {
|
if(stack.is(ModItems.DEVILS_DEVASTATION.get()) && player.getEffect(ModEffects.KILL_MODE) != null) {
|
||||||
Component text = Component.translatable("effect.lzxnoneterraria.kill_mode");
|
Component text = Component.translatable("tooltip.lzxnoneterraria.devils_devastation_kill_mode");
|
||||||
Font font = minecraft.font;
|
Font font = minecraft.font;
|
||||||
String plainText = text.getString();
|
String plainText = text.getString();
|
||||||
int yShift = Math.max(minecraft.gui.leftHeight, minecraft.gui.rightHeight) + (68 - 59);
|
int yShift = Math.max(minecraft.gui.leftHeight, minecraft.gui.rightHeight) + (68 - 59);
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ public class InputHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MutableComponent displayText = Component.empty();
|
MutableComponent displayText = Component.empty();
|
||||||
displayText.append(Component.literal(String.format("%s", Zenith.isDistanceMode() ? "相对距离: " : "绝对距离: ")).withStyle(ChatFormatting.WHITE))
|
displayText.append(Component.translatable(Zenith.isDistanceMode() ? "tooltip.lzxnoneterraria.relative_distance" : "tooltip.lzxnoneterraria.absolute_distance").withStyle(ChatFormatting.WHITE))
|
||||||
.append(Component.literal(String.format("%.1f", finalDelta)).withStyle(ChatFormatting.GREEN, ChatFormatting.BOLD));
|
.append(Component.literal(": ").withStyle(ChatFormatting.WHITE))
|
||||||
|
.append(Component.literal(String.format("%.2f", finalDelta)).withStyle(ChatFormatting.GREEN, ChatFormatting.BOLD));
|
||||||
player.displayClientMessage(displayText, true);
|
player.displayClientMessage(displayText, true);
|
||||||
|
|
||||||
PacketDistributor.sendToServer(new ZenithScrollPayload(scrollDelta));
|
PacketDistributor.sendToServer(new ZenithScrollPayload(scrollDelta));
|
||||||
@@ -81,8 +82,9 @@ public class InputHandler {
|
|||||||
else if(finalDelta < 0) finalDelta = 0;
|
else if(finalDelta < 0) finalDelta = 0;
|
||||||
}
|
}
|
||||||
MutableComponent displayText = Component.empty();
|
MutableComponent displayText = Component.empty();
|
||||||
displayText.append(Component.literal(String.format("%s", FirstFractal.isDistanceMode() ? "相对距离: " : "绝对距离: ")).withStyle(ChatFormatting.WHITE))
|
displayText.append(Component.translatable(FirstFractal.isDistanceMode() ? "tooltip.lzxnoneterraria.relative_distance" : "tooltip.lzxnoneterraria.absolute_distance").withStyle(ChatFormatting.WHITE))
|
||||||
.append(Component.literal(String.format("%.1f", finalDelta)).withStyle(ChatFormatting.GREEN, ChatFormatting.BOLD));
|
.append(Component.literal(": ").withStyle(ChatFormatting.WHITE))
|
||||||
|
.append(Component.literal(String.format("%.2f", finalDelta)).withStyle(ChatFormatting.GREEN, ChatFormatting.BOLD));
|
||||||
player.displayClientMessage(displayText, true);
|
player.displayClientMessage(displayText, true);
|
||||||
|
|
||||||
PacketDistributor.sendToServer(new FirstFractalScrollPayload(scrollDelta));
|
PacketDistributor.sendToServer(new FirstFractalScrollPayload(scrollDelta));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lzxnone.terraria.item;
|
|||||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
import com.lzxnone.terraria.item.projectile.*;
|
import com.lzxnone.terraria.item.projectile.*;
|
||||||
import com.lzxnone.terraria.item.projectile.first_fractal.*;
|
import com.lzxnone.terraria.item.projectile.first_fractal.*;
|
||||||
|
import com.lzxnone.terraria.item.weapon.magic.*;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.neoforged.neoforge.registries.DeferredItem;
|
import net.neoforged.neoforge.registries.DeferredItem;
|
||||||
@@ -37,6 +38,9 @@ public class ModItems {
|
|||||||
public static final DeferredItem<Item> MACE = ITEMS.register("mace", Mace::new);
|
public static final DeferredItem<Item> MACE = ITEMS.register("mace", Mace::new);
|
||||||
public static final DeferredItem<Item> DEVILS_DEVASTATION = ITEMS.register("devils_devastation", DevilsDevastation::new);
|
public static final DeferredItem<Item> DEVILS_DEVASTATION = ITEMS.register("devils_devastation", DevilsDevastation::new);
|
||||||
|
|
||||||
|
//魔法武器
|
||||||
|
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
|
||||||
|
|
||||||
//弹射物
|
//弹射物
|
||||||
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new);
|
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new);
|
||||||
public static final DeferredItem<Item> STARFURY_STAR = ITEMS.register("starfury_star", StarfuryStar::new);
|
public static final DeferredItem<Item> STARFURY_STAR = ITEMS.register("starfury_star", StarfuryStar::new);
|
||||||
|
|||||||
@@ -0,0 +1,573 @@
|
|||||||
|
package com.lzxnone.terraria.item.weapon.magic;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
|
import com.lzxnone.terraria.ModSounds;
|
||||||
|
import com.lzxnone.terraria.entity.ModEntities;
|
||||||
|
import com.lzxnone.terraria.entity.ModRenderTypes;
|
||||||
|
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.item.weapon.melee.Mace;
|
||||||
|
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||||
|
import com.lzxnone.terraria.ui.config.ConfigFactory;
|
||||||
|
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||||
|
import com.lzxnone.terraria.ui.config.ConfigUtil;
|
||||||
|
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||||
|
import com.lzxnone.terraria.utils.DamageUtil;
|
||||||
|
import com.lzxnone.terraria.utils.FilterUtil;
|
||||||
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
|
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||||
|
import com.lzxnone.terraria.utils.SoundUtil;
|
||||||
|
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.texture.OverlayTexture;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Rarity;
|
||||||
|
import net.minecraft.world.item.UseAnim;
|
||||||
|
import net.minecraft.world.level.ClipContext;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Quaternionf;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
import org.jspecify.annotations.NonNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class LastPrism extends Item {
|
||||||
|
private static final String CONFIG_TRANSLATION_PREFIX = "lzxnoneterraria.configuration.";
|
||||||
|
|
||||||
|
public static final String DAMAGE_PATH = "weapon.last_prism.damage";
|
||||||
|
public static final float DAMAGE_DEFAULT = 100.0f;
|
||||||
|
public static final float DAMAGE_MIN = 0.0f;
|
||||||
|
public static final float DAMAGE_MAX = 8388600.0f;
|
||||||
|
|
||||||
|
public static final String CHARGE_TIME_PATH = "weapon.last_prism.charge_time";
|
||||||
|
public static final int CHARGE_TIME_DEFAULT = 67;
|
||||||
|
public static final int CHARGE_TIME_MIN = 1;
|
||||||
|
public static final int CHARGE_TIME_MAX = 72000;
|
||||||
|
|
||||||
|
public static final String MAX_USE_TIME_PATH = "weapon.last_prism.max_use_time";
|
||||||
|
public static final int MAX_USE_TIME_DEFAULT = 60 * 20;
|
||||||
|
public static final int MAX_USE_TIME_MIN = 1;
|
||||||
|
public static final int MAX_USE_TIME_MAX = 72000;
|
||||||
|
|
||||||
|
public static final String MAX_RANGE_PATH = "weapon.last_prism.max_range";
|
||||||
|
public static final double MAX_RANGE_DEFAULT = 64.0;
|
||||||
|
public static final double MAX_RANGE_MIN = 1.0;
|
||||||
|
public static final double MAX_RANGE_MAX = 512.0;
|
||||||
|
|
||||||
|
public LastPrism() {
|
||||||
|
super(new Properties().stacksTo(1).rarity(Rarity.EPIC));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||||
|
@Override
|
||||||
|
public void onConfigLoad() {
|
||||||
|
ConfigFactory.loadFloatConfig(DAMAGE_PATH, configText("last_prism_damage"), configTooltip("last_prism_damage"), DAMAGE_DEFAULT, DAMAGE_MIN, DAMAGE_MAX);
|
||||||
|
ConfigFactory.loadIntConfig(CHARGE_TIME_PATH, configText("last_prism_charge_time"), configTooltip("last_prism_charge_time"), CHARGE_TIME_DEFAULT, CHARGE_TIME_MIN, CHARGE_TIME_MAX);
|
||||||
|
ConfigFactory.loadIntConfig(MAX_USE_TIME_PATH, configText("last_prism_max_use_time"), configTooltip("last_prism_max_use_time"), MAX_USE_TIME_DEFAULT, MAX_USE_TIME_MIN, MAX_USE_TIME_MAX);
|
||||||
|
ConfigFactory.loadDoubleConfig(MAX_RANGE_PATH, configText("last_prism_max_range"), configTooltip("last_prism_max_range"), MAX_RANGE_DEFAULT, MAX_RANGE_MIN, MAX_RANGE_MAX);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Component configText(String key) {
|
||||||
|
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Component configTooltip(String key) {
|
||||||
|
return Component.translatable(CONFIG_TRANSLATION_PREFIX + key + ".tooltip");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getDamage() {
|
||||||
|
return Math.clamp(ConfigUtil.readFloat(DAMAGE_PATH, DAMAGE_DEFAULT), DAMAGE_MIN, DAMAGE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getChargeTime() {
|
||||||
|
return Math.clamp(ConfigUtil.readInt(CHARGE_TIME_PATH, CHARGE_TIME_DEFAULT), CHARGE_TIME_MIN, CHARGE_TIME_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getMaxUseTime() {
|
||||||
|
return Math.clamp(ConfigUtil.readInt(MAX_USE_TIME_PATH, MAX_USE_TIME_DEFAULT), MAX_USE_TIME_MIN, MAX_USE_TIME_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getMaxRange() {
|
||||||
|
return Math.clamp(ConfigUtil.readDouble(MAX_RANGE_PATH, MAX_RANGE_DEFAULT), MAX_RANGE_MIN, MAX_RANGE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||||
|
"last_prism",
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/last_prism.png"),
|
||||||
|
Component.translatable("item.lzxnoneterraria.last_prism"),
|
||||||
|
CONFIG_DATA
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/normal_trail.png");
|
||||||
|
public static final int RING = 8;
|
||||||
|
public static final float MAX_ROTATE = 36.0f;
|
||||||
|
public static final float MAX_RADIUS = 0.5f;
|
||||||
|
public static final float DELTA_DIST = 0.5f;
|
||||||
|
public static final float MIN_DIST = 0.25f;
|
||||||
|
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||||
|
0.1f, 0.5f, 40, true, new Vector3f[]{
|
||||||
|
new Vector3f(0.0F, 1.0F, 1.0F),
|
||||||
|
new Vector3f(0.1F, 0.4F, 1.0F),
|
||||||
|
new Vector3f(1.0F, 1.0F, 0.6F),
|
||||||
|
new Vector3f(1.0F, 0.9F, 0.0F),
|
||||||
|
new Vector3f(0.5F, 1.0F, 0.5F),
|
||||||
|
new Vector3f(0.0F, 1.0F, 0.2F),
|
||||||
|
new Vector3f(1.0F, 0.6F, 0.8F),
|
||||||
|
new Vector3f(1.0F, 0.0F, 1.0F),
|
||||||
|
new Vector3f(1.0F, 0.8F, 0.5F),
|
||||||
|
new Vector3f(1.0F, 0.5F, 0.0F),
|
||||||
|
new Vector3f(0.7F, 0.7F, 0.7F)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final Vector3f[] BEAM_COLORS = {
|
||||||
|
new Vector3f(1.0f, 0.0f, 0.0f),
|
||||||
|
new Vector3f(1.0f, 1.0f, 0.0f),
|
||||||
|
new Vector3f(0.5f, 0.0f, 0.5f),
|
||||||
|
new Vector3f(0.0f, 1.0f, 0.0f),
|
||||||
|
new Vector3f(0.0f, 1.0f, 1.0f),
|
||||||
|
new Vector3f(1.0f, 0.0f, 0.5f)
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
Entity owner = summon.getOwner();
|
||||||
|
if(owner == null) return;
|
||||||
|
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(owner);
|
||||||
|
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||||
|
|
||||||
|
float time = summon.getEntityData().get(StaticSummon.AGE) + partialTick;
|
||||||
|
float size = 0.35F;
|
||||||
|
float hue = (time * 0.02F) % 1.0F;
|
||||||
|
float baseZ = -size / 3.0F;
|
||||||
|
float baseRadius = size * 2.0F * Mth.sqrt(2.0F) / 3.0F;
|
||||||
|
|
||||||
|
Vec3 v0 = new Vec3(0.0D, 0.0D, size);
|
||||||
|
Vec3 v1 = new Vec3(baseRadius, 0.0D, baseZ);
|
||||||
|
Vec3 v2 = new Vec3(baseRadius * Math.cos(Math.toRadians(120.0D)), baseRadius * Math.sin(Math.toRadians(120.0D)), baseZ);
|
||||||
|
Vec3 v3 = new Vec3(baseRadius * Math.cos(Math.toRadians(240.0D)), baseRadius * Math.sin(Math.toRadians(240.0D)), baseZ);
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1]));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0]));
|
||||||
|
|
||||||
|
poseStack.mulPose(Axis.ZP.rotationDegrees(computePrismAngle(time)));
|
||||||
|
|
||||||
|
Matrix4f matrix = poseStack.last().pose();
|
||||||
|
VertexConsumer innerConsumer = bufferSource.getBuffer(ModRenderTypes.entitySolidEmissiveTriangles(RES));
|
||||||
|
renderTetrahedronFace(innerConsumer, matrix, v0, v1, v2, 1.0F, 1.0F, 1.0F, 0.5f);
|
||||||
|
renderTetrahedronFace(innerConsumer, matrix, v0, v3, v1, 1.0F, 1.0F, 1.0F, 0.5f);
|
||||||
|
renderTetrahedronFace(innerConsumer, matrix, v0, v2, v3, 1.0F, 1.0F, 1.0F, 0.5f);
|
||||||
|
renderTetrahedronFace(innerConsumer, matrix, v1, v3, v2, 1.0F, 1.0F, 1.0F, 0.5f);
|
||||||
|
|
||||||
|
float outerScale = 1.2F;
|
||||||
|
VertexConsumer outerConsumer = bufferSource.getBuffer(ModRenderTypes.entitySolidEmissiveTriangles(RES));
|
||||||
|
renderTetrahedronFace(outerConsumer, matrix, v0.scale(outerScale), v1.scale(outerScale), v2.scale(outerScale), hue);
|
||||||
|
renderTetrahedronFace(outerConsumer, matrix, v0.scale(outerScale), v3.scale(outerScale), v1.scale(outerScale), hue + 0.25F);
|
||||||
|
renderTetrahedronFace(outerConsumer, matrix, v0.scale(outerScale), v2.scale(outerScale), v3.scale(outerScale), hue + 0.50F);
|
||||||
|
renderTetrahedronFace(outerConsumer, matrix, v1.scale(outerScale), v3.scale(outerScale), v2.scale(outerScale), hue + 0.75F);
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(StaticSummon summon) {
|
||||||
|
this.checkBeforeTick(summon);
|
||||||
|
if(summon.getOwner() instanceof Player player) {
|
||||||
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
if(!stack.is(ModItems.LAST_PRISM.get()) || !player.isUsingItem()) {
|
||||||
|
this.onDied(summon);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ItemStack usingStack = player.getUseItem();
|
||||||
|
if(!usingStack.is(ModItems.LAST_PRISM.get())) {
|
||||||
|
this.onDied(summon);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(summon.getOwner());
|
||||||
|
Vec3 pos = summon.getOwner().getEyePosition().add(MathUtil.toVec3(dirs[0]).scale(1.25)).add(MathUtil.toVec3(dirs[1]).scale(-1.0));
|
||||||
|
summon.setPos(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AABB getBoundingBoxForCulling(StaticSummon summon) {
|
||||||
|
return summon.getBoundingBox().inflate(2.0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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 beam)) return;
|
||||||
|
if(!(beam.getOwner() instanceof StaticSummon tri)) return;
|
||||||
|
|
||||||
|
BeamData beamData = computeBeamData(tri, getBeamIndex(beam), partialTick);
|
||||||
|
if(beamData == null) return;
|
||||||
|
|
||||||
|
VertexConsumer consumer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES));
|
||||||
|
Matrix4f matrix = poseStack.last().pose();
|
||||||
|
List<Vec3> points = List.of(beamData.start(), beamData.end());
|
||||||
|
|
||||||
|
renderTube(consumer, matrix, beam.position(),
|
||||||
|
points, beamData.radius() * 0.8f, 1.0f, 1.0f, 1.0f, 1.0f, false);
|
||||||
|
renderTube(consumer, matrix, beam.position(),
|
||||||
|
points, beamData.radius(), beam.getEntityData().get(StaticSummon.COLOR_A),
|
||||||
|
beam.getEntityData().get(StaticSummon.COLOR_R),
|
||||||
|
beam.getEntityData().get(StaticSummon.COLOR_G),
|
||||||
|
beam.getEntityData().get(StaticSummon.COLOR_B), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(StaticSummon beam) {
|
||||||
|
this.checkBeforeTick(beam);
|
||||||
|
if(!(beam.getOwner() instanceof StaticSummon tri)) {
|
||||||
|
this.onDied(beam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!(tri.getOwner() instanceof Player player)) {
|
||||||
|
this.onDied(beam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
ItemStack usingStack = player.getUseItem();
|
||||||
|
if(!stack.is(ModItems.LAST_PRISM.get()) || !player.isUsingItem() || !usingStack.is(ModItems.LAST_PRISM.get())) {
|
||||||
|
this.onDied(beam);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
beam.setPos(tri.position());
|
||||||
|
BeamData beamData = computeBeamData(tri, getBeamIndex(beam), 0.0f);
|
||||||
|
if(beamData == null) return;
|
||||||
|
|
||||||
|
if(beamData.blocked() && beam.level() instanceof ServerLevel serverLevel) {
|
||||||
|
ParticleUtil.addParticles(
|
||||||
|
serverLevel,
|
||||||
|
PARTICLE,
|
||||||
|
beamData.end(),
|
||||||
|
new Vec3(0.08, 0.08, 0.08),
|
||||||
|
0.05,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
AABB searchBox = new AABB(beamData.start(), beamData.end()).inflate(1.0f);
|
||||||
|
List<Entity> entities = beam.level().getEntities(
|
||||||
|
beam,
|
||||||
|
searchBox,
|
||||||
|
FilterUtil.createTargetFilter(beam, player)
|
||||||
|
);
|
||||||
|
|
||||||
|
for(Entity hitEntity : entities) {
|
||||||
|
AABB entityBox = hitEntity.getBoundingBox().inflate(beamData.radius());
|
||||||
|
Optional<Vec3> clipResult = entityBox.clip(beamData.start(), beamData.end());
|
||||||
|
if(entityBox.contains(beamData.start()) || clipResult.isPresent()) {
|
||||||
|
if(DamageUtil.attack(player, hitEntity, getDamage() * beamData.ratio())) {
|
||||||
|
hitEntity.invulnerableTime = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AABB getBoundingBoxForCulling(StaticSummon beam) {
|
||||||
|
if(!(beam.getOwner() instanceof StaticSummon tri)) return IStaticSummonBehavior.super.getBoundingBoxForCulling(beam);
|
||||||
|
BeamData beamData = computeBeamData(tri, getBeamIndex(beam), 0.0f);
|
||||||
|
if(beamData == null) return IStaticSummonBehavior.super.getBoundingBoxForCulling(beam);
|
||||||
|
return new AABB(beamData.start(), beamData.end()).inflate(MAX_RADIUS + 1.0f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private record BeamData(Vec3 start, Vec3 end, float radius, float ratio, boolean blocked) {}
|
||||||
|
|
||||||
|
private static int getBeamIndex(StaticSummon beam) {
|
||||||
|
CompoundTag customData = beam.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||||
|
return Mth.clamp(customData.getInt("idx"), 0, BEAM_COLORS.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BeamData computeBeamData(StaticSummon tri, int idx, float partialTick) {
|
||||||
|
Entity owner = tri.getOwner();
|
||||||
|
if(owner == null) return null;
|
||||||
|
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(owner);
|
||||||
|
float time = tri.getEntityData().get(StaticSummon.AGE) + partialTick;
|
||||||
|
float angle = computePrismAngle(time);
|
||||||
|
float ratio = Math.min(1.0f, time / getChargeTime());
|
||||||
|
double maxRange = getMaxRange();
|
||||||
|
double dy = maxRange / 2;
|
||||||
|
|
||||||
|
Vec3 basePos = tri.position().add(MathUtil.toVec3(dirs[0]).scale(0.5f));
|
||||||
|
Vector3f baseDir = MathUtil.toVec3(dirs[0])
|
||||||
|
.scale(maxRange)
|
||||||
|
.add(MathUtil.toVec3(dirs[1]).scale(dy * (1.0f - ratio)))
|
||||||
|
.toVector3f();
|
||||||
|
Vector3f deltaDir = MathUtil.toVec3(dirs[1])
|
||||||
|
.scale(DELTA_DIST * (1.0f - ratio) + MIN_DIST)
|
||||||
|
.toVector3f();
|
||||||
|
|
||||||
|
Quaternionf rotation = new Quaternionf().fromAxisAngleRad(dirs[0], (float) Math.toRadians(angle + 60.0 * idx));
|
||||||
|
Vec3 shootDir = MathUtil.toVec3(baseDir.rotate(rotation));
|
||||||
|
Vec3 shootPos = basePos.add(MathUtil.toVec3(deltaDir.rotate(rotation)));
|
||||||
|
Vec3 endPos = shootPos.add(shootDir);
|
||||||
|
boolean blocked = false;
|
||||||
|
|
||||||
|
BlockHitResult blockHit = tri.level().clip(new ClipContext(
|
||||||
|
shootPos,
|
||||||
|
endPos,
|
||||||
|
ClipContext.Block.COLLIDER,
|
||||||
|
ClipContext.Fluid.NONE,
|
||||||
|
tri
|
||||||
|
));
|
||||||
|
if(blockHit.getType() != HitResult.Type.MISS) {
|
||||||
|
endPos = blockHit.getLocation();
|
||||||
|
blocked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BeamData(shootPos, endPos, MAX_RADIUS * ratio, ratio, blocked);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float computePrismAngle(float time) {
|
||||||
|
int chargeTime = getChargeTime();
|
||||||
|
float a = MAX_ROTATE / chargeTime;
|
||||||
|
float v = Math.min(a * time, MAX_ROTATE);
|
||||||
|
if(v < MAX_ROTATE) {
|
||||||
|
return 0.5f * a * time * time;
|
||||||
|
}
|
||||||
|
return 0.5f * a * chargeTime * chargeTime + v * time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||||
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
|
if(stack.is(ModItems.LAST_PRISM.get()) && !player.level().isClientSide()) {
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||||
|
|
||||||
|
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||||
|
summon.setOwner(player);
|
||||||
|
Vec3 pos = player.getEyePosition().add(MathUtil.toVec3(dirs[0]).scale(0.5)).add(MathUtil.toVec3(dirs[1]).scale(-1.0));
|
||||||
|
summon.setPos(pos);
|
||||||
|
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.LAST_PRISM_TRI);
|
||||||
|
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||||
|
summon.getEntityData().set(StaticSummon.LIFETIME, 72000);
|
||||||
|
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||||
|
|
||||||
|
summon.setNoGravity(true);
|
||||||
|
summon.noPhysics = true;
|
||||||
|
|
||||||
|
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||||
|
summon.setXRot(xyRot[0]);
|
||||||
|
summon.setYRot(xyRot[1]);
|
||||||
|
|
||||||
|
level.addFreshEntity(summon);
|
||||||
|
|
||||||
|
for(int i = 0; i < BEAM_COLORS.length; i++) {
|
||||||
|
StaticSummon beam = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||||
|
Vector3f color = BEAM_COLORS[i];
|
||||||
|
beam.setOwner(summon);
|
||||||
|
beam.setPos(pos);
|
||||||
|
beam.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.LAST_PRISM_BEAM);
|
||||||
|
beam.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||||
|
beam.getEntityData().set(StaticSummon.LIFETIME, getMaxUseTime());
|
||||||
|
beam.getEntityData().set(StaticSummon.GLOW, true);
|
||||||
|
beam.getEntityData().set(StaticSummon.COLOR_R, color.x);
|
||||||
|
beam.getEntityData().set(StaticSummon.COLOR_G, color.y);
|
||||||
|
beam.getEntityData().set(StaticSummon.COLOR_B, color.z);
|
||||||
|
beam.getEntityData().set(StaticSummon.COLOR_A, 1.0f);
|
||||||
|
|
||||||
|
CompoundTag customData = new CompoundTag();
|
||||||
|
customData.putInt("idx", i);
|
||||||
|
beam.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||||
|
|
||||||
|
beam.setNoGravity(true);
|
||||||
|
beam.noPhysics = true;
|
||||||
|
|
||||||
|
level.addFreshEntity(beam);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.startUsingItem(hand);
|
||||||
|
return InteractionResultHolder.consume(stack);
|
||||||
|
}
|
||||||
|
return InteractionResultHolder.pass(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull UseAnim getUseAnimation(ItemStack stack) {
|
||||||
|
return UseAnim.BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int count) {
|
||||||
|
if(!(livingEntity instanceof Player player)) return;
|
||||||
|
if(level.isClientSide()) return;
|
||||||
|
if(player.tickCount % 20 == 0) {
|
||||||
|
SoundUtil.playClientSound(player, ModSounds.BEAM2.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUseDuration(ItemStack stack, LivingEntity entity) {
|
||||||
|
return getMaxUseTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderTetrahedronFace(
|
||||||
|
VertexConsumer buffer,
|
||||||
|
Matrix4f matrix,
|
||||||
|
Vec3 v0,
|
||||||
|
Vec3 v1,
|
||||||
|
Vec3 v2,
|
||||||
|
float hue
|
||||||
|
) {
|
||||||
|
float[] color0 = computeSoftPrismColor(hue);
|
||||||
|
float[] color1 = computeSoftPrismColor(hue + 0.10F);
|
||||||
|
float[] color2 = computeSoftPrismColor(hue + 0.20F);
|
||||||
|
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v0, color0[0], color0[1], color0[2]);
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v1, color1[0], color1[1], color1[2]);
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v2, color2[0], color2[1], color2[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderTetrahedronFace(
|
||||||
|
VertexConsumer buffer,
|
||||||
|
Matrix4f matrix,
|
||||||
|
Vec3 v0,
|
||||||
|
Vec3 v1,
|
||||||
|
Vec3 v2,
|
||||||
|
float r,
|
||||||
|
float g,
|
||||||
|
float b,
|
||||||
|
float alpha
|
||||||
|
) {
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v0, r, g, b, alpha);
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v1, r, g, b, alpha);
|
||||||
|
renderTetrahedronVertex(buffer, matrix, v2, r, g, b, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderTetrahedronVertex(
|
||||||
|
VertexConsumer buffer,
|
||||||
|
Matrix4f matrix,
|
||||||
|
Vec3 vertex,
|
||||||
|
float r,
|
||||||
|
float g,
|
||||||
|
float b
|
||||||
|
) {
|
||||||
|
renderTetrahedronVertex(buffer, matrix, vertex, r, g, b, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderTetrahedronVertex(
|
||||||
|
VertexConsumer buffer,
|
||||||
|
Matrix4f matrix,
|
||||||
|
Vec3 vertex,
|
||||||
|
float r,
|
||||||
|
float g,
|
||||||
|
float b,
|
||||||
|
float alpha
|
||||||
|
) {
|
||||||
|
buffer.addVertex(matrix, (float)vertex.x, (float)vertex.y, (float)vertex.z)
|
||||||
|
.setColor(r, g, b, alpha)
|
||||||
|
.setUv(0.5F, 0.5F)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||||
|
.setLight(LightTexture.FULL_BRIGHT)
|
||||||
|
.setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float[] computeSoftPrismColor(float hue) {
|
||||||
|
float normalizedHue = Math.floorMod((int)(hue * 1000.0F), 1000) / 1000.0F;
|
||||||
|
int color = Mth.hsvToRgb(normalizedHue, 0.85F, 1.0F);
|
||||||
|
float rainbowR = ((color >> 16) & 255) / 255.0F;
|
||||||
|
float rainbowG = ((color >> 8) & 255) / 255.0F;
|
||||||
|
float rainbowB = (color & 255) / 255.0F;
|
||||||
|
float tint = 0.75F;
|
||||||
|
|
||||||
|
return new float[]{
|
||||||
|
1.0F * (1.0F - tint) + rainbowR * tint,
|
||||||
|
1.0F * (1.0F - tint) + rainbowG * tint,
|
||||||
|
1.0F * (1.0F - tint) + rainbowB * tint
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void renderTube(VertexConsumer buffer, Matrix4f matrix, Vec3 entityWorldPos,
|
||||||
|
List<Vec3> points, float radius, float alpha, float colorR, float colorG, float colorB, boolean linear) {
|
||||||
|
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 = linear ? radius * (1.0F - (float) i / (float) (n - 1)) : radius;
|
||||||
|
float r1 = linear ? radius * (1.0F - (float) (i + 1) / (float) (n - 1)) : radius;
|
||||||
|
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 < RING;j++) {
|
||||||
|
float a0 = (float) (2.0 * Math.PI * j / RING);
|
||||||
|
float a1 = (float) (2.0 * Math.PI * (j + 1) / 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, 0.5f, 0.5f, alpha, colorR, colorG, colorB);
|
||||||
|
writeVert(buffer, matrix, entityWorldPos, v1, 0.5f, 0.5f, alpha, colorR, colorG, colorB);
|
||||||
|
writeVert(buffer, matrix, entityWorldPos, v2, 0.5f, 0.5f, alpha, colorR, colorG, colorB);
|
||||||
|
writeVert(buffer, matrix, entityWorldPos, v3, 0.5f, 0.5f, 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 u, float v, 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(u, v)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||||
|
.setLight(LightTexture.FULL_BRIGHT)
|
||||||
|
.setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -297,6 +297,10 @@ public class TerraBlade extends SwordItem {
|
|||||||
float size = 1.0f - 0.25f * progress;
|
float size = 1.0f - 0.25f * progress;
|
||||||
poseStack.scale(size, size, size);
|
poseStack.scale(size, size, size);
|
||||||
|
|
||||||
|
float[] dz = {0.1f, 0f, -0.1f};
|
||||||
|
|
||||||
|
for(int x = 0;x < 3;x++) {
|
||||||
|
|
||||||
VertexConsumer vertexConsumer0 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES0));
|
VertexConsumer vertexConsumer0 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES0));
|
||||||
|
|
||||||
//左边
|
//左边
|
||||||
@@ -304,7 +308,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 18 * (1.0f - progress), SwordBeam.DIST);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 18 * (1.0f - progress), SwordBeam.DIST);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 18 * (1.0f - progress), rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 18 * (1.0f - progress), rotate);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
||||||
COLOR0.x(), COLOR0.y(), COLOR0.z(), alpha, halfWidth, halfHeight, 0f, 0, -0.01f);
|
COLOR0.x(), COLOR0.y(), COLOR0.z(), alpha, halfWidth, halfHeight, 0f, 0, -0.01f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
|
|
||||||
@@ -313,7 +317,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
||||||
COLOR1.x(), COLOR1.y(), COLOR1.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0f);
|
COLOR1.x(), COLOR1.y(), COLOR1.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
//右边
|
//右边
|
||||||
@@ -321,7 +325,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 108, SwordBeam.DIST);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 108, SwordBeam.DIST);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -9 * (1.0f - progress), rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -9 * (1.0f - progress), rotate);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer0,
|
||||||
COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0, 0.01f);
|
COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0, 0.01f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
VertexConsumer vertexConsumer1 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES1));
|
VertexConsumer vertexConsumer1 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES1));
|
||||||
@@ -332,7 +336,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
poseStack.scale(0.5f, 0.5f, 0.5f);
|
poseStack.scale(0.5f, 0.5f, 0.5f);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
||||||
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f);
|
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
@@ -340,7 +344,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
poseStack.scale(0.75f, 0.75f, 0.75f);
|
poseStack.scale(0.75f, 0.75f, 0.75f);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
||||||
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f);
|
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
@@ -348,7 +352,7 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
poseStack.scale(0.95f, 0.95f, 0.95f);
|
poseStack.scale(0.95f, 0.95f, 0.95f);
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer1,
|
||||||
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f);
|
1.0f, 1.0f, 1.0f, alpha, halfWidth, halfHeight, 0f, 0f, 0.02f + dz[x]);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
VertexConsumer vertexConsumer2 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES2));
|
VertexConsumer vertexConsumer2 = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES2));
|
||||||
@@ -358,19 +362,19 @@ public class TerraBlade extends SwordItem {
|
|||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 100, SwordBeam.DIST * 1.15f);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 100, SwordBeam.DIST * 1.15f);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
poseStack.scale(1.0f, 1.0f, 1.0f);
|
poseStack.scale(1.0f, 1.0f, 1.0f);
|
||||||
for(int i = 0;i < 5;i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer2,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer2,
|
||||||
COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.03f);
|
COLOR2.x(), COLOR2.y(), COLOR2.z(), alpha, halfWidth, halfHeight, 0f, 0f, 0.03f + dz[x]);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
|
|
||||||
float sparkleAlpha;
|
float sparkleAlpha;
|
||||||
if(progress < FADE_IN) {
|
if (progress < FADE_IN) {
|
||||||
sparkleAlpha = 0;
|
sparkleAlpha = 0;
|
||||||
}else if(progress > FADE_OUT) {
|
} else if (progress > FADE_OUT) {
|
||||||
sparkleAlpha = 1.0f - (progress - FADE_OUT) / (1.0f - FADE_OUT);
|
sparkleAlpha = 1.0f - (progress - FADE_OUT) / (1.0f - FADE_OUT);
|
||||||
}else {
|
} else {
|
||||||
sparkleAlpha = (progress - FADE_IN) / (FADE_OUT - FADE_IN);
|
sparkleAlpha = (progress - FADE_IN) / (FADE_OUT - FADE_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,23 +382,23 @@ public class TerraBlade extends SwordItem {
|
|||||||
|
|
||||||
//闪烁(外层)
|
//闪烁(外层)
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
for(int k = 0;k < 2;k++) {
|
for (int k = 0; k < 2; k++) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
if(k == 0) {
|
if (k == 0) {
|
||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 60.0 * progress, SwordBeam.DIST * 2f);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 60.0 * progress, SwordBeam.DIST * 2f);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 60 * progress, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 60 * progress, rotate);
|
||||||
}else {
|
} else {
|
||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 60.0 * progress, SwordBeam.DIST * 2f + 0.5f * progress);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 60.0 * progress, SwordBeam.DIST * 2f + 0.5f * progress);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -60 * progress, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -60 * progress, rotate);
|
||||||
}
|
}
|
||||||
for(int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
if (j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
||||||
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
||||||
poseStack.scale(0.5f, 0.5f, 0.5f);
|
poseStack.scale(0.5f, 0.5f, 0.5f);
|
||||||
for(int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
||||||
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f);
|
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f + dz[x]);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
@@ -404,23 +408,23 @@ public class TerraBlade extends SwordItem {
|
|||||||
|
|
||||||
//闪烁(中层)
|
//闪烁(中层)
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
for(int k = 0;k < 2;k++) {
|
for (int k = 0; k < 2; k++) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
if(k == 0) {
|
if (k == 0) {
|
||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 30.0 * progress, SwordBeam.DIST * 2f);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 - 30.0 * progress, SwordBeam.DIST * 2f);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 30 * progress, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 30 * progress, rotate);
|
||||||
}else {
|
} else {
|
||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 30.0 * progress, SwordBeam.DIST * 2.1f);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90 + 30.0 * progress, SwordBeam.DIST * 2.1f);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -30 * progress, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], -30 * progress, rotate);
|
||||||
}
|
}
|
||||||
for(int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
if (j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
||||||
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
||||||
poseStack.scale(0.75f, 0.75f, 0.75f);
|
poseStack.scale(0.75f, 0.75f, 0.75f);
|
||||||
for(int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
||||||
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f);
|
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f + dz[x]);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
@@ -432,19 +436,21 @@ public class TerraBlade extends SwordItem {
|
|||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST * 2f);
|
RenderUtil.applyTranslate(poseStack, dirs[0], dirs[2], 90, SwordBeam.DIST * 2f);
|
||||||
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
RenderUtil.applyRotate(poseStack, dirs[0], dirs[1], 0, rotate);
|
||||||
for(int j = 0; j < 2; j++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
if(j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
if (j == 0) poseStack.mulPose(Axis.ZP.rotationDegrees(0.0F));
|
||||||
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
else poseStack.mulPose(Axis.ZP.rotationDegrees(45.0F));
|
||||||
poseStack.scale(1.0f, 1.0f, 1.0f);
|
poseStack.scale(1.0f, 1.0f, 1.0f);
|
||||||
for(int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
RenderUtil.renderQuad(poseStack.last().pose(), vertexConsumer3,
|
||||||
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f);
|
COLOR2.x(), COLOR2.y(), COLOR2.z(), sparkleAlpha, 32 * SwordBeam.SCALE, 32 * SwordBeam.SCALE, 0f, 0f, 0.03f + dz[x]);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,13 @@ public class ItemInHandRenderMixin {
|
|||||||
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
}else if(itemStack.is(ModItems.LAST_PRISM) && entity instanceof Player player) {
|
||||||
|
if(player.isUsingItem()) {
|
||||||
|
ItemStack usingStack = player.getUseItem();
|
||||||
|
if(usingStack.is(itemStack.getItem())) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public abstract class UseSpeedMixin {
|
|||||||
|| usingItem.is(ModItems.TRUE_COPPER_SHORTSWORD.get())
|
|| usingItem.is(ModItems.TRUE_COPPER_SHORTSWORD.get())
|
||||||
|| usingItem.is(ModItems.FIRST_FRACTAL.get())
|
|| usingItem.is(ModItems.FIRST_FRACTAL.get())
|
||||||
|| usingItem.is(ModItems.TERRAGRIM.get())
|
|| usingItem.is(ModItems.TERRAGRIM.get())
|
||||||
|| usingItem.is(ModItems.MACE.get());
|
|| usingItem.is(ModItems.MACE.get())
|
||||||
|
|| usingItem.is(ModItems.LAST_PRISM.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WrapOperation(
|
@WrapOperation(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.lzxnone.terraria.ui.config;
|
|||||||
|
|
||||||
import com.lzxnone.terraria.effect.BloodButcheredEffect;
|
import com.lzxnone.terraria.effect.BloodButcheredEffect;
|
||||||
import com.lzxnone.terraria.effect.DemonicFlamesEffect;
|
import com.lzxnone.terraria.effect.DemonicFlamesEffect;
|
||||||
|
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
|
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.BladeOfGrass;
|
import com.lzxnone.terraria.item.weapon.melee.BladeOfGrass;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.BloodButcherer;
|
import com.lzxnone.terraria.item.weapon.melee.BloodButcherer;
|
||||||
@@ -59,7 +60,8 @@ public class ConfigList {
|
|||||||
Terragrim.CONFIG_LIST_ITEM,
|
Terragrim.CONFIG_LIST_ITEM,
|
||||||
FirstFractal.CONFIG_LIST_ITEM,
|
FirstFractal.CONFIG_LIST_ITEM,
|
||||||
Mace.CONFIG_LIST_ITEM,
|
Mace.CONFIG_LIST_ITEM,
|
||||||
DevilsDevastation.CONFIG_LIST_ITEM
|
DevilsDevastation.CONFIG_LIST_ITEM,
|
||||||
|
LastPrism.CONFIG_LIST_ITEM
|
||||||
});
|
});
|
||||||
ITEMS.put(EFFECT, new ConfigListItem[]{
|
ITEMS.put(EFFECT, new ConfigListItem[]{
|
||||||
BloodButcheredEffect.CONFIG_LIST_ITEM,
|
BloodButcheredEffect.CONFIG_LIST_ITEM,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"itemGroup.lzxnoneterraria.melee": "Terraria Melee",
|
"itemGroup.lzxnoneterraria.melee": "Terraria Melee",
|
||||||
|
"itemGroup.lzxnoneterraria.magic": "Terraria Magic",
|
||||||
"itemGroup.lzxnoneterraria.block": "Terraria Block",
|
"itemGroup.lzxnoneterraria.block": "Terraria Block",
|
||||||
"itemGroup.lzxnoneterraria.calamity_melee": "Terraria Calamity Melee",
|
"itemGroup.lzxnoneterraria.calamity_melee": "Terraria Calamity Melee",
|
||||||
|
|
||||||
"item.lzxnoneterraria.copper_shortsword": "Copper Shortsword",
|
"item.lzxnoneterraria.copper_shortsword": "Copper Shortsword",
|
||||||
"item.lzxnoneterraria.enchanted_sword": "Enchanted Sword",
|
"item.lzxnoneterraria.enchanted_sword": "Enchanted Sword",
|
||||||
"item.lzxnoneterraria.bee_keeper": "Bee Keeper",
|
"item.lzxnoneterraria.bee_keeper": "Bee Keeper",
|
||||||
@@ -27,19 +29,28 @@
|
|||||||
"item.lzxnoneterraria.first_fractal": "First Fractal",
|
"item.lzxnoneterraria.first_fractal": "First Fractal",
|
||||||
"item.lzxnoneterraria.mace": "Mace",
|
"item.lzxnoneterraria.mace": "Mace",
|
||||||
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
||||||
|
"item.lzxnoneterraria.last_prism": "Last Prism",
|
||||||
|
|
||||||
|
"tooltip.lzxnoneterraria.relative_distance": "Relative Distance",
|
||||||
|
"tooltip.lzxnoneterraria.absolute_distance": "Absolute Distance",
|
||||||
|
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "Kill Mode",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.0": "The perfect blade of the Underworld, wielding the power of Brimstone directly.",
|
"tooltip.lzxnoneterraria.devils_devastation.0": "The perfect blade of the Underworld, wielding the power of Brimstone directly.",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.1": "Humans understand this force as Havoc, the inevitable sundering of all order in fire.",
|
"tooltip.lzxnoneterraria.devils_devastation.1": "Humans understand this force as Havoc, the inevitable sundering of all order in fire.",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.2": "Perhaps this is why the Brimstone Elemental had strength unrivaled by her sisters.",
|
"tooltip.lzxnoneterraria.devils_devastation.2": "Perhaps this is why the Brimstone Elemental had strength unrivaled by her sisters.",
|
||||||
|
|
||||||
"entity.lzxnoneterraria.static_projectile": "Projectile",
|
"entity.lzxnoneterraria.static_projectile": "Projectile",
|
||||||
"entity.lzxnoneterraria.static_summon": "Summon",
|
"entity.lzxnoneterraria.static_summon": "Summon",
|
||||||
"entity.lzxnoneterraria.bee_summon": "Bee",
|
"entity.lzxnoneterraria.bee_summon": "Bee",
|
||||||
|
|
||||||
"effect.lzxnoneterraria.confused": "Confused",
|
"effect.lzxnoneterraria.confused": "Confused",
|
||||||
"effect.lzxnoneterraria.blood_butchered": "Blood Butchered",
|
"effect.lzxnoneterraria.blood_butchered": "Blood Butchered",
|
||||||
"effect.lzxnoneterraria.kill_mode": "Kill Mode",
|
"effect.lzxnoneterraria.kill_mode": "Kill Mode",
|
||||||
"effect.lzxnoneterraria.kill_mode_cooldown": "Kill Mode Cooldown",
|
"effect.lzxnoneterraria.kill_mode_cooldown": "Kill Mode Cooldown",
|
||||||
"effect.lzxnoneterraria.demonic_flames": "Demonic Flames",
|
"effect.lzxnoneterraria.demonic_flames": "Demonic Flames",
|
||||||
"key.lzxnoneterraria.kill_mode": "Kill Mode",
|
|
||||||
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
||||||
|
"key.lzxnoneterraria.kill_mode": "Kill Mode",
|
||||||
|
|
||||||
"lzxnoneterraria.configuration.title": "LzxnoneTerraria Config",
|
"lzxnoneterraria.configuration.title": "LzxnoneTerraria Config",
|
||||||
"lzxnoneterraria.configuration.nav_weapon": "Weapon",
|
"lzxnoneterraria.configuration.nav_weapon": "Weapon",
|
||||||
"lzxnoneterraria.configuration.nav_effect": "Effect",
|
"lzxnoneterraria.configuration.nav_effect": "Effect",
|
||||||
@@ -300,6 +311,15 @@
|
|||||||
"lzxnoneterraria.configuration.mace_fly_time.tooltip": "Maximum projectile fly time in ticks",
|
"lzxnoneterraria.configuration.mace_fly_time.tooltip": "Maximum projectile fly time in ticks",
|
||||||
"lzxnoneterraria.configuration.mace_max_range": "Max Range",
|
"lzxnoneterraria.configuration.mace_max_range": "Max Range",
|
||||||
"lzxnoneterraria.configuration.mace_max_range.tooltip": "Maximum projectile travel range",
|
"lzxnoneterraria.configuration.mace_max_range.tooltip": "Maximum projectile travel range",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_settings": "Last Prism Settings",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_damage": "Damage",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_damage.tooltip": "Damage per hit",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_charge_time": "Charge Time",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_charge_time.tooltip": "Time required for beams to converge to full power in ticks",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_use_time": "Max Use Time",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_use_time.tooltip": "Maximum duration of one continuous use in ticks",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_range": "Max Range",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_range.tooltip": "Maximum beam range",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_settings": "Devil's Devastation Settings",
|
"lzxnoneterraria.configuration.devils_devastation_settings": "Devil's Devastation Settings",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "Kill Mode Duration",
|
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "Kill Mode Duration",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "Kill Mode duration in ticks",
|
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "Kill Mode duration in ticks",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"itemGroup.lzxnoneterraria.melee": "泰拉瑞亚 近战武器",
|
"itemGroup.lzxnoneterraria.melee": "泰拉瑞亚 近战武器",
|
||||||
|
"itemGroup.lzxnoneterraria.magic": "泰拉瑞亚 魔法武器",
|
||||||
"itemGroup.lzxnoneterraria.block": "泰拉瑞亚 方块",
|
"itemGroup.lzxnoneterraria.block": "泰拉瑞亚 方块",
|
||||||
"itemGroup.lzxnoneterraria.calamity_melee": "泰拉瑞亚灾厄 近战武器",
|
"itemGroup.lzxnoneterraria.calamity_melee": "泰拉瑞亚灾厄 近战武器",
|
||||||
|
|
||||||
"item.lzxnoneterraria.copper_shortsword": "铜短剑",
|
"item.lzxnoneterraria.copper_shortsword": "铜短剑",
|
||||||
"item.lzxnoneterraria.enchanted_sword": "附魔剑",
|
"item.lzxnoneterraria.enchanted_sword": "附魔剑",
|
||||||
"item.lzxnoneterraria.bee_keeper": "养蜂人",
|
"item.lzxnoneterraria.bee_keeper": "养蜂人",
|
||||||
@@ -27,9 +29,15 @@
|
|||||||
"item.lzxnoneterraria.first_fractal": "第一分形",
|
"item.lzxnoneterraria.first_fractal": "第一分形",
|
||||||
"item.lzxnoneterraria.mace": "链锤",
|
"item.lzxnoneterraria.mace": "链锤",
|
||||||
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
||||||
|
"item.lzxnoneterraria.last_prism": "终极棱镜",
|
||||||
|
|
||||||
|
"tooltip.lzxnoneterraria.relative_distance": "相对距离",
|
||||||
|
"tooltip.lzxnoneterraria.absolute_distance": "绝对距离",
|
||||||
|
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "杀戮模式",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.0": "完美的地狱之剑,直接掌握着硫磺火之力。",
|
"tooltip.lzxnoneterraria.devils_devastation.0": "完美的地狱之剑,直接掌握着硫磺火之力。",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.1": "人类将这种力量理解为浩劫,即一切秩序在火焰之中的必然毁灭。",
|
"tooltip.lzxnoneterraria.devils_devastation.1": "人类将这种力量理解为浩劫,即一切秩序在火焰之中的必然毁灭。",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.2": "或许这就是硫磺火元素掌握着她的姐妹所不能匹敌之力量的原因。",
|
"tooltip.lzxnoneterraria.devils_devastation.2": "或许这就是硫磺火元素掌握着她的姐妹所不能匹敌之力量的原因。",
|
||||||
|
|
||||||
"entity.lzxnoneterraria.static_projectile": "弹射物",
|
"entity.lzxnoneterraria.static_projectile": "弹射物",
|
||||||
"entity.lzxnoneterraria.static_summon": "召唤物",
|
"entity.lzxnoneterraria.static_summon": "召唤物",
|
||||||
"entity.lzxnoneterraria.bee_summon": "蜜蜂",
|
"entity.lzxnoneterraria.bee_summon": "蜜蜂",
|
||||||
@@ -38,8 +46,10 @@
|
|||||||
"effect.lzxnoneterraria.kill_mode": "杀戮模式",
|
"effect.lzxnoneterraria.kill_mode": "杀戮模式",
|
||||||
"effect.lzxnoneterraria.kill_mode_cooldown": "杀戮模式 冷却",
|
"effect.lzxnoneterraria.kill_mode_cooldown": "杀戮模式 冷却",
|
||||||
"effect.lzxnoneterraria.demonic_flames": "恶魔之焰",
|
"effect.lzxnoneterraria.demonic_flames": "恶魔之焰",
|
||||||
"key.lzxnoneterraria.kill_mode": "进入杀戮模式",
|
|
||||||
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
"key.categories.lzxnoneterraria": "lzxnoneterraria",
|
||||||
|
"key.lzxnoneterraria.kill_mode": "进入杀戮模式",
|
||||||
|
|
||||||
"lzxnoneterraria.configuration.title": "LzxnoneTerraria 配置",
|
"lzxnoneterraria.configuration.title": "LzxnoneTerraria 配置",
|
||||||
"lzxnoneterraria.configuration.nav_weapon": "武器",
|
"lzxnoneterraria.configuration.nav_weapon": "武器",
|
||||||
"lzxnoneterraria.configuration.nav_effect": "药水效果",
|
"lzxnoneterraria.configuration.nav_effect": "药水效果",
|
||||||
@@ -300,6 +310,15 @@
|
|||||||
"lzxnoneterraria.configuration.mace_fly_time.tooltip": "弹射物最大飞行时间(刻)",
|
"lzxnoneterraria.configuration.mace_fly_time.tooltip": "弹射物最大飞行时间(刻)",
|
||||||
"lzxnoneterraria.configuration.mace_max_range": "最大范围",
|
"lzxnoneterraria.configuration.mace_max_range": "最大范围",
|
||||||
"lzxnoneterraria.configuration.mace_max_range.tooltip": "弹射物最大飞行距离",
|
"lzxnoneterraria.configuration.mace_max_range.tooltip": "弹射物最大飞行距离",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_settings": "终极棱镜 设置",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_damage": "伤害",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_damage.tooltip": "每次命中伤害",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_charge_time": "蓄力时间",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_charge_time.tooltip": "激光聚合到最大威力所需时间(刻)",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_use_time": "最大使用时间",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_use_time.tooltip": "单次持续使用的最大时间(刻)",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_range": "最大范围",
|
||||||
|
"lzxnoneterraria.configuration.last_prism_max_range.tooltip": "激光最大射程",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_settings": "破灭魔王剑 设置",
|
"lzxnoneterraria.configuration.devils_devastation_settings": "破灭魔王剑 设置",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "杀戮模式持续时间",
|
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "杀戮模式持续时间",
|
||||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "杀戮模式持续时间(刻)",
|
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "杀戮模式持续时间(刻)",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/last_prism"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
"beam": {
|
"beam": {
|
||||||
"sounds": ["lzxnoneterraria:beam"]
|
"sounds": ["lzxnoneterraria:beam"]
|
||||||
},
|
},
|
||||||
|
"beam2": {
|
||||||
|
"sounds": ["lzxnoneterraria:beam2"]
|
||||||
|
},
|
||||||
"star_fall": {
|
"star_fall": {
|
||||||
"sounds": ["lzxnoneterraria:star_fall"]
|
"sounds": ["lzxnoneterraria:star_fall"]
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 222 B |
Reference in new issue
Block a user