Skip to content

Commit

Permalink
2.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Partonetrain committed Jul 22, 2024
1 parent 22c5bd5 commit cb39a4c
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 18 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<Ingredient> repairIngredientSupplier, RangedConfig rangedConfig) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public InteractionResultHolder<ItemStack> 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<LivingEntity> mobsInFront = world.getEntitiesOfClass(LivingEntity.class, areaInFrontOfPlayer);
List<LivingEntity> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"type": "crafting",
"text": "botaniacombat.page.terrasteel_shield1",
"recipe": "botaniacombat:terrasteel_shield"
},
{
"type": "text",
"text": "botaniacombat.page.terrasteel_shield2"
}
]
}
9 changes: 5 additions & 4 deletions src/main/resources/assets/botaniacombat/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/resources/botaniacombat.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit cb39a4c

Please sign in to comment.