diff --git a/build.gradle b/build.gradle index 3a077f5..4fb9ec5 100644 --- a/build.gradle +++ b/build.gradle @@ -65,6 +65,9 @@ dependencies { modImplementation "maven.modrinth:ranged-weapon-api:${project.ranged_weapon_api_version}" + modImplementation "maven.modrinth:archers:${project.archers_version}" + include(implementation("com.github.ZsoltMolnarrr:TinyConfig:${project.tiny_config_version}")) + modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { exclude(group: "net.fabricmc.fabric-api") } diff --git a/gradle.properties b/gradle.properties index 6886233..5ab73ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ archives_base_name=botaniacombat # Dependencies #Fabric api -fabric_version=0.92.0+1.20.1 +fabric_version=0.92.2+1.20.1 #botania botania_version=1.20.1-445 @@ -31,3 +31,6 @@ mod_menu_version=7.2.2 fabricasm_version=2.3 # rangedweaponapi deps ranged_weapon_api_version = 1.1.2+1.20.1 +# archers (for power ench nerf config) +archers_version = 1.2.5+1.20.1 +tiny_config_version=2.3.2 diff --git a/src/main/java/info/partonetrain/botaniacombat/BotaniaCombat.java b/src/main/java/info/partonetrain/botaniacombat/BotaniaCombat.java index daa2560..e8890e1 100644 --- a/src/main/java/info/partonetrain/botaniacombat/BotaniaCombat.java +++ b/src/main/java/info/partonetrain/botaniacombat/BotaniaCombat.java @@ -20,6 +20,8 @@ public class BotaniaCombat implements ModInitializer { public static final boolean FABRIC_SHIELD_LIB_INSTALLED = FabricLoader.getInstance().isModLoaded("fabricshieldlib"); public static final boolean RANGED_WEAPON_API_INSTALLED = FabricLoader.getInstance().isModLoaded("ranged_weapon_api"); public static final boolean FARMERS_DELIGHT_INSTALLED = FabricLoader.getInstance().isModLoaded("farmersdelight"); + public static final boolean ARCHERS_INSTALLED = FabricLoader.getInstance().isModLoaded("archers"); + public static final int MANA_PER_DAMAGE = 60; public static final int MANA_PER_DAMAGE_TERRA = 100; diff --git a/src/main/java/info/partonetrain/botaniacombat/item/ranged/SkadiBowItem.java b/src/main/java/info/partonetrain/botaniacombat/item/ranged/SkadiBowItem.java index b1416c9..42f367d 100644 --- a/src/main/java/info/partonetrain/botaniacombat/item/ranged/SkadiBowItem.java +++ b/src/main/java/info/partonetrain/botaniacombat/item/ranged/SkadiBowItem.java @@ -1,16 +1,19 @@ package info.partonetrain.botaniacombat.item.ranged; import info.partonetrain.botaniacombat.BotaniaCombat; +import net.archers.ArchersMod; import net.fabric_extras.ranged_weapon.api.CustomBow; import net.fabric_extras.ranged_weapon.api.CustomRangedWeapon; import net.fabric_extras.ranged_weapon.api.RangedConfig; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.tags.EntityTypeTags; 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.monster.Skeleton; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ArrowItem; @@ -31,6 +34,8 @@ import java.util.function.Supplier; public class SkadiBowItem extends CustomBow implements CustomDamageItem { + + private static final int MANA_PER_HIT = 50; RangedConfig rangedConfig; public SkadiBowItem(Properties settings, Supplier repairIngredientSupplier, RangedConfig rangedConfig) { @@ -103,9 +108,9 @@ public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity abstractArrow.setCritArrow(true); } - int j = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, stack); - if (j > 0) { //TODO modify for archers power nerf config - abstractArrow.setBaseDamage(abstractArrow.getBaseDamage() + (double) j * 0.5 + 0.5); + int powerLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, stack); + if (powerLevel > 0) { + abstractArrow.setBaseDamage(abstractArrow.getBaseDamage() + calculatePowerBonus(powerLevel)); } int k = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.PUNCH_ARROWS, stack); @@ -144,4 +149,38 @@ public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity } } } + + @Override + public boolean hurtEnemy(ItemStack stack, LivingEntity target, @NotNull LivingEntity attacker) { + if(!target.level().isClientSide() && attacker instanceof Player player && + ManaItemHandler.instance().requestManaExactForTool(stack, player, MANA_PER_HIT, true)){ + if (target.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES)) { + target.hurt(player.damageSources().playerAttack(player), (float) (5 + calculatePowerBonus(EnchantmentHelper.getItemEnchantmentLevel(Enchantments.POWER_ARROWS, stack)))); + } + + target.setTicksFrozen(target.getTicksFrozen() + 200); + target.setIsInPowderSnow(true); + if (target instanceof Skeleton s){ + s.doFreezeConversion(); + } + } + + stack.hurtAndBreak(1, attacker, e -> e.broadcastBreakEvent(InteractionHand.MAIN_HAND)); + return true; + } + + //Archers mod nerfs Power enchantment. Since SkadiBow overrides releaseUsing, + //it doesn't inherit the Archers nerfing mixin. So account for that here. + public double calculatePowerBonus(int powerLevel){ + if(powerLevel == 0){ + return 0; + } + if(BotaniaCombat.ARCHERS_INSTALLED){ + float configValue = ArchersMod.tweaksConfig.value.power_enchantment_multiplier_per_level; + if(configValue > 0){ + return (1 + powerLevel * configValue); + } + } + return (double) powerLevel * 0.5 + 0.5; + } } diff --git a/src/main/java/info/partonetrain/botaniacombat/item/shield/TerrasteelShieldItem.java b/src/main/java/info/partonetrain/botaniacombat/item/shield/TerrasteelShieldItem.java index db05369..c07a7e3 100644 --- a/src/main/java/info/partonetrain/botaniacombat/item/shield/TerrasteelShieldItem.java +++ b/src/main/java/info/partonetrain/botaniacombat/item/shield/TerrasteelShieldItem.java @@ -74,9 +74,9 @@ public InteractionResultHolder use(Level world, Player user, Interact Vec3 destVec = srcVec.add(lookVec); AABB areaInFrontOfPlayer = new AABB(destVec.x() + range, destVec.y() + range, destVec.z() + range, destVec.x() - range, destVec.y(), destVec.z() - range); - List mobsInFront = world.getEntitiesOfClass(LivingEntity.class, areaInFrontOfPlayer); + List livingInFront = world.getEntitiesOfClass(LivingEntity.class, areaInFrontOfPlayer); - for (LivingEntity living : mobsInFront) { + for (LivingEntity living : livingInFront) { if (living.isAlive() && !living.is(user) && !user.isAlliedTo(living)) { living.knockback((getPushPower(user)), -lookAngle.x, -lookAngle.z); this.useExtra(living, world); diff --git a/src/main/resources/assets/botania/patchouli_books/lexicon/en_us/entries/tools/terrasteel_shield.json b/src/main/resources/assets/botania/patchouli_books/lexicon/en_us/entries/tools/terrasteel_shield.json index 8d53a8a..be7b0aa 100644 --- a/src/main/resources/assets/botania/patchouli_books/lexicon/en_us/entries/tools/terrasteel_shield.json +++ b/src/main/resources/assets/botania/patchouli_books/lexicon/en_us/entries/tools/terrasteel_shield.json @@ -13,6 +13,10 @@ "type": "crafting", "text": "botaniacombat.page.terrasteel_shield1", "recipe": "botaniacombat:terrasteel_shield" + }, + { + "type": "text", + "text": "botaniacombat.page.terrasteel_shield2" } ] } \ No newline at end of file diff --git a/src/main/resources/assets/botaniacombat/lang/en_us.json b/src/main/resources/assets/botaniacombat/lang/en_us.json index 512d19b..40ced9b 100644 --- a/src/main/resources/assets/botaniacombat/lang/en_us.json +++ b/src/main/resources/assets/botaniacombat/lang/en_us.json @@ -75,12 +75,13 @@ "botaniacombat.entry.terrasteel_shield": "Terra Tower Shield", "botaniacombat.tagline.terrasteel_shield": "Tall, pushy, and powerful shield", - "botaniacombat.page.terrasteel_shield0": "Shields, while useful for protecting yourself from projectiles, can't prevent you from getting cornered. That is, not unless your shield is a $(item)Terra Tower Shield$(). To perform a Shield Bash, begin blocking while sneaking. This will send mobs in front of you back. $(br)The Shield Bash deflects knockback; that is, the more knockback resistance you have, the more knockback will be applied to mobs.", + "botaniacombat.page.terrasteel_shield0": "Shields are useful for protecting yourself from projectiles, but can't prevent you from getting cornered... Unless your shield is a $(item)Terra Tower Shield$(). To perform a Shield Bash while wielding one, begin blocking while sneaking. This will consume some $(thing)mana$() and send foes in front of you back.", "botaniacombat.page.terrasteel_shield1": "I wanna push you around$(br)Well, I will, well, I will", + "botaniacombat.page.terrasteel_shield2": "The Shield Bash uses absorbed knockback; that is, the more knockback resistance you have, the more knockback will be applied to foes. Paired with a full set of $(l:tools/terrasteel_armor)$(item)Terrasteel Armor$(0)$(/l), it can send your enemies 20 or more blocks away!", "botaniacombat.entry.svalinn": "Gaia Gift: Svalinn", "botaniacombat.tagline.svalinn": "Sun Shield", - "botaniacombat.page.svalinn0": "Svalinn is a shield that protects the world (or, more specifically, Midgard - what seems to be known as the \"overworld\") from the sun. In the same way that the $(l:tools/terrasteel_shield)$(item)Terra Tower Shield$(0)$(/l) takes in knockback and deflects it during a Shield Bash, Svalinn takes in heat from the sun to burn enemies.", + "botaniacombat.page.svalinn0": "Svalinn is a shield that protects the world (or, more specifically, Midgard -- what seems to be known as the \"overworld\") from the sun. In the same way that the $(l:tools/terrasteel_shield)$(item)Terra Tower Shield$(0)$(/l) takes in knockback and deflects it during a Shield Bash, Svalinn takes in heat from the sun to burn enemies.", "botaniacombat.page.svalinn1": "How long enemies burn for is dependent on how high in the sky the sun is, and there will be no ignition if used during the darkest hours of the night.$(br2)It will also grant its user temporary immunity to fire at the cost of some $(thing)mana$(), should they come into contact with heat.", "botaniacombat.entry.livingwood_crossbow": "Livingwood Crossbow", @@ -95,8 +96,8 @@ "botaniacombat.entry.skadi_bow": "Gaia Gift: Skaði's Bow", "botaniacombat.tagline.skadi_bow": "Frost Bow", - "botaniacombat.page.skadi_bow0": "Long, long ago, a jötunn by the name of Skaði skied down snowy mountains and hunted game. Her bow had the ability to nearly freeze her prey in place for a moment, which was just enough time to deliver the killing blow.", - "botaniacombat.page.skadi_bow1": "Skaði's Bow freely converts mundane arrows into Arrows of Slowness IV when fired. Being a larger bow, any arrow fired from it will have a greater velocity, resulting in greater damage.$(br2)Additionally, when enchanted with Infinity, Skaði's Bow does not require arrows at all. It will still consume non-mundane arrows.", + "botaniacombat.page.skadi_bow0": "Long, long ago, a jötunn by the name of Skaði skied down snowy mountains and hunted game. Her bow had the ability to nearly freeze her prey in place for a moment, which was just enough time to deliver the killing blow.$(br2)Skaði's Bow freely converts mundane arrows into Arrows of Slowness IV when fired. ", + "botaniacombat.page.skadi_bow1": "Being a larger bow, any arrow fired from it will have greater power than a standard bow, resulting in greater damage. When enchanted with Infinity, Skaði's Bow does not require arrows at all. It will still consume non-mundane arrows.$(br2)Unusual for a bow is the fang-like structures near its arrow rest, which will cause foes hit with it to become inflicted with cold as if they were standing in $(item)Powdered Snow$() at the cost of a minimal amount of $(thing)mana$().", "botaniacombat.entry.angry_bozu": "Angry Angry Bozu", "botaniacombat.tagline.angry_bozu": "just a glimpse into my dark reality.", diff --git a/src/main/resources/assets/botaniacombat/models/item/svalinn.json b/src/main/resources/assets/botaniacombat/models/item/svalinn.json index 9031e6a..be3ec98 100644 --- a/src/main/resources/assets/botaniacombat/models/item/svalinn.json +++ b/src/main/resources/assets/botaniacombat/models/item/svalinn.json @@ -112,11 +112,11 @@ }, "firstperson_righthand": { "rotation": [0, 180, 0], - "translation": [-2, -8, 2] + "translation": [6, -12, 2] }, "firstperson_lefthand": { "rotation": [0, 180, 0], - "translation": [-2, -8, 2] + "translation": [6, -12, 2] }, "ground": { "translation": [0, 3, 0], diff --git a/src/main/resources/assets/botaniacombat/models/item/terrasteel_shield.json b/src/main/resources/assets/botaniacombat/models/item/terrasteel_shield.json index fd042bf..f0471a1 100644 --- a/src/main/resources/assets/botaniacombat/models/item/terrasteel_shield.json +++ b/src/main/resources/assets/botaniacombat/models/item/terrasteel_shield.json @@ -144,13 +144,11 @@ }, "firstperson_righthand": { "rotation": [0, 180, 5], - "translation": [-2, -24, 0], - "scale": [1.65, 1.65, 1.65] + "translation": [4.5, -14, 2] }, "firstperson_lefthand": { "rotation": [0, 180, 5], - "translation": [4.5, -24, 2], - "scale": [1.65, 1.65, 1.65] + "translation": [4.5, -14, 2] }, "ground": { "translation": [0, 3, 0], diff --git a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_held.png b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_held.png index edd13e4..3224bd0 100644 Binary files a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_held.png and b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_held.png differ diff --git a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_0_held.png b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_0_held.png index 65f34b2..f2ada6b 100644 Binary files a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_0_held.png and b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_0_held.png differ diff --git a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_1_held.png b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_1_held.png index 767cd11..ba611a3 100644 Binary files a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_1_held.png and b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_1_held.png differ diff --git a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_2_held.png b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_2_held.png index 5c297c5..3e97423 100644 Binary files a/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_2_held.png and b/src/main/resources/assets/botaniacombat/textures/item/skadi_bow_pulling_2_held.png differ diff --git a/src/main/resources/botaniacombat.accesswidener b/src/main/resources/botaniacombat.accesswidener index 93f4f31..a879025 100644 --- a/src/main/resources/botaniacombat.accesswidener +++ b/src/main/resources/botaniacombat.accesswidener @@ -5,4 +5,5 @@ accessible method net/minecraft/world/item/CrossbowItem getArrow (Lnet/minecraft accessible method net/minecraft/world/item/CrossbowItem getChargedProjectiles (Lnet/minecraft/world/item/ItemStack;)Ljava/util/List; accessible method net/minecraft/world/item/CrossbowItem getShotPitches (Lnet/minecraft/util/RandomSource;)[F accessible method net/minecraft/world/item/CrossbowItem onCrossbowShot (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/item/ItemStack;)V -accessible method net/minecraft/client/renderer/entity/ItemRenderer renderModelLists (Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/item/ItemStack;IILcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;)V \ No newline at end of file +accessible method net/minecraft/client/renderer/entity/ItemRenderer renderModelLists (Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/item/ItemStack;IILcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;)V +accessible method net/minecraft/world/entity/monster/Skeleton doFreezeConversion ()V diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index db87caf..e2bc04c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -37,7 +37,7 @@ "fabricloader": "*", "minecraft": ">=1.20", "cloth-config": ">=11", - "fabric-api": "*", + "fabric-api": ">=0.92.2+1.20.1", "botania": ">=1.20.1-445" }, "suggests": {