v1.8.0
This commit is contained in:
1 parent
daacff6dab
commit
27cc00d87b
31 files changed
+486
-5
No files matched your search
@@ -79,6 +79,30 @@ public class ModSounds {
|
|||||||
SOUND_EVENTS.register("star_collide",
|
SOUND_EVENTS.register("star_collide",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_collide")));
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_collide")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE0 =
|
||||||
|
SOUND_EVENTS.register("star_tune0",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune0")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE1 =
|
||||||
|
SOUND_EVENTS.register("star_tune1",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune1")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE2 =
|
||||||
|
SOUND_EVENTS.register("star_tune2",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune2")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE3 =
|
||||||
|
SOUND_EVENTS.register("star_tune3",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune3")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE4 =
|
||||||
|
SOUND_EVENTS.register("star_tune4",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune4")));
|
||||||
|
public static final Supplier<SoundEvent> STAR_TUNE5 =
|
||||||
|
SOUND_EVENTS.register("star_tune5",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_tune5")));
|
||||||
public static final Supplier<SoundEvent> SNOW_BREAK =
|
public static final Supplier<SoundEvent> SNOW_BREAK =
|
||||||
SOUND_EVENTS.register("snow_break",
|
SOUND_EVENTS.register("snow_break",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
|||||||
+5
-2
@@ -1,11 +1,13 @@
|
|||||||
package com.lzxnone.terraria.client.entity.projectile;
|
package com.lzxnone.terraria.client.entity.projectile;
|
||||||
|
|
||||||
import com.lzxnone.terraria.client.item.accessory.ClientAccessoryFallenStar;
|
import com.lzxnone.terraria.client.item.accessory.ClientAccessoryFallenStar;
|
||||||
|
import com.lzxnone.terraria.client.item.magic.ClientStellarTune;
|
||||||
import com.lzxnone.terraria.client.item.magic.ClientNebulaArcanum;
|
import com.lzxnone.terraria.client.item.magic.ClientNebulaArcanum;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientBladeOfGrass;
|
import com.lzxnone.terraria.client.item.melee.ClientBladeOfGrass;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
|
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientMace;
|
import com.lzxnone.terraria.client.item.melee.ClientMace;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientMuramasa;
|
import com.lzxnone.terraria.client.item.melee.ClientMuramasa;
|
||||||
|
import com.lzxnone.terraria.client.item.melee.ClientStarfallProjectile;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientZenith;
|
import com.lzxnone.terraria.client.item.melee.ClientZenith;
|
||||||
import com.lzxnone.terraria.client.item.ranged.ClientFlamethrower;
|
import com.lzxnone.terraria.client.item.ranged.ClientFlamethrower;
|
||||||
import com.lzxnone.terraria.client.item.ranged.ClientSuperStarShooter;
|
import com.lzxnone.terraria.client.item.ranged.ClientSuperStarShooter;
|
||||||
@@ -22,9 +24,9 @@ public class ClientStaticProjectileRenderBehaviors {
|
|||||||
static {
|
static {
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.DEFAULT, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.DEFAULT, DEFAULT_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.ENCHANTED_SWORD_BEAM, DEFAULT_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.STARFURY_STAR, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.STARFURY_STAR, ClientStarfallProjectile.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.SEEDLER_THORN, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.SEEDLER_THORN, DEFAULT_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.STAR_WRATH_STAR, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.STAR_WRATH_STAR, ClientStarfallProjectile.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.ZENITH_PROJECTILE, ClientZenith.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.ZENITH_PROJECTILE, ClientZenith.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.MURAMASA_PROJECTILE, ClientMuramasa.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.MURAMASA_PROJECTILE, ClientMuramasa.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.LEAF_PROJECTILE, ClientBladeOfGrass.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.LEAF_PROJECTILE, ClientBladeOfGrass.PROJECTILE_BEHAVIOR);
|
||||||
@@ -37,6 +39,7 @@ public class ClientStaticProjectileRenderBehaviors {
|
|||||||
BEHAVIORS.put(StaticProjectileBehaviors.POSSESSION_PROJECTILE, ClientPossession.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.POSSESSION_PROJECTILE, ClientPossession.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.ACCESSORY_FALLEN_STAR_PROJECTILE, ClientAccessoryFallenStar.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.ACCESSORY_FALLEN_STAR_PROJECTILE, ClientAccessoryFallenStar.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticProjectileBehaviors.NEBULA_ARCANUM_ORBIT_PROJECTILE, ClientNebulaArcanum.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(StaticProjectileBehaviors.NEBULA_ARCANUM_ORBIT_PROJECTILE, ClientNebulaArcanum.PROJECTILE_BEHAVIOR);
|
||||||
|
BEHAVIORS.put(StaticProjectileBehaviors.STELLAR_TUNE_PROJECTILE, ClientStellarTune.PROJECTILE_BEHAVIOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStaticProjectileRenderBehavior getBehavior(String id) {
|
public static IStaticProjectileRenderBehavior getBehavior(String id) {
|
||||||
|
|||||||
+6
@@ -49,6 +49,12 @@ public class ClientAccessoryFallenStar {
|
|||||||
poseStack.mulPose(Axis.YP.rotationDegrees(270.0F));
|
poseStack.mulPose(Axis.YP.rotationDegrees(270.0F));
|
||||||
|
|
||||||
VertexConsumer consumer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(STAR_WAVE_RES));
|
VertexConsumer consumer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(STAR_WAVE_RES));
|
||||||
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT,
|
||||||
|
STAR_WAVE_COLOR_R, STAR_WAVE_COLOR_G, STAR_WAVE_COLOR_B, STAR_WAVE_ALPHA);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT,
|
||||||
|
STAR_WAVE_COLOR_R, STAR_WAVE_COLOR_G, STAR_WAVE_COLOR_B, STAR_WAVE_ALPHA);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT,
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT,
|
||||||
STAR_WAVE_COLOR_R, STAR_WAVE_COLOR_G, STAR_WAVE_COLOR_B, STAR_WAVE_ALPHA);
|
STAR_WAVE_COLOR_R, STAR_WAVE_COLOR_G, STAR_WAVE_COLOR_B, STAR_WAVE_ALPHA);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.lzxnone.terraria.client.item.magic;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.client.entity.projectile.IStaticProjectileRenderBehavior;
|
||||||
|
import com.lzxnone.terraria.entity.ModRenderTypes;
|
||||||
|
import com.lzxnone.terraria.entity.TintedVertexConsumer;
|
||||||
|
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||||
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
import com.mojang.math.Axis;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.inventory.InventoryMenu;
|
||||||
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
public class ClientStellarTune {
|
||||||
|
private static final ResourceLocation STAR_WAVE_RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/star_wave.png");
|
||||||
|
private static final float STAR_WAVE_HALF_WIDTH = 45 * 0.06F;
|
||||||
|
private static final float STAR_WAVE_HALF_HEIGHT = 17 * 0.06F;
|
||||||
|
|
||||||
|
public static final IStaticProjectileRenderBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileRenderBehavior() {
|
||||||
|
@Override
|
||||||
|
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||||
|
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||||
|
ItemStack itemStack = projectile.getEntityData().get(StaticProjectile.ITEM);
|
||||||
|
if(itemStack.isEmpty()) return;
|
||||||
|
|
||||||
|
Vec3 dir = projectile.getDeltaMovement();
|
||||||
|
if(dir.lengthSqr() < 1.0E-7D) dir = MathUtil.toVec3(projectile.getEntityData().get(StaticProjectile.DIRECTION));
|
||||||
|
if(dir.lengthSqr() < 1.0E-7D) dir = new Vec3(0.0D, 0.0D, 1.0D);
|
||||||
|
dir = dir.normalize();
|
||||||
|
float[] xyRot = MathUtil.computeXYRot(dir.toVector3f());
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1]));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0]));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(90.0F));
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||||
|
poseStack.scale(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
|
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||||
|
itemStack,
|
||||||
|
ItemDisplayContext.NONE,
|
||||||
|
LightTexture.FULL_BRIGHT,
|
||||||
|
OverlayTexture.NO_OVERLAY,
|
||||||
|
poseStack,
|
||||||
|
renderType -> new TintedVertexConsumer(
|
||||||
|
bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(InventoryMenu.BLOCK_ATLAS)),
|
||||||
|
1.0F,
|
||||||
|
0.95F,
|
||||||
|
0.2F,
|
||||||
|
1.0F
|
||||||
|
),
|
||||||
|
entity.level(),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
poseStack.popPose();
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.translate(-dir.x * 0.75D, -dir.y * 0.75D, -dir.z * 0.75D);
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-xyRot[1]));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(xyRot[0]));
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(270.0F));
|
||||||
|
poseStack.scale(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
|
VertexConsumer consumer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(STAR_WAVE_RES));
|
||||||
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT, 1.0F, 0.62F, 0.9F, 0.5F);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT, 1.0F, 0.62F, 0.9F, 0.5F);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
|
addQuad(consumer, poseStack.last().pose(), STAR_WAVE_HALF_WIDTH, STAR_WAVE_HALF_HEIGHT, 1.0F, 0.62F, 0.9F, 0.5F);
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static void addQuad(VertexConsumer consumer, Matrix4f matrix, float halfWidth, float halfHeight,
|
||||||
|
float r, float g, float b, float alpha) {
|
||||||
|
consumer.addVertex(matrix, -halfWidth, -halfHeight, 0.0F)
|
||||||
|
.setColor(r, g, b, alpha).setUv(0.0F, 1.0F)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
consumer.addVertex(matrix, halfWidth, -halfHeight, 0.0F)
|
||||||
|
.setColor(r, g, b, alpha).setUv(1.0F, 1.0F)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
consumer.addVertex(matrix, halfWidth, halfHeight, 0.0F)
|
||||||
|
.setColor(r, g, b, alpha).setUv(1.0F, 0.0F)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
consumer.addVertex(matrix, -halfWidth, halfHeight, 0.0F)
|
||||||
|
.setColor(r, g, b, alpha).setUv(0.0F, 0.0F)
|
||||||
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.lzxnone.terraria.client.item.melee;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.client.entity.projectile.IStaticProjectileRenderBehavior;
|
||||||
|
import com.lzxnone.terraria.entity.TintedVertexConsumer;
|
||||||
|
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||||
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
import com.mojang.math.Axis;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Matrix3f;
|
||||||
|
import org.joml.Quaternionf;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
public class ClientStarfallProjectile {
|
||||||
|
public static final IStaticProjectileRenderBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileRenderBehavior() {
|
||||||
|
@Override
|
||||||
|
public void renderItem(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||||
|
if(!(entity instanceof StaticProjectile projectile)) return;
|
||||||
|
ItemStack stack = projectile.getEntityData().get(StaticProjectile.ITEM);
|
||||||
|
if(stack.isEmpty()) return;
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
|
||||||
|
Vec3 velCurrent = entity.getDeltaMovement();
|
||||||
|
Vec3 velOld = projectile.prevDeltaMovement;
|
||||||
|
if(velOld == null) velOld = velCurrent;
|
||||||
|
|
||||||
|
Vector3f velForRot;
|
||||||
|
if(velCurrent.lengthSqr() > 0.0001D) {
|
||||||
|
velForRot = new Vector3f(
|
||||||
|
(float) Mth.lerp(partialTick, velOld.x, velCurrent.x),
|
||||||
|
(float) Mth.lerp(partialTick, velOld.y, velCurrent.y),
|
||||||
|
(float) Mth.lerp(partialTick, velOld.z, velCurrent.z)
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
velForRot = new Vector3f(projectile.getEntityData().get(StaticProjectile.DIRECTION));
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(velForRot, 0);
|
||||||
|
Matrix3f rotMatrix = new Matrix3f().set(dirs[2], dirs[1], dirs[0]);
|
||||||
|
poseStack.mulPose(new Quaternionf().setFromNormalized(rotMatrix));
|
||||||
|
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(projectile.getEntityData().get(StaticProjectile.RXP) + projectile.getEntityData().get(StaticProjectile.RXPS) * (projectile.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(projectile.getEntityData().get(StaticProjectile.RYP) + projectile.getEntityData().get(StaticProjectile.RYPS) * (projectile.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||||
|
poseStack.mulPose(Axis.ZP.rotationDegrees(projectile.getEntityData().get(StaticProjectile.RZP) + projectile.getEntityData().get(StaticProjectile.RZPS) * (projectile.getEntityData().get(StaticProjectile.AGE) + partialTick)));
|
||||||
|
|
||||||
|
poseStack.scale(
|
||||||
|
projectile.getEntityData().get(StaticProjectile.SCALE_X),
|
||||||
|
projectile.getEntityData().get(StaticProjectile.SCALE_Y),
|
||||||
|
projectile.getEntityData().get(StaticProjectile.SCALE_Z)
|
||||||
|
);
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||||
|
stack,
|
||||||
|
ItemDisplayContext.NONE,
|
||||||
|
projectile.getEntityData().get(StaticProjectile.GLOW) ? LightTexture.FULL_BRIGHT : packedLight,
|
||||||
|
OverlayTexture.NO_OVERLAY,
|
||||||
|
poseStack,
|
||||||
|
renderType -> {
|
||||||
|
VertexConsumer vertexConsumer = bufferSource.getBuffer(renderType);
|
||||||
|
return new TintedVertexConsumer(vertexConsumer,
|
||||||
|
projectile.getEntityData().get(StaticProjectile.COLOR_R),
|
||||||
|
projectile.getEntityData().get(StaticProjectile.COLOR_G),
|
||||||
|
projectile.getEntityData().get(StaticProjectile.COLOR_B),
|
||||||
|
projectile.getEntityData().get(StaticProjectile.COLOR_A));
|
||||||
|
},
|
||||||
|
entity.level(),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
|
}
|
||||||
|
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -78,7 +78,7 @@ public class ClientStarCannon {
|
|||||||
|
|
||||||
Vector3f color = new Vector3f(0.29f, 0.29f, 0.871f);
|
Vector3f color = new Vector3f(0.29f, 0.29f, 0.871f);
|
||||||
float alpha = 0.5f;
|
float alpha = 0.5f;
|
||||||
for(int i = 0; i < 1; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, -starHalfHeight, 0f)
|
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, -starHalfHeight, 0f)
|
||||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 1.0f)
|
.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);
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||||
@@ -91,6 +91,7 @@ public class ClientStarCannon {
|
|||||||
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, starHalfHeight, 0f)
|
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, starHalfHeight, 0f)
|
||||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 0.0f)
|
.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);
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class ClientSuperStarShooter {
|
|||||||
|
|
||||||
Vector3f color = new Vector3f(1.0f, 0.72f, 0.35f);
|
Vector3f color = new Vector3f(1.0f, 0.72f, 0.35f);
|
||||||
float alpha = 0.5f;
|
float alpha = 0.5f;
|
||||||
for(int i = 0; i < 1; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, -starHalfHeight, 0f)
|
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, -starHalfHeight, 0f)
|
||||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 1.0f)
|
.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);
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||||
@@ -102,6 +102,7 @@ public class ClientSuperStarShooter {
|
|||||||
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, starHalfHeight, 0f)
|
starConsumer.addVertex(poseStack.last().pose(), -starHalfWidth, starHalfHeight, 0f)
|
||||||
.setColor(color.x, color.y, color.z, alpha).setUv(0.0f, 0.0f)
|
.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);
|
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0f, 1.0f, 0.0f);
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(60.0F));
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class ModCreativeModeTabs {
|
|||||||
output.accept(ModItems.LUNAR_FLARE.get());
|
output.accept(ModItems.LUNAR_FLARE.get());
|
||||||
output.accept(ModItems.NEBULA_BLAZE.get());
|
output.accept(ModItems.NEBULA_BLAZE.get());
|
||||||
output.accept(ModItems.NEBULA_ARCANUM.get());
|
output.accept(ModItems.NEBULA_ARCANUM.get());
|
||||||
|
output.accept(ModItems.STELLAR_TUNE.get());
|
||||||
output.accept(ModItems.BUBBLE_GUN.get());
|
output.accept(ModItems.BUBBLE_GUN.get());
|
||||||
output.accept(ModItems.MANA_CRYSTAL.get());
|
output.accept(ModItems.MANA_CRYSTAL.get());
|
||||||
output.accept(ModItems.LESSER_MANA_POTION.get());
|
output.accept(ModItems.LESSER_MANA_POTION.get());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lzxnone.terraria.entity.projectile;
|
|||||||
import com.lzxnone.terraria.item.ammo.CrystalBullet;
|
import com.lzxnone.terraria.item.ammo.CrystalBullet;
|
||||||
import com.lzxnone.terraria.item.effect.FallenStarSummoner;
|
import com.lzxnone.terraria.item.effect.FallenStarSummoner;
|
||||||
import com.lzxnone.terraria.item.weapon.magic.NebulaArcanum;
|
import com.lzxnone.terraria.item.weapon.magic.NebulaArcanum;
|
||||||
|
import com.lzxnone.terraria.item.weapon.magic.StellarTune;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||||
import com.lzxnone.terraria.item.weapon.ranged.Flamethrower;
|
import com.lzxnone.terraria.item.weapon.ranged.Flamethrower;
|
||||||
import com.lzxnone.terraria.item.weapon.ranged.SuperStarShooter;
|
import com.lzxnone.terraria.item.weapon.ranged.SuperStarShooter;
|
||||||
@@ -33,6 +34,7 @@ public class StaticProjectileBehaviors {
|
|||||||
public static final String POSSESSION_PROJECTILE = "possession_projectile";
|
public static final String POSSESSION_PROJECTILE = "possession_projectile";
|
||||||
public static final String ACCESSORY_FALLEN_STAR_PROJECTILE = "accessory_fallen_star_projectile";
|
public static final String ACCESSORY_FALLEN_STAR_PROJECTILE = "accessory_fallen_star_projectile";
|
||||||
public static final String NEBULA_ARCANUM_ORBIT_PROJECTILE = "nebula_arcanum_orbit_projectile";
|
public static final String NEBULA_ARCANUM_ORBIT_PROJECTILE = "nebula_arcanum_orbit_projectile";
|
||||||
|
public static final String STELLAR_TUNE_PROJECTILE = "stellar_tune_projectile";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() {
|
BEHAVIORS.put(DEFAULT, new IStaticProjectileBehavior() {
|
||||||
@@ -65,6 +67,7 @@ public class StaticProjectileBehaviors {
|
|||||||
BEHAVIORS.put(POSSESSION_PROJECTILE, Possession.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(POSSESSION_PROJECTILE, Possession.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(ACCESSORY_FALLEN_STAR_PROJECTILE, FallenStarSummoner.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(ACCESSORY_FALLEN_STAR_PROJECTILE, FallenStarSummoner.PROJECTILE_BEHAVIOR);
|
||||||
BEHAVIORS.put(NEBULA_ARCANUM_ORBIT_PROJECTILE, NebulaArcanum.PROJECTILE_BEHAVIOR);
|
BEHAVIORS.put(NEBULA_ARCANUM_ORBIT_PROJECTILE, NebulaArcanum.PROJECTILE_BEHAVIOR);
|
||||||
|
BEHAVIORS.put(STELLAR_TUNE_PROJECTILE, StellarTune.PROJECTILE_BEHAVIOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStaticProjectileBehavior getBehavior(String id) {
|
public static IStaticProjectileBehavior getBehavior(String id) {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class ModItems {
|
|||||||
public static final DeferredItem<Item> LUNAR_FLARE = ITEMS.register("lunar_flare", LunarFlare::new);
|
public static final DeferredItem<Item> LUNAR_FLARE = ITEMS.register("lunar_flare", LunarFlare::new);
|
||||||
public static final DeferredItem<Item> NEBULA_BLAZE = ITEMS.register("nebula_blaze", NebulaBlaze::new);
|
public static final DeferredItem<Item> NEBULA_BLAZE = ITEMS.register("nebula_blaze", NebulaBlaze::new);
|
||||||
public static final DeferredItem<Item> NEBULA_ARCANUM = ITEMS.register("nebula_arcanum", NebulaArcanum::new);
|
public static final DeferredItem<Item> NEBULA_ARCANUM = ITEMS.register("nebula_arcanum", NebulaArcanum::new);
|
||||||
|
public static final DeferredItem<Item> STELLAR_TUNE = ITEMS.register("stellar_tune", StellarTune::new);
|
||||||
public static final DeferredItem<Item> BUBBLE_GUN = ITEMS.register("bubble_gun", BubbleGun::new);
|
public static final DeferredItem<Item> BUBBLE_GUN = ITEMS.register("bubble_gun", BubbleGun::new);
|
||||||
|
|
||||||
//远程武器
|
//远程武器
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class NebulaArcanum extends MagicWeapon {
|
|||||||
);
|
);
|
||||||
|
|
||||||
public NebulaArcanum() {
|
public NebulaArcanum() {
|
||||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC));
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||||
|
|||||||
@@ -0,0 +1,197 @@
|
|||||||
|
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.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.item.weapon.MagicWeapon;
|
||||||
|
import com.lzxnone.terraria.particle.ModParticles;
|
||||||
|
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||||
|
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||||
|
import com.lzxnone.terraria.ui.config.struct.ConfigDouble;
|
||||||
|
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||||
|
import com.lzxnone.terraria.ui.config.struct.ConfigInt;
|
||||||
|
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||||
|
import com.lzxnone.terraria.utils.DamageUtil;
|
||||||
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
|
import com.lzxnone.terraria.utils.AmmoUtil;
|
||||||
|
import com.lzxnone.terraria.utils.CollisionUtil;
|
||||||
|
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||||
|
import com.lzxnone.terraria.utils.SearchUtil;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Rarity;
|
||||||
|
import net.minecraft.world.item.Tiers;
|
||||||
|
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.EntityHitResult;
|
||||||
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class StellarTune extends MagicWeapon {
|
||||||
|
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.stellar_tune.damage", "stellar_tune_damage", 9.0F, 0.0F, 8388600.0F);
|
||||||
|
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.stellar_tune.mana_consume", "stellar_tune_mana_consume", 12.0D, 0.0D, 10000.0D);
|
||||||
|
public static final ConfigDouble TARGET_RANGE = new ConfigDouble("weapon.stellar_tune.target_range", "stellar_tune_target_range", 32.0D, 0.0D, 128.0D);
|
||||||
|
public static final ConfigInt ARRIVAL_TIME = new ConfigInt("weapon.stellar_tune.arrival_time", "stellar_tune_arrival_time", 10, 1, 72000);
|
||||||
|
public static final Vector3f OFFSET = new Vector3f(-0.3F, -0.1F, 1.5F);
|
||||||
|
|
||||||
|
private static final double WAVE_AMPLITUDE = 2.0D;
|
||||||
|
private static final double HITBOX_INFLATE = 1.0D;
|
||||||
|
|
||||||
|
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||||
|
@Override
|
||||||
|
public void onConfigLoad() {
|
||||||
|
ConfigStruct.loadAll(DAMAGE, MANA_CONSUME, TARGET_RANGE, ARRIVAL_TIME);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||||
|
"stellar_tune",
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/stellar_tune.png"),
|
||||||
|
Component.translatable("item.lzxnoneterraria.stellar_tune"),
|
||||||
|
CONFIG_DATA
|
||||||
|
);
|
||||||
|
|
||||||
|
public StellarTune() {
|
||||||
|
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||||
|
@Override
|
||||||
|
public void onMoving(StaticProjectile projectile) {
|
||||||
|
if(projectile.level().isClientSide()) {
|
||||||
|
ParticleUtil.addParticle(projectile.level(), ModParticles.STAR_PARTICLE.get(), projectile.position(), 0.25D, Vec3.ZERO, 0.2D);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vec3 start = projectile.prevPos == null ? projectile.position() : projectile.prevPos;
|
||||||
|
EntityHitResult result = CollisionUtil.checkEntityHit(projectile, start, projectile.position(), HITBOX_INFLATE);
|
||||||
|
if(result != null) onHitEntity(projectile, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHitEntity(StaticProjectile projectile, EntityHitResult result) {
|
||||||
|
if(projectile.level().isClientSide()) return;
|
||||||
|
DamageUtil.magicAttack(projectile, result.getEntity(), projectile.getEntityData().get(StaticProjectile.STACK_SOURCE), DAMAGE.get(), 0.4F, 10);
|
||||||
|
onDied(projectile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDied(StaticProjectile projectile) {
|
||||||
|
if(projectile.level() instanceof ServerLevel serverLevel) {
|
||||||
|
ParticleUtil.addParticles(serverLevel, ModParticles.STAR_PARTICLE.get(), projectile.position(), new Vec3(0.5D, 0.5D, 0.5D), 0.25D, 25);
|
||||||
|
}
|
||||||
|
projectile.discard();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||||
|
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||||
|
return applyMagicDamageBonus(weaponStack, entity, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected double getManaConsumeRate(ItemStack stack, LivingEntity entity) {
|
||||||
|
return MANA_CONSUME.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||||
|
if(level.isClientSide()) return;
|
||||||
|
|
||||||
|
double targetRange = TARGET_RANGE.get();
|
||||||
|
Vector3f[] playerDirs = MathUtil.computeCoordinateSystem(player);
|
||||||
|
Vector3f offset = AmmoUtil.getOffset(hand, OFFSET);
|
||||||
|
Vec3 eyePos = player.getEyePosition();
|
||||||
|
Vec3 start = new Vec3(
|
||||||
|
eyePos.x + playerDirs[0].x * offset.z + playerDirs[1].x * offset.y + playerDirs[2].x * offset.x,
|
||||||
|
eyePos.y + playerDirs[0].y * offset.z + playerDirs[1].y * offset.y + playerDirs[2].y * offset.x,
|
||||||
|
eyePos.z + playerDirs[0].z * offset.z + playerDirs[1].z * offset.y + playerDirs[2].z * offset.x
|
||||||
|
);
|
||||||
|
Vec3 targetPos = null;
|
||||||
|
double bestDistanceSqr = Double.MAX_VALUE;
|
||||||
|
AABB searchBox = AABB.ofSize(player.getEyePosition(), targetRange * 2.0D, targetRange * 2.0D, targetRange * 2.0D);
|
||||||
|
for(Entity target : SearchUtil.searchEnemies(player, player, searchBox)) {
|
||||||
|
Vec3 candidatePos = target.getBoundingBox().getCenter();
|
||||||
|
double distanceSqr = candidatePos.distanceToSqr(start);
|
||||||
|
if(distanceSqr > targetRange * targetRange || distanceSqr >= bestDistanceSqr) continue;
|
||||||
|
if(!hasLineOfSight(player, candidatePos)) continue;
|
||||||
|
bestDistanceSqr = distanceSqr;
|
||||||
|
targetPos = candidatePos;
|
||||||
|
}
|
||||||
|
if(targetPos == null) {
|
||||||
|
targetPos = MathUtil.getCrosshairPos(player, level, targetRange, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3 dir = targetPos.subtract(start);
|
||||||
|
double distance = dir.length();
|
||||||
|
if(distance < 0.001D) {
|
||||||
|
dir = player.getLookAngle().normalize();
|
||||||
|
distance = 0.001D;
|
||||||
|
}
|
||||||
|
|
||||||
|
int soundIndex = targetRange <= 0.0D ? 0 : (int) Math.floor(distance / Math.max(0.001D, targetRange / 6.0D));
|
||||||
|
soundIndex = Math.max(0, Math.min(5, soundIndex));
|
||||||
|
switch(soundIndex) {
|
||||||
|
case 0 -> player.playNotifySound(ModSounds.STAR_TUNE0.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
case 1 -> player.playNotifySound(ModSounds.STAR_TUNE1.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
case 2 -> player.playNotifySound(ModSounds.STAR_TUNE2.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
case 3 -> player.playNotifySound(ModSounds.STAR_TUNE3.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
case 4 -> player.playNotifySound(ModSounds.STAR_TUNE4.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
default -> player.playNotifySound(ModSounds.STAR_TUNE5.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
int arrivalTime = Math.max(1, ARRIVAL_TIME.get());
|
||||||
|
double speed = distance / arrivalTime;
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(dir.toVector3f(), player.getYRot());
|
||||||
|
dirs = MathUtil.rotateCoordinateSystem(dirs[0], dirs[2], (int) ((Math.random() * 2 - 1) * 90));
|
||||||
|
|
||||||
|
StaticProjectile projectile = new StaticProjectile(ModEntities.STATIC_PROJECTILE.get(), level);
|
||||||
|
projectile.setOwner(player);
|
||||||
|
projectile.setPos(start);
|
||||||
|
projectile.getEntityData().set(StaticProjectile.STACK_SOURCE, stack.copy());
|
||||||
|
projectile.getEntityData().set(StaticProjectile.ITEM, new ItemStack(ModItems.FALLEN_STAR.get()));
|
||||||
|
projectile.getEntityData().set(StaticProjectile.BEHAVIOR, StaticProjectileBehaviors.STELLAR_TUNE_PROJECTILE);
|
||||||
|
projectile.getEntityData().set(StaticProjectile.RENDER_MODE, "custom");
|
||||||
|
projectile.getEntityData().set(StaticProjectile.ORIGIN, start.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.LIFETIME, arrivalTime);
|
||||||
|
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Z, String.format(Locale.ROOT, "%.5f*t", speed));
|
||||||
|
projectile.getEntityData().set(StaticProjectile.EXPRESSION_Y, String.format(Locale.ROOT, "%.5f*sin(%.5f*t)", WAVE_AMPLITUDE, Math.PI * 2.0D / arrivalTime));
|
||||||
|
projectile.getEntityData().set(StaticProjectile.GLOW, true);
|
||||||
|
level.addFreshEntity(projectile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasLineOfSight(Player player, Vec3 targetPos) {
|
||||||
|
return player.level().clip(new ClipContext(
|
||||||
|
player.getEyePosition(),
|
||||||
|
targetPos,
|
||||||
|
ClipContext.Block.COLLIDER,
|
||||||
|
ClipContext.Fluid.NONE,
|
||||||
|
player
|
||||||
|
)).getType() == HitResult.Type.MISS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -99,6 +99,7 @@ import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
|||||||
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
|
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
|
||||||
import com.lzxnone.terraria.item.weapon.magic.NebulaArcanum;
|
import com.lzxnone.terraria.item.weapon.magic.NebulaArcanum;
|
||||||
import com.lzxnone.terraria.item.weapon.magic.NebulaBlaze;
|
import com.lzxnone.terraria.item.weapon.magic.NebulaBlaze;
|
||||||
|
import com.lzxnone.terraria.item.weapon.magic.StellarTune;
|
||||||
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;
|
||||||
@@ -183,6 +184,7 @@ public class ConfigList {
|
|||||||
LunarFlare.CONFIG_LIST_ITEM,
|
LunarFlare.CONFIG_LIST_ITEM,
|
||||||
NebulaBlaze.CONFIG_LIST_ITEM,
|
NebulaBlaze.CONFIG_LIST_ITEM,
|
||||||
NebulaArcanum.CONFIG_LIST_ITEM,
|
NebulaArcanum.CONFIG_LIST_ITEM,
|
||||||
|
StellarTune.CONFIG_LIST_ITEM,
|
||||||
BubbleGun.CONFIG_LIST_ITEM,
|
BubbleGun.CONFIG_LIST_ITEM,
|
||||||
Minishark.CONFIG_LIST_ITEM,
|
Minishark.CONFIG_LIST_ITEM,
|
||||||
FlintlockPistol.CONFIG_LIST_ITEM,
|
FlintlockPistol.CONFIG_LIST_ITEM,
|
||||||
|
|||||||
@@ -24,6 +24,21 @@ public class CollisionUtil {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EntityHitResult checkEntityHit(StaticProjectile projectile, Vec3 start, Vec3 end, double inflate) {
|
||||||
|
EntityHitResult result = ProjectileUtil.getEntityHitResult(
|
||||||
|
projectile.level(),
|
||||||
|
projectile,
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
projectile.getBoundingBox()
|
||||||
|
.move(start.subtract(projectile.position()))
|
||||||
|
.expandTowards(end.subtract(start))
|
||||||
|
.inflate(inflate),
|
||||||
|
FilterUtil.createTargetFilter(projectile, projectile.getOwner())
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos, double inflate) {
|
public static EntityHitResult checkEntityHit(StaticSummon summon, Vec3 nextPos, double inflate) {
|
||||||
EntityHitResult result = ProjectileUtil.getEntityHitResult(
|
EntityHitResult result = ProjectileUtil.getEntityHitResult(
|
||||||
summon.level(),
|
summon.level(),
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"item.lzxnoneterraria.lunar_flare": "Lunar Flare",
|
"item.lzxnoneterraria.lunar_flare": "Lunar Flare",
|
||||||
"item.lzxnoneterraria.nebula_blaze": "Nebula Blaze",
|
"item.lzxnoneterraria.nebula_blaze": "Nebula Blaze",
|
||||||
"item.lzxnoneterraria.nebula_arcanum": "Nebula Arcanum",
|
"item.lzxnoneterraria.nebula_arcanum": "Nebula Arcanum",
|
||||||
|
"item.lzxnoneterraria.stellar_tune": "Stellar Tune",
|
||||||
"item.lzxnoneterraria.bubble_gun": "Bubble Gun",
|
"item.lzxnoneterraria.bubble_gun": "Bubble Gun",
|
||||||
"item.lzxnoneterraria.bubble_gun_projectile": "Bubble",
|
"item.lzxnoneterraria.bubble_gun_projectile": "Bubble",
|
||||||
"item.lzxnoneterraria.vortex_rocket": "Vortex Rocket",
|
"item.lzxnoneterraria.vortex_rocket": "Vortex Rocket",
|
||||||
@@ -1087,6 +1088,14 @@
|
|||||||
"lzxnoneterraria.configuration.nebula_arcanum_orbit_projectile_damage.tooltip": "Magic damage dealt by orbiting projectiles",
|
"lzxnoneterraria.configuration.nebula_arcanum_orbit_projectile_damage.tooltip": "Magic damage dealt by orbiting projectiles",
|
||||||
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage": "Small Projectile Damage",
|
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage": "Small Projectile Damage",
|
||||||
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage.tooltip": "Magic damage dealt by small projectiles spawned after the main projectile dies",
|
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage.tooltip": "Magic damage dealt by small projectiles spawned after the main projectile dies",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_damage": "Damage",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_damage.tooltip": "Magic damage dealt",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_mana_consume": "Mana Cost",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_mana_consume.tooltip": "Mana consumed per shot",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_target_range": "Target Range",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_target_range.tooltip": "Maximum range to search visible enemies when firing",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_arrival_time": "Arrival Time",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_arrival_time.tooltip": "Time in ticks for the projectile to reach its target point",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_damage": "Damage",
|
"lzxnoneterraria.configuration.bubble_gun_damage": "Damage",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "Magic damage dealt by each bubble hit",
|
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "Magic damage dealt by each bubble hit",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_speed": "Speed",
|
"lzxnoneterraria.configuration.bubble_gun_speed": "Speed",
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"item.lzxnoneterraria.lunar_flare": "月耀",
|
"item.lzxnoneterraria.lunar_flare": "月耀",
|
||||||
"item.lzxnoneterraria.nebula_blaze": "星云烈焰",
|
"item.lzxnoneterraria.nebula_blaze": "星云烈焰",
|
||||||
"item.lzxnoneterraria.nebula_arcanum": "星云奥秘",
|
"item.lzxnoneterraria.nebula_arcanum": "星云奥秘",
|
||||||
|
"item.lzxnoneterraria.stellar_tune": "星星吉他",
|
||||||
"item.lzxnoneterraria.bubble_gun": "泡泡枪",
|
"item.lzxnoneterraria.bubble_gun": "泡泡枪",
|
||||||
"item.lzxnoneterraria.bubble_gun_projectile": "泡泡",
|
"item.lzxnoneterraria.bubble_gun_projectile": "泡泡",
|
||||||
"item.lzxnoneterraria.vortex_rocket": "星旋火箭",
|
"item.lzxnoneterraria.vortex_rocket": "星旋火箭",
|
||||||
@@ -1087,6 +1088,14 @@
|
|||||||
"lzxnoneterraria.configuration.nebula_arcanum_orbit_projectile_damage.tooltip": "环绕主体的弹射造成的魔法伤害",
|
"lzxnoneterraria.configuration.nebula_arcanum_orbit_projectile_damage.tooltip": "环绕主体的弹射造成的魔法伤害",
|
||||||
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage": "小弹射伤害",
|
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage": "小弹射伤害",
|
||||||
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage.tooltip": "主体死亡后生成的小弹射造成的魔法伤害",
|
"lzxnoneterraria.configuration.nebula_arcanum_small_projectile_damage.tooltip": "主体死亡后生成的小弹射造成的魔法伤害",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_damage": "伤害",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_damage.tooltip": "造成的魔法伤害",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_mana_consume": "魔力消耗",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_mana_consume.tooltip": "每次发射消耗的魔力",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_target_range": "寻怪范围",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_target_range.tooltip": "发射时搜寻可视敌怪的最大范围",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_arrival_time": "到达时间",
|
||||||
|
"lzxnoneterraria.configuration.stellar_tune_arrival_time.tooltip": "弹射到达目标点所需时间(刻)",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_damage": "伤害",
|
"lzxnoneterraria.configuration.bubble_gun_damage": "伤害",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "每个泡泡命中造成的魔法伤害",
|
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "每个泡泡命中造成的魔法伤害",
|
||||||
"lzxnoneterraria.configuration.bubble_gun_speed": "速度",
|
"lzxnoneterraria.configuration.bubble_gun_speed": "速度",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "lzxnoneterraria:item/sword2",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/stellar_tune"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,6 +58,24 @@
|
|||||||
"star_collide": {
|
"star_collide": {
|
||||||
"sounds": ["lzxnoneterraria:star_collide"]
|
"sounds": ["lzxnoneterraria:star_collide"]
|
||||||
},
|
},
|
||||||
|
"star_tune0": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune0"]
|
||||||
|
},
|
||||||
|
"star_tune1": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune1"]
|
||||||
|
},
|
||||||
|
"star_tune2": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune2"]
|
||||||
|
},
|
||||||
|
"star_tune3": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune3"]
|
||||||
|
},
|
||||||
|
"star_tune4": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune4"]
|
||||||
|
},
|
||||||
|
"star_tune5": {
|
||||||
|
"sounds": ["lzxnoneterraria:star_tune5"]
|
||||||
|
},
|
||||||
"snow_break": {
|
"snow_break": {
|
||||||
"sounds": ["lzxnoneterraria:snow_break"]
|
"sounds": ["lzxnoneterraria:snow_break"]
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 339 B |
Reference in new issue
Block a user