Skip to content

Commit

Permalink
balancing
Browse files Browse the repository at this point in the history
- increase bite cooldown from 6 -> 10 seconds
- decrease bleeding bite duration from 5 -> 3 seconds
- remove suspicious stew effects for werewolves
  • Loading branch information
Cheaterpaul committed May 23, 2024
1 parent ee1a765 commit 39059bb
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Player(ModConfigSpec.Builder builder) {
werewolf_speed_amount = builder.comment("Level based speed attribute modifier").defineInRange("werewolf_speed_amount", 0.1, 0, 5);
werewolf_armor_toughness = builder.comment("Level based armor toughness attribute modifier").defineInRange("werewolf_armor_toughness", 3.0, 0, 10.0);
werewolf_claw_damage = builder.comment("Level based claw damage attribute modifier").defineInRange("werewolf_claw_damage", 1d, 0, Integer.MAX_VALUE);
bite_cooldown = builder.comment("Cooldown of bite attack (in ticks)").defineInRange("bite_cooldown", 120, 5, Integer.MAX_VALUE);
bite_cooldown = builder.comment("Cooldown of bite attack (in ticks)").defineInRange("bite_cooldown", 200, 5, Integer.MAX_VALUE);
}
}

Expand Down Expand Up @@ -300,7 +300,7 @@ public Skills(ModConfigSpec.Builder builder) {
builder.pop();

builder.push("bleeding_bite");
this.bleeding_bite_duration = builder.comment("In ticks").defineInRange("bleeding_bite_duration", 100, 0, Integer.MAX_VALUE);
this.bleeding_bite_duration = builder.comment("In ticks").defineInRange("bleeding_bite_duration", 60, 0, Integer.MAX_VALUE);
builder.pop();

builder.push("better_claws");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package de.teamlapen.werewolves.mixin;

import com.llamalad7.mixinextras.injector.ModifyReceiver;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import de.teamlapen.werewolves.util.Helper;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SuspiciousStewItem;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SuspiciousEffectHolder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import java.util.function.Consumer;

@Mixin(SuspiciousStewItem.class)
public class SuspiciousStewItemMixin {

@WrapOperation(method = "finishUsingItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/SuspiciousStewItem;listPotionEffects(Lnet/minecraft/world/item/ItemStack;Ljava/util/function/Consumer;)V"))
private void finishUsing(ItemStack pStack, Consumer<SuspiciousEffectHolder.EffectEntry> pOutput, Operation<Void> original, ItemStack originalStack, Level pLevel, LivingEntity pEntityLiving) {
if (!Helper.canEat(pEntityLiving, pStack)) {
ItemStack copy = pStack.copy();
CompoundTag tag = copy.getTag();
if (tag != null) {
tag.remove("effects");
}
pStack = copy;
}
original.call(pStack, pOutput);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {

@Shadow protected abstract void playBlockFallSound();

@Inject(method = "addEatEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/Item;isEdible()Z", shift = At.Shift.AFTER), cancellable = true)
private void test(ItemStack pFood, Level pLevel, LivingEntity pLivingEntity, CallbackInfo ci) {
var food = pFood.getFoodProperties(pLivingEntity);
if (food != null && !food.isMeat() && pLivingEntity instanceof Player player && Helper.isWerewolf(player) && !WerewolfPlayer.get(player).getSkillHandler().isSkillEnabled(ModSkills.NOT_MEAT.get())) {
if (!Helper.canEat(pLivingEntity, pFood)) {
ci.cancel();
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/de/teamlapen/werewolves/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public static boolean isRawMeatSkipMeat(ItemStack stack) {
return stack.is(ModTags.Items.RAW_MEAT);
}

public static boolean canEat(LivingEntity entity, ItemStack stack) {
return Helper.isMeat(entity, stack) || !(entity instanceof Player player) || !Helper.isWerewolf(player) || WerewolfPlayer.get(player).getSkillHandler().isSkillEnabled(ModSkills.NOT_MEAT.get());
}

public static Optional<IWerewolf> asIWerewolf(LivingEntity entity) {
if (entity instanceof IWerewolf werewolf) {
return Optional.of(werewolf);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/werewolves.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"PowderSnowBlockMixin",
"RegistriesDatapackGeneratorAccessor",
"SmithingTemplateItemAccessor",
"SuspiciousStewItemMixin",
"TargetingConditionsAccessor",
"VanillaBlockLootAccessor",
"entity.CatMixin",
Expand Down

0 comments on commit 39059bb

Please sign in to comment.