Skip to content

Commit

Permalink
Combatify 1.1.8.3 - Remove parry crits
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Jan 28, 2024
1 parent e56e85b commit 9a3092d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/atlas/combatify/config/ItemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public void parseItemConfig(Item item, JsonObject jsonObject) {
if (jsonObject.has("use_duration"))
useDuration = getInt(jsonObject, "use_duration");
if (jsonObject.has("armor_piercing"))
useDuration = getInt(jsonObject, "armor_piercing");
piercingLevel = getDouble(jsonObject, "armor_piercing");
ConfigurableItemData configurableItemData = new ConfigurableItemData(damage, speed, reach, chargedReach, stack_size, cooldown, cooldownAfterUse, type, blockingType, blockStrength, blockKbRes, enchantment_level, isEnchantable, hasSwordEnchants, useDuration, piercingLevel);
configuredItems.put(item, configurableItemData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,5 @@ public interface LivingEntityExtensions {

void setPiercingNegation(double negation);

boolean getIsParry();

void setIsParry(boolean isParry);

int getIsParryTicker();

void setIsParryTicker(int isParryTicker);

void setUseItemRemaining(int useItemRemaining);
}
21 changes: 0 additions & 21 deletions src/main/java/net/atlas/combatify/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ public LivingEntityMixin(EntityType<?> entityType, Level level) {
super(entityType, level);
}

@Unique
boolean isParry = false;
@Unique
public int isParryTicker = 0;

@Unique
LivingEntity thisEntity = LivingEntity.class.cast(this);

Expand Down Expand Up @@ -240,22 +235,6 @@ public void isDamageSourceBlocked(DamageSource source, CallbackInfoReturnable<Bo
public boolean hasEnabledShieldOnCrouch() {
return true;
}
@Override
public boolean getIsParry() {
return isParry;
}
@Override
public void setIsParry(boolean isParry) {
this.isParry = isParry;
}
@Override
public int getIsParryTicker() {
return isParryTicker;
}
@Override
public void setIsParryTicker(int isParryTicker) {
this.isParryTicker = isParryTicker;
}

@Override
public void setUseItemRemaining(int ticks) {
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/net/atlas/combatify/mixin/PlayerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ public void addServerOnlyCheck(ItemStack itemStack, boolean bl, boolean bl2, Cal
@Redirect(method = "tick", at = @At(value = "FIELD",target = "Lnet/minecraft/world/entity/player/Player;attackStrengthTicker:I",opcode = Opcodes.PUTFIELD))
public void redirectAttackStrengthTicker(Player instance, int value) {
--instance.attackStrengthTicker;
setIsParryTicker(getIsParryTicker() + 1);
if(getIsParryTicker() >= 40) {
setIsParry(false);
setIsParryTicker(0);
}
}

@ModifyExpressionValue(method = "hurtCurrentlyUsedShield", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z"))
Expand Down Expand Up @@ -201,14 +196,9 @@ public void injectCrit(Entity target, CallbackInfo ci, @Local(ordinal = 0) Local
if(!Combatify.CONFIG.sprintCritsEnabled()) {
isCrit &= !isSprinting();
}
bl3.set(isCrit || getIsParry());
if (isCrit) {
bl3.set(isCrit);
if (isCrit)
attackDamage.set(attackDamage.get() * 1.5F);
}
if (getIsParry()) {
attackDamage.set(attackDamage.get() * 1.25F);
setIsParry(false);
}

}
@Redirect(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;knockback(DDD)V"))
Expand Down
20 changes: 6 additions & 14 deletions src/main/java/net/atlas/combatify/util/SwordBlockingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ public SwordBlockingType(String name) {
public void block(LivingEntity instance, @Nullable Entity entity, ItemStack blockingItem, DamageSource source, LocalFloatRef amount, LocalFloatRef f, LocalFloatRef g, LocalBooleanRef bl) {
if(instance.getItemInHand(InteractionHand.OFF_HAND).isEmpty()) {
boolean blocked = !source.is(DamageTypeTags.IS_EXPLOSION) && !source.is(DamageTypeTags.IS_PROJECTILE);
if (blocked) {
((LivingEntityExtensions)instance).setIsParryTicker(0);
((LivingEntityExtensions)instance).setIsParry(true);
float actualStrength = this.getShieldBlockDamageValue(blockingItem);
g.set(amount.get() * actualStrength);
entity = source.getDirectEntity();
if (entity instanceof LivingEntity) {
instance.blockUsingShield((LivingEntity) entity);
}
} else {
float actualStrength = this.getShieldBlockDamageValue(blockingItem);
g.set(amount.get() * actualStrength);
}
float actualStrength = this.getShieldBlockDamageValue(blockingItem);
g.set(amount.get() * actualStrength);
entity = source.getDirectEntity();
if (blocked && entity instanceof LivingEntity)
instance.blockUsingShield((LivingEntity) entity);

amount.set(amount.get() - g.get());
amount.set(amount.get() - g.get());
}
}

Expand Down

0 comments on commit 9a3092d

Please sign in to comment.