Skip to content

Commit

Permalink
2.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ExDrill committed Sep 14, 2024
1 parent 7c4d2e7 commit bd62ba8
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 32 deletions.
33 changes: 4 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
### Gameplay Changes
* Netherite Shield enchantability has been reduced. `20 -> 15`
* Barbed durability damage has been reduced. `2 -> 1`
* Barbed success chance has been increased. `20% -> 33%`
* Barbed damage can now be inflicted from ranged attacks.
* Added the "Attacks Blocked by Shield" stat.
* Added the "Attacks Parried by Shield" stat.

### Config Changes
* The enchantability of the Shield and Netherite Shield have been made configurable.
* Configurations for Pummeling and Barbed and projectile deflection strength have been removed.

### Technical Changes
Guarding now uses 1.21's data driven enchantments, for this reason, several configurations were removed in favor of this new system.

Added 3 new enchantment effect components:

`guarding:shield_blocked`: Effects applying after an attack is blocked.
* Condition Context: Damage Parameters
* Effect: Entity Effect
* Additional fields:
- `cancel_on_parry`: When true, stops the effects from being applied when a parry is landed
- `affected`: A specifier for whom the effect is applied to. Possible values are `attacker`, `damaging_entity`, and `victim`

`guarding:shield_parried`: Effects applying after an attack is parried.
* Condition Context: Damage Parameters
* Effect: Entity Effect
* Additional fields:
- `affected`: A specifier for whom the effect is applied to. Possible values are `attacker`, `damaging_entity`, and `victim`

`guarding:shield_knockback`: Effects for the amount of knockback to deal when an attack is blocked.
* Condition Context: Damage Parameters
* Effect: Value Effect
### Fixes
* Fixed an issue where players wouldn't receive knockback from parries.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ org.gradle.parallel=true
loader_version=0.15.11

# Mod Properties
mod_version = 2.7.3
mod_version = 2.7.4
maven_group = com.teamabode
archives_base_name = guarding

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/teamabode/guarding/Guarding.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public void onInitialize() {
GuardingParticles.init();
GuardingCritieriaTriggers.init();
GuardingRecipeSerializers.init();
GuardingStats.init();


ShieldEvents.BLOCKED.register(ShieldUtils::onBlocked);
ConfigManager.INSTANCE.register(GuardingConfig.INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public void onInitializeClient() {

private static void netheriteShield() {
NetheriteShieldRenderer renderer = new NetheriteShieldRenderer();
BuiltinItemRendererRegistry.INSTANCE.register(GuardingItems.NETHERITE_SHIELD, renderer);
ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(renderer);
BuiltinItemRendererRegistry.INSTANCE.register(GuardingItems.NETHERITE_SHIELD, renderer);
ItemProperties.register(GuardingItems.NETHERITE_SHIELD, Guarding.id("blocking"), GuardingClient::blockingPredicate);
}

private static float blockingPredicate(ItemStack stack, ClientLevel level, LivingEntity user, int i) {
return user != null && user.getUseItem() == stack ? 1.0f : 0.0f;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.teamabode.guarding.core.registry;

import com.teamabode.guarding.Guarding;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.stats.StatFormatter;
import net.minecraft.stats.Stats;

public class GuardingStats {
public static final ResourceLocation ATTACKS_BLOCKED_BY_SHIELD = register("attacks_blocked_by_shield", StatFormatter.DEFAULT);
public static final ResourceLocation ATTACKS_PARRIED_BY_SHIELD = register("attacks_parried_by_shield", StatFormatter.DEFAULT);

private static ResourceLocation register(String name, StatFormatter format) {
ResourceLocation location = Guarding.id(name);
Registry.register(BuiltInRegistries.CUSTOM_STAT, location, location);
Stats.CUSTOM.get(location, format);
return location;
}

public static void init() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.teamabode.guarding.core.access.ProjectileAccessor;
import com.teamabode.guarding.core.registry.GuardingParticles;
import com.teamabode.guarding.core.registry.GuardingSounds;
import com.teamabode.guarding.core.registry.GuardingStats;
import com.teamabode.guarding.core.tag.GuardingDamageTypeTags;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -21,6 +23,7 @@ public static void onBlocked(Player user, DamageSource source, float amount) {
if (performedParry) {
parry(server, user, source);
}
user.awardStat(GuardingStats.ATTACKS_BLOCKED_BY_SHIELD, 1);
EnchantmentUtils.runBlockedEffects(server, user, source, performedParry);
}

Expand All @@ -35,11 +38,15 @@ else if (source.getDirectEntity() instanceof LivingEntity attacker) {
}
player.causeFoodExhaustion(GuardingConfig.INSTANCE.exhaustionCost.get());
server.playSound(null, player.blockPosition(), GuardingSounds.ITEM_SHIELD_PARRY, SoundSource.PLAYERS);
player.awardStat(GuardingStats.ATTACKS_PARRIED_BY_SHIELD, 1);

EnchantmentUtils.runParriedEffects(server, player, source);
}

public static void knockbackAttacker(Player player, LivingEntity attacker) {
float knockbackStrength = getKnockbackStrength(player);

attacker.hurtMarked = true;
attacker.knockback(knockbackStrength, player.getX() - attacker.getX(), player.getZ() - attacker.getZ());
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/guarding/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

"item.guarding.netherite_shield": "Netherite Shield",

"stat.guarding.attacks_blocked_by_shield": "Attacks Blocked by Shield",
"stat.guarding.attacks_parried_by_shield": "Attacks Parried by Shield",

"subtitle.guarding.item.shield.parry": "Shield parries",
"subtitle.guarding.item.netherite_shield.block": "Shield blocks",
"subtitle.guarding.item.netherite_shield.break": "Shield breaks",
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/guarding/lang/es_mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"enchantment.guarding.pummeling": "Apalear",
"enchantment.guarding.pummeling.desc": "Aumenta la fuerza de empuje de un bloqueo perfecto.",
"item.guarding.netherite_shield": "Escudo de netherita",

"stat.guarding.attacks_blocked_by_shield": "Ataques bloqueados con escudo",
"stat.guarding.attacks_parried_by_shield": "Ataques bloqueados perfectamente con escudo",

"subtitle.guarding.item.netherite_shield.block": "Bloqueo con escudo",
"subtitle.guarding.item.netherite_shield.break": "Ítem destruido",
"subtitle.guarding.item.netherite_shield.equip": "Armadura equipada",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"depends": {
"fabricloader": ">=0.15.10",
"fabric-api": "*",
"sketch": "*",
"minecraft": "~1.21",
"java": ">=21"
},
Expand Down

0 comments on commit bd62ba8

Please sign in to comment.