v1.1-pre3
This commit is contained in:
1 parent
72a15c93ae
commit
70484812e5
6 files changed
+67
-1
No files matched your search
@@ -27,6 +27,10 @@ public class ModSounds {
|
||||
SOUND_EVENTS.register("wave2",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "wave2")));
|
||||
public static final Supplier<SoundEvent> WAVE3 =
|
||||
SOUND_EVENTS.register("wave3",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "wave3")));
|
||||
public static final Supplier<SoundEvent> STAR_FALL =
|
||||
SOUND_EVENTS.register("star_fall",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
|
||||
@@ -539,6 +539,7 @@ public class TerraBlade extends SwordItem {
|
||||
if(item instanceof TerraBlade && !player.getCooldowns().isOnCooldown(item)) {
|
||||
PacketDistributor.sendToServer(new SwordBeamPayload("terra_blade", BEAM_DATA));
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE.get());
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE3.get());
|
||||
}
|
||||
}
|
||||
public void onAttackEntity(AttackEntityEvent event) {
|
||||
@@ -551,6 +552,7 @@ public class TerraBlade extends SwordItem {
|
||||
SwordBeamBehaviors.getBehavior("terra_blade").generate(player, BEAM_DATA);
|
||||
}else {
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE.get());
|
||||
SoundUtil.playClientSound(player, ModSounds.WAVE3.get());
|
||||
}
|
||||
}
|
||||
event.setCanceled(true);
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.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 net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class Zenith extends SwordItem {
|
||||
public Zenith() {
|
||||
@@ -22,4 +38,45 @@ public class Zenith extends SwordItem {
|
||||
.build()
|
||||
));
|
||||
}
|
||||
|
||||
@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);
|
||||
}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());
|
||||
}
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 15);
|
||||
return InteractionResultHolder.sidedSuccess(stack, level.isClientSide());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user