v1.2-pre1
No files matched your search
@@ -20,6 +20,8 @@ import net.objecthunter.exp4j.Expression;
|
||||
import net.objecthunter.exp4j.ExpressionBuilder;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
|
||||
public class StaticProjectile extends Projectile {
|
||||
public static final EntityDataAccessor<String> BEHAVIOR =
|
||||
@@ -92,8 +94,11 @@ public class StaticProjectile extends Projectile {
|
||||
|
||||
public boolean positionOverridden = false;
|
||||
|
||||
public LinkedList<Vec3> trailPositions = new LinkedList<>();
|
||||
|
||||
public StaticProjectile(EntityType<StaticProjectile> type, Level level) {
|
||||
super(type, level);
|
||||
this.noPhysics = true;
|
||||
this.setNoGravity(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,9 @@ public class StaticProjectileBehaviors {
|
||||
public static final String DEFAULT = "default";
|
||||
public static final String ENCHANTED_SWORD_BEAM = "enchanted_sword_beam";
|
||||
public static final String STARFURY_STAR = "starfury_star";
|
||||
public static final String SEEDLER_NUT = "seedler_nut";
|
||||
public static final String SEEDLER_THORN = "seedler_thorn";
|
||||
public static final String INFLUX_WAVER_BEAM = "influx_waver";
|
||||
public static final String STAR_WRATH_STAR = "star_wrath_star";
|
||||
public static final String ZENITH_PROJECTILE = "zenith_projectile";
|
||||
|
||||
static {
|
||||
BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() {
|
||||
@@ -37,6 +36,7 @@ public class StaticProjectileBehaviors {
|
||||
BEHAVIORS.put(STARFURY_STAR, Starfury.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(SEEDLER_THORN, Seedler.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(STAR_WRATH_STAR, StarWrath.PROJECTILE_BEHAVIOR);
|
||||
BEHAVIORS.put(ZENITH_PROJECTILE, Zenith.PROJECTILE_BEHAVIOR);
|
||||
}
|
||||
|
||||
public static IStaticProjectileBehavior getBehavior(String id) {
|
||||
|
||||
@@ -21,6 +21,16 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> MEOWMERE = ITEMS.register("meowmere", Meowmere::new);
|
||||
public static final DeferredItem<Item> TERRA_BLADE = ITEMS.register("terra_blade", TerraBlade::new);
|
||||
public static final DeferredItem<Item> ZENITH = ITEMS.register("zenith", Zenith::new);
|
||||
public static final DeferredItem<Item> LIGHTS_BANE = ITEMS.register("lights_bane", LightsBane::new);
|
||||
public static final DeferredItem<Item> BLOOD_BUTCHERER = ITEMS.register("blood_butcherer", BloodButcherer::new);
|
||||
public static final DeferredItem<Item> MURAMASA = ITEMS.register("muramasa", Muramasa::new);
|
||||
public static final DeferredItem<Item> TERRAGRIM = ITEMS.register("terragrim", Terragrim::new);
|
||||
public static final DeferredItem<Item> BLADE_OF_GRASS = ITEMS.register("blade_of_grass", BladeOfGrass::new);
|
||||
public static final DeferredItem<Item> VOLCANO = ITEMS.register("volcano", Volcano::new);
|
||||
public static final DeferredItem<Item> NIGHTS_EDGE = ITEMS.register("nights_edge", NightsEdge::new);
|
||||
public static final DeferredItem<Item> TRUE_NIGHTS_EDGE = ITEMS.register("true_nights_edge", TrueNightsEdge::new);
|
||||
public static final DeferredItem<Item> EXCALIBUR = ITEMS.register("excalibur", Excalibur::new);
|
||||
public static final DeferredItem<Item> TRUE_EXCALIBUR = ITEMS.register("true_excalibur", TrueExcalibur::new);
|
||||
|
||||
//弹射物
|
||||
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", EnchantedSwordBeam::new);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class BladeOfGrass extends SwordItem {
|
||||
public BladeOfGrass() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.6, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class BloodButcherer extends SwordItem {
|
||||
public BloodButcherer() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class Excalibur extends SwordItem {
|
||||
public Excalibur() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 10, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class LightsBane extends SwordItem {
|
||||
public LightsBane() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class Muramasa extends SwordItem {
|
||||
public Muramasa() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 3, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class NightsEdge extends SwordItem {
|
||||
public NightsEdge() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 9, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.6, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class Terragrim extends SwordItem {
|
||||
public Terragrim() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class TrueExcalibur extends SwordItem {
|
||||
public TrueExcalibur() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 13, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.2, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class TrueNightsEdge extends SwordItem {
|
||||
public TrueNightsEdge() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 12, 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()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.Item;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
|
||||
public class Volcano extends SwordItem {
|
||||
public Volcano() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 8, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -3.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -3,29 +3,50 @@ package com.lzxnone.terraria.item.weapon.melee;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.TintedVertexConsumer;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeam;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectileBehaviors;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
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.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Matrix3f;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Zenith extends SwordItem {
|
||||
public Zenith() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
@@ -39,44 +60,392 @@ public class Zenith extends SwordItem {
|
||||
));
|
||||
}
|
||||
|
||||
private static ItemStack[] weapons;
|
||||
|
||||
private static ItemStack[] getWeapons() {
|
||||
if(weapons == null) {
|
||||
weapons = new ItemStack[]{
|
||||
new ItemStack(ModItems.COPPER_SHORTSWORD.get()),
|
||||
new ItemStack(ModItems.LIGHTS_BANE.get()),
|
||||
new ItemStack(ModItems.MURAMASA.get()),
|
||||
new ItemStack(ModItems.TERRAGRIM.get()),
|
||||
new ItemStack(ModItems.BLOOD_BUTCHERER.get()),
|
||||
new ItemStack(ModItems.STARFURY.get()),
|
||||
new ItemStack(ModItems.ENCHANTED_SWORD.get()),
|
||||
new ItemStack(ModItems.BEE_KEEPER.get()),
|
||||
new ItemStack(ModItems.BLADE_OF_GRASS.get()),
|
||||
new ItemStack(ModItems.VOLCANO.get()),
|
||||
new ItemStack(ModItems.NIGHTS_EDGE.get()),
|
||||
new ItemStack(ModItems.TRUE_NIGHTS_EDGE.get()),
|
||||
new ItemStack(ModItems.EXCALIBUR.get()),
|
||||
new ItemStack(ModItems.TRUE_EXCALIBUR.get()),
|
||||
new ItemStack(ModItems.THE_HORSEMANS_BLADE.get()),
|
||||
new ItemStack(ModItems.SEEDLER.get()),
|
||||
new ItemStack(ModItems.TERRA_BLADE.get()),
|
||||
new ItemStack(ModItems.INFLUX_WAVER.get()),
|
||||
new ItemStack(ModItems.STAR_WRATH.get()),
|
||||
new ItemStack(ModItems.MURAMASA.get()),
|
||||
new ItemStack(ModItems.ZENITH.get())
|
||||
};
|
||||
}
|
||||
return weapons;
|
||||
}
|
||||
|
||||
public static final Vector3f[] COLORS = {
|
||||
new Vector3f(0.922f, 0.651f, 0.529f), // 1. 淺橙色 (#EBA687)
|
||||
new Vector3f(0.478f, 0.259f, 0.749f), // 2. 紫色 (#7A42BF)
|
||||
new Vector3f(0.220f, 0.306f, 0.824f), // 3. 海軍藍 (#384ED2)
|
||||
new Vector3f(0.698f, 1.000f, 0.706f), // 4. 亮薄荷綠 (#B2FFB4)
|
||||
new Vector3f(0.929f, 0.110f, 0.141f), // 5. 紅色 (#ED1C24)
|
||||
new Vector3f(0.925f, 0.243f, 0.753f), // 6. 粉色 (#EC3EC0)
|
||||
new Vector3f(0.357f, 0.620f, 0.910f), // 7. 淺藍色 (#5B9EE8)
|
||||
new Vector3f(1.000f, 0.906f, 0.271f), // 8. 黃色 (#FFE745)
|
||||
new Vector3f(0.420f, 0.796f, 0.000f), // 9. 綠色 (#6BCB00)
|
||||
new Vector3f(0.996f, 0.620f, 0.137f), // 10. 橙色 (#FE9E23)
|
||||
new Vector3f(0.702f, 0.212f, 0.788f), // 11. 紫色 (#B336C9)
|
||||
new Vector3f(0.702f, 0.212f, 0.788f), // 12. 紫色 (#B336C9)
|
||||
new Vector3f(0.925f, 0.784f, 0.075f), // 13. 黃色 (#ECC813)
|
||||
new Vector3f(0.925f, 0.784f, 0.075f), // 14. 黃色 (#ECC813)
|
||||
new Vector3f(0.988f, 0.373f, 0.016f), // 15. 橙色 (#FC5F04)
|
||||
new Vector3f(0.561f, 0.843f, 0.114f), // 16. 綠色 (#8FD71D)
|
||||
new Vector3f(0.314f, 0.871f, 0.478f), // 17. 淺綠色 (#50DE7A)
|
||||
new Vector3f(0.329f, 0.918f, 0.961f), // 18. 青色 (#54EAF5)
|
||||
new Vector3f(0.929f, 0.247f, 0.522f), // 19. 粉色 (#ED3F85)
|
||||
new Vector3f(0.996f, 0.761f, 0.980f), // 20. 淺粉色 (#FEC2FA)
|
||||
new Vector3f(0.698f, 1.000f, 0.706f) // 20. 亮薄荷綠 (#B2FFB4)
|
||||
};
|
||||
|
||||
public static final ResourceLocation RES0 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/sword_trail.png");
|
||||
public static final ResourceLocation RES1 = ResourceLocation.parse("lzxnoneterraria:textures/vfx/beam_sparkle.png");
|
||||
public static final double RANGE = 64;
|
||||
public static final int CYCLE = 30;
|
||||
public static final double BOUNDING_BOX = 1.5;
|
||||
public static final int MAX_LENGTH = 10;
|
||||
|
||||
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 proj)) return;
|
||||
ItemStack stack = proj.getEntityData().get(StaticProjectile.ITEM);
|
||||
if(stack.isEmpty()) return;
|
||||
|
||||
CompoundTag customData = proj.getEntityData().get(StaticProjectile.CUSTOM_DATA);
|
||||
if(!customData.contains("a") || !customData.contains("w") || !customData.contains("angle")) return;
|
||||
|
||||
Vec3 dir = MathUtil.toVec3(proj.getEntityData().get(StaticProjectile.DIRECTION)).normalize();
|
||||
Vec3 up = MathUtil.toVec3(proj.getEntityData().get(StaticProjectile.UP)).normalize();
|
||||
Vec3 right = MathUtil.toVec3(proj.getEntityData().get(StaticProjectile.RIGHT)).normalize();
|
||||
|
||||
Quaternionf rotationDir = new Quaternionf()
|
||||
.fromAxisAngleRad(dir.toVector3f(), (float) Math.toRadians(customData.getInt("angle")));
|
||||
Quaternionf rotationUp1 = new Quaternionf()
|
||||
.fromAxisAngleRad(up.toVector3f(), (float) -(customData.getDouble("w") * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||
Quaternionf rotationUp2 = new Quaternionf()
|
||||
.fromAxisAngleRad(up.toVector3f(), (float) Math.PI);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(dir.toVector3f(), up.toVector3f());
|
||||
|
||||
poseStack.pushPose();
|
||||
|
||||
//旋转
|
||||
poseStack.mulPose(rotationUp1);
|
||||
poseStack.mulPose(rotationUp2);
|
||||
poseStack.mulPose(rotationDir);
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1]));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0]));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RXP) + proj.getEntityData().get(StaticProjectile.RXPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RYP) + proj.getEntityData().get(StaticProjectile.RYPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(proj.getEntityData().get(StaticProjectile.RZP) + proj.getEntityData().get(StaticProjectile.RZPS) * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||
|
||||
//缩放
|
||||
poseStack.scale(
|
||||
proj.getEntityData().get(StaticProjectile.SCALE_X),
|
||||
proj.getEntityData().get(StaticProjectile.SCALE_Y),
|
||||
proj.getEntityData().get(StaticProjectile.SCALE_Z)
|
||||
);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||
stack,
|
||||
ItemDisplayContext.NONE,
|
||||
proj.getEntityData().get(StaticProjectile.GLOW) ? LightTexture.FULL_BRIGHT : packedLight,
|
||||
OverlayTexture.NO_OVERLAY,
|
||||
poseStack,
|
||||
renderType -> {
|
||||
VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType);
|
||||
return new TintedVertexConsumer(vertexConsumer,
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_R),
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_G),
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_B),
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_A));
|
||||
},
|
||||
entity.level(),
|
||||
0
|
||||
);
|
||||
|
||||
poseStack.popPose();
|
||||
|
||||
Vec3 currentPos = proj.getPosition(partialTick);
|
||||
|
||||
VertexConsumer vertexConsumer0 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES0));
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
|
||||
Vector3f color = new Vector3f(
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_R),
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_G),
|
||||
proj.getEntityData().get(StaticProjectile.COLOR_B)
|
||||
);
|
||||
|
||||
//尾迹
|
||||
int quadCount = proj.trailPositions.size() / 2 - 1;
|
||||
for(int j = 0;j < 2;j++) {
|
||||
for(int i = 0; i < quadCount; i++) {
|
||||
Vec3 currentPoint1 = proj.trailPositions.get(i * 2);
|
||||
Vec3 currentPoint2 = proj.trailPositions.get(i * 2 + 1);
|
||||
Vec3 nextPoint1 = proj.trailPositions.get(i * 2 + 3);
|
||||
Vec3 nextPoint2 = proj.trailPositions.get(i * 2 + 2);
|
||||
|
||||
double x1 = currentPoint1.x - currentPos.x;
|
||||
double y1 = currentPoint1.y - currentPos.y;
|
||||
double z1 = currentPoint1.z - currentPos.z;
|
||||
|
||||
double x2 = currentPoint2.x - currentPos.x;
|
||||
double y2 = currentPoint2.y - currentPos.y;
|
||||
double z2 = currentPoint2.z - currentPos.z;
|
||||
|
||||
double x3 = nextPoint1.x - currentPos.x;
|
||||
double y3 = nextPoint1.y - currentPos.y;
|
||||
double z3 = nextPoint1.z - currentPos.z;
|
||||
|
||||
double x4 = nextPoint2.x - currentPos.x;
|
||||
double y4 = nextPoint2.y - currentPos.y;
|
||||
double z4 = nextPoint2.z - currentPos.z;
|
||||
|
||||
float radio1 = (float) i / quadCount;
|
||||
float radio2 = (float) (i + 1) / quadCount;
|
||||
|
||||
vertexConsumer0.addVertex(matrix, (float) x1, (float) y1, (float) z1)
|
||||
.setColor(color.x, color.y, color.z, 1).setUv(radio1, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer0.addVertex(matrix, (float) x2, (float) y2, (float) z2)
|
||||
.setColor(color.x, color.y, color.z, 0).setUv(radio1, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer0.addVertex(matrix, (float) x3, (float) y3, (float) z3)
|
||||
.setColor(color.x, color.y, color.z, 0).setUv(radio2, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
vertexConsumer0.addVertex(matrix, (float) x4, (float) y4, (float) z4)
|
||||
.setColor(color.x, color.y, color.z, 1).setUv(radio2, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//闪烁
|
||||
float halfWidth = 32 * 0.05f;
|
||||
float halfHeight = 32 * 0.05f;
|
||||
|
||||
float radio = (float) proj.getEntityData().get(StaticProjectile.AGE) / (float) proj.getEntityData().get(StaticProjectile.LIFETIME);
|
||||
float alpha;
|
||||
if(radio > 0.25f && radio < 0.4f) {
|
||||
alpha = (radio - 0.25f) / 0.15f;
|
||||
}else if(radio > 0.4f && radio < 0.6f) {
|
||||
alpha = 1.0f;
|
||||
}else if(radio > 0.6f && radio < 0.75f) {
|
||||
alpha = 1.0f - (radio - 0.6f) / 0.15f;
|
||||
}else {
|
||||
alpha = 0;
|
||||
}
|
||||
if(Math.abs(alpha) < 0.001) return;
|
||||
|
||||
VertexConsumer vertexConsumer1 = bufferSource.getBuffer(RenderType.entityTranslucentEmissive(RES1));
|
||||
poseStack.pushPose();
|
||||
|
||||
Vector3f tempRight = right.toVector3f();
|
||||
double rad = customData.getDouble("w") * (proj.getEntityData().get(StaticProjectile.AGE) + partialTick);
|
||||
Vector3f swordTipDir = tempRight.rotate(new Quaternionf().fromAxisAngleRad(up.toVector3f(), (float) (Math.PI / 2 - rad))).normalize();
|
||||
Vec3 trans = MathUtil.toVec3(swordTipDir).scale(1.25);
|
||||
|
||||
poseStack.translate(trans.x, trans.y, trans.z);
|
||||
poseStack.mulPose(new Quaternionf()
|
||||
.fromAxisAngleRad(dir.toVector3f(), (float) Math.toRadians(customData.getInt("angle")))
|
||||
.rotateY((float) Math.toRadians(-xyRot[1]))
|
||||
.rotateX((float) Math.toRadians(-90 + xyRot[0]))
|
||||
);
|
||||
|
||||
poseStack.scale(1.0f, 1.0f, 1.0f);
|
||||
matrix = poseStack.last().pose();
|
||||
for(int i = 0; i < 3; i++) {
|
||||
vertexConsumer1.addVertex(matrix, -halfWidth, -halfHeight, 0.01f)
|
||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer1.addVertex(matrix, halfWidth, -halfHeight, 0.01f)
|
||||
.setColor(color.x, color.y, color.z, alpha).setUv(1.0f, 1.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer1.addVertex(matrix, halfWidth, halfHeight, 0.01f)
|
||||
.setColor(color.x, color.y, color.z, alpha).setUv(1.0f, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
vertexConsumer1.addVertex(matrix, -halfWidth, halfHeight, 0.01f)
|
||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 0.0f)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoving(StaticProjectile projectile) {
|
||||
if(projectile.getOwner() == null) return;
|
||||
addTrailPoints(projectile);
|
||||
|
||||
LzxnoneTerraria.LOGGER.info("{}", projectile.tickCount);
|
||||
|
||||
projectile.setBoundingBox(new AABB(
|
||||
projectile.getX() - BOUNDING_BOX, projectile.getY() - BOUNDING_BOX, projectile.getZ() - BOUNDING_BOX,
|
||||
projectile.getX() + BOUNDING_BOX, projectile.getY() + BOUNDING_BOX, projectile.getZ() + BOUNDING_BOX
|
||||
));
|
||||
if(!projectile.level().isClientSide()) {
|
||||
List<LivingEntity> targets = projectile.level().getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
projectile.getBoundingBox(),
|
||||
FilterUtil.createLivingTargetFilter(projectile, projectile.getOwner())
|
||||
);
|
||||
|
||||
for(LivingEntity target : targets) this.onHitEntity(projectile, new EntityHitResult(target, target.position()));
|
||||
}
|
||||
|
||||
Vector3f dir = projectile.getEntityData().get(StaticProjectile.DIRECTION).normalize();
|
||||
Vec3 currentPos = (projectile.getOwner().getBoundingBox().getCenter()).add(MathUtil.toVec3(dir).scale(-2));
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, currentPos.toVector3f());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||
if(!projectile.level().isClientSide()) {
|
||||
Entity target = result.getEntity();
|
||||
if(projectile.getOwner() instanceof Player player && target instanceof LivingEntity livingEntity && FilterUtil.createLivingTargetFilter(projectile, projectile.getOwner()).test(livingEntity)) {
|
||||
if(target.hurt(projectile.damageSources().playerAttack(player), 20.f)) {
|
||||
target.invulnerableTime = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static void addTrailPoints(StaticProjectile projectile) {
|
||||
CompoundTag customData = projectile.getEntityData().get(StaticProjectile.CUSTOM_DATA);
|
||||
if(!customData.contains("w")) return;
|
||||
|
||||
Vector3f originalRight = projectile.getEntityData().get(StaticProjectile.RIGHT).normalize();
|
||||
Vector3f tempRight = new Vector3f(originalRight);
|
||||
Vector3f up = projectile.getEntityData().get(StaticProjectile.UP).normalize();
|
||||
double rad = customData.getDouble("w") * projectile.getEntityData().get(StaticProjectile.AGE);
|
||||
Quaternionf rotation = new Quaternionf()
|
||||
.fromAxisAngleRad(up, (float) (Math.PI / 2 - rad - 0.3));
|
||||
|
||||
Vec3 right = MathUtil.toVec3(tempRight.rotate(rotation));
|
||||
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(-1.2)));
|
||||
projectile.trailPositions.addFirst(projectile.position().add(right.scale(1.5)));
|
||||
while(projectile.trailPositions.size() > MAX_LENGTH) projectile.trailPositions.removeLast();
|
||||
}
|
||||
|
||||
public static void summon(Player player, boolean isFirst) {
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
int randomAngle = (int) ((Math.random() * 2 - 1) * 80);
|
||||
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], randomAngle);
|
||||
|
||||
Vec3 pos = (player.getBoundingBox().getCenter()).add(MathUtil.toVec3(dirs[0]).scale(-2));
|
||||
Vec3 targetPos = MathUtil.getCrosshairPos(player, player.level(), RANGE);
|
||||
double dist = targetPos.subtract(pos).length();
|
||||
int cycle = (int) Math.max(10, dist / RANGE * CYCLE);
|
||||
double a = Math.max(dist / 2 + 1, 2);
|
||||
double b = Math.min(Math.random() * 2 + 2, a / 2);
|
||||
double w = Math.PI * 2 / (double) cycle;
|
||||
if(player.getRandom().nextInt(2) == 0) w = -w;
|
||||
|
||||
int randomIndex = isFirst ? getWeapons().length - 1 : player.getRandom().nextInt(getWeapons().length);
|
||||
|
||||
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), player.level());
|
||||
projectile.setOwner(player);
|
||||
|
||||
projectile.setPos(pos);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.ZENITH_PROJECTILE);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, getWeapons()[randomIndex]);
|
||||
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.COLOR_R, COLORS[randomIndex].x);
|
||||
projectile.getEntityData().set(StaticProjectile.COLOR_G, COLORS[randomIndex].y);
|
||||
projectile.getEntityData().set(StaticProjectile.COLOR_B, COLORS[randomIndex].z);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_X, 2.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Y, 2.0f);
|
||||
projectile.getEntityData().set(StaticProjectile.RXP, -90);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, -135);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_X, String.format("%.3f*cos(%.3ft-1.571)", b, w));
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format("%.3f*sin(%.3ft-1.571)+%.3f", a, w, a));
|
||||
projectile.getEntityData().set(StaticProjectile.LIFETIME, cycle);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
customData.putDouble("a", a);
|
||||
customData.putDouble("b", b);
|
||||
customData.putDouble("w", w);
|
||||
customData.putInt("angle", randomAngle);
|
||||
projectile.getEntityData().set(StaticProjectile.CUSTOM_DATA, customData);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||
projectile.setXRot(xyRot[0]);
|
||||
projectile.setYRot(xyRot[1]);
|
||||
player.level().addFreshEntity(projectile);
|
||||
}
|
||||
|
||||
@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 = new Vec3(player.getX(), player.getEyeY() - 0.1, player.getZ());
|
||||
projectile.setPos(pos);
|
||||
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM);
|
||||
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "item");
|
||||
projectile.getEntityData().set(StaticProjectile.ORIGIN, MathUtil.toVector3f(pos));
|
||||
projectile.getEntityData().set(StaticProjectile.DIRECTION, dirs[0]);
|
||||
projectile.getEntityData().set(StaticProjectile.UP, dirs[1]);
|
||||
projectile.getEntityData().set(StaticProjectile.RIGHT, dirs[2]);
|
||||
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.ENCHANTED_SWORD_BEAM.get()));
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_X, 0.5f);
|
||||
projectile.getEntityData().set(StaticProjectile.SCALE_Y, 0.5f);
|
||||
projectile.getEntityData().set(StaticProjectile.RXP, 90);
|
||||
projectile.getEntityData().set(StaticProjectile.RZP, 45);
|
||||
projectile.getEntityData().set(StaticProjectile.RYPS, 10);
|
||||
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, "t");
|
||||
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
level.addFreshEntity(projectile);
|
||||
int count = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag().getInt("attackCount");
|
||||
if(count == 0) {
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putBoolean("isFirst", true));
|
||||
}
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putInt("attackCount", 3));
|
||||
}else {
|
||||
ParticleUtil.addParticles(
|
||||
player.level(), ModParticles.COLORFUL_PARTICLE,
|
||||
new Vec3(player.getX(), player.getY() + 0.5, player.getZ()), 0.2,
|
||||
new Vec3(0, 0, 0), 0.2,
|
||||
25
|
||||
);
|
||||
SoundUtil.playClientSound(player, ModSounds.BEAM.get());
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE.get());
|
||||
}
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 15);
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 3);
|
||||
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inventoryTick(ItemStack stack, Level level, net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) {
|
||||
super.inventoryTick(stack, level, entity, slotId, isSelected);
|
||||
if(entity instanceof Player player) {
|
||||
if(isSelected) {
|
||||
if(player.tickCount % 3 == 0) {
|
||||
boolean isFirst = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag().getBoolean("isFirst");
|
||||
int count = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag().getInt("attackCount");
|
||||
if(count > 0) {
|
||||
summon(player, isFirst);
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putInt("attackCount", count - 1));
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putBoolean("isFirst", false));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
int count = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag().getInt("attackCount");
|
||||
if(count > 0) {
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack,
|
||||
tag -> tag.putInt("attackCount", 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,16 @@
|
||||
"item.lzxnoneterraria.terra_blade": "Terra Blade",
|
||||
"item.lzxnoneterraria.the_horsemans_blade": "The Horseman's Blade",
|
||||
"item.lzxnoneterraria.zenith": "Zenith",
|
||||
"item.lzxnoneterraria.lights_bane": "Lights Bane",
|
||||
"item.lzxnoneterraria.blood_butcherer": "Blood Butcherer",
|
||||
"item.lzxnoneterraria.muramasa": "Muramasa",
|
||||
"item.lzxnoneterraria.terragrim": "Terragrim",
|
||||
"item.lzxnoneterraria.blade_of_grass": "Blade of Grass",
|
||||
"item.lzxnoneterraria.volcano": "Volcano",
|
||||
"item.lzxnoneterraria.nights_edge": "Night's Edge",
|
||||
"item.lzxnoneterraria.true_nights_edge": "True Night's Edge",
|
||||
"item.lzxnoneterraria.excalibur": "Excalibur",
|
||||
"item.lzxnoneterraria.true_excalibur": "True Excalibur",
|
||||
|
||||
"entity.lzxnoneterraria.static_projectile": "Projectile",
|
||||
"entity.lzxnoneterraria.static_summon": "Summon",
|
||||
|
||||
@@ -13,6 +13,16 @@
|
||||
"item.lzxnoneterraria.terra_blade": "泰拉刃",
|
||||
"item.lzxnoneterraria.the_horsemans_blade": "无头骑士剑",
|
||||
"item.lzxnoneterraria.zenith": "天顶剑",
|
||||
"item.lzxnoneterraria.lights_bane": "魔光剑",
|
||||
"item.lzxnoneterraria.blood_butcherer": "血腥屠刀",
|
||||
"item.lzxnoneterraria.muramasa": "村正",
|
||||
"item.lzxnoneterraria.terragrim": "泰拉魔刃",
|
||||
"item.lzxnoneterraria.blade_of_grass": "草剑",
|
||||
"item.lzxnoneterraria.volcano": "火山",
|
||||
"item.lzxnoneterraria.nights_edge": "永夜刃",
|
||||
"item.lzxnoneterraria.true_nights_edge": "真永夜刃",
|
||||
"item.lzxnoneterraria.excalibur": "断钢剑",
|
||||
"item.lzxnoneterraria.true_excalibur": "真断钢剑",
|
||||
|
||||
"entity.lzxnoneterraria.static_projectile": "弹射物",
|
||||
"entity.lzxnoneterraria.static_summon": "召唤物",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/blade_of_grass"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/blood_butcherer"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/excalibur"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/lights_bane"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/muramasa"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/nights_edge"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/terragrim"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/true_excalibur"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/true_nights_edge"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/volcano"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 530 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 382 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 500 B |
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 403 B |
|
After Width: | Height: | Size: 482 B |
|
After Width: | Height: | Size: 1.5 KiB |