Skip to content

Commit

Permalink
Critical Multiplier bugged + Downgrade MixinExtra for compatibility +…
Browse files Browse the repository at this point in the history
… Remove Anvil Mixin for compatibility
  • Loading branch information
minheragon12345 committed Nov 16, 2024
1 parent 47003a9 commit ff93f21
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 75 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ forgeVersion=43.3.5
# Parchment Version
parchmentVersion=2022.11.27
# Mod Information see https://mcforge.readthedocs.io/en/1.18.x/gettingstarted/versioning/#examples
modVersion=2.1.4.0
modVersion=2.1.4.1
modId=manascore
# Mixin Extras
mixinExtrasVersion=0.3.2
mixinExtrasVersion=0.2.0
# Photon: https://modrinth.com/mod/photon-editor/versions?l=forge&g=1.19.2
photonVersion=1.0.7.a
# LDLib: https://modrinth.com/mod/ldlib/versions?l=forge&g=1.19.2
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/github/manasmods/manascore/ManasCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
package com.github.manasmods.manascore;

import com.github.manasmods.manascore.attribute.ManasCoreAttributes;
import com.github.manasmods.manascore.config.ManasCoreConfig;
import com.github.manasmods.manascore.network.ManasCoreNetwork;
import com.github.manasmods.manascore.skill.SkillRegistry;
import lombok.Getter;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig.Type;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
Expand All @@ -27,7 +24,6 @@ public final class ManasCore {
private static final Logger logger = LogManager.getLogger();

public ManasCore() {
ModLoadingContext.get().registerConfig(Type.COMMON, ManasCoreConfig.SPEC);
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
ManasCoreAttributes.register(modEventBus);
SkillRegistry.register(modEventBus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ public static void applyEntityCrit(final LivingHurtEvent e) {

@SubscribeEvent(priority = EventPriority.HIGH)
public static void modifyCrit(final CriticalHitEvent e) {
float vanillaMultiplier = e.getDamageModifier() / e.getOldDamageModifier();
float critMultiplier = (float) e.getEntity().getAttributeValue(ManasCoreAttributes.CRIT_MULTIPLIER.get());
if (e.isVanillaCritical()) {
e.setDamageModifier(e.getDamageModifier() * (float) e.getEntity().getAttributeValue(ManasCoreAttributes.CRIT_MULTIPLIER.get()));
e.setDamageModifier(vanillaMultiplier * critMultiplier);
return;
}

double critChance = e.getEntity().getAttributeValue(ManasCoreAttributes.CRIT_CHANCE.get()) / 100; // convert to %
float critMultiplier = (float) e.getEntity().getAttributeValue(ManasCoreAttributes.CRIT_MULTIPLIER.get());
CriticalChanceEvent event = new CriticalChanceEvent(e.getEntity(), e.getTarget(), e.getDamageModifier() * critMultiplier, critChance);
CriticalChanceEvent event = new CriticalChanceEvent(e.getEntity(), e.getTarget(), vanillaMultiplier * critMultiplier, critChance);
if (MinecraftForge.EVENT_BUS.post(event)) return;

RandomSource random = e.getEntity().getRandom();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions src/main/resources/manascore.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
"refmap": "manascore.refmap.json",
"mixins": [
"BlockLootAccessor",
"MixinAnvilMenu",
"MixinLivingEntity",
"MixinServerLevel",
"RegistryBuilderAccessor",
"ShapedRecipeBuilderAccessor"
],
"client": [
"AbstractContainerScreenAccessor",
"MixinAnvilScreen",
"MixinMinecraft"
],
"injectors": {
Expand Down

0 comments on commit ff93f21

Please sign in to comment.