v1.7.4
This commit is contained in:
1 parent
5f7330158f
commit
189572c7b7
138 files changed
+2496
-924
No files matched your search
@@ -83,6 +83,9 @@ public class LzxnoneTerrariaClient {
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.SOLAR_EXPLOSION_PARTICLE.get(), SolarExplosionParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.LUNAR_FLARE_EXPLOSION_PARTICLE.get(), LunarFlareExplosionParticle.Provider::new);
|
||||
});
|
||||
modEventBus.addListener(RegisterParticleProvidersEvent.class, event -> {
|
||||
event.registerSpriteSet(ModParticles.CRYSTAL_FRAGMENT_PARTICLE.get(), CrystalFragmentParticle.Provider::new);
|
||||
});
|
||||
|
||||
@@ -19,6 +19,26 @@ public class ModSounds {
|
||||
SOUND_EVENTS.register("beam2",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "beam2")));
|
||||
public static final Supplier<SoundEvent> BETSYS_FIREBALL_SHOOT =
|
||||
SOUND_EVENTS.register("betsys_fireball_shoot",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "betsys_fireball_shoot")));
|
||||
public static final Supplier<SoundEvent> BETSYS_FIREBALL_COLLIDE =
|
||||
SOUND_EVENTS.register("betsys_fireball_collide",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "betsys_fireball_collide")));
|
||||
public static final Supplier<SoundEvent> MAGIC_SHOOT =
|
||||
SOUND_EVENTS.register("magic_shoot",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "magic_shoot")));
|
||||
public static final Supplier<SoundEvent> BUBBLE =
|
||||
SOUND_EVENTS.register("bubble",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "bubble")));
|
||||
public static final Supplier<SoundEvent> BUBBLE_BREAK =
|
||||
SOUND_EVENTS.register("bubble_break",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "bubble_break")));
|
||||
public static final Supplier<SoundEvent> MAX_MANA =
|
||||
SOUND_EVENTS.register("max_mana",
|
||||
() -> SoundEvent.createVariableRangeEvent(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.lzxnone.terraria.attachment;
|
||||
|
||||
import com.lzxnone.terraria.event.PlayerManaSyncEventHandler;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public class PlayerMana {
|
||||
@@ -79,26 +81,63 @@ public class PlayerMana {
|
||||
return recoverDelay;
|
||||
}
|
||||
|
||||
public boolean hasMana() {
|
||||
return mana > 0;
|
||||
public static boolean recoverMana(ServerPlayer player, double amount) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
if(!mana.recoverMana(amount)) return false;
|
||||
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
if(mana.getMana() != oldMana) {
|
||||
PlayerManaSyncEventHandler.playMaxManaSoundIfRecovered(player, oldMana, mana);
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//通过魔力水晶增加基础最大魔力
|
||||
public int increaseBaseMaxMana(int amount) {
|
||||
if(amount <= 0 || baseMaxMana >= MAX_BASE_MANA) return 0;
|
||||
public static boolean consumeMana(ServerPlayer player, double amount) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
if(!mana.consumeMana(amount)) return false;
|
||||
|
||||
int oldBaseMaxMana = baseMaxMana;
|
||||
setBaseMaxMana(Math.min(baseMaxMana + amount, MAX_BASE_MANA));
|
||||
int increase = baseMaxMana - oldBaseMaxMana;
|
||||
setMana(mana + increase);
|
||||
return increase;
|
||||
mana.applyRecoverDelay();
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
if(mana.getMana() != oldMana) {
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean setBaseMaxMana(ServerPlayer player, int baseMaxMana) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
int oldBaseMaxMana = mana.getBaseMaxMana();
|
||||
mana.setBaseMaxMana(Mth.clamp(baseMaxMana, 0, MAX_BASE_MANA));
|
||||
if(oldMana == mana.getMana() && oldBaseMaxMana == mana.getBaseMaxMana()) return false;
|
||||
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean setBonusMaxMana(ServerPlayer player, int bonusMaxMana) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
int oldBonusMaxMana = mana.getBonusMaxMana();
|
||||
mana.setBonusMaxMana(bonusMaxMana);
|
||||
if(oldMana == mana.getMana() && oldBonusMaxMana == mana.getBonusMaxMana()) return false;
|
||||
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
//通过累加计数器恢复魔力
|
||||
public boolean recoverMana(double amount) {
|
||||
private boolean recoverMana(double amount) {
|
||||
if(amount <= 0.0D || mana >= getMaxMana()) return false;
|
||||
|
||||
int recoverAmount = addManaProgress(false, amount);
|
||||
double progress = recoverProgress + amount;
|
||||
int recoverAmount = (int)Math.floor(progress);
|
||||
recoverProgress = progress - recoverAmount;
|
||||
if(recoverAmount <= 0) return true;
|
||||
|
||||
int oldMana = mana;
|
||||
@@ -106,27 +145,16 @@ public class PlayerMana {
|
||||
return mana != oldMana;
|
||||
}
|
||||
|
||||
//直接恢复指定值的魔力
|
||||
public boolean recoverManaImmediately(int amount) {
|
||||
if(amount <= 0 || mana >= getMaxMana()) return false;
|
||||
|
||||
int oldMana = mana;
|
||||
setMana(mana + amount);
|
||||
return mana != oldMana;
|
||||
}
|
||||
|
||||
//通过累加计数器消耗魔力
|
||||
public boolean consumeMana(double amount) {
|
||||
private boolean consumeMana(double amount) {
|
||||
if(amount <= 0.0D) return true;
|
||||
if(mana <= 0) return false;
|
||||
if(mana < (int)Math.floor(consumeProgress + amount)) return false;
|
||||
|
||||
int consumeAmount = addManaProgress(true, amount);
|
||||
if(consumeAmount <= 0) return mana > 0;
|
||||
|
||||
if(consumeAmount >= mana) {
|
||||
mana = 0;
|
||||
return false;
|
||||
}
|
||||
double progress = consumeProgress + amount;
|
||||
int consumeAmount = (int)Math.floor(progress);
|
||||
consumeProgress = progress - consumeAmount;
|
||||
if(consumeAmount <= 0) return true;
|
||||
|
||||
mana -= consumeAmount;
|
||||
return true;
|
||||
@@ -137,7 +165,7 @@ public class PlayerMana {
|
||||
if(getMaxMana() <= 0) return;
|
||||
|
||||
double emptyRatio = 1.0D - (double) mana / getMaxMana();
|
||||
recoverDelay = Math.max(recoverDelay, (int) Math.ceil(0.7D * (emptyRatio * 240.0D + 45.0D)));
|
||||
recoverDelay = Math.max(recoverDelay, (int) Math.ceil(0.7D * (emptyRatio * 240.0D + 45.0D) / 3.0D));
|
||||
recoverProgress = 0.0D;
|
||||
}
|
||||
|
||||
@@ -150,17 +178,4 @@ public class PlayerMana {
|
||||
return recoverDelay > 0;
|
||||
}
|
||||
|
||||
//累计计数器
|
||||
private int addManaProgress(boolean consume, double amount) {
|
||||
double progress = (consume ? consumeProgress : recoverProgress) + amount;
|
||||
int wholeAmount = (int)Math.floor(progress);
|
||||
double nextProgress = progress - wholeAmount;
|
||||
|
||||
if(consume) {
|
||||
consumeProgress = nextProgress;
|
||||
}else {
|
||||
recoverProgress = nextProgress;
|
||||
}
|
||||
return wholeAmount;
|
||||
}
|
||||
}
|
||||
+2
@@ -4,6 +4,7 @@ import com.lzxnone.terraria.client.item.normal.ClientDropFallenStar;
|
||||
import com.lzxnone.terraria.client.item.normal.ClientManaStar;
|
||||
import com.lzxnone.terraria.client.item.ranged.ClientArrowAmmo;
|
||||
import com.lzxnone.terraria.client.item.ranged.ClientBulletAmmo;
|
||||
import com.lzxnone.terraria.client.item.magic.ClientBetsysWrath;
|
||||
import com.lzxnone.terraria.client.item.magic.ClientLastPrism;
|
||||
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
|
||||
import com.lzxnone.terraria.client.item.melee.ClientFirstFractal;
|
||||
@@ -53,6 +54,7 @@ public class ClientStaticSummonRenderBehaviors {
|
||||
BEHAVIORS.put(StaticSummonBehaviors.DEVILS_DEVASTATION_MARK_LIGHTNING, ClientDevilsDevastation.SUMMON_BEHAVIOR4);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_TRI, ClientLastPrism.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_BEAM, ClientLastPrism.SUMMON_BEHAVIOR2);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.BETSY_WRATH, ClientBetsysWrath.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.TERRAPRISMA, ClientTerraprisma.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.POSSESSION, ClientWhip.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(StaticSummonBehaviors.POSSESSION_VISION, DEFAULT_BEHAVIOR);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.lzxnone.terraria.client.event;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||
import com.lzxnone.terraria.item.weapon.SummonWeapon;
|
||||
import com.lzxnone.terraria.item.weapon.summon.minion.MinionWeapon;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -26,6 +29,9 @@ public class ItemTooltipHandler {
|
||||
public static void onItemTooltip(ItemTooltipEvent event) {
|
||||
addEnchantedBookTooltip(event);
|
||||
addMinionWeaponTooltip(event);
|
||||
addRangedWeaponTooltip(event);
|
||||
addSummonWeaponTooltip(event);
|
||||
addMagicWeaponTooltip(event);
|
||||
}
|
||||
|
||||
private static void addEnchantedBookTooltip(ItemTooltipEvent event) {
|
||||
@@ -68,4 +74,58 @@ public class ItemTooltipHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addMagicWeaponTooltip(ItemTooltipEvent event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
if(stack.getItem() instanceof MagicWeapon magicWeapon) {
|
||||
Player player = event.getEntity();
|
||||
if(player != null) {
|
||||
float damage = magicWeapon.getTooltipDamage(stack, player);
|
||||
if(damage > 0.0F) {
|
||||
event.getToolTip().add(
|
||||
Component.translatable(
|
||||
"tooltip.lzxnoneterraria.magic_weapon_damage",
|
||||
damage == Math.rint(damage) ? String.valueOf((int) damage) : String.format("%.2f", damage)
|
||||
).withStyle(ChatFormatting.RED)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRangedWeaponTooltip(ItemTooltipEvent event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
if(stack.getItem() instanceof RangedWeapon rangedWeapon) {
|
||||
Player player = event.getEntity();
|
||||
if(player != null) {
|
||||
float damage = rangedWeapon.getTooltipDamage(stack, player);
|
||||
if(damage > 0.0F) {
|
||||
event.getToolTip().add(
|
||||
Component.translatable(
|
||||
"tooltip.lzxnoneterraria.ranged_weapon_damage",
|
||||
damage == Math.rint(damage) ? String.valueOf((int) damage) : String.format("%.2f", damage)
|
||||
).withStyle(ChatFormatting.RED)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addSummonWeaponTooltip(ItemTooltipEvent event) {
|
||||
ItemStack stack = event.getItemStack();
|
||||
if(stack.getItem() instanceof SummonWeapon summonWeapon) {
|
||||
Player player = event.getEntity();
|
||||
if(player != null) {
|
||||
float damage = summonWeapon.getTooltipDamage(stack, player);
|
||||
if(damage > 0.0F) {
|
||||
event.getToolTip().add(
|
||||
Component.translatable(
|
||||
"tooltip.lzxnoneterraria.summon_weapon_damage",
|
||||
damage == Math.rint(damage) ? String.valueOf((int) damage) : String.format("%.2f", damage)
|
||||
).withStyle(ChatFormatting.RED)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public class ShaderRegistry {
|
||||
private static ShaderInstance blur;
|
||||
private static ShaderInstance composite;
|
||||
private static ShaderInstance outline;
|
||||
private static ShaderInstance particleBloom;
|
||||
|
||||
public static ShaderInstance getBlur() {
|
||||
return blur;
|
||||
@@ -29,6 +30,10 @@ public class ShaderRegistry {
|
||||
return outline;
|
||||
}
|
||||
|
||||
public static ShaderInstance getParticleBloom() {
|
||||
return particleBloom;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerShaders(RegisterShadersEvent event) {
|
||||
try {
|
||||
@@ -56,6 +61,14 @@ public class ShaderRegistry {
|
||||
),
|
||||
shader -> outline = shader
|
||||
);
|
||||
event.registerShader(
|
||||
new ShaderInstance(
|
||||
event.getResourceProvider(),
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "particle_bloom"),
|
||||
DefaultVertexFormat.PARTICLE
|
||||
),
|
||||
shader -> particleBloom = shader
|
||||
);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Shader load error", e);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.lzxnone.terraria.client.item.magic;
|
||||
|
||||
import com.lzxnone.terraria.client.entity.summon.IStaticSummonRenderBehavior;
|
||||
import com.lzxnone.terraria.entity.ModRenderTypes;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
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.phys.Vec3;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class ClientBetsysWrath {
|
||||
private static final ResourceLocation RES = ResourceLocation.parse("lzxnoneterraria:textures/vfx/normal_wave.png");
|
||||
private static final int POINTS_PER_SECTION = 2;
|
||||
private static final float[] PLANE_ROTATIONS = new float[]{0.0F, 60.0F, 120.0F};
|
||||
private static final double SCALE = 2.0D;
|
||||
private static final float TAIL_COLOR_START = 0.1F;
|
||||
private static final float BODY_RED = 1.0F;
|
||||
private static final float BODY_GREEN = 0.85F;
|
||||
private static final float BODY_BLUE = 0.12F;
|
||||
private static final float TAIL_RED = 0.65F;
|
||||
private static final float TAIL_GREEN = 0.0F;
|
||||
private static final float TAIL_BLUE = 0.0F;
|
||||
|
||||
public static final IStaticSummonRenderBehavior SUMMON_BEHAVIOR = new IStaticSummonRenderBehavior() {
|
||||
@Override
|
||||
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||
if(!(entity instanceof StaticSummon summon)) return;
|
||||
LinkedList<Vec3> positions = summon.trailPositions;
|
||||
if(positions.size() < POINTS_PER_SECTION * 2) return;
|
||||
|
||||
VertexConsumer consumer = bufferSource.getBuffer(ModRenderTypes.entityTranslucentEmissive(RES));
|
||||
Matrix4f matrix = poseStack.last().pose();
|
||||
Vec3 renderOrigin = summon.getPosition(partialTick);
|
||||
int sectionCount = positions.size() / POINTS_PER_SECTION;
|
||||
|
||||
for(float rotationDegrees : PLANE_ROTATIONS) {
|
||||
for(int i = 0; i < sectionCount - 1; i++) {
|
||||
Vec3 sectionRight0 = positions.get(i * POINTS_PER_SECTION);
|
||||
Vec3 sectionLeft0 = positions.get(i * POINTS_PER_SECTION + 1);
|
||||
Vec3 sectionRight1 = positions.get((i + 1) * POINTS_PER_SECTION);
|
||||
Vec3 sectionLeft1 = positions.get((i + 1) * POINTS_PER_SECTION + 1);
|
||||
|
||||
Vec3 center0 = sectionRight0.add(sectionLeft0).scale(0.5D);
|
||||
Vec3 center1 = sectionRight1.add(sectionLeft1).scale(0.5D);
|
||||
Vec3 half0 = sectionRight0.subtract(sectionLeft0).scale(0.5D * SCALE);
|
||||
Vec3 half1 = sectionRight1.subtract(sectionLeft1).scale(0.5D * SCALE);
|
||||
Vec3 direction = center1.subtract(center0);
|
||||
|
||||
if(direction.lengthSqr() > 1.0E-7D) {
|
||||
Quaternionf rotation = new Quaternionf().fromAxisAngleRad(direction.normalize().toVector3f(), (float) Math.toRadians(rotationDegrees));
|
||||
half0 = MathUtil.toVec3(half0.toVector3f().rotate(rotation));
|
||||
half1 = MathUtil.toVec3(half1.toVector3f().rotate(rotation));
|
||||
}
|
||||
|
||||
Vec3 right0 = center0.add(half0).subtract(renderOrigin);
|
||||
Vec3 left0 = center0.subtract(half0).subtract(renderOrigin);
|
||||
Vec3 right1 = center1.add(half1).subtract(renderOrigin);
|
||||
Vec3 left1 = center1.subtract(half1).subtract(renderOrigin);
|
||||
|
||||
float v0 = i / (float) (sectionCount - 1);
|
||||
float v1 = (i + 1) / (float) (sectionCount - 1);
|
||||
float u0 = 1.0F - v0;
|
||||
float u1 = 1.0F - v1;
|
||||
float tail0 = Math.max(0.0F, Math.min(1.0F, (v0 - TAIL_COLOR_START) / (1.0F - TAIL_COLOR_START)));
|
||||
float tail1 = Math.max(0.0F, Math.min(1.0F, (v1 - TAIL_COLOR_START) / (1.0F - TAIL_COLOR_START)));
|
||||
for(int layer = 0; layer < 2; layer++) {
|
||||
boolean tailLayer = layer == 1;
|
||||
float red0 = tailLayer ? TAIL_RED : BODY_RED;
|
||||
float green0 = tailLayer ? TAIL_GREEN : BODY_GREEN;
|
||||
float blue0 = tailLayer ? TAIL_BLUE : BODY_BLUE;
|
||||
float alpha0 = tailLayer ? tail0 : 1.0F - tail0;
|
||||
float red1 = tailLayer ? TAIL_RED : BODY_RED;
|
||||
float green1 = tailLayer ? TAIL_GREEN : BODY_GREEN;
|
||||
float blue1 = tailLayer ? TAIL_BLUE : BODY_BLUE;
|
||||
float alpha1 = tailLayer ? tail1 : 1.0F - tail1;
|
||||
|
||||
consumer.addVertex(matrix, (float) left0.x, (float) left0.y, (float) left0.z)
|
||||
.setColor(red0, green0, blue0, alpha0).setUv(u0, 0.0F)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||
consumer.addVertex(matrix, (float) right0.x, (float) right0.y, (float) right0.z)
|
||||
.setColor(red0, green0, blue0, alpha0).setUv(u0, 1.0F)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||
consumer.addVertex(matrix, (float) right1.x, (float) right1.y, (float) right1.z)
|
||||
.setColor(red1, green1, blue1, alpha1).setUv(u1, 1.0F)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||
consumer.addVertex(matrix, (float) left1.x, (float) left1.y, (float) left1.z)
|
||||
.setColor(red1, green1, blue1, alpha1).setUv(u1, 0.0F)
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY).setLight(LightTexture.FULL_BRIGHT).setNormal(0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -53,6 +53,9 @@ public class ModCreativeModeTabs {
|
||||
.icon(() -> ModItems.LAST_PRISM.get().getDefaultInstance())
|
||||
.displayItems((parameters, output) -> {
|
||||
output.accept(ModItems.LAST_PRISM.get());
|
||||
output.accept(ModItems.BETSY_WRATH.get());
|
||||
output.accept(ModItems.LUNAR_FLARE.get());
|
||||
output.accept(ModItems.BUBBLE_GUN.get());
|
||||
output.accept(ModItems.MANA_CRYSTAL.get());
|
||||
output.accept(ModItems.LESSER_MANA_POTION.get());
|
||||
output.accept(ModItems.MANA_POTION.get());
|
||||
|
||||
@@ -60,6 +60,7 @@ public class MEntityLuminance implements EntityLuminance {
|
||||
StaticSummonBehaviors.DEVILS_DEVASTATION_MARK_LIGHTNING,
|
||||
StaticSummonBehaviors.LAST_PRISM_TRI,
|
||||
StaticSummonBehaviors.LAST_PRISM_BEAM,
|
||||
StaticSummonBehaviors.LUNAR_FLARE,
|
||||
StaticSummonBehaviors.TERRAPRISMA,
|
||||
StaticSummonBehaviors.FLAMETHROWER_FLAME,
|
||||
StaticSummonBehaviors.ELF_MELTER_FLAME,
|
||||
@@ -67,7 +68,8 @@ public class MEntityLuminance implements EntityLuminance {
|
||||
StaticSummonBehaviors.FALLEN_STAR,
|
||||
StaticSummonBehaviors.FALLEN_STAR_SUPER,
|
||||
StaticSummonBehaviors.DROP_FALLEN_STAR,
|
||||
StaticSummonBehaviors.MANA_STAR -> {
|
||||
StaticSummonBehaviors.MANA_STAR,
|
||||
StaticSummonBehaviors.BETSY_WRATH -> {
|
||||
return 15;
|
||||
}
|
||||
case StaticSummonBehaviors.CHLOROPHYTE_BULLET,
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.lzxnone.terraria.effect;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
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.ConfigFloat;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectCategory;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class BetsysCurseEffect extends MobEffect {
|
||||
public static final ConfigFloat ARMOR_REDUCTION_PER_LEVEL = new ConfigFloat("effect.betsys_curse.armor_reduction_per_level", "betsys_curse_armor_reduction_per_level", 15.0f, 0.0f, 1024.0f);
|
||||
private static final ResourceLocation ARMOR_REDUCTION_ID = ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "betsys_curse_armor_reduction");
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(ARMOR_REDUCTION_PER_LEVEL);
|
||||
}
|
||||
};
|
||||
|
||||
public static float getArmorReductionPerLevel() {
|
||||
return ARMOR_REDUCTION_PER_LEVEL.get();
|
||||
}
|
||||
|
||||
public static void applyArmorReduction(LivingEntity entity) {
|
||||
removeArmorReduction(entity);
|
||||
|
||||
MobEffectInstance instance = entity.getEffect(ModEffects.BETSYS_CURSE);
|
||||
if(instance == null) return;
|
||||
|
||||
double reduction = getArmorReductionPerLevel() * (instance.getAmplifier() + 1);
|
||||
if(reduction <= 0.0D) return;
|
||||
|
||||
AttributeInstance armor = entity.getAttribute(Attributes.ARMOR);
|
||||
if(armor != null) {
|
||||
armor.addTransientModifier(new AttributeModifier(
|
||||
ARMOR_REDUCTION_ID,
|
||||
-reduction,
|
||||
AttributeModifier.Operation.ADD_VALUE
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeArmorReduction(LivingEntity entity) {
|
||||
AttributeInstance armor = entity.getAttribute(Attributes.ARMOR);
|
||||
if(armor != null) armor.removeModifier(ARMOR_REDUCTION_ID);
|
||||
}
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"betsys_curse",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/mob_effect/betsys_curse.png"),
|
||||
Component.translatable("effect.lzxnoneterraria.betsys_curse"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
public BetsysCurseEffect() {
|
||||
super(MobEffectCategory.HARMFUL, 0x8A2BE2);
|
||||
}
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.08f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(0.85F, 0.25F, 1.0F),
|
||||
new Vector3f(0.6F, 0.0F, 0.85F),
|
||||
new Vector3f(0.35F, 0.0F, 0.55F),
|
||||
new Vector3f(0.2F, 0.0F, 0.35F),
|
||||
}
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
if(entity.level() instanceof ServerLevel serverLevel) {
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
entity.getBoundingBox().getCenter(), new Vec3(0, 0, 0),
|
||||
0.25, 1
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ public class ModEffects {
|
||||
MOB_EFFECTS.register("cursed_inferno", CursedInfernoEffect::new);
|
||||
public static final DeferredHolder<MobEffect, IchorEffect> ICHOR =
|
||||
MOB_EFFECTS.register("ichor", IchorEffect::new);
|
||||
public static final DeferredHolder<MobEffect, BetsysCurseEffect> BETSYS_CURSE =
|
||||
MOB_EFFECTS.register("betsys_curse", BetsysCurseEffect::new);
|
||||
public static final DeferredHolder<MobEffect, AcidVenomEffect> ACID_VENOM =
|
||||
MOB_EFFECTS.register("acid_venom", AcidVenomEffect::new);
|
||||
public static final DeferredHolder<MobEffect, SummonEffect> SUMMON =
|
||||
|
||||
@@ -40,27 +40,6 @@ public class ModRenderTypes {
|
||||
);
|
||||
}
|
||||
|
||||
public static RenderType entityTranslucentEmissiveTriangles(ResourceLocation texture) {
|
||||
return RenderType.create(
|
||||
"m_entity_translucent_emissive_triangles",
|
||||
DefaultVertexFormat.NEW_ENTITY,
|
||||
VertexFormat.Mode.TRIANGLES,
|
||||
1536,
|
||||
false,
|
||||
false,
|
||||
RenderType.CompositeState.builder()
|
||||
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setTransparencyState(RenderStateShard.TRANSLUCENT_TRANSPARENCY)
|
||||
.setCullState(RenderStateShard.NO_CULL)
|
||||
.setLightmapState(RenderStateShard.NO_LIGHTMAP)
|
||||
.setOverlayState(RenderStateShard.OVERLAY)
|
||||
.setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
|
||||
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
|
||||
.createCompositeState(true)
|
||||
);
|
||||
}
|
||||
|
||||
public static RenderType entitySolidEmissiveTriangles(ResourceLocation texture) {
|
||||
return RenderType.create(
|
||||
"m_entity_solid_emissive_triangles",
|
||||
@@ -103,27 +82,6 @@ public class ModRenderTypes {
|
||||
);
|
||||
}
|
||||
|
||||
public static RenderType entityAdditiveEmissiveTriangles(ResourceLocation texture) {
|
||||
return RenderType.create(
|
||||
"m_entity_additive_emissive_triangles",
|
||||
DefaultVertexFormat.NEW_ENTITY,
|
||||
VertexFormat.Mode.TRIANGLES,
|
||||
1536,
|
||||
false,
|
||||
false,
|
||||
RenderType.CompositeState.builder()
|
||||
.setShaderState(RenderStateShard.RENDERTYPE_ENTITY_TRANSLUCENT_EMISSIVE_SHADER)
|
||||
.setTextureState(new RenderStateShard.TextureStateShard(texture, false, false))
|
||||
.setTransparencyState(ADDITIVE_TRANSPARENCY)
|
||||
.setCullState(RenderStateShard.NO_CULL)
|
||||
.setLightmapState(RenderStateShard.NO_LIGHTMAP)
|
||||
.setOverlayState(RenderStateShard.OVERLAY)
|
||||
.setDepthTestState(RenderStateShard.LEQUAL_DEPTH_TEST)
|
||||
.setWriteMaskState(RenderStateShard.COLOR_DEPTH_WRITE)
|
||||
.createCompositeState(true)
|
||||
);
|
||||
}
|
||||
|
||||
public static RenderType entityTranslucent(ResourceLocation texture) {
|
||||
return RenderType.create(
|
||||
"m_entity_translucent",
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.lzxnone.terraria.entity.summon;
|
||||
import com.lzxnone.terraria.item.ammo.*;
|
||||
import com.lzxnone.terraria.item.normal.FallenStar;
|
||||
import com.lzxnone.terraria.item.normal.ManaStar;
|
||||
import com.lzxnone.terraria.item.weapon.magic.BetsyWrath;
|
||||
import com.lzxnone.terraria.item.weapon.magic.BubbleGun;
|
||||
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
|
||||
import com.lzxnone.terraria.item.weapon.ranged.ElfMelter;
|
||||
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||
@@ -46,6 +49,9 @@ public class StaticSummonBehaviors {
|
||||
public static final String DEVILS_DEVASTATION_MARK_LIGHTNING = "devils_devastation_mark_lightning";
|
||||
public static final String LAST_PRISM_TRI = "last_prism_tri";
|
||||
public static final String LAST_PRISM_BEAM = "last_prism_beam";
|
||||
public static final String BETSY_WRATH = "betsys_wrath";
|
||||
public static final String LUNAR_FLARE = "lunar_flare";
|
||||
public static final String BUBBLE = "bubble";
|
||||
public static final String TERRAPRISMA = "terraprisma";
|
||||
public static final String STARDUST_DRAGON_STAFF = "stardust_dragon_staff";
|
||||
public static final String POSSESSION = "possession";
|
||||
@@ -100,6 +106,9 @@ public class StaticSummonBehaviors {
|
||||
BEHAVIORS.put(DEVILS_DEVASTATION_MARK_LIGHTNING, DevilsDevastation.SUMMON_BEHAVIOR4);
|
||||
BEHAVIORS.put(LAST_PRISM_TRI, LastPrism.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(LAST_PRISM_BEAM, LastPrism.SUMMON_BEHAVIOR2);
|
||||
BEHAVIORS.put(BETSY_WRATH, BetsyWrath.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(LUNAR_FLARE, LunarFlare.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(BUBBLE, BubbleGun.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(TERRAPRISMA, Terraprisma.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(STARDUST_DRAGON_STAFF, StardustDragonStaff.SUMMON_BEHAVIOR);
|
||||
BEHAVIORS.put(POSSESSION, Whip.SUMMON_BEHAVIOR);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.lzxnone.terraria.attachment.PlayerMana;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.effect.BetsysCurseEffect;
|
||||
import com.lzxnone.terraria.effect.IchorEffect;
|
||||
import com.lzxnone.terraria.effect.MidasEffect;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
@@ -24,10 +25,12 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.tags.DamageTypeTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.damagesource.DamageTypes;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.monster.Enemy;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
@@ -37,11 +40,13 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingDamageEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent;
|
||||
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||
import net.neoforged.neoforge.event.tick.PlayerTickEvent;
|
||||
|
||||
import java.util.List;
|
||||
@@ -53,6 +58,53 @@ public class EntityEventHandler {
|
||||
//魔力星掉落概率
|
||||
private static final double MANA_STAR_DROP_CHANCE = 1.0D / 9.0D;
|
||||
|
||||
//吸引掉落物
|
||||
private static final double ITEM_PICKUP_PROBE_RANGE = 16.0D;
|
||||
private static final double ITEM_ATTRACT_MIN_SPEED = 0.08D;
|
||||
private static final double ITEM_ATTRACT_MAX_SPEED = 0.6D;
|
||||
private static final double ITEM_ATTRACT_SPEED_SCALE = 0.18D;
|
||||
private static final double ITEM_ATTRACT_EXISTING_MOTION_SCALE = 0.6D;
|
||||
private static final double ITEM_PICKUP_TOUCH_RANGE_SQR = 1.2D * 1.2D;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onEntityTick(EntityTickEvent.Post event) {
|
||||
if(!(event.getEntity() instanceof ItemEntity itemEntity)) return;
|
||||
if(!(itemEntity.level() instanceof ServerLevel serverLevel)) return;
|
||||
if(!itemEntity.isAlive() || itemEntity.getItem().isEmpty() || itemEntity.hasPickUpDelay()) return;
|
||||
|
||||
ServerPlayer target = null;
|
||||
double bestScore = Double.MAX_VALUE;
|
||||
List<ServerPlayer> players = serverLevel.getEntitiesOfClass(
|
||||
ServerPlayer.class,
|
||||
itemEntity.getBoundingBox().inflate(ITEM_PICKUP_PROBE_RANGE),
|
||||
player -> player.isAlive() && !player.isSpectator()
|
||||
);
|
||||
for(ServerPlayer player : players) {
|
||||
double range = AccessoryUtil.getEffectivePickupRange(player, itemEntity.getItem().getItem());
|
||||
if(range <= 0.0D) continue;
|
||||
double distanceSqr = itemEntity.distanceToSqr(player);
|
||||
if(distanceSqr > range * range) continue;
|
||||
if(distanceSqr < bestScore) {
|
||||
bestScore = distanceSqr;
|
||||
target = player;
|
||||
}
|
||||
}
|
||||
if(target == null) return;
|
||||
|
||||
if(itemEntity.distanceToSqr(target) <= ITEM_PICKUP_TOUCH_RANGE_SQR) {
|
||||
itemEntity.playerTouch(target);
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 toPlayer = target.getEyePosition().subtract(itemEntity.position());
|
||||
double distance = toPlayer.length();
|
||||
if(distance < 1.0E-4D) return;
|
||||
double speed = Mth.clamp(distance * ITEM_ATTRACT_SPEED_SCALE, ITEM_ATTRACT_MIN_SPEED, ITEM_ATTRACT_MAX_SPEED);
|
||||
Vec3 attractMotion = toPlayer.scale(speed / distance);
|
||||
itemEntity.setDeltaMovement(itemEntity.getDeltaMovement().scale(ITEM_ATTRACT_EXISTING_MOTION_SCALE).add(attractMotion));
|
||||
itemEntity.hasImpulse = true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingIncomingDamage(LivingIncomingDamageEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
@@ -87,6 +139,7 @@ public class EntityEventHandler {
|
||||
if(!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
if(attacker instanceof LivingEntity livingEntity) AccessoryUtil.applyTargetArmorModifiers(livingEntity, entity);
|
||||
IchorEffect.applyArmorReduction(entity);
|
||||
BetsysCurseEffect.applyArmorReduction(entity);
|
||||
}
|
||||
//近战攻击命中时点燃目标
|
||||
if(attacker instanceof LivingEntity livingAttacker && livingAttacker != entity) {
|
||||
@@ -100,12 +153,8 @@ public class EntityEventHandler {
|
||||
|| source.is(DamageTypes.ON_FIRE) || source.is(DamageTypes.IN_FIRE) || source.is(DamageTypes.WITHER);
|
||||
double manaMultiplier = AccessoryUtil.getManaOnHurtMultiplier(player);
|
||||
if(!isDebuffDamage && manaMultiplier > 0.0D) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int recover = (int) Math.round(event.getAmount() * manaMultiplier);
|
||||
if(recover > 0 && mana.recoverManaImmediately(recover)) {
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
PlayerManaSyncEventHandler.sync((ServerPlayer) player);
|
||||
}
|
||||
if(recover > 0 && player instanceof ServerPlayer serverPlayer) PlayerMana.recoverMana(serverPlayer, recover);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,6 +177,7 @@ public class EntityEventHandler {
|
||||
//移除饰品加成护甲穿透
|
||||
AccessoryUtil.removeTargetArmorModifiers(event.getEntity());
|
||||
IchorEffect.removeArmorReduction(event.getEntity());
|
||||
BetsysCurseEffect.removeArmorReduction(event.getEntity());
|
||||
//暴击
|
||||
if(attacker instanceof LivingEntity livingEntity && attacker != target) {
|
||||
double critChance = AccessoryUtil.getCritChance(livingEntity);
|
||||
|
||||
@@ -48,9 +48,7 @@ public class PlayerManaSyncEventHandler {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int bonus = AccessoryUtil.getMaxManaBonus(player);
|
||||
if(mana.getBonusMaxMana() != bonus) {
|
||||
mana.setBonusMaxMana(bonus);
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
sync(player);
|
||||
PlayerMana.setBonusMaxMana(player, bonus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,15 +61,8 @@ public class PlayerManaSyncEventHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
int oldMana = mana.getMana();
|
||||
double regenBonus = AccessoryUtil.getManaRegenBonus(player, mana.getMana(), mana.getMaxMana());
|
||||
if(!mana.recoverMana(PlayerMana.DEFAULT_RECOVER_RATE + regenBonus)) return;
|
||||
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
if(mana.getMana() != oldMana) {
|
||||
playMaxManaSoundIfRecovered(player, oldMana, mana);
|
||||
sync(player);
|
||||
}
|
||||
PlayerMana.recoverMana(player, PlayerMana.DEFAULT_RECOVER_RATE + regenBonus);
|
||||
}
|
||||
|
||||
public static void sync(ServerPlayer player) {
|
||||
|
||||
@@ -55,6 +55,9 @@ public class ModItems {
|
||||
|
||||
//魔法武器
|
||||
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
|
||||
public static final DeferredItem<Item> BETSY_WRATH = ITEMS.register("betsys_wrath", BetsyWrath::new);
|
||||
public static final DeferredItem<Item> LUNAR_FLARE = ITEMS.register("lunar_flare", LunarFlare::new);
|
||||
public static final DeferredItem<Item> BUBBLE_GUN = ITEMS.register("bubble_gun", BubbleGun::new);
|
||||
|
||||
//远程武器
|
||||
public static final DeferredItem<Item> MUSKET = ITEMS.register("musket", Musket::new);
|
||||
@@ -244,6 +247,7 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> LUMINITE_BULLET_PROJECTILE = ITEMS.register("luminite_bullet_projectile", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> WHITE_STAR = ITEMS.register("white_star", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> MANA_STAR = ITEMS.register("mana_star", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> BUBBLE_GUN_PROJECTILE = ITEMS.register("bubble_gun_projectile", () -> new Item(new Item.Properties()));
|
||||
|
||||
public static final DeferredItem<Item> ENCHANTED_SWORD_BEAM = ITEMS.register("enchanted_sword_beam", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredItem<Item> STARFURY_STAR = ITEMS.register("starfury_star", () -> new Item(new Item.Properties()));
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.core.particles.BlockParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -18,6 +19,10 @@ public class Ammo extends Item {
|
||||
super(new Item.Properties().stacksTo(MAX_STACK_SIZE));
|
||||
}
|
||||
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public static void playBlockHitEffects(ServerLevel level, BlockHitResult blockHitResult) {
|
||||
BlockState hitState = level.getBlockState(blockHitResult.getBlockPos());
|
||||
ParticleUtil.addParticles(
|
||||
|
||||
@@ -254,4 +254,9 @@ public class ChlorophyteBullet extends BulletAmmo {
|
||||
summon.xRotO = xyRot[0];
|
||||
summon.yRotO = xyRot[1];
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -179,4 +179,9 @@ public class CrystalBullet extends BulletAmmo {
|
||||
projectile.setDeltaMovement(MathUtil.toVec3(dirs[0]));
|
||||
summon.level().addFreshEntity(projectile);
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,4 +100,9 @@ public class CursedBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -135,4 +135,9 @@ public class ExplodingBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,4 +100,9 @@ public class GoldenBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -107,4 +107,9 @@ public class HighVelocityBullet extends BulletAmmo {
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
return hit;
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,4 +100,9 @@ public class IchorBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -118,4 +118,9 @@ public class LuminiteBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -129,4 +129,9 @@ public class MeteorShot extends BulletAmmo {
|
||||
summon.setYRot(xyRot[1]);
|
||||
summon.yRotO = xyRot[1];
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,4 +90,9 @@ public class MusketBall extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,4 +136,9 @@ public class NanoBullet extends BulletAmmo {
|
||||
summon.setYRot(xyRot[1]);
|
||||
summon.yRotO = xyRot[1];
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,4 +106,9 @@ public class PartyBullet extends BulletAmmo {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,4 +99,9 @@ public class SilverBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,4 +90,9 @@ public class TungstenBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,4 +100,9 @@ public class VenomBullet extends BulletAmmo {
|
||||
summon.setPos(end);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -109,4 +109,9 @@ public class WoodenArrow extends ArrowAmmo {
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
}
|
||||
@Override
|
||||
public float getBaseDamage(ItemStack stack) {
|
||||
return BASE_DAMAGE.get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.lzxnone.terraria.item.food;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.attachment.PlayerMana;
|
||||
import com.lzxnone.terraria.event.PlayerManaSyncEventHandler;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -33,14 +32,13 @@ public class ManaCrystal extends Food {
|
||||
|
||||
@Override
|
||||
protected boolean onEat(Level level, Player player, ItemStack stack) {
|
||||
if(!(player instanceof ServerPlayer serverPlayer)) return false;
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
if(mana.increaseBaseMaxMana(MANA_INCREASE) <= 0) return false;
|
||||
int baseMaxMana = mana.getBaseMaxMana();
|
||||
if(baseMaxMana >= PlayerMana.MAX_BASE_MANA) return false;
|
||||
if(!PlayerMana.setBaseMaxMana(serverPlayer, Math.min(baseMaxMana + MANA_INCREASE, PlayerMana.MAX_BASE_MANA))) return false;
|
||||
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
if(player instanceof ServerPlayer serverPlayer) {
|
||||
PlayerManaSyncEventHandler.sync(serverPlayer);
|
||||
SoundUtil.playServerSound(player, ModSounds.GET_MANA.get(), 0.5f, 1.0f);
|
||||
}
|
||||
player.playNotifySound(ModSounds.GET_MANA.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.lzxnone.terraria.item.normal;
|
||||
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.attachment.PlayerMana;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.event.PlayerManaSyncEventHandler;
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -71,13 +69,9 @@ public class ManaStar extends Item {
|
||||
summon.setDeltaMovement(dir.scale(ATTRACT_SPEED));
|
||||
}
|
||||
if(dist <= PICKUP_RADIUS) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
int amount = customData.contains("mana") ? customData.getInt("mana") : 0;
|
||||
if(mana.recoverManaImmediately(amount)) {
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
}
|
||||
PlayerMana.recoverMana(player, amount);
|
||||
onDied(summon);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.lzxnone.terraria.item.potion;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.attachment.PlayerMana;
|
||||
import com.lzxnone.terraria.effect.ManaSicknessEffect;
|
||||
import com.lzxnone.terraria.event.PlayerManaSyncEventHandler;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -20,14 +19,9 @@ public abstract class AbstractManaPotion extends Potion {
|
||||
|
||||
@Override
|
||||
protected boolean onDrink(ServerPlayer player, ItemStack stack) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
if(!mana.recoverManaImmediately(getRecoverAmount())) return false;
|
||||
if(!PlayerMana.recoverMana(player, getRecoverAmount())) return false;
|
||||
|
||||
ManaSicknessEffect.applyTo(player);
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
PlayerManaSyncEventHandler.playMaxManaSoundIfRecovered(player, oldMana, mana);
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +1,136 @@
|
||||
package com.lzxnone.terraria.item.weapon;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.attachment.PlayerMana;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||
import com.lzxnone.terraria.event.PlayerManaSyncEventHandler;
|
||||
import com.lzxnone.terraria.effect.ManaSicknessEffect;
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.lzxnone.terraria.item.effect.AutoManaPotionUser;
|
||||
import com.lzxnone.terraria.item.effect.MagicDamageModifier;
|
||||
import com.lzxnone.terraria.item.effect.ManaCostModifier;
|
||||
import com.lzxnone.terraria.item.effect.SummonDamageModifier;
|
||||
import com.lzxnone.terraria.item.potion.AbstractManaPotion;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
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.Tier;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MagicWeapon extends Weapon {
|
||||
public MagicWeapon(Tier tier, Properties properties) {
|
||||
super(tier, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
if(player.getCooldowns().isOnCooldown(stack.getItem())) return InteractionResultHolder.fail(stack);
|
||||
player.startUsingItem(hand);
|
||||
|
||||
if(level.isClientSide()) return InteractionResultHolder.consume(stack);
|
||||
if(!tryShoot(level, player, hand, stack)) return InteractionResultHolder.fail(stack);
|
||||
player.getCooldowns().addCooldown(stack.getItem(), Math.max(1, getUseTime(stack, player) / 3));
|
||||
return InteractionResultHolder.consume(stack);
|
||||
}
|
||||
|
||||
public boolean shouldShootThisTick(ItemStack weaponStack, LivingEntity entity, int remainingUseTicks) {
|
||||
int useTime = Math.max(1, getUseTime(weaponStack, entity));
|
||||
int elapsedMinecraftTicks = getUseDuration(weaponStack, entity) - remainingUseTicks;
|
||||
if(elapsedMinecraftTicks <= 0) return false;
|
||||
|
||||
int currentShot = elapsedMinecraftTicks * 3 / useTime;
|
||||
int previousShot = (elapsedMinecraftTicks - 1) * 3 / useTime;
|
||||
return currentShot > previousShot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUseTick(Level level, LivingEntity entity, ItemStack stack, int count) {
|
||||
if(!canUseMagic(stack, entity)) {
|
||||
entity.stopUsingItem();
|
||||
return;
|
||||
}
|
||||
if(level.isClientSide()) return;
|
||||
if(!(entity instanceof Player player)) return;
|
||||
if(!shouldShootThisTick(stack, entity, count)) return;
|
||||
|
||||
if(!level.isClientSide()) {
|
||||
if(!tryConsumeMana(level, entity, stack, getFinalManaConsumeRate(stack, entity))) {
|
||||
entity.stopUsingItem();
|
||||
return;
|
||||
if(!tryShoot(level, player, player.getUsedItemHand(), stack)) {
|
||||
player.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
onMagicUseTick(level, entity, stack, count);
|
||||
@Override
|
||||
public int getUseDuration(ItemStack stack, LivingEntity entity) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, 0.0F) : 0.0F;
|
||||
return applyMagicDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull UseAnim getUseAnimation(ItemStack stack) {
|
||||
return UseAnim.BLOCK;
|
||||
}
|
||||
|
||||
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean tryShoot(Level level, Player player, InteractionHand hand, ItemStack weaponStack) {
|
||||
double manaConsume = getFinalManaConsumeRate(weaponStack, player);
|
||||
if(!tryConsumeMana(player, manaConsume)) return false;
|
||||
|
||||
shoot(level, player, hand, weaponStack);
|
||||
return true;
|
||||
}
|
||||
|
||||
//尝试消耗魔力
|
||||
protected boolean tryConsumeMana(Player player, double amount) {
|
||||
//创造模式
|
||||
if(amount <= 0.0D || player.hasInfiniteMaterials()) return true;
|
||||
if(!(player instanceof ServerPlayer serverPlayer)) return false;
|
||||
//直接消耗
|
||||
if(PlayerMana.consumeMana(serverPlayer, amount)) return true;
|
||||
|
||||
//自动喝药
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
double targetMana = Math.max(1.0D, Math.floor(mana.getConsumeProgress() + amount));
|
||||
if(!tryAutoUseManaPotionToReachTarget(player, targetMana)) return false;
|
||||
return PlayerMana.consumeMana(serverPlayer, amount);
|
||||
}
|
||||
|
||||
//使用魔法武器时
|
||||
protected void onMagicUseTick(Level level, LivingEntity entity, ItemStack stack, int count) {}
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {}
|
||||
|
||||
//提供基础魔力消耗
|
||||
protected double getManaConsumeRate(ItemStack stack, LivingEntity entity) { return 0.0D; }
|
||||
|
||||
protected double getManaTooltipValue(ItemStack stack) {
|
||||
return getManaConsumeRate(stack, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, Item.TooltipContext context,
|
||||
List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
|
||||
double mana = getManaTooltipValue(stack);
|
||||
if(mana > 0.0D) {
|
||||
tooltipComponents.add(Component.translatable(
|
||||
"tooltip.lzxnoneterraria.magic_weapon_mana",
|
||||
mana == Math.rint(mana) ? String.valueOf((int) mana) : String.format("%.2f", mana)
|
||||
).withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
|
||||
//获取最终魔力消耗
|
||||
protected double getFinalManaConsumeRate(ItemStack stack, LivingEntity entity) {
|
||||
double rate = getManaConsumeRate(stack, entity);
|
||||
@@ -87,61 +170,65 @@ public class MagicWeapon extends Weapon {
|
||||
return (float) Math.max(0.0D, finalDamage);
|
||||
}
|
||||
|
||||
//是否可以继续使用魔法武器
|
||||
protected boolean canUseMagic(ItemStack stack, LivingEntity entity) {
|
||||
if(entity.hasInfiniteMaterials()) return true;
|
||||
if(entity instanceof Player player) {
|
||||
if(player.getData(ModAttachments.PLAYER_MANA).hasMana()) return true;
|
||||
if(player instanceof ServerPlayer serverPlayer) return tryAutoUseManaPotion(serverPlayer);
|
||||
return canAutoUseManaPotion(player) && findManaPotionSlot(player) >= 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//进行魔力消耗
|
||||
protected boolean tryConsumeMana(Level level, LivingEntity entity, ItemStack stack, double amount) {
|
||||
if(amount <= 0.0D || entity.hasInfiniteMaterials()) return true;
|
||||
if(!(entity instanceof ServerPlayer player)) return true;
|
||||
|
||||
protected static boolean tryAutoUseManaPotionToReachTarget(Player player, double targetMana) {
|
||||
PlayerMana mana = player.getData(ModAttachments.PLAYER_MANA);
|
||||
int oldMana = mana.getMana();
|
||||
boolean canContinue = mana.consumeMana(amount);
|
||||
mana.applyRecoverDelay();
|
||||
player.setData(ModAttachments.PLAYER_MANA, mana);
|
||||
if(mana.getMana() != oldMana) {
|
||||
PlayerManaSyncEventHandler.sync(player);
|
||||
}
|
||||
if(canContinue) return true;
|
||||
return tryAutoUseManaPotion(player);
|
||||
}
|
||||
if(targetMana <= 0.0D || mana.getMana() >= targetMana) return true;
|
||||
if(mana.getMaxMana() < targetMana) return false;
|
||||
|
||||
private static int findManaPotionSlot(Player player) {
|
||||
for(int i = 0; i < player.getInventory().getContainerSize(); i++) {
|
||||
ItemStack stack = player.getInventory().getItem(i);
|
||||
if(stack.getItem() instanceof AbstractManaPotion potion) {
|
||||
if(potion.getRecoverAmount() > 0) return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static boolean canAutoUseManaPotion(LivingEntity entity) {
|
||||
boolean[] result = {false};
|
||||
AccessoryUtil.forEachAccessory(entity, (accessory, stack) -> {
|
||||
if(accessory instanceof AutoManaPotionUser autoUser && autoUser.canAutoUseManaPotion(stack, entity)) {
|
||||
AccessoryUtil.forEachAccessory(player, (accessory, stack) -> {
|
||||
if(accessory instanceof AutoManaPotionUser autoUser && autoUser.canAutoUseManaPotion(stack, player)) {
|
||||
result[0] = true;
|
||||
}
|
||||
});
|
||||
return result[0];
|
||||
if(!result[0]) return false;
|
||||
|
||||
if(!(player instanceof ServerPlayer serverPlayer)) {
|
||||
int simulatedMana = mana.getMana();
|
||||
for(int i = 0; i < player.getInventory().getContainerSize() && simulatedMana < targetMana; i++) {
|
||||
ItemStack stack = player.getInventory().getItem(i);
|
||||
if(!(stack.getItem() instanceof AbstractManaPotion potion)) continue;
|
||||
int recoverAmount = potion.getRecoverAmount();
|
||||
if(recoverAmount <= 0) continue;
|
||||
for(int j = 0; j < stack.getCount() && simulatedMana < targetMana; j++) {
|
||||
simulatedMana = Math.min(mana.getMaxMana(), simulatedMana + recoverAmount);
|
||||
}
|
||||
}
|
||||
return simulatedMana >= targetMana;
|
||||
}
|
||||
|
||||
private static boolean tryAutoUseManaPotion(ServerPlayer player) {
|
||||
if(!canAutoUseManaPotion(player)) return false;
|
||||
int slot = findManaPotionSlot(player);
|
||||
if(slot < 0) return false;
|
||||
ItemStack stack = player.getInventory().getItem(slot);
|
||||
while(serverPlayer.getData(ModAttachments.PLAYER_MANA).getMana() < targetMana) {
|
||||
mana = serverPlayer.getData(ModAttachments.PLAYER_MANA);
|
||||
int bestSlot = -1;
|
||||
int bestRecoverAmount = 0;
|
||||
int smallestSufficientRecoverAmount = Integer.MAX_VALUE;
|
||||
for(int i = 0; i < serverPlayer.getInventory().getContainerSize(); i++) {
|
||||
ItemStack stack = serverPlayer.getInventory().getItem(i);
|
||||
if(!(stack.getItem() instanceof AbstractManaPotion potion)) continue;
|
||||
int recoverAmount = potion.getRecoverAmount();
|
||||
if(recoverAmount <= 0) continue;
|
||||
int manaAfterDrink = Math.min(mana.getMaxMana(), mana.getMana() + recoverAmount);
|
||||
if(manaAfterDrink <= mana.getMana()) continue;
|
||||
if(manaAfterDrink >= targetMana) {
|
||||
if(recoverAmount < smallestSufficientRecoverAmount) {
|
||||
bestSlot = i;
|
||||
bestRecoverAmount = recoverAmount;
|
||||
smallestSufficientRecoverAmount = recoverAmount;
|
||||
}
|
||||
}else if(smallestSufficientRecoverAmount == Integer.MAX_VALUE && recoverAmount > bestRecoverAmount) {
|
||||
bestSlot = i;
|
||||
bestRecoverAmount = recoverAmount;
|
||||
}
|
||||
}
|
||||
if(bestSlot < 0) return false;
|
||||
|
||||
ItemStack stack = serverPlayer.getInventory().getItem(bestSlot);
|
||||
if(!(stack.getItem() instanceof AbstractManaPotion potion)) return false;
|
||||
return potion.tryDrink(player, stack);
|
||||
int oldMana = mana.getMana();
|
||||
if(!potion.tryDrink(serverPlayer, stack)) return false;
|
||||
if(serverPlayer.getData(ModAttachments.PLAYER_MANA).getMana() <= oldMana) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,32 @@
|
||||
package com.lzxnone.terraria.item.weapon;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.lzxnone.terraria.item.effect.MeleeDamageModifier;
|
||||
import com.lzxnone.terraria.item.effect.MeleeKnockbackModifier;
|
||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
||||
public class MeleeWeapon extends Weapon {
|
||||
private static final float BASE_MELEE_DAMAGE_MIN = 0.0F;
|
||||
private static final float BASE_MELEE_DAMAGE_MAX = 8388600.0F;
|
||||
private static final float BASE_MELEE_ATTACK_SPEED_MIN = -100.0F;
|
||||
private static final float BASE_MELEE_ATTACK_SPEED_MAX = 100.0F;
|
||||
private static final ResourceLocation BASE_MELEE_DAMAGE_ID = ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_melee_damage");
|
||||
private static final ResourceLocation BASE_MELEE_ATTACK_SPEED_ID = ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_melee_attack_speed");
|
||||
|
||||
public MeleeWeapon(Tier tier, Properties properties) {
|
||||
super(tier, properties);
|
||||
}
|
||||
@@ -16,6 +35,60 @@ public class MeleeWeapon extends Weapon {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public static ConfigFloat createBaseMeleeDamageConfig(String id, float damageDefault) {
|
||||
return new ConfigFloat(baseMeleeDamagePath(id), "base_melee_damage", damageDefault, BASE_MELEE_DAMAGE_MIN, BASE_MELEE_DAMAGE_MAX);
|
||||
}
|
||||
|
||||
public static ConfigFloat createBaseMeleeAttackSpeedConfig(String id, float attackSpeedDefault) {
|
||||
return new ConfigFloat(baseMeleeAttackSpeedPath(id), "base_melee_attack_speed", attackSpeedDefault, BASE_MELEE_ATTACK_SPEED_MIN, BASE_MELEE_ATTACK_SPEED_MAX);
|
||||
}
|
||||
|
||||
public static IConfigData createConfigData(ConfigStruct... configs) {
|
||||
return new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(configs);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static ConfigListItem createConfigListItem(String id, IConfigData configData) {
|
||||
return new ConfigListItem(
|
||||
id,
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/" + id + ".png"),
|
||||
Component.translatable("item.lzxnoneterraria." + id),
|
||||
configData
|
||||
);
|
||||
}
|
||||
|
||||
private static String baseMeleeDamagePath(String id) {
|
||||
return "weapon." + id + ".base_melee_damage";
|
||||
}
|
||||
|
||||
private static String baseMeleeAttackSpeedPath(String id) {
|
||||
return "weapon." + id + ".base_melee_attack_speed";
|
||||
}
|
||||
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return -2.4F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemAttributeModifiers getDefaultAttributeModifiers(ItemStack stack) {
|
||||
return ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(BASE_MELEE_DAMAGE_ID, getBaseMeleeDamage(stack), AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(BASE_MELEE_ATTACK_SPEED_ID, getBaseMeleeAttackSpeed(stack), AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static float applyMeleeDamageBonus(ItemStack stack, LivingEntity entity, float damage) {
|
||||
double finalDamage = damage;
|
||||
//饰品
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.lzxnone.terraria.item.weapon;
|
||||
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||
import com.lzxnone.terraria.item.ammo.Ammo;
|
||||
import com.lzxnone.terraria.item.ModItemTags;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.lzxnone.terraria.item.effect.RangedDamageModifier;
|
||||
import com.lzxnone.terraria.item.effect.SummonDamageModifier;
|
||||
import com.lzxnone.terraria.item.weapon.ranged.bow.Bow;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
@@ -55,13 +57,24 @@ public class RangedWeapon extends Weapon {
|
||||
return null;
|
||||
}
|
||||
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, 0.0F) : 0.0F;
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
protected float getAmmoBaseDamage(ItemStack ammoStack) {
|
||||
return ammoStack.getItem() instanceof Ammo ammo ? ammo.getBaseDamage(ammoStack) : 0.0F;
|
||||
}
|
||||
|
||||
public static float applyRangedDamageBonus(ItemStack stack, LivingEntity entity, float damage) {
|
||||
double finalDamage = damage;
|
||||
//力量
|
||||
if(stack.getItem() instanceof Bow) {
|
||||
int powerLevel = getEnchantmentLevel(entity, stack, Enchantments.POWER);
|
||||
if (powerLevel > 0) {
|
||||
finalDamage *= 1.0D + 0.2D * powerLevel;
|
||||
}
|
||||
}
|
||||
//火药
|
||||
if(stack.is(ModItemTags.GUNPOWDER_WEAPONS)) {
|
||||
int gunpowderLevel = getEnchantmentLevel(entity, stack, ModEnchantments.GUNPOWDER);
|
||||
@@ -172,11 +185,6 @@ public class RangedWeapon extends Weapon {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public boolean isSelectedAmmo(ItemStack weaponStack, ItemStack ammoStack) {
|
||||
ItemStack selectedAmmo = getAmmoStack(weaponStack);
|
||||
return isAmmoStack(selectedAmmo, ammoStack);
|
||||
}
|
||||
|
||||
protected ItemStack findAmmoItem(Player player, ItemStack ammoStack) {
|
||||
if(ammoStack.isEmpty()) return ItemStack.EMPTY;
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.lzxnone.terraria.item.effect.SummonDamageModifier;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tier;
|
||||
|
||||
@@ -13,6 +15,11 @@ public class SummonWeapon extends Weapon {
|
||||
super(tier, properties);
|
||||
}
|
||||
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, 0.0F) : 0.0F;
|
||||
return applySummonDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
public static float applySummonDamageBonus(ItemStack stack, LivingEntity entity, float damage) {
|
||||
double finalDamage = damage;
|
||||
//召唤增幅
|
||||
|
||||
@@ -2,19 +2,24 @@ package com.lzxnone.terraria.item.weapon;
|
||||
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.lzxnone.terraria.item.effect.DamageModifier;
|
||||
import com.lzxnone.terraria.item.effect.MeleeDamageModifier;
|
||||
import com.lzxnone.terraria.item.ModItemTags;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
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.Tier;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Weapon extends Item {
|
||||
private final int enchantmentValue;
|
||||
|
||||
@@ -56,6 +61,17 @@ public class Weapon extends Item {
|
||||
return enchantmentValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, Item.TooltipContext context,
|
||||
List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||
if(stack.is(ModItemTags.SPREAD_RANGED_WEAPONS)) {
|
||||
tooltipComponents.add(Component.translatable(
|
||||
"tooltip.lzxnoneterraria.spread_ranged_weapon"
|
||||
).withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
|
||||
}
|
||||
|
||||
public static int getEnchantmentLevel(LivingEntity entity, ItemStack stack, ResourceKey<Enchantment> enchantment) {
|
||||
return entity.registryAccess()
|
||||
.lookupOrThrow(Registries.ENCHANTMENT)
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
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.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
import com.lzxnone.terraria.item.ammo.Ammo;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
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.CollisionUtil;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.effect.MobEffectInstance;
|
||||
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.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;
|
||||
|
||||
public class BetsyWrath extends MagicWeapon {
|
||||
public static final double SIDE_ANGLE = 5.0D;
|
||||
public static final double SPEED = 2.4D;
|
||||
public static final double GRAVITY = 0.05D;
|
||||
public static final double MAX_GRAVITY = 0.22D;
|
||||
public static final double MIN_TICKS_TO_TARGET = 8.0D;
|
||||
public static final double MIN_ARC_HEIGHT = 1.25D;
|
||||
public static final double MAX_ARC_HEIGHT = 6.0D;
|
||||
public static final double ARC_HEIGHT_PER_BLOCK = 0.12D;
|
||||
public static final double HITBOX_INFLATE = 0.5D;
|
||||
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.betsys_wrath.damage", "betsys_wrath_damage", 10.0F, 0.0F, 8388600.0F);
|
||||
public static final ConfigDouble RANGE = new ConfigDouble("weapon.betsys_wrath.range", "betsys_wrath_range", 64.0D, 0.0D, 512.0D);
|
||||
public static final ConfigDouble EXPLOSION_RANGE = new ConfigDouble("weapon.betsys_wrath.explosion_range", "betsys_wrath_explosion_range", 3.5D, 0.0D, 64.0D);
|
||||
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.betsys_wrath.mana_consume", "betsys_wrath_mana_consume", 14.0D, 0.0D, 10000.0D);
|
||||
public static final ConfigInt BUFF_DURATION = new ConfigInt("weapon.betsys_wrath.buff_duration", "betsys_wrath_buff_duration", 200, 0, 72000);
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(DAMAGE, RANGE, EXPLOSION_RANGE, MANA_CONSUME, BUFF_DURATION);
|
||||
}
|
||||
};
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"betsys_wrath",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/betsys_wrath.png"),
|
||||
Component.translatable("item.lzxnoneterraria.betsys_wrath"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
//黄
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.08f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(1.0F, 1.0F, 0.6F),
|
||||
new Vector3f(1.0F, 0.9F, 0.0F),
|
||||
new Vector3f(1.0F, 0.8F, 0.5F),
|
||||
new Vector3f(1.0F, 0.5F, 0.0F),
|
||||
}
|
||||
);
|
||||
|
||||
//红
|
||||
public static final DustParticleOptions PARTICLE2 = new DustParticleOptions(
|
||||
0.08f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(0.75F, 0.0F, 0.0F),
|
||||
new Vector3f(0.55F, 0.0F, 0.0F),
|
||||
new Vector3f(0.35F, 0.0F, 0.0F),
|
||||
new Vector3f(0.2F, 0.0F, 0.0F),
|
||||
}
|
||||
);
|
||||
|
||||
//紫
|
||||
public static final DustParticleOptions PARTICLE3 = new DustParticleOptions(
|
||||
0.08f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(0.85F, 0.25F, 1.0F),
|
||||
new Vector3f(0.6F, 0.0F, 0.85F),
|
||||
new Vector3f(0.35F, 0.0F, 0.55F),
|
||||
new Vector3f(0.2F, 0.0F, 0.35F),
|
||||
}
|
||||
);
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
checkBeforeTick(summon);
|
||||
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
double gravity = customData.contains("gravity") ? customData.getDouble("gravity") : GRAVITY;
|
||||
Vec3 motion = summon.getDeltaMovement().add(0.0D, -gravity, 0.0D);
|
||||
if(motion.lengthSqr() < 1.0E-7D) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 nextPos = summon.position().add(motion);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(motion.toVector3f());
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
|
||||
if(summon.level().isClientSide()) {
|
||||
summon.setDeltaMovement(motion);
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(motion.toVector3f(), 0);
|
||||
Vec3 right = MathUtil.toVec3(dirs[2]).normalize();
|
||||
summon.trailPositions.addFirst(summon.position().add(right.scale(0.25)));
|
||||
summon.trailPositions.addFirst(summon.position().add(right.scale(-0.25)));
|
||||
while(summon.trailPositions.size() > 12) summon.trailPositions.removeLast();
|
||||
ParticleUtil.addParticles(
|
||||
summon.level(), PARTICLE,
|
||||
summon.position(), 2,
|
||||
new Vec3(0, 0, 0), 0.25,
|
||||
3
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
summon.level(), PARTICLE2,
|
||||
summon.position(), 2,
|
||||
new Vec3(0, 0, 0), 0.25,
|
||||
3
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, nextPos, HITBOX_INFLATE);
|
||||
if(entityHitResult != null) {
|
||||
if(summon.level() instanceof ServerLevel serverLevel) {
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE3,
|
||||
summon.position(), new Vec3(0.0D, 0.0D, 0.0D),
|
||||
0.4D, 25
|
||||
);
|
||||
}
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, nextPos);
|
||||
if(blockHitResult.getType() != HitResult.Type.MISS) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
summon.setDeltaMovement(motion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB getBoundingBoxForCulling(StaticSummon summon) {
|
||||
return summon.getBoundingBox().inflate(8.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDied(StaticSummon summon) {
|
||||
if(!(summon.level() instanceof ServerLevel serverLevel)) return;
|
||||
|
||||
Vec3 pos = summon.position();
|
||||
|
||||
SoundUtil.playServerSound(serverLevel, ModSounds.BETSYS_FIREBALL_COLLIDE.get(), pos);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, ParticleTypes.EXPLOSION,
|
||||
pos, new Vec3(0.0D, 0.0D, 0.0D),
|
||||
0.0D, 1
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
pos, new Vec3(0.0D, 0.0D, 0.0D),
|
||||
0.4D, 25
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE2,
|
||||
pos, new Vec3(0.0D, 0.0D, 0.0D),
|
||||
0.4D, 25
|
||||
);
|
||||
|
||||
double explosionRange = EXPLOSION_RANGE.get();
|
||||
if(explosionRange > 0.0D) {
|
||||
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
||||
for(LivingEntity target : serverLevel.getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
AABB.ofSize(pos, explosionRange * 2.0D, explosionRange * 2.0D, explosionRange * 2.0D),
|
||||
FilterUtil.createLivingTargetFilter(summon, summon.getOwner())
|
||||
)) {
|
||||
if(target.distanceToSqr(pos) > explosionRange * explosionRange) continue;
|
||||
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.6F)) {
|
||||
target.invulnerableTime = 10;
|
||||
if(BUFF_DURATION.get() > 0) target.addEffect(new MobEffectInstance(ModEffects.BETSYS_CURSE, BUFF_DURATION.get(), 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summon.discard();
|
||||
}
|
||||
};
|
||||
|
||||
public BetsyWrath() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
if(level.isClientSide()) return;
|
||||
player.playNotifySound(ModSounds.BETSYS_FIREBALL_SHOOT.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||
if(level instanceof ServerLevel serverLevel) {
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
player.getBoundingBox().getCenter(), new Vec3(0, 0, 0), 0.25,
|
||||
25
|
||||
);
|
||||
}
|
||||
Vec3 start = player.getBoundingBox().getCenter();
|
||||
Vec3 target = MathUtil.getCrosshairPos(player, level, RANGE.get());
|
||||
double[] angles = new double[]{SIDE_ANGLE, 0.0D, -SIDE_ANGLE};
|
||||
for(int i = 0; i < angles.length; i++) {
|
||||
Vec3 offset = target.subtract(start);
|
||||
double radians = Math.toRadians(angles[i]);
|
||||
double cos = Math.cos(radians);
|
||||
double sin = Math.sin(radians);
|
||||
Vec3 angledTarget = start.add(
|
||||
offset.x * cos - offset.z * sin,
|
||||
offset.y,
|
||||
offset.x * sin + offset.z * cos
|
||||
);
|
||||
Vec3 toTarget = angledTarget.subtract(start);
|
||||
double horizontalDistance = toTarget.horizontalDistance();
|
||||
double ticksToTarget = Math.max(MIN_TICKS_TO_TARGET, horizontalDistance / SPEED);
|
||||
double arcHeight = Math.min(MAX_ARC_HEIGHT, Math.max(MIN_ARC_HEIGHT, horizontalDistance * ARC_HEIGHT_PER_BLOCK));
|
||||
double gravity = Math.min(MAX_GRAVITY, Math.max(GRAVITY, 8.0D * arcHeight / (ticksToTarget * ticksToTarget)));
|
||||
Vec3 initialMovement = new Vec3(
|
||||
toTarget.x / ticksToTarget,
|
||||
(toTarget.y + gravity * ticksToTarget * (ticksToTarget + 1.0D) * 0.5D) / ticksToTarget,
|
||||
toTarget.z / ticksToTarget
|
||||
);
|
||||
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||
summon.setOwner(player);
|
||||
summon.setPos(start);
|
||||
summon.setDeltaMovement(initialMovement);
|
||||
summon.getEntityData().set(StaticSummon.STACK_SOURCE, stack.copy());
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.BETSY_WRATH);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, 1200);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
summon.setNoGravity(true);
|
||||
summon.noPhysics = true;
|
||||
|
||||
float[] initialXyRot = MathUtil.computeXYRot(initialMovement.toVector3f());
|
||||
summon.setXRot(initialXyRot[0]);
|
||||
summon.setYRot(initialXyRot[1]);
|
||||
summon.xRotO = summon.getXRot();
|
||||
summon.yRotO = summon.getYRot();
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
customData.putDouble("gravity", gravity);
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
level.addFreshEntity(summon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.lzxnone.terraria.item.weapon.magic;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
import com.lzxnone.terraria.particle.CircleParticleOptions;
|
||||
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.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.CollisionUtil;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
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.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.Level;
|
||||
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;
|
||||
|
||||
public class BubbleGun extends MagicWeapon {
|
||||
public static final Vector3f OFFSET = new Vector3f(-0.25F, -0.1F, 1.2F);
|
||||
public static final double SPRINT_SPREAD_MULTIPLIER = 2.0D;
|
||||
public static final double WALK_SPREAD_MULTIPLIER = 1.5D;
|
||||
public static final double CROUCH_SPREAD_MULTIPLIER = 0.5D;
|
||||
public static final double HITBOX_INFLATE = 0.35D;
|
||||
public static final double BREAK_SPEED = 0.05D;
|
||||
public static final float SPREAD = 10.0F;
|
||||
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.bubble_gun.damage", "bubble_gun_damage", 10.0F, 0.0F, 8388600.0F);
|
||||
public static final ConfigDouble SPEED = new ConfigDouble("weapon.bubble_gun.speed", "bubble_gun_speed", 1.2D, 0.0D, 10.0D);
|
||||
public static final ConfigDouble DRAG = new ConfigDouble("weapon.bubble_gun.drag", "bubble_gun_drag", 0.94D, 0.0D, 1.0D);
|
||||
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.bubble_gun.mana_consume", "bubble_gun_mana_consume", 5.0D, 0.0D, 10000.0D);
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(DAMAGE, SPEED, DRAG, MANA_CONSUME);
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"bubble_gun",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/bubble_gun.png"),
|
||||
Component.translatable("item.lzxnoneterraria.bubble_gun"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
public static final CircleParticleOptions PARTICLE = new CircleParticleOptions(
|
||||
0.04F, 16, new Vector3f(0.0F, 0.12F, 0.65F)
|
||||
);
|
||||
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
checkBeforeTick(summon);
|
||||
|
||||
Vec3 motion = summon.getDeltaMovement().scale(DRAG.get());
|
||||
if(motion.lengthSqr() <= BREAK_SPEED * BREAK_SPEED) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 nextPos = summon.position().add(motion);
|
||||
summon.setDeltaMovement(motion);
|
||||
|
||||
if(summon.level().isClientSide()) return;
|
||||
|
||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, nextPos, HITBOX_INFLATE);
|
||||
if(entityHitResult != null) {
|
||||
if(DamageUtil.magicAttack(summon, entityHitResult.getEntity(), summon.getEntityData().get(StaticSummon.STACK_SOURCE), DAMAGE.get(), 0.2F)) {
|
||||
entityHitResult.getEntity().invulnerableTime = 5;
|
||||
}
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, nextPos);
|
||||
if(blockHitResult.getType() != HitResult.Type.MISS) {
|
||||
onDied(summon);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDied(StaticSummon summon) {
|
||||
if(!(summon.level() instanceof ServerLevel serverLevel)) return;
|
||||
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
summon.position(), new Vec3(0.18D, 0.18D, 0.18D),
|
||||
0.12D, 12
|
||||
);
|
||||
SoundUtil.playServerSound(serverLevel, ModSounds.BUBBLE_BREAK.get(), summon.position());
|
||||
summon.discard();
|
||||
}
|
||||
};
|
||||
|
||||
public BubbleGun() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@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
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
if(level.isClientSide()) return;
|
||||
|
||||
player.playNotifySound(ModSounds.BUBBLE.get(), SoundSource.PLAYERS, 2.0F, 1.0F);
|
||||
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
Vec3 forward = MathUtil.toVec3(dirs[0]).normalize();
|
||||
Vec3 up = MathUtil.toVec3(dirs[1]).normalize();
|
||||
Vec3 right = MathUtil.toVec3(dirs[2]).normalize();
|
||||
|
||||
double spread = SPREAD;
|
||||
if(player.isSprinting()) {
|
||||
spread *= SPRINT_SPREAD_MULTIPLIER;
|
||||
}else if(player.getDeltaMovement().horizontalDistanceSqr() > 1.0E-4D) {
|
||||
spread *= WALK_SPREAD_MULTIPLIER;
|
||||
}
|
||||
if(player.isShiftKeyDown()) spread *= CROUCH_SPREAD_MULTIPLIER;
|
||||
|
||||
int steadyBreathLevel = getEnchantmentLevel(player, stack, ModEnchantments.STEADY_BREATH);
|
||||
if(steadyBreathLevel > 0) {
|
||||
spread *= Math.pow(ModEnchantmentConfigs.getSteadyBreathSpreadMultiplier(), steadyBreathLevel);
|
||||
}
|
||||
|
||||
double yaw = Math.toRadians((player.getRandom().nextFloat() * 2.0F - 1.0F) * spread);
|
||||
double pitch = Math.toRadians((player.getRandom().nextFloat() * 2.0F - 1.0F) * spread);
|
||||
Vec3 direction = forward
|
||||
.add(right.scale(Math.tan(yaw)))
|
||||
.add(up.scale(Math.tan(pitch)))
|
||||
.normalize();
|
||||
|
||||
Vector3f offset = new Vector3f(
|
||||
hand == InteractionHand.OFF_HAND ? -OFFSET.x : OFFSET.x,
|
||||
OFFSET.y,
|
||||
OFFSET.z
|
||||
);
|
||||
Vec3 eyePos = player.getEyePosition();
|
||||
Vec3 pos = new Vec3(
|
||||
eyePos.x + dirs[0].x * offset.z + dirs[1].x * offset.y + dirs[2].x * offset.x,
|
||||
eyePos.y + dirs[0].y * offset.z + dirs[1].y * offset.y + dirs[2].y * offset.x,
|
||||
eyePos.z + dirs[0].z * offset.z + dirs[1].z * offset.y + dirs[2].z * offset.x
|
||||
);
|
||||
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||
summon.setOwner(player);
|
||||
summon.setPos(pos);
|
||||
summon.setDeltaMovement(direction.scale(SPEED.get()));
|
||||
summon.getEntityData().set(StaticSummon.STACK_SOURCE, stack.copy());
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.BUBBLE);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "item");
|
||||
summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.BUBBLE_GUN_PROJECTILE.get()));
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, 1200);
|
||||
summon.getEntityData().set(StaticSummon.SCALE_X, 0.5F);
|
||||
summon.getEntityData().set(StaticSummon.SCALE_Y, 0.5F);
|
||||
summon.getEntityData().set(StaticSummon.SCALE_Z, 0.5F);
|
||||
summon.setNoGravity(true);
|
||||
summon.noPhysics = true;
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(direction.toVector3f());
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
summon.xRotO = xyRot[0];
|
||||
summon.yRotO = xyRot[1];
|
||||
level.addFreshEntity(summon);
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,13 @@ package com.lzxnone.terraria.item.weapon.magic;
|
||||
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
import com.lzxnone.terraria.item.weapon.melee.Mace;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
@@ -20,12 +20,11 @@ import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
@@ -38,7 +37,6 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.UseAnim;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
@@ -47,7 +45,6 @@ import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -88,7 +85,7 @@ public class LastPrism extends MagicWeapon {
|
||||
"last_prism_mana_consume_rate",
|
||||
144,
|
||||
0,
|
||||
72000
|
||||
10000
|
||||
);
|
||||
public LastPrism() {
|
||||
super(
|
||||
@@ -118,14 +115,25 @@ public class LastPrism extends MagicWeapon {
|
||||
return MAX_RANGE.get();
|
||||
}
|
||||
|
||||
@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) {
|
||||
long startGameTime = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||
.copyTag()
|
||||
.getLong(USE_START_GAME_TIME_KEY);
|
||||
long elapsedTime = Math.max(0L, entity.level().getGameTime() - startGameTime);
|
||||
double useRatio = Mth.clamp(elapsedTime / (double)MAX_USE_TIME.get(), 0.0D, 1.0D);
|
||||
return MANA_CONSUME_RATE.get() * useRatio;
|
||||
double useRatio = Mth.clamp(elapsedTime / (double)CHARGE_TIME.get(), 0.0D, 1.0D);
|
||||
return MANA_CONSUME_RATE.get() * useRatio / 20.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getManaTooltipValue(ItemStack stack) {
|
||||
return MANA_CONSUME_RATE.get();
|
||||
}
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
@@ -310,9 +318,11 @@ public class LastPrism extends MagicWeapon {
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||
ItemStack stack = player.getItemInHand(hand);
|
||||
if(!canUseMagic(stack, player)) return InteractionResultHolder.fail(stack);
|
||||
player.startUsingItem(hand);
|
||||
if(level.isClientSide()) return InteractionResultHolder.consume(stack);
|
||||
if(!canStartUsingPrism(player)) return InteractionResultHolder.fail(stack);
|
||||
|
||||
if(stack.is(ModItems.LAST_PRISM.get()) && !player.level().isClientSide()) {
|
||||
if(stack.is(ModItems.LAST_PRISM.get())) {
|
||||
CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.putLong(USE_START_GAME_TIME_KEY, level.getGameTime()));
|
||||
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||
|
||||
@@ -359,28 +369,25 @@ public class LastPrism extends MagicWeapon {
|
||||
|
||||
level.addFreshEntity(beam);
|
||||
}
|
||||
|
||||
player.startUsingItem(hand);
|
||||
}
|
||||
return InteractionResultHolder.consume(stack);
|
||||
}
|
||||
return InteractionResultHolder.pass(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull UseAnim getUseAnimation(ItemStack stack) {
|
||||
return UseAnim.BLOCK;
|
||||
public void onUseTick(Level level, LivingEntity entity, ItemStack stack, int count) {
|
||||
if(level.isClientSide()) return;
|
||||
if(!(entity instanceof Player player)) return;
|
||||
if(entity.tickCount % 10 == 0) {
|
||||
player.playNotifySound(ModSounds.BEAM2.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMagicUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int count) {
|
||||
if(!(livingEntity instanceof Player player)) return;
|
||||
if(player.tickCount % 10 == 0) {
|
||||
SoundUtil.playClientSound(player, ModSounds.BEAM2.get());
|
||||
if(!tryConsumeMana(player, getFinalManaConsumeRate(stack, player))) {
|
||||
player.stopUsingItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUseDuration(ItemStack stack, LivingEntity entity) {
|
||||
return 72000;
|
||||
private boolean canStartUsingPrism(Player player) {
|
||||
if(player.hasInfiniteMaterials()) return true;
|
||||
if(player.getData(ModAttachments.PLAYER_MANA).getMana() > 0) return true;
|
||||
return tryAutoUseManaPotionToReachTarget(player, 1.0D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
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.summon.IStaticSummonBehavior;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
import com.lzxnone.terraria.particle.DustParticleOptions;
|
||||
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.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.CollisionUtil;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.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.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;
|
||||
|
||||
public class LunarFlare extends MagicWeapon {
|
||||
public static final double HITBOX_INFLATE = 0.75D;
|
||||
public static final double SPAWN_HEIGHT = 20.0D;
|
||||
public static final double DELTA_HEIGHT = 10.0D;
|
||||
public static final double SPAWN_OFFSET = 10.0D;
|
||||
public static final double HIT_OFFSET = 1.5D;
|
||||
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.lunar_flare.damage", "lunar_flare_damage", 5.0F, 0.0F, 8388600.0F);
|
||||
public static final ConfigDouble RANGE = new ConfigDouble("weapon.lunar_flare.range", "lunar_flare_range", 64.0D, 0.0D, 512.0D);
|
||||
public static final ConfigDouble SPEED = new ConfigDouble("weapon.lunar_flare.speed", "lunar_flare_speed", 2.5D, 0.0D, 10.0D);
|
||||
public static final ConfigDouble EXPLOSION_RANGE = new ConfigDouble("weapon.lunar_flare.explosion_range", "lunar_flare_explosion_range", 3.0D, 0.0D, 64.0D);
|
||||
public static final ConfigDouble MANA_CONSUME = new ConfigDouble("weapon.lunar_flare.mana_consume", "lunar_flare_mana_consume", 9.0D, 0.0D, 10000.0D);
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(DAMAGE, RANGE, SPEED, EXPLOSION_RANGE, MANA_CONSUME);
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"lunar_flare",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/lunar_flare.png"),
|
||||
Component.translatable("item.lzxnoneterraria.lunar_flare"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.04F, 0.35F, 24, true, new Vector3f[]{
|
||||
new Vector3f(0.15F, 0.45F, 1.0F),
|
||||
new Vector3f(0.0F, 0.9F, 1.0F)
|
||||
}
|
||||
);
|
||||
|
||||
public static final DustParticleOptions PARTICLE2 = new DustParticleOptions(
|
||||
0.12F, 0.5F, 44, true, new Vector3f[]{
|
||||
new Vector3f(0.05F, 0.25F, 1.0F),
|
||||
new Vector3f(0.0F, 0.8F, 1.0F),
|
||||
new Vector3f(0.45F, 1.0F, 1.0F)
|
||||
}
|
||||
);
|
||||
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
checkBeforeTick(summon);
|
||||
|
||||
Vec3 motion = summon.getDeltaMovement();
|
||||
if(motion.lengthSqr() < 1.0E-7D) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 start = summon.position();
|
||||
Vec3 nextPos = start.add(motion);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(motion.toVector3f());
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
|
||||
if(summon.level().isClientSide()) {
|
||||
double length = motion.length();
|
||||
int count = Math.max(4, (int) Math.ceil(length / 0.25D));
|
||||
for(int i = 0; i <= count; i++) {
|
||||
double ratio = i / (double) count;
|
||||
Vec3 pos = start.add(motion.scale(ratio));
|
||||
ParticleUtil.addParticle(
|
||||
summon.level(), PARTICLE,
|
||||
pos, 0.02D,
|
||||
new Vec3(0.0D, 0.0D, 0.0D), 0.01D
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
EntityHitResult entityHitResult = CollisionUtil.checkEntityHit(summon, nextPos, HITBOX_INFLATE);
|
||||
if(entityHitResult != null) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
|
||||
BlockHitResult blockHitResult = CollisionUtil.checkBlockHit(summon, nextPos);
|
||||
if(blockHitResult.getType() != HitResult.Type.MISS) {
|
||||
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
|
||||
int targetLifetime = customData.getInt("targetLifetime");
|
||||
int age = summon.getEntityData().get(StaticSummon.AGE);
|
||||
if(age >= targetLifetime && !summon.level().getBlockState(blockHitResult.getBlockPos()).getCollisionShape(summon.level(), blockHitResult.getBlockPos()).isEmpty()) {
|
||||
onDied(summon);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AABB getBoundingBoxForCulling(StaticSummon summon) {
|
||||
return summon.getBoundingBox().inflate(8.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDied(StaticSummon summon) {
|
||||
if(!(summon.level() instanceof ServerLevel serverLevel)) return;
|
||||
|
||||
Vec3 pos = summon.position();
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, ModParticles.LUNAR_FLARE_EXPLOSION_PARTICLE.get(),
|
||||
pos, new Vec3(0.0D, 0.0D, 0.0D),
|
||||
0.0D, 1
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE2,
|
||||
pos, new Vec3(0.7D, 0.7D, 0.7D),
|
||||
0.35D, 45
|
||||
);
|
||||
ParticleUtil.addParticles(
|
||||
serverLevel, PARTICLE,
|
||||
pos, new Vec3(0.45D, 0.45D, 0.45D),
|
||||
0.25D, 25
|
||||
);
|
||||
|
||||
double explosionRange = EXPLOSION_RANGE.get();
|
||||
if(explosionRange > 0.0D) {
|
||||
ItemStack sourceStack = summon.getEntityData().get(StaticSummon.STACK_SOURCE);
|
||||
for(LivingEntity target : serverLevel.getEntitiesOfClass(
|
||||
LivingEntity.class,
|
||||
AABB.ofSize(pos, explosionRange * 2.0D, explosionRange * 2.0D, explosionRange * 2.0D),
|
||||
FilterUtil.createLivingTargetFilter(summon, summon.getOwner())
|
||||
)) {
|
||||
if(target.distanceToSqr(pos) > explosionRange * explosionRange) continue;
|
||||
if(DamageUtil.magicAttack(summon, target, sourceStack, DAMAGE.get(), 0.4F)) {
|
||||
target.invulnerableTime = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
summon.discard();
|
||||
}
|
||||
};
|
||||
|
||||
public LunarFlare() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().stacksTo(1).rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@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
|
||||
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getManaConsumeRate(ItemStack stack, LivingEntity entity) {
|
||||
return MANA_CONSUME.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
if(level.isClientSide()) return;
|
||||
|
||||
player.playNotifySound(ModSounds.MAGIC_SHOOT.get(), SoundSource.PLAYERS, 4.0F, 1.0F);
|
||||
|
||||
int count = 2 + player.getRandom().nextInt(3);
|
||||
for(int i = 0; i < count; i++) {
|
||||
Vec3 target = MathUtil.getCrosshairPos(player, level, RANGE.get());
|
||||
|
||||
Vec3 spawnPos = new Vec3(
|
||||
target.x + SPAWN_OFFSET * (player.getRandom().nextDouble() * 2.0D - 1.0D),
|
||||
target.y + SPAWN_HEIGHT + i * DELTA_HEIGHT,
|
||||
target.z + SPAWN_OFFSET * (player.getRandom().nextDouble() * 2.0D - 1.0D)
|
||||
);
|
||||
|
||||
Vec3 hitPos = new Vec3(
|
||||
target.x + HIT_OFFSET * (player.getRandom().nextDouble() * 2.0D - 1.0D),
|
||||
target.y,
|
||||
target.z + HIT_OFFSET * (player.getRandom().nextDouble() * 2.0D - 1.0D)
|
||||
);
|
||||
|
||||
Vec3 toTarget = hitPos.subtract(spawnPos);
|
||||
if(toTarget.lengthSqr() < 1.0E-7D) continue;
|
||||
|
||||
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||
summon.setOwner(player);
|
||||
summon.setPos(spawnPos);
|
||||
summon.setDeltaMovement(toTarget.normalize().scale(SPEED.get()));
|
||||
summon.getEntityData().set(StaticSummon.STACK_SOURCE, stack.copy());
|
||||
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.LUNAR_FLARE);
|
||||
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||
summon.getEntityData().set(StaticSummon.LIFETIME, 1200);
|
||||
summon.getEntityData().set(StaticSummon.GLOW, true);
|
||||
summon.setNoGravity(true);
|
||||
summon.noPhysics = true;
|
||||
|
||||
CompoundTag customData = new CompoundTag();
|
||||
customData.putInt("targetLifetime", (int) Math.round(target.distanceTo(spawnPos) / SPEED.get()));
|
||||
summon.getEntityData().set(StaticSummon.CUSTOM_DATA, customData);
|
||||
|
||||
float[] xyRot = MathUtil.computeXYRot(summon.getDeltaMovement().toVector3f());
|
||||
summon.setXRot(xyRot[0]);
|
||||
summon.setYRot(xyRot[1]);
|
||||
summon.xRotO = xyRot[0];
|
||||
summon.yRotO = xyRot[1];
|
||||
|
||||
level.addFreshEntity(summon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.BeeSummon;
|
||||
@@ -13,23 +12,21 @@ import com.lzxnone.terraria.ui.config.struct.ConfigInt;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
|
||||
public class BeeKeeper extends MeleeWeapon {
|
||||
public static final String ID = "bee_keeper";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 5F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigInt MAX_BEES = new ConfigInt(
|
||||
"weapon.bee_keeper.max_bees",
|
||||
"bee_keeper_max_bees",
|
||||
@@ -52,21 +49,25 @@ public class BeeKeeper extends MeleeWeapon {
|
||||
8388600.0f
|
||||
);
|
||||
public BeeKeeper() {
|
||||
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.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
MAX_BEES,
|
||||
CONFUSION_DURATION,
|
||||
BEE_DAMAGE
|
||||
@@ -74,12 +75,7 @@ public class BeeKeeper extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"bee_keeper",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/bee_keeper.png"),
|
||||
Component.translatable("item.lzxnoneterraria.bee_keeper"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() {
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
@@ -19,15 +18,11 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
@@ -41,12 +36,14 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class BladeOfGrass extends MeleeWeapon {
|
||||
public static final String ID = "blade_of_grass";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 3F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat PROJECTILE_DAMAGE = new ConfigFloat(
|
||||
"weapon.blade_of_grass.projectile_damage",
|
||||
"blade_of_grass_projectile_damage",
|
||||
@@ -100,6 +97,8 @@ public class BladeOfGrass extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_DAMAGE,
|
||||
EFFECT_DURATION,
|
||||
TARGET_RANGE,
|
||||
@@ -111,23 +110,20 @@ public class BladeOfGrass extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"blade_of_grass",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/blade_of_grass.png"),
|
||||
Component.translatable("item.lzxnoneterraria.blade_of_grass"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public BladeOfGrass() {
|
||||
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.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
import com.lzxnone.terraria.item.IItemWaveBehavior;
|
||||
import com.lzxnone.terraria.particle.ModParticles;
|
||||
@@ -11,24 +11,22 @@ import com.lzxnone.terraria.ui.config.struct.ConfigInt;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
public class BloodButcherer extends MeleeWeapon {
|
||||
public static final String ID = "blood_butcherer";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 3.5F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.5F);
|
||||
public static final ConfigInt EFFECT_DURATION = new ConfigInt(
|
||||
"weapon.blood_butcherer.effect_duration",
|
||||
"blood_butcherer_effect_duration",
|
||||
@@ -44,33 +42,32 @@ public class BloodButcherer extends MeleeWeapon {
|
||||
255
|
||||
);
|
||||
public BloodButcherer() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 3.5, 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()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
EFFECT_DURATION,
|
||||
MAX_LEVEL
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"blood_butcherer",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/blood_butcherer.png"),
|
||||
Component.translatable("item.lzxnoneterraria.blood_butcherer"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final IItemWaveBehavior ITEM_WAVE_BEHAVIOR = new IItemWaveBehavior() {
|
||||
@Override
|
||||
|
||||
@@ -1,25 +1,32 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
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.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class CopperShortsword extends MeleeWeapon {
|
||||
public static final String ID = "copper_shortsword";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 2F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1F);
|
||||
|
||||
public static final IConfigData CONFIG_DATA = createConfigData(BASE_MELEE_DAMAGE, BASE_MELEE_ATTACK_SPEED);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
public CopperShortsword() {
|
||||
super(Tiers.STONE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 2, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.STONE, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||
import com.lzxnone.terraria.effect.ModEffects;
|
||||
@@ -29,13 +28,9 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
@@ -58,6 +53,9 @@ import java.util.*;
|
||||
|
||||
|
||||
public class DevilsDevastation extends MeleeWeapon {
|
||||
public static final String ID = "devils_devastation";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 30F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigInt KILL_MODE_TIME = new ConfigInt(
|
||||
"weapon.devils_devastation.kill_mode_time",
|
||||
"devils_devastation_kill_mode_time",
|
||||
@@ -181,6 +179,8 @@ public class DevilsDevastation extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
KILL_MODE_TIME,
|
||||
KILL_MODE_COOLDOWN_TIME,
|
||||
PROJECTILE_DAMAGE,
|
||||
@@ -213,23 +213,20 @@ public class DevilsDevastation extends MeleeWeapon {
|
||||
return KILL_MODE_PROJECTILE_CYCLE.get();
|
||||
}
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"devils_devastation",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/devils_devastation.png"),
|
||||
Component.translatable("item.lzxnoneterraria.devils_devastation"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public DevilsDevastation() {
|
||||
super(Tiers.NETHERITE, new Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 30, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
super(Tiers.NETHERITE, new Properties().fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -17,7 +16,6 @@ import com.lzxnone.terraria.ui.config.struct.ConfigInt;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -25,16 +23,12 @@ import net.minecraft.sounds.SoundSource;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
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.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
@@ -42,6 +36,9 @@ import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class EnchantedSword extends MeleeWeapon {
|
||||
public static final String ID = "enchanted_sword";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 4F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.enchanted_sword.damage",
|
||||
"enchanted_sword_damage",
|
||||
@@ -64,23 +61,25 @@ public class EnchantedSword extends MeleeWeapon {
|
||||
10.0
|
||||
);
|
||||
public EnchantedSword() {
|
||||
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()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
LIFETIME,
|
||||
SPEED
|
||||
@@ -88,12 +87,7 @@ public class EnchantedSword extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"enchanted_sword",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/enchanted_sword.png"),
|
||||
Component.translatable("item.lzxnoneterraria.enchanted_sword"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeam;
|
||||
@@ -21,12 +20,8 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -39,9 +34,11 @@ import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
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 net.minecraft.network.chat.Component;
|
||||
|
||||
public class Excalibur extends MeleeWeapon {
|
||||
public static final String ID = "excalibur";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 7.0F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.0F);
|
||||
public static final ConfigInt ROTATE_RANGE = new ConfigInt(
|
||||
"weapon.excalibur.rotate_range",
|
||||
"excalibur_rotate_range",
|
||||
@@ -67,6 +64,8 @@ public class Excalibur extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
ROTATE_RANGE,
|
||||
MAX_HIT_COUNT,
|
||||
DAMAGE
|
||||
@@ -74,23 +73,20 @@ public class Excalibur extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"excalibur",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/excalibur.png"),
|
||||
Component.translatable("item.lzxnoneterraria.excalibur"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public Excalibur() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).rarity(Rarity.UNCOMMON));
|
||||
super(Tiers.IRON, new Item.Properties().rarity(Rarity.UNCOMMON));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.*;
|
||||
@@ -15,14 +14,10 @@ import net.minecraft.util.FastColor;
|
||||
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.player.Player;
|
||||
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.Vec3;
|
||||
@@ -35,12 +30,14 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FirstFractal extends MeleeWeapon {
|
||||
public static final String ID = "first_fractal";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 20.0F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat PROJECTILE_DAMAGE = new ConfigFloat(
|
||||
"weapon.first_fractal.projectile_damage",
|
||||
"first_fractal_projectile_damage",
|
||||
@@ -99,6 +96,8 @@ public class FirstFractal extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_DAMAGE,
|
||||
BOUNDING_BOX_SIZE,
|
||||
PROJECTILE_SPEED,
|
||||
@@ -123,23 +122,20 @@ public class FirstFractal extends MeleeWeapon {
|
||||
return MAX_RANGE.get();
|
||||
}
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"first_fractal",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/first_fractal.png"),
|
||||
Component.translatable("item.lzxnoneterraria.first_fractal"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public FirstFractal() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 20.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
super(Tiers.NETHERITE, new Item.Properties().fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
private static ItemStack[] weapons;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -21,15 +20,11 @@ import net.minecraft.sounds.SoundSource;
|
||||
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.ai.targeting.TargetingConditions;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
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.level.block.Blocks;
|
||||
import net.minecraft.world.phys.*;
|
||||
@@ -41,13 +36,15 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class InfluxWaver extends MeleeWeapon {
|
||||
public static final String ID = "influx_waver";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 11F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.influx_waver.damage",
|
||||
"influx_waver_damage",
|
||||
@@ -87,6 +84,8 @@ public class InfluxWaver extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
MAX_COUNT,
|
||||
SPEED,
|
||||
@@ -96,23 +95,20 @@ public class InfluxWaver extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"influx_waver",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/influx_waver.png"),
|
||||
Component.translatable("item.lzxnoneterraria.influx_waver"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public InfluxWaver() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 11, 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()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final float FADE_OUT = 0.1f;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeam;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
@@ -21,19 +21,14 @@ import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
@@ -43,6 +38,9 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class LightsBane extends MeleeWeapon {
|
||||
public static final String ID = "lights_bane";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 3F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.0F);
|
||||
public static final ConfigFloat BIG_DAMAGE = new ConfigFloat(
|
||||
"weapon.lights_bane.big_damage",
|
||||
"lights_bane_big_damage",
|
||||
@@ -65,21 +63,25 @@ public class LightsBane extends MeleeWeapon {
|
||||
64.0
|
||||
);
|
||||
public LightsBane() {
|
||||
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"), -1.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
BIG_DAMAGE,
|
||||
SMALL_DAMAGE,
|
||||
TARGET_RANGE
|
||||
@@ -87,12 +89,7 @@ public class LightsBane extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"lights_bane",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/lights_bane.png"),
|
||||
Component.translatable("item.lzxnoneterraria.lights_bane"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.075f, 0.5f, 40, true, new Vector3f[]{
|
||||
@@ -207,4 +204,3 @@ public class LightsBane extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -23,14 +22,10 @@ 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.player.Player;
|
||||
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.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.*;
|
||||
@@ -42,11 +37,13 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Mace extends MeleeWeapon {
|
||||
public static final String ID = "mace";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 3F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigDouble PROJECTILE_SPEED = new ConfigDouble(
|
||||
"weapon.mace.projectile_speed",
|
||||
"mace_projectile_speed",
|
||||
@@ -86,6 +83,8 @@ public class Mace extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_SPEED,
|
||||
GRAVITY,
|
||||
DAMAGE,
|
||||
@@ -95,23 +94,20 @@ public class Mace extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"mace",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/mace.png"),
|
||||
Component.translatable("item.lzxnoneterraria.mace"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public Mace() {
|
||||
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.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public enum State {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
@@ -17,19 +16,14 @@ import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
import org.joml.Vector3f;
|
||||
@@ -37,6 +31,9 @@ import org.joml.Vector3f;
|
||||
import java.util.List;
|
||||
|
||||
public class Meowmere extends MeleeWeapon {
|
||||
public static final String ID = "meowmere";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 19F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.meowmere.damage",
|
||||
"meowmere_damage",
|
||||
@@ -59,21 +56,25 @@ public class Meowmere extends MeleeWeapon {
|
||||
10.0
|
||||
);
|
||||
public Meowmere() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 19, 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()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
GRAVITY,
|
||||
INITIAL_SPEED
|
||||
@@ -81,12 +82,7 @@ public class Meowmere extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"meowmere",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/meowmere.png"),
|
||||
Component.translatable("item.lzxnoneterraria.meowmere"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.05f, 0.5f, 40, true, new Vector3f[]{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
@@ -15,15 +14,11 @@ import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
@@ -33,9 +28,11 @@ import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class Muramasa extends MeleeWeapon {
|
||||
public static final String ID = "muramasa";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 4F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.5F);
|
||||
public static final ConfigFloat BEAM_DAMAGE = new ConfigFloat(
|
||||
"weapon.muramasa.beam_damage",
|
||||
"muramasa_beam_damage",
|
||||
@@ -47,28 +44,27 @@ public class Muramasa extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
BEAM_DAMAGE
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"muramasa",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/muramasa.png"),
|
||||
Component.translatable("item.lzxnoneterraria.muramasa"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public Muramasa() {
|
||||
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"), -1.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
@@ -23,13 +22,9 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
@@ -45,11 +40,13 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NightsEdge extends MeleeWeapon {
|
||||
public static final String ID = "nights_edge";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 6.0F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.5F);
|
||||
public static final ConfigBoolean PROJECTILE_ALIGN_TO_BLADE = new ConfigBoolean(
|
||||
"weapon.nights_edge.projectile_align_to_blade",
|
||||
"nights_edge_projectile_align_to_blade",
|
||||
@@ -122,6 +119,8 @@ public class NightsEdge extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_ALIGN_TO_BLADE,
|
||||
ROTATE_RANGE,
|
||||
PROJECTILE_ROTATE_RANGE,
|
||||
@@ -136,23 +135,20 @@ public class NightsEdge extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"nights_edge",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/nights_edge.png"),
|
||||
Component.translatable("item.lzxnoneterraria.nights_edge"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public NightsEdge() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 6.0, 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()
|
||||
).rarity(Rarity.UNCOMMON));
|
||||
super(Tiers.IRON, new Item.Properties().rarity(Rarity.UNCOMMON));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -21,19 +20,14 @@ import com.lzxnone.terraria.ui.config.struct.ConfigInt;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
import org.joml.Vector3f;
|
||||
@@ -42,6 +36,9 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class Seedler extends MeleeWeapon {
|
||||
public static final String ID = "seedler";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 7F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigDouble NUT_GRAVITY = new ConfigDouble(
|
||||
"weapon.seedler.nut_gravity",
|
||||
"seedler_nut_gravity",
|
||||
@@ -85,21 +82,25 @@ public class Seedler extends MeleeWeapon {
|
||||
10.0
|
||||
);
|
||||
public Seedler() {
|
||||
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"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).rarity(Rarity.UNCOMMON));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.UNCOMMON));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
NUT_GRAVITY,
|
||||
NUT_BOUNCE,
|
||||
NUT_INITIAL_SPEED,
|
||||
@@ -110,12 +111,7 @@ public class Seedler extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"seedler",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/seedler.png"),
|
||||
Component.translatable("item.lzxnoneterraria.seedler"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.025f, 0.5f, 40, true, new Vector3f[]{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -18,25 +17,23 @@ import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.*;
|
||||
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.*;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class StarWrath extends MeleeWeapon {
|
||||
public static final String ID = "star_wrath";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 15F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.star_wrath.damage",
|
||||
"star_wrath_damage",
|
||||
@@ -59,21 +56,25 @@ public class StarWrath extends MeleeWeapon {
|
||||
1024.0
|
||||
);
|
||||
public StarWrath() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 15, 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()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
SPEED,
|
||||
MAX_RANGE
|
||||
@@ -81,12 +82,7 @@ public class StarWrath extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"star_wrath",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/star_wrath.png"),
|
||||
Component.translatable("item.lzxnoneterraria.star_wrath"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.05f, 0.5f, 40, true, new Vector3f[]{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -17,7 +16,6 @@ import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.*;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -25,21 +23,20 @@ import net.minecraft.sounds.SoundSource;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class Starfury extends MeleeWeapon {
|
||||
public static final String ID = "starfury";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 5F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.starfury.damage",
|
||||
"starfury_damage",
|
||||
@@ -62,21 +59,25 @@ public class Starfury extends MeleeWeapon {
|
||||
10.0
|
||||
);
|
||||
public Starfury() {
|
||||
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.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
MAX_RANGE,
|
||||
SPEED
|
||||
@@ -84,12 +85,7 @@ public class Starfury extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"starfury",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/starfury.png"),
|
||||
Component.translatable("item.lzxnoneterraria.starfury"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final IStaticProjectileBehavior PROJECTILE_BEHAVIOR = new IStaticProjectileBehavior() {
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
@@ -25,18 +24,13 @@ import com.lzxnone.terraria.utils.*;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
@@ -49,6 +43,9 @@ import org.joml.Vector3f;
|
||||
import java.util.List;
|
||||
|
||||
public class TerraBlade extends MeleeWeapon {
|
||||
public static final String ID = "terra_blade";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 10F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.0F);
|
||||
public static final ConfigBoolean PROJECTILE_ALIGN_TO_SWORD_BEAM = new ConfigBoolean(
|
||||
"weapon.terra_blade.projectile_align_to_sword_beam",
|
||||
"terra_projectile_align_to_blade",
|
||||
@@ -112,21 +109,25 @@ public class TerraBlade extends MeleeWeapon {
|
||||
);
|
||||
|
||||
public TerraBlade() {
|
||||
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"), -1.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_ALIGN_TO_SWORD_BEAM,
|
||||
SWORD_BEAM_ROTATE_RANGE,
|
||||
PROJECTILE_ROTATE_RANGE,
|
||||
@@ -140,12 +141,7 @@ public class TerraBlade extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"terra_blade",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/terra_blade.png"),
|
||||
Component.translatable("item.lzxnoneterraria.terra_blade"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
tag.putString("behavior", "terra_blade");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
@@ -20,20 +19,15 @@ import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.AttributeInstance;
|
||||
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.*;
|
||||
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.Vec3;
|
||||
@@ -44,6 +38,9 @@ import org.jspecify.annotations.NonNull;
|
||||
import java.util.List;
|
||||
|
||||
public class Terragrim extends MeleeWeapon {
|
||||
public static final String ID = "terragrim";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 3F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -0.5F);
|
||||
public static final ConfigDouble HIT_RANGE = new ConfigDouble(
|
||||
"weapon.terragrim.hit_range",
|
||||
"terragrim_hit_range",
|
||||
@@ -66,21 +63,25 @@ public class Terragrim extends MeleeWeapon {
|
||||
90
|
||||
);
|
||||
public Terragrim() {
|
||||
super(Tiers.DIAMOND, 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"), -0.5, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
HIT_RANGE,
|
||||
DAMAGE,
|
||||
ROTATE_RANGE
|
||||
@@ -88,12 +89,7 @@ public class Terragrim extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"terragrim",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/terragrim.png"),
|
||||
Component.translatable("item.lzxnoneterraria.terragrim"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final ResourceLocation[] RES = {
|
||||
ResourceLocation.parse("lzxnoneterraria:textures/vfx/terragrim_beam0.png"),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
@@ -24,14 +23,10 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.damagesource.DamageTypes;
|
||||
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.ai.targeting.TargetingConditions;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
@@ -47,12 +42,14 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class TheHorsemansBlade extends MeleeWeapon {
|
||||
public static final String ID = "the_horsemans_blade";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 14F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigInt BLADE_ROTATE_RANGE = new ConfigInt(
|
||||
"weapon.the_horsemans_blade.blade_rotate_range",
|
||||
"horsemans_blade_rotate_range",
|
||||
@@ -106,6 +103,8 @@ public class TheHorsemansBlade extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
BLADE_ROTATE_RANGE,
|
||||
BLADE_MAX_HIT_COUNT,
|
||||
BLADE_DAMAGE,
|
||||
@@ -117,23 +116,20 @@ public class TheHorsemansBlade extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"the_horsemans_blade",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/the_horsemans_blade.png"),
|
||||
Component.translatable("item.lzxnoneterraria.the_horsemans_blade"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public TheHorsemansBlade() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 14, 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()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.StaticProjectile;
|
||||
@@ -14,30 +16,34 @@ import net.minecraft.nbt.CompoundTag;
|
||||
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.LivingEntity;
|
||||
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.*;
|
||||
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.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
public class TrueCopperShortsword extends MeleeWeapon {
|
||||
public static final String ID = "true_copper_shortsword";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 20F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
|
||||
public static final IConfigData CONFIG_DATA = createConfigData(BASE_MELEE_DAMAGE, BASE_MELEE_ATTACK_SPEED);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
public TrueCopperShortsword() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 20, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
super(Tiers.NETHERITE, new Item.Properties().fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static void summon(Player player, double deltaDist) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
import com.lzxnone.terraria.entity.beam.SwordBeam;
|
||||
@@ -19,12 +18,8 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -37,9 +32,11 @@ import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
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 net.minecraft.network.chat.Component;
|
||||
|
||||
public class TrueExcalibur extends MeleeWeapon {
|
||||
public static final String ID = "true_excalibur";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 7.0F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -1.0F);
|
||||
public static final ConfigInt ROTATE_RANGE = new ConfigInt(
|
||||
"weapon.true_excalibur.rotate_range",
|
||||
"true_excalibur_rotate_range",
|
||||
@@ -65,6 +62,8 @@ public class TrueExcalibur extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
ROTATE_RANGE,
|
||||
MAX_HIT_COUNT,
|
||||
DAMAGE
|
||||
@@ -72,23 +71,20 @@ public class TrueExcalibur extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"true_excalibur",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/true_excalibur.png"),
|
||||
Component.translatable("item.lzxnoneterraria.true_excalibur"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public TrueExcalibur() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0f, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -1.0, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.beam.ISwordBeamBehavior;
|
||||
@@ -23,13 +22,9 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
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.*;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.*;
|
||||
@@ -45,11 +40,13 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TrueNightsEdge extends MeleeWeapon {
|
||||
public static final String ID = "true_nights_edge";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 7.0F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigBoolean PROJECTILE_ALIGN_TO_BLADE = new ConfigBoolean(
|
||||
"weapon.true_nights_edge.projectile_align_to_blade",
|
||||
"true_nights_edge_projectile_align_to_blade",
|
||||
@@ -129,6 +126,8 @@ public class TrueNightsEdge extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
PROJECTILE_ALIGN_TO_BLADE,
|
||||
ROTATE_RANGE,
|
||||
PROJECTILE_ROTATE_RANGE,
|
||||
@@ -144,23 +143,20 @@ public class TrueNightsEdge extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"true_nights_edge",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/true_nights_edge.png"),
|
||||
Component.translatable("item.lzxnoneterraria.true_nights_edge"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public TrueNightsEdge() {
|
||||
super(Tiers.DIAMOND, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 7.0f, 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()
|
||||
).rarity(Rarity.RARE));
|
||||
super(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.RARE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final CompoundTag BEAM_DATA = Util.make(new CompoundTag(), tag -> {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||
@@ -20,19 +19,14 @@ import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.FilterUtil;
|
||||
import com.lzxnone.terraria.utils.ParticleUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
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.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Tiers;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.entity.player.AttackEntityEvent;
|
||||
@@ -43,6 +37,9 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class Volcano extends MeleeWeapon {
|
||||
public static final String ID = "volcano";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 6F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigDouble EXPLOSION_RANGE = new ConfigDouble(
|
||||
"weapon.volcano.explosion_range",
|
||||
"volcano_explosion_range",
|
||||
@@ -72,21 +69,25 @@ public class Volcano extends MeleeWeapon {
|
||||
60
|
||||
);
|
||||
public Volcano() {
|
||||
super(Tiers.IRON, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 6, 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()
|
||||
));
|
||||
super(Tiers.IRON, new Item.Properties());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
EXPLOSION_RANGE,
|
||||
EXPLOSION_DAMAGE,
|
||||
EXPLOSION_MAX_HIT_COUNT,
|
||||
@@ -95,12 +96,7 @@ public class Volcano extends MeleeWeapon {
|
||||
}
|
||||
};
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"volcano",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/volcano.png"),
|
||||
Component.translatable("item.lzxnoneterraria.volcano"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.075f, 0.5f, 40, true, new Vector3f[]{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.lzxnone.terraria.item.weapon.melee;
|
||||
|
||||
import com.lzxnone.terraria.item.weapon.MeleeWeapon;
|
||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||
import com.lzxnone.terraria.ModSounds;
|
||||
import com.lzxnone.terraria.entity.ModEntities;
|
||||
import com.lzxnone.terraria.entity.projectile.IStaticProjectileBehavior;
|
||||
@@ -17,14 +16,10 @@ import net.minecraft.resources.ResourceLocation;
|
||||
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.player.Player;
|
||||
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.EntityHitResult;
|
||||
@@ -39,11 +34,13 @@ 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 net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Zenith extends MeleeWeapon {
|
||||
public static final String ID = "zenith";
|
||||
public static final ConfigFloat BASE_MELEE_DAMAGE = createBaseMeleeDamageConfig(ID, 20F);
|
||||
public static final ConfigFloat BASE_MELEE_ATTACK_SPEED = createBaseMeleeAttackSpeedConfig(ID, -2.4F);
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat(
|
||||
"weapon.zenith.damage",
|
||||
"zenith_damage",
|
||||
@@ -130,6 +127,8 @@ public class Zenith extends MeleeWeapon {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(
|
||||
BASE_MELEE_DAMAGE,
|
||||
BASE_MELEE_ATTACK_SPEED,
|
||||
DAMAGE,
|
||||
MAX_RANGE,
|
||||
DISTANCE_MODE,
|
||||
@@ -185,23 +184,20 @@ public class Zenith extends MeleeWeapon {
|
||||
return TRAIL_ALPHA.get();
|
||||
}
|
||||
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
"zenith",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/zenith.png"),
|
||||
Component.translatable("item.lzxnoneterraria.zenith"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = createConfigListItem(ID, CONFIG_DATA);
|
||||
|
||||
public Zenith() {
|
||||
super(Tiers.NETHERITE, new Item.Properties().attributes(ItemAttributeModifiers.builder()
|
||||
.add(Attributes.ATTACK_DAMAGE,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_damage"), 20, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.add(Attributes.ATTACK_SPEED,
|
||||
new AttributeModifier(ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "base_attack_speed"), -2.4, AttributeModifier.Operation.ADD_VALUE),
|
||||
EquipmentSlotGroup.MAINHAND)
|
||||
.build()
|
||||
).fireResistant().rarity(Rarity.EPIC));
|
||||
super(Tiers.NETHERITE, new Item.Properties().fireResistant().rarity(Rarity.EPIC));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeDamage(ItemStack stack) {
|
||||
return BASE_MELEE_DAMAGE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getBaseMeleeAttackSpeed(ItemStack stack) {
|
||||
return BASE_MELEE_ATTACK_SPEED.get();
|
||||
}
|
||||
|
||||
private static ItemStack[] weapons;
|
||||
|
||||
@@ -139,6 +139,12 @@ public class ElfMelter extends RangedWeapon {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
SoundUtil.playClientSound(player, ModSounds.SHOT9.get());
|
||||
|
||||
@@ -161,6 +161,12 @@ public class Flamethrower extends RangedWeapon {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
SoundUtil.playClientSound(player, ModSounds.SHOT9.get());
|
||||
|
||||
@@ -127,6 +127,12 @@ public class SnowballCannon extends RangedWeapon {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
SoundUtil.playClientSound(player, ModSounds.SHOT2.get());
|
||||
|
||||
@@ -113,6 +113,12 @@ public class StarCannon extends RangedWeapon {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
SoundUtil.playClientSound(player, ModSounds.STAR_FALL.get());
|
||||
|
||||
@@ -152,6 +152,12 @@ public class SuperStarShooter extends RangedWeapon {
|
||||
return 18;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shoot(Level level, Player player, InteractionHand hand, ItemStack stack) {
|
||||
SoundUtil.playClientSound(player, ModSounds.STAR_FALL.get());
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.item.ModItemTags;
|
||||
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||
import com.lzxnone.terraria.utils.AmmoUtil;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -69,6 +70,18 @@ public class Bow extends RangedWeapon {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
ItemStack ammoStack = getTooltipAmmoStack(weaponStack, entity);
|
||||
float damage = getDamage(weaponStack, entity, ammoStack) + getAmmoBaseDamage(ammoStack);
|
||||
if(entity instanceof Player player) damage = DamageUtil.applyPlayerDamageEffects(player, damage);
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
protected ItemStack getTooltipAmmoStack(ItemStack weaponStack, LivingEntity entity) {
|
||||
return getAmmoStack(weaponStack);
|
||||
}
|
||||
|
||||
protected float getKnockbackScale(ItemStack weaponStack, LivingEntity entity, ItemStack ammoStack) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||
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.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
@@ -24,25 +25,24 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class DaedalusStormbow extends Bow {
|
||||
public static final String ID = "daedalus_stormbow";
|
||||
public static final int USE_TIME = 19;
|
||||
public static final int ARROW_COUNT = 3;
|
||||
public static final double RANGE = 64.0D;
|
||||
public static final double SPAWN_HEIGHT = 20.0D;
|
||||
public static final double SPAWN_OFFSET = 6.0D;
|
||||
public static final double HIT_OFFSET = 2D;
|
||||
|
||||
public static final ConfigFloat DAMAGE = new ConfigFloat("weapon.daedalus_stormbow.damage", "daedalus_stormbow_damage", 4.0F, 0.0F, 8388600.0F);
|
||||
public static final ConfigDouble RANGE = new ConfigDouble("weapon.daedalus_stormbow.range", "daedalus_stormbow_range", 64.0D, 0.0D, 1024.0D);
|
||||
public static final IConfigData CONFIG_DATA = new IConfigData() {
|
||||
@Override
|
||||
public void onConfigLoad() {
|
||||
ConfigStruct.loadAll(DAMAGE);
|
||||
ConfigStruct.loadAll(DAMAGE, RANGE);
|
||||
}
|
||||
};
|
||||
public static final ConfigListItem CONFIG_LIST_ITEM = new ConfigListItem(
|
||||
ID,
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/" + ID + ".png"),
|
||||
Component.translatable("item.lzxnoneterraria." + ID),
|
||||
"daedalus_stormbow",
|
||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "textures/item/daedalus_stormbow.png"),
|
||||
Component.translatable("item.lzxnoneterraria.daedalus_stormbow"),
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DaedalusStormbow extends Bow {
|
||||
|
||||
for(int i = 0; i < ARROW_COUNT; i++) {
|
||||
StaticSummon summon = createArrowSummon(level, player, hand, weaponStack);
|
||||
Vec3 targetPos = MathUtil.getCrosshairPos(player, level, RANGE);
|
||||
Vec3 targetPos = MathUtil.getCrosshairPos(player, level, RANGE.get());
|
||||
Vec3 spawnPos = targetPos.add(
|
||||
(level.random.nextDouble() * 2.0D - 1.0D) * SPAWN_OFFSET,
|
||||
SPAWN_HEIGHT + i * 1.5D,
|
||||
|
||||
@@ -6,15 +6,16 @@ import com.lzxnone.terraria.enchantment.ModEnchantmentConfigs;
|
||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||
import com.lzxnone.terraria.item.ModItemTags;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||
import com.lzxnone.terraria.ui.config.ConfigListItem;
|
||||
import com.lzxnone.terraria.ui.config.IConfigData;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigFloat;
|
||||
import com.lzxnone.terraria.ui.config.struct.ConfigStruct;
|
||||
import com.lzxnone.terraria.utils.AmmoUtil;
|
||||
import com.lzxnone.terraria.utils.DamageUtil;
|
||||
import com.lzxnone.terraria.utils.MathUtil;
|
||||
import com.lzxnone.terraria.utils.SoundUtil;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -22,16 +23,12 @@ import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
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.Tier;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Gun extends RangedWeapon {
|
||||
private static final float DAMAGE_MIN = 0.0f;
|
||||
private static final float DAMAGE_MAX = 8388600.0f;
|
||||
@@ -117,6 +114,21 @@ public class Gun extends RangedWeapon {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
Player player = entity instanceof Player playerEntity ? playerEntity : null;
|
||||
ItemStack ammoStack = getTooltipAmmoStack(weaponStack, entity);
|
||||
float damage = getDamage(weaponStack, player) + getAmmoBaseDamage(ammoStack);
|
||||
if(player != null) damage = DamageUtil.applyPlayerDamageEffects(player, damage);
|
||||
return applyRangedDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
protected ItemStack getTooltipAmmoStack(ItemStack weaponStack, LivingEntity entity) {
|
||||
ItemStack ammoStack = getAmmoStack(weaponStack);
|
||||
if(ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) return ModItems.MUSKET_BALL.get().getDefaultInstance();
|
||||
return ammoStack;
|
||||
}
|
||||
|
||||
protected float getAmmoNotConsumeChance(ItemStack stack, LivingEntity entity) {
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -220,15 +232,5 @@ public class Gun extends RangedWeapon {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendHoverText(ItemStack stack, Item.TooltipContext context,
|
||||
List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||
if(stack.is(ModItemTags.SPREAD_RANGED_WEAPONS)) {
|
||||
tooltipComponents.add(Component.translatable(
|
||||
"tooltip.lzxnoneterraria.spread_ranged_weapon"
|
||||
).withStyle(ChatFormatting.GRAY));
|
||||
}
|
||||
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,11 @@ public class SniperRifle extends Gun implements ScopeZoomModifier {
|
||||
|
||||
@Override
|
||||
protected ItemStack getBulletAmmoStack(Level level, Player player, InteractionHand hand, ItemStack weaponStack) {
|
||||
return getTooltipAmmoStack(weaponStack, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getTooltipAmmoStack(ItemStack weaponStack, LivingEntity entity) {
|
||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(weaponStack);
|
||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||
return ModItems.HIGH_VELOCITY_BULLET.get().getDefaultInstance();
|
||||
|
||||
@@ -53,6 +53,11 @@ public class Uzi extends Gun {
|
||||
|
||||
@Override
|
||||
protected ItemStack getBulletAmmoStack(Level level, Player player, InteractionHand hand, ItemStack weaponStack) {
|
||||
return getTooltipAmmoStack(weaponStack, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getTooltipAmmoStack(ItemStack weaponStack, LivingEntity entity) {
|
||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(weaponStack);
|
||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||
return ModItems.HIGH_VELOCITY_BULLET.get().getDefaultInstance();
|
||||
|
||||
@@ -53,6 +53,11 @@ public class VenusMagnum extends Gun {
|
||||
|
||||
@Override
|
||||
protected ItemStack getBulletAmmoStack(Level level, Player player, InteractionHand hand, ItemStack weaponStack) {
|
||||
return getTooltipAmmoStack(weaponStack, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getTooltipAmmoStack(ItemStack weaponStack, LivingEntity entity) {
|
||||
ItemStack ammoStack = RangedWeapon.getAmmoStack(weaponStack);
|
||||
if(ammoStack.is(ModItems.MUSKET_BALL.get()) || ammoStack.is(ModItems.TUNGSTEN_BULLET.get()) || ammoStack.is(ModItems.ENDLESS_MUSKET_POUCH.get())) {
|
||||
return ModItems.HIGH_VELOCITY_BULLET.get().getDefaultInstance();
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Rarity;
|
||||
@@ -89,6 +90,19 @@ public class StardustDragonStaff extends MinionWeapon {
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
int stardustDragonSlotCount = 0;
|
||||
if(entity instanceof Player player) {
|
||||
for(PlayerSummon.SummonSlot slot : player.getData(ModAttachments.PLAYER_SUMMON).getMinionSlots()) {
|
||||
if(slot.getId().equals(StaticSummonBehaviors.STARDUST_DRAGON_STAFF)) stardustDragonSlotCount++;
|
||||
}
|
||||
}
|
||||
float damage = DAMAGE.get() + ADD_DAMAGE.get() * Math.max(0, stardustDragonSlotCount - 1);
|
||||
if(entity instanceof Player player) damage = DamageUtil.applyPlayerDamageEffects(player, damage);
|
||||
return applySummonDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
public static final DustParticleOptions PARTICLE = new DustParticleOptions(
|
||||
0.1f, 0.5f, 40, true, new Vector3f[]{
|
||||
new Vector3f(0.0F, 1.0F, 1.0F),
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -142,6 +143,12 @@ public class Terraprisma extends MinionWeapon {
|
||||
CONFIG_DATA
|
||||
);
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, DAMAGE.get()) : DAMAGE.get();
|
||||
return applySummonDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||
@Override
|
||||
public void tick(StaticSummon summon) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -44,6 +45,12 @@ public abstract class Whip extends SummonWeapon {
|
||||
|
||||
protected abstract float getDamage();
|
||||
|
||||
@Override
|
||||
public float getTooltipDamage(ItemStack weaponStack, LivingEntity entity) {
|
||||
float damage = entity instanceof Player player ? DamageUtil.applyPlayerDamageEffects(player, getDamage()) : getDamage();
|
||||
return applySummonDamageBonus(weaponStack, entity, damage);
|
||||
}
|
||||
|
||||
protected abstract int getLifetime();
|
||||
|
||||
protected double getHeight() {
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.lzxnone.terraria.mixin;
|
||||
|
||||
import com.lzxnone.terraria.item.accessory.AccessoryUtil;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ItemEntity.class)
|
||||
public class ItemEntityMixin {
|
||||
@Unique
|
||||
private static final double lzxnoneterraria$PICKUP_PROBE_RANGE = 16.0D;
|
||||
|
||||
@Unique
|
||||
private static final double lzxnoneterraria$ATTRACT_SPEED = 0.25D;
|
||||
|
||||
@Unique
|
||||
private boolean lzxnoneterraria$attracting = false;
|
||||
|
||||
@Shadow
|
||||
private int pickupDelay;
|
||||
|
||||
@WrapOperation(
|
||||
method = "tick",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/item/ItemEntity;applyGravity()V")
|
||||
)
|
||||
private void lzxnoneterraria$wrapGravityWhileAttracted(ItemEntity self, Operation<Void> original) {
|
||||
if(!lzxnoneterraria$attracting) {
|
||||
original.call(self);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At("TAIL"))
|
||||
private void lzxnoneterraria$attractToPlayer(CallbackInfo ci) {
|
||||
ItemEntity self = (ItemEntity)(Object) this;
|
||||
boolean attracting = false;
|
||||
if(this.pickupDelay == 0) {
|
||||
Player player = self.level().getNearestPlayer(
|
||||
self.getX(), self.getY(), self.getZ(), lzxnoneterraria$PICKUP_PROBE_RANGE, false
|
||||
);
|
||||
if(player != null && self.getOwner() != player) {
|
||||
Item item = self.getItem().getItem();
|
||||
double range = AccessoryUtil.getEffectivePickupRange(player, item);
|
||||
if(range > 0.0D) {
|
||||
double distanceSqr = self.distanceToSqr(player);
|
||||
if(distanceSqr <= range * range) {
|
||||
attracting = true;
|
||||
Vec3 toPlayer = player.position().subtract(self.position()).normalize();
|
||||
self.setDeltaMovement(toPlayer.scale(lzxnoneterraria$ATTRACT_SPEED));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lzxnoneterraria$attracting = attracting;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.lzxnone.terraria.mixin;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.lzxnone.terraria.item.ModItems;
|
||||
import com.lzxnone.terraria.item.weapon.MagicWeapon;
|
||||
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -20,7 +21,7 @@ public abstract class UseSpeedMixin {
|
||||
|| usingItem.is(ModItems.FIRST_FRACTAL.get())
|
||||
|| usingItem.is(ModItems.TERRAGRIM.get())
|
||||
|| usingItem.is(ModItems.MACE.get())
|
||||
|| usingItem.is(ModItems.LAST_PRISM.get())
|
||||
|| usingItem.getItem() instanceof MagicWeapon
|
||||
|| usingItem.getItem() instanceof RangedWeapon;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,10 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
|
||||
public class CircleParticle extends EmissiveBloomParticle {
|
||||
public class CircleParticle extends TextureSheetParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected CircleParticle(ClientLevel level, double x, double y, double z,
|
||||
@@ -48,6 +49,16 @@ public class CircleParticle extends EmissiveBloomParticle {
|
||||
for(int i = 0;i < 10;i++) super.render(buffer, camera, partialTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM_PARTICLE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<CircleParticleOptions> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class DevilsDevastationRuneParticle extends EmissiveBloomParticle {
|
||||
public class DevilsDevastationRuneParticle extends TextureSheetParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected DevilsDevastationRuneParticle(ClientLevel level, double x, double y, double z,
|
||||
@@ -49,6 +50,16 @@ public class DevilsDevastationRuneParticle extends EmissiveBloomParticle {
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM_PARTICLE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class DevilsDevastationRuneParticle2 extends EmissiveBloomParticle {
|
||||
public class DevilsDevastationRuneParticle2 extends TextureSheetParticle {
|
||||
private final float baseSize;
|
||||
|
||||
protected DevilsDevastationRuneParticle2(ClientLevel level, double x, double y, double z,
|
||||
@@ -43,6 +44,16 @@ public class DevilsDevastationRuneParticle2 extends EmissiveBloomParticle {
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM_PARTICLE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
@@ -141,11 +140,9 @@ public class DustParticle extends TextureSheetParticle {
|
||||
vertex.add(x, y, z);
|
||||
|
||||
buffer.addVertex(vertex.x(), vertex.y(), vertex.z())
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setUv(uvs[i][0], uvs[i][1])
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(0.0F, 0.0F, 1.0F);
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setLight(LightTexture.FULL_BRIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +153,7 @@ public class DustParticle extends TextureSheetParticle {
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return glow ? ModParticleRenderTypes.EMISSIVE_BLOOM : ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
||||
return glow ? ModParticleRenderTypes.EMISSIVE_BLOOM_PARTICLE : ParticleRenderType.PARTICLE_SHEET_OPAQUE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<DustParticleOptions> {
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.ParticleRenderType;
|
||||
import net.minecraft.client.particle.TextureSheetParticle;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class EmissiveBloomParticle extends TextureSheetParticle {
|
||||
|
||||
protected EmissiveBloomParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(VertexConsumer buffer, Camera camera, float partialTick) {
|
||||
if (this.alpha <= 0.01F) return;
|
||||
|
||||
float f = (float) (Mth.lerp(partialTick, this.xo, this.x) - camera.getPosition().x);
|
||||
float f1 = (float) (Mth.lerp(partialTick, this.yo, this.y) - camera.getPosition().y);
|
||||
float f2 = (float) (Mth.lerp(partialTick, this.zo, this.z) - camera.getPosition().z);
|
||||
|
||||
Quaternionf quaternion = new Quaternionf(camera.rotation());
|
||||
quaternion.rotateZ(Mth.lerp(partialTick, this.oRoll, this.roll));
|
||||
|
||||
float size = this.quadSize;
|
||||
|
||||
float u0 = this.getU0();
|
||||
float u1 = this.getU1();
|
||||
float v0 = this.getV0();
|
||||
float v1 = this.getV1();
|
||||
|
||||
float[][] uvs = {
|
||||
{u1, v1},
|
||||
{u1, v0},
|
||||
{u0, v0},
|
||||
{u0, v1}
|
||||
};
|
||||
|
||||
Vector3f[] corners = {
|
||||
new Vector3f(1.0F, -1.0F, 0.0F),
|
||||
new Vector3f(1.0F, 1.0F, 0.0F),
|
||||
new Vector3f(-1.0F, 1.0F, 0.0F),
|
||||
new Vector3f(-1.0F, -1.0F, 0.0F)
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Vector3f vertex = corners[i];
|
||||
vertex.rotate(quaternion);
|
||||
vertex.mul(size);
|
||||
vertex.add(f, f1, f2);
|
||||
|
||||
buffer.addVertex(vertex.x(), vertex.y(), vertex.z())
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setUv(uvs[i][0], uvs[i][1])
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -14,7 +13,6 @@ public class IronSparkParticle extends TextureSheetParticle {
|
||||
private final float sparkLength;
|
||||
private final Vector3f dir;
|
||||
private final Vector3f right;
|
||||
private final Vector3f normal;
|
||||
|
||||
protected IronSparkParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed,
|
||||
@@ -37,7 +35,6 @@ public class IronSparkParticle extends TextureSheetParticle {
|
||||
|
||||
this.dir = new Vector3f(options.dir).normalize();
|
||||
this.right = new Vector3f(options.right).normalize();
|
||||
this.normal = new Vector3f(this.dir).cross(this.right).normalize();
|
||||
|
||||
this.xd = dir.x;
|
||||
this.yd = dir.y;
|
||||
@@ -89,11 +86,9 @@ public class IronSparkParticle extends TextureSheetParticle {
|
||||
for(int j = 0; j < 4; j++) {
|
||||
float[] v = verts[j];
|
||||
buffer.addVertex(v[0], v[1], v[2])
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setUv(v[3], v[4])
|
||||
.setOverlay(OverlayTexture.NO_OVERLAY)
|
||||
.setLight(LightTexture.FULL_BRIGHT)
|
||||
.setNormal(this.normal.x(), this.normal.y(), this.normal.z());
|
||||
.setColor(this.rCol, this.gCol, this.bCol, this.alpha)
|
||||
.setLight(LightTexture.FULL_BRIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +100,7 @@ public class IronSparkParticle extends TextureSheetParticle {
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM;
|
||||
return ModParticleRenderTypes.EMISSIVE_BLOOM_PARTICLE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<IronSparkParticleOptions> {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.lzxnone.terraria.particle;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleProvider;
|
||||
import net.minecraft.client.particle.ParticleRenderType;
|
||||
import net.minecraft.client.particle.SpriteSet;
|
||||
import net.minecraft.client.particle.TextureSheetParticle;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.core.particles.SimpleParticleType;
|
||||
|
||||
public class LunarFlareExplosionParticle extends TextureSheetParticle {
|
||||
private final SpriteSet spriteSet;
|
||||
private final float baseSize;
|
||||
|
||||
protected LunarFlareExplosionParticle(ClientLevel level, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed, SpriteSet spriteSet) {
|
||||
super(level, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
this.hasPhysics = false;
|
||||
this.friction = 0.9F;
|
||||
this.gravity = 0.0F;
|
||||
this.xd = xSpeed;
|
||||
this.yd = ySpeed;
|
||||
this.zd = zSpeed;
|
||||
this.baseSize = 1.25F;
|
||||
this.quadSize = this.baseSize;
|
||||
this.lifetime = 14;
|
||||
this.spriteSet = spriteSet;
|
||||
this.setSpriteFromAge(this.spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
float lifeRatio = (float) this.age / (float) this.lifetime;
|
||||
this.quadSize = this.baseSize * (1.0F + lifeRatio * 0.2F);
|
||||
this.alpha = 1.0F - lifeRatio;
|
||||
this.setSpriteFromAge(this.spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightColor(float partialTick) {
|
||||
return LightTexture.FULL_BRIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleRenderType getRenderType() {
|
||||
return ParticleRenderType.PARTICLE_SHEET_OPAQUE;
|
||||
}
|
||||
|
||||
public static class Provider implements ParticleProvider<SimpleParticleType> {
|
||||
private final SpriteSet spriteSet;
|
||||
|
||||
public Provider(SpriteSet spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(SimpleParticleType type, ClientLevel level,
|
||||
double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new LunarFlareExplosionParticle(level, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import com.lzxnone.terraria.client.event.ShaderRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.ParticleRenderType;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
@@ -13,28 +14,25 @@ import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
|
||||
public final class ModParticleRenderTypes {
|
||||
public static final ParticleRenderType EMISSIVE_BLOOM = new ParticleRenderType() {
|
||||
public static final ParticleRenderType EMISSIVE_BLOOM_PARTICLE = new ParticleRenderType() {
|
||||
@Override
|
||||
public BufferBuilder begin(Tesselator tesselator, TextureManager textureManager) {
|
||||
Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.setShader(GameRenderer::getRendertypeEntityTranslucentEmissiveShader);
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.setShader(ShaderRegistry::getParticleBloom);
|
||||
RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES);
|
||||
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.NEW_ENTITY);
|
||||
return tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "lzxnoneterraria:emissive_bloom";
|
||||
return "lzxnoneterraria:emissive_bloom_particle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTranslucent() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ public class ModParticles {
|
||||
PARTICLE_TYPES.register("leaf_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> SOLAR_EXPLOSION_PARTICLE =
|
||||
PARTICLE_TYPES.register("solar_explosion_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> LUNAR_FLARE_EXPLOSION_PARTICLE =
|
||||
PARTICLE_TYPES.register("lunar_flare_explosion_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> CRYSTAL_FRAGMENT_PARTICLE =
|
||||
PARTICLE_TYPES.register("crystal_fragment_particle", () -> new SimpleParticleType(true));
|
||||
public static final Supplier<SimpleParticleType> DEVILS_DEVASTATION_RUNE_PARTICLE =
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.lzxnone.terraria.effect.BloodButcheredEffect;
|
||||
import com.lzxnone.terraria.effect.AcidVenomEffect;
|
||||
import com.lzxnone.terraria.effect.CursedInfernoEffect;
|
||||
import com.lzxnone.terraria.effect.DemonicFlamesEffect;
|
||||
import com.lzxnone.terraria.effect.BetsysCurseEffect;
|
||||
import com.lzxnone.terraria.effect.IchorEffect;
|
||||
import com.lzxnone.terraria.effect.ManaSicknessEffect;
|
||||
import com.lzxnone.terraria.effect.MidasEffect;
|
||||
@@ -92,10 +93,14 @@ import com.lzxnone.terraria.item.accessory.PutridScent;
|
||||
import com.lzxnone.terraria.item.accessory.Shackle;
|
||||
import com.lzxnone.terraria.item.accessory.SniperScope;
|
||||
import com.lzxnone.terraria.item.accessory.ReconScope;
|
||||
import com.lzxnone.terraria.item.weapon.magic.BetsyWrath;
|
||||
import com.lzxnone.terraria.item.weapon.magic.BubbleGun;
|
||||
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
||||
import com.lzxnone.terraria.item.weapon.magic.LunarFlare;
|
||||
import com.lzxnone.terraria.item.weapon.melee.BeeKeeper;
|
||||
import com.lzxnone.terraria.item.weapon.melee.BladeOfGrass;
|
||||
import com.lzxnone.terraria.item.weapon.melee.BloodButcherer;
|
||||
import com.lzxnone.terraria.item.weapon.melee.CopperShortsword;
|
||||
import com.lzxnone.terraria.item.weapon.melee.DevilsDevastation;
|
||||
import com.lzxnone.terraria.item.weapon.melee.EnchantedSword;
|
||||
import com.lzxnone.terraria.item.weapon.melee.Excalibur;
|
||||
@@ -112,6 +117,7 @@ import com.lzxnone.terraria.item.weapon.melee.Starfury;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TerraBlade;
|
||||
import com.lzxnone.terraria.item.weapon.melee.Terragrim;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TheHorsemansBlade;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TrueCopperShortsword;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TrueExcalibur;
|
||||
import com.lzxnone.terraria.item.weapon.melee.TrueNightsEdge;
|
||||
import com.lzxnone.terraria.item.weapon.melee.Volcano;
|
||||
@@ -142,6 +148,7 @@ public class ConfigList {
|
||||
|
||||
static {
|
||||
ITEMS.put(WEAPON, new ConfigListItem[]{
|
||||
CopperShortsword.CONFIG_LIST_ITEM,
|
||||
EnchantedSword.CONFIG_LIST_ITEM,
|
||||
BeeKeeper.CONFIG_LIST_ITEM,
|
||||
Starfury.CONFIG_LIST_ITEM,
|
||||
@@ -156,6 +163,7 @@ public class ConfigList {
|
||||
NightsEdge.CONFIG_LIST_ITEM,
|
||||
TrueExcalibur.CONFIG_LIST_ITEM,
|
||||
TrueNightsEdge.CONFIG_LIST_ITEM,
|
||||
TrueCopperShortsword.CONFIG_LIST_ITEM,
|
||||
LightsBane.CONFIG_LIST_ITEM,
|
||||
BloodButcherer.CONFIG_LIST_ITEM,
|
||||
Muramasa.CONFIG_LIST_ITEM,
|
||||
@@ -169,6 +177,9 @@ public class ConfigList {
|
||||
StardustDragonStaff.CONFIG_LIST_ITEM,
|
||||
Possession.CONFIG_LIST_ITEM,
|
||||
LastPrism.CONFIG_LIST_ITEM,
|
||||
BetsyWrath.CONFIG_LIST_ITEM,
|
||||
LunarFlare.CONFIG_LIST_ITEM,
|
||||
BubbleGun.CONFIG_LIST_ITEM,
|
||||
Minishark.CONFIG_LIST_ITEM,
|
||||
FlintlockPistol.CONFIG_LIST_ITEM,
|
||||
Boomstick.CONFIG_LIST_ITEM,
|
||||
@@ -201,6 +212,7 @@ public class ConfigList {
|
||||
DemonicFlamesEffect.CONFIG_LIST_ITEM,
|
||||
CursedInfernoEffect.CONFIG_LIST_ITEM,
|
||||
IchorEffect.CONFIG_LIST_ITEM,
|
||||
BetsysCurseEffect.CONFIG_LIST_ITEM,
|
||||
AcidVenomEffect.CONFIG_LIST_ITEM,
|
||||
MidasEffect.CONFIG_LIST_ITEM,
|
||||
ManaSicknessEffect.CONFIG_LIST_ITEM,
|
||||
|
||||
@@ -140,7 +140,10 @@ public class DamageUtil {
|
||||
extraKnockback = livingTarget.getDeltaMovement().subtract(beforeHurtMovement);
|
||||
}
|
||||
|
||||
livingTarget.setDeltaMovement(beforeHurtMovement.add(hurtKnockback.add(extraKnockback).scale(knockbackScale)));
|
||||
Vec3 knockback = hurtKnockback.add(extraKnockback);
|
||||
double scaledY = knockback.y * Math.min(knockbackScale, 1.0F);
|
||||
Vec3 scaledKnockback = new Vec3(knockback.x * knockbackScale, scaledY, knockback.z * knockbackScale);
|
||||
livingTarget.setDeltaMovement(beforeHurtMovement.add(scaledKnockback));
|
||||
}
|
||||
DamageSource postSource = attackEntity == player
|
||||
? source
|
||||
@@ -151,7 +154,7 @@ public class DamageUtil {
|
||||
return hasHurt;
|
||||
}
|
||||
|
||||
private static float applyPlayerDamageEffects(Player player, float damage) {
|
||||
public static float applyPlayerDamageEffects(Player player, float damage) {
|
||||
float finalDamage = damage;
|
||||
//力量
|
||||
if(player.hasEffect(MobEffects.DAMAGE_BOOST) && player.getEffect(MobEffects.DAMAGE_BOOST) != null) {
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
"item.lzxnoneterraria.mace": "Mace",
|
||||
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
||||
"item.lzxnoneterraria.last_prism": "Last Prism",
|
||||
"item.lzxnoneterraria.betsys_wrath": "Betsy's Wrath",
|
||||
"item.lzxnoneterraria.lunar_flare": "Lunar Flare",
|
||||
"item.lzxnoneterraria.bubble_gun": "Bubble Gun",
|
||||
"item.lzxnoneterraria.bubble_gun_projectile": "Bubble",
|
||||
"item.lzxnoneterraria.terraprisma": "Terraprisma",
|
||||
"item.lzxnoneterraria.stardust_dragon_staff": "Stardust Dragon Staff",
|
||||
"item.lzxnoneterraria.possession": "Possession",
|
||||
@@ -346,6 +350,10 @@
|
||||
"tooltip.lzxnoneterraria.melee_knockback_bonus": "Melee Knockback +%s",
|
||||
"tooltip.lzxnoneterraria.attack_speed_bonus": "Attack Speed +%s%%",
|
||||
"tooltip.lzxnoneterraria.ignite_on_hit": "Melee attacks inflict fire damage",
|
||||
"lzxnoneterraria.configuration.base_melee_damage": "Base Melee Damage",
|
||||
"lzxnoneterraria.configuration.base_melee_damage.tooltip": "Base damage dealt by the weapon's direct melee attack",
|
||||
"lzxnoneterraria.configuration.base_melee_attack_speed": "Base Melee Attack Speed",
|
||||
"lzxnoneterraria.configuration.base_melee_attack_speed.tooltip": "Attack speed attribute modifier for the weapon's direct melee attack",
|
||||
"lzxnoneterraria.configuration.melee_damage_multiplier": "Melee Damage Multiplier",
|
||||
"lzxnoneterraria.configuration.melee_damage_multiplier.tooltip": "Melee damage is multiplied by this value while equipped",
|
||||
"lzxnoneterraria.configuration.melee_knockback": "Melee Knockback",
|
||||
@@ -357,12 +365,15 @@
|
||||
|
||||
"tooltip.lzxnoneterraria.ranged_damage_increase": "+%s%% ranged damage",
|
||||
"tooltip.lzxnoneterraria.ranged_damage_decrease": "-%s%% ranged damage",
|
||||
"tooltip.lzxnoneterraria.ranged_weapon_damage": "Ranged Damage: %s",
|
||||
"tooltip.lzxnoneterraria.rifle_scope": "Scroll wheel adjusts zoom while using firearms",
|
||||
"tooltip.lzxnoneterraria.spread_ranged_weapon": "Standing still or sneaking reduces spread",
|
||||
"tooltip.lzxnoneterraria.sniper_rifle": "Scroll wheel adjusts zoom",
|
||||
"lzxnoneterraria.configuration.ranged_damage_multiplier": "Ranged Damage Multiplier",
|
||||
"lzxnoneterraria.configuration.ranged_damage_multiplier.tooltip": "Ranged damage is multiplied by this value while equipped",
|
||||
|
||||
"tooltip.lzxnoneterraria.magic_weapon_mana": "Mana: %s",
|
||||
"tooltip.lzxnoneterraria.magic_weapon_damage": "Magic Damage: %s",
|
||||
"tooltip.lzxnoneterraria.magic_damage_increase": "+%s%% magic damage",
|
||||
"tooltip.lzxnoneterraria.magic_damage_decrease": "-%s%% magic damage",
|
||||
"tooltip.lzxnoneterraria.mana_cost_increase": "+%s%% mana cost",
|
||||
@@ -388,6 +399,7 @@
|
||||
|
||||
"tooltip.lzxnoneterraria.summon_damage_increase": "+%s%% summon damage",
|
||||
"tooltip.lzxnoneterraria.summon_damage_decrease": "-%s%% summon damage",
|
||||
"tooltip.lzxnoneterraria.summon_weapon_damage": "Summon Damage: %s",
|
||||
"tooltip.lzxnoneterraria.minion_knockback_increase": "+%s%% minion knockback",
|
||||
"tooltip.lzxnoneterraria.minion_knockback_decrease": "-%s%% minion knockback",
|
||||
"tooltip.lzxnoneterraria.minion_slot_add": "+%s minion capacity",
|
||||
@@ -454,6 +466,7 @@
|
||||
"effect.lzxnoneterraria.demonic_flames": "Demonic Flames",
|
||||
"effect.lzxnoneterraria.cursed_inferno": "Cursed Inferno",
|
||||
"effect.lzxnoneterraria.ichor": "Ichor",
|
||||
"effect.lzxnoneterraria.betsys_curse": "Betsy's Curse",
|
||||
"effect.lzxnoneterraria.acid_venom": "Acid Venom",
|
||||
"effect.lzxnoneterraria.midas": "Midas",
|
||||
"effect.lzxnoneterraria.paladins_shield": "Paladin's Shield",
|
||||
@@ -523,6 +536,8 @@
|
||||
"lzxnoneterraria.configuration.cursed_inferno_damage_per_level.tooltip": "Cursed Inferno checks damage once per second; damage dealt per effect level",
|
||||
"lzxnoneterraria.configuration.ichor_armor_reduction_per_level": "Armor Reduction Per Level",
|
||||
"lzxnoneterraria.configuration.ichor_armor_reduction_per_level.tooltip": "Armor reduced per Ichor level on the target",
|
||||
"lzxnoneterraria.configuration.betsys_curse_armor_reduction_per_level": "Armor Reduction Per Level",
|
||||
"lzxnoneterraria.configuration.betsys_curse_armor_reduction_per_level.tooltip": "Armor reduced per Betsy's Curse level on the target",
|
||||
"lzxnoneterraria.configuration.acid_venom_damage_per_level": "Damage Per Level",
|
||||
"lzxnoneterraria.configuration.acid_venom_damage_per_level.tooltip": "Acid Venom checks damage once per second; damage dealt per effect level",
|
||||
"lzxnoneterraria.configuration.midas_drop_chance": "Emerald Drop Chance",
|
||||
@@ -824,7 +839,7 @@
|
||||
"lzxnoneterraria.configuration.last_prism_max_range": "Max Range",
|
||||
"lzxnoneterraria.configuration.last_prism_max_range.tooltip": "Maximum beam range",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate": "Mana Consume Rate",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate.tooltip": "Mana consumed per tick while using",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate.tooltip": "Mana consumed per second at full power",
|
||||
"lzxnoneterraria.configuration.musket_ball_base_damage": "Base Damage",
|
||||
"lzxnoneterraria.configuration.musket_ball_base_damage.tooltip": "Base damage provided by the ammo",
|
||||
"lzxnoneterraria.configuration.musket_ball_speed": "Speed",
|
||||
@@ -1015,6 +1030,36 @@
|
||||
"lzxnoneterraria.configuration.elf_melter_freeze_ticks.tooltip": "Frozen time applied on hit, in ticks",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_damage": "Damage",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_damage.tooltip": "Damage per hit",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_range": "Range",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_range.tooltip": "Maximum distance for selecting the crosshair target point",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_damage": "Damage",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_damage.tooltip": "Magic damage dealt to each target in the explosion radius",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_range": "Range",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_range.tooltip": "Maximum distance for selecting the crosshair target point",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_explosion_range": "Explosion Range",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_explosion_range.tooltip": "Radius for damage and effect after projectile collision",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_mana_consume": "Mana Cost",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_mana_consume.tooltip": "Mana consumed per shot",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_buff_duration": "Effect Duration",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_buff_duration.tooltip": "Duration of Betsy's Curse applied on explosion hit, in ticks",
|
||||
"lzxnoneterraria.configuration.lunar_flare_damage": "Damage",
|
||||
"lzxnoneterraria.configuration.lunar_flare_damage.tooltip": "Magic damage dealt to each target in the explosion radius",
|
||||
"lzxnoneterraria.configuration.lunar_flare_range": "Range",
|
||||
"lzxnoneterraria.configuration.lunar_flare_range.tooltip": "Maximum distance for selecting the crosshair target point",
|
||||
"lzxnoneterraria.configuration.lunar_flare_speed": "Speed",
|
||||
"lzxnoneterraria.configuration.lunar_flare_speed.tooltip": "Lunar Flare projectile movement speed",
|
||||
"lzxnoneterraria.configuration.lunar_flare_explosion_range": "Explosion Range",
|
||||
"lzxnoneterraria.configuration.lunar_flare_explosion_range.tooltip": "Radius for damage after projectile explosion",
|
||||
"lzxnoneterraria.configuration.lunar_flare_mana_consume": "Mana Cost",
|
||||
"lzxnoneterraria.configuration.lunar_flare_mana_consume.tooltip": "Mana consumed per shot",
|
||||
"lzxnoneterraria.configuration.bubble_gun_damage": "Damage",
|
||||
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "Magic damage dealt by each bubble hit",
|
||||
"lzxnoneterraria.configuration.bubble_gun_speed": "Speed",
|
||||
"lzxnoneterraria.configuration.bubble_gun_speed.tooltip": "Initial bubble movement speed",
|
||||
"lzxnoneterraria.configuration.bubble_gun_drag": "Drag",
|
||||
"lzxnoneterraria.configuration.bubble_gun_drag.tooltip": "Velocity multiplier retained by the bubble each tick",
|
||||
"lzxnoneterraria.configuration.bubble_gun_mana_consume": "Mana Cost",
|
||||
"lzxnoneterraria.configuration.bubble_gun_mana_consume.tooltip": "Mana consumed per shot",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "Kill Mode Duration",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "Kill Mode duration in ticks",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_cooldown_time": "Kill Mode Cooldown",
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
"item.lzxnoneterraria.mace": "链锤",
|
||||
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
||||
"item.lzxnoneterraria.last_prism": "终极棱镜",
|
||||
"item.lzxnoneterraria.betsys_wrath": "双足翼龙怒气",
|
||||
"item.lzxnoneterraria.lunar_flare": "月耀",
|
||||
"item.lzxnoneterraria.bubble_gun": "泡泡枪",
|
||||
"item.lzxnoneterraria.bubble_gun_projectile": "泡泡",
|
||||
"item.lzxnoneterraria.terraprisma": "泰拉棱镜",
|
||||
"item.lzxnoneterraria.stardust_dragon_staff": "星尘之龙法杖",
|
||||
"item.lzxnoneterraria.possession": "支配之鞭",
|
||||
@@ -346,6 +350,10 @@
|
||||
"tooltip.lzxnoneterraria.melee_knockback_bonus": "近战击退 +%s",
|
||||
"tooltip.lzxnoneterraria.attack_speed_bonus": "攻击速度 +%s%%",
|
||||
"tooltip.lzxnoneterraria.ignite_on_hit": "近战攻击造成火焰伤害",
|
||||
"lzxnoneterraria.configuration.base_melee_damage": "基础近战伤害",
|
||||
"lzxnoneterraria.configuration.base_melee_damage.tooltip": "武器本体近战攻击造成的基础伤害",
|
||||
"lzxnoneterraria.configuration.base_melee_attack_speed": "基础近战攻击速度",
|
||||
"lzxnoneterraria.configuration.base_melee_attack_speed.tooltip": "武器本体近战攻击速度属性修饰值",
|
||||
"lzxnoneterraria.configuration.melee_damage_multiplier": "近战武器伤害倍率",
|
||||
"lzxnoneterraria.configuration.melee_damage_multiplier.tooltip": "佩戴后近战伤害乘以该倍率",
|
||||
"lzxnoneterraria.configuration.melee_knockback": "近战击退",
|
||||
@@ -357,12 +365,15 @@
|
||||
|
||||
"tooltip.lzxnoneterraria.ranged_damage_increase": "远程伤害 +%s%%",
|
||||
"tooltip.lzxnoneterraria.ranged_damage_decrease": "远程伤害 -%s%%",
|
||||
"tooltip.lzxnoneterraria.ranged_weapon_damage": "远程伤害: %s",
|
||||
"tooltip.lzxnoneterraria.rifle_scope": "使用枪械时,滚轮可以调节放大倍率",
|
||||
"tooltip.lzxnoneterraria.spread_ranged_weapon": "静止或者潜行可以减低散射幅度",
|
||||
"tooltip.lzxnoneterraria.sniper_rifle": "滚轮可以调节放大倍率",
|
||||
"lzxnoneterraria.configuration.ranged_damage_multiplier": "远程伤害倍率",
|
||||
"lzxnoneterraria.configuration.ranged_damage_multiplier.tooltip": "佩戴后远程伤害乘以该倍率",
|
||||
|
||||
"tooltip.lzxnoneterraria.magic_weapon_mana": "魔力: %s",
|
||||
"tooltip.lzxnoneterraria.magic_weapon_damage": "魔法伤害: %s",
|
||||
"tooltip.lzxnoneterraria.magic_damage_increase": "魔法伤害 +%s%%",
|
||||
"tooltip.lzxnoneterraria.magic_damage_decrease": "魔法伤害 -%s%%",
|
||||
"tooltip.lzxnoneterraria.mana_cost_increase": "魔力花费 +%s%%",
|
||||
@@ -388,6 +399,7 @@
|
||||
|
||||
"tooltip.lzxnoneterraria.summon_damage_increase": "召唤伤害 +%s%%",
|
||||
"tooltip.lzxnoneterraria.summon_damage_decrease": "召唤伤害 -%s%%",
|
||||
"tooltip.lzxnoneterraria.summon_weapon_damage": "召唤伤害: %s",
|
||||
"tooltip.lzxnoneterraria.minion_knockback_increase": "仆从击退 +%s%%",
|
||||
"tooltip.lzxnoneterraria.minion_knockback_decrease": "仆从击退 -%s%%",
|
||||
"tooltip.lzxnoneterraria.minion_slot_add": "仆从数量上限 +%s",
|
||||
@@ -454,6 +466,7 @@
|
||||
"effect.lzxnoneterraria.demonic_flames": "恶魔之焰",
|
||||
"effect.lzxnoneterraria.cursed_inferno": "诅咒狱火",
|
||||
"effect.lzxnoneterraria.ichor": "灵液",
|
||||
"effect.lzxnoneterraria.betsys_curse": "双足翼龙诅咒",
|
||||
"effect.lzxnoneterraria.acid_venom": "酸性毒液",
|
||||
"effect.lzxnoneterraria.midas": "迈达斯",
|
||||
"effect.lzxnoneterraria.paladins_shield": "圣骑士护盾",
|
||||
@@ -523,6 +536,8 @@
|
||||
"lzxnoneterraria.configuration.cursed_inferno_damage_per_level.tooltip": "诅咒狱火每秒进行一次伤害判定,每级造成的伤害",
|
||||
"lzxnoneterraria.configuration.ichor_armor_reduction_per_level": "每级护甲降低",
|
||||
"lzxnoneterraria.configuration.ichor_armor_reduction_per_level.tooltip": "目标拥有灵液效果时,每级降低的护甲值",
|
||||
"lzxnoneterraria.configuration.betsys_curse_armor_reduction_per_level": "每级护甲降低",
|
||||
"lzxnoneterraria.configuration.betsys_curse_armor_reduction_per_level.tooltip": "目标拥有双足翼龙诅咒效果时,每级降低的护甲值",
|
||||
"lzxnoneterraria.configuration.acid_venom_damage_per_level": "每级伤害",
|
||||
"lzxnoneterraria.configuration.acid_venom_damage_per_level.tooltip": "酸性毒液每秒进行一次伤害判定,每级造成的伤害",
|
||||
"lzxnoneterraria.configuration.midas_drop_chance": "绿宝石掉落概率",
|
||||
@@ -824,7 +839,7 @@
|
||||
"lzxnoneterraria.configuration.last_prism_max_range": "最大范围",
|
||||
"lzxnoneterraria.configuration.last_prism_max_range.tooltip": "激光最大射程",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate": "魔力消耗速率",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate.tooltip": "使用时每刻消耗的魔力值",
|
||||
"lzxnoneterraria.configuration.last_prism_mana_consume_rate.tooltip": "满功率时每秒消耗的魔力值",
|
||||
"lzxnoneterraria.configuration.musket_ball_base_damage": "基础伤害",
|
||||
"lzxnoneterraria.configuration.musket_ball_base_damage.tooltip": "子弹自身提供的基础伤害",
|
||||
"lzxnoneterraria.configuration.musket_ball_speed": "速度",
|
||||
@@ -1015,6 +1030,36 @@
|
||||
"lzxnoneterraria.configuration.elf_melter_freeze_ticks.tooltip": "命中后施加的冻结时间(刻)",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_damage": "伤害",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_damage.tooltip": "每次命中伤害",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_range": "射程",
|
||||
"lzxnoneterraria.configuration.daedalus_stormbow_range.tooltip": "选择准星目标点的最大距离",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_damage": "伤害",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_damage.tooltip": "爆炸范围内每个目标受到的魔法伤害",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_range": "射程",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_range.tooltip": "选择准星目标点的最大距离",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_explosion_range": "爆炸范围",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_explosion_range.tooltip": "飞弹碰撞后造成伤害和效果的半径",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_mana_consume": "魔力消耗",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_mana_consume.tooltip": "每次发射消耗的魔力",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_buff_duration": "效果持续时间",
|
||||
"lzxnoneterraria.configuration.betsys_wrath_buff_duration.tooltip": "爆炸命中后造成双足翼龙诅咒的持续时间(刻)",
|
||||
"lzxnoneterraria.configuration.lunar_flare_damage": "伤害",
|
||||
"lzxnoneterraria.configuration.lunar_flare_damage.tooltip": "爆炸范围内每个目标受到的魔法伤害",
|
||||
"lzxnoneterraria.configuration.lunar_flare_range": "射程",
|
||||
"lzxnoneterraria.configuration.lunar_flare_range.tooltip": "选择准星目标点的最大距离",
|
||||
"lzxnoneterraria.configuration.lunar_flare_speed": "速度",
|
||||
"lzxnoneterraria.configuration.lunar_flare_speed.tooltip": "月耀弹射物移动速度",
|
||||
"lzxnoneterraria.configuration.lunar_flare_explosion_range": "爆炸范围",
|
||||
"lzxnoneterraria.configuration.lunar_flare_explosion_range.tooltip": "弹射物爆炸后造成伤害的半径",
|
||||
"lzxnoneterraria.configuration.lunar_flare_mana_consume": "魔力消耗",
|
||||
"lzxnoneterraria.configuration.lunar_flare_mana_consume.tooltip": "每次发射消耗的魔力",
|
||||
"lzxnoneterraria.configuration.bubble_gun_damage": "伤害",
|
||||
"lzxnoneterraria.configuration.bubble_gun_damage.tooltip": "每个泡泡命中造成的魔法伤害",
|
||||
"lzxnoneterraria.configuration.bubble_gun_speed": "速度",
|
||||
"lzxnoneterraria.configuration.bubble_gun_speed.tooltip": "泡泡初始移动速度",
|
||||
"lzxnoneterraria.configuration.bubble_gun_drag": "阻力",
|
||||
"lzxnoneterraria.configuration.bubble_gun_drag.tooltip": "泡泡每刻保留的速度比例",
|
||||
"lzxnoneterraria.configuration.bubble_gun_mana_consume": "魔力消耗",
|
||||
"lzxnoneterraria.configuration.bubble_gun_mana_consume.tooltip": "每次发射消耗的魔力",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time": "杀戮模式持续时间",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_time.tooltip": "杀戮模式持续时间(刻)",
|
||||
"lzxnoneterraria.configuration.devils_devastation_kill_mode_cooldown_time": "杀戮模式冷却时间",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "lzxnoneterraria:item/sword3",
|
||||
"textures": {
|
||||
"layer0": "lzxnoneterraria:item/betsys_wrath"
|
||||
}
|
||||
}
|
||||
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user