diff --git a/gradle.properties b/gradle.properties index 3c455364..00cd1fe0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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.2 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 diff --git a/src/main/java/com/github/manasmods/manascore/ManasCore.java b/src/main/java/com/github/manasmods/manascore/ManasCore.java index 78c9fb14..7f666f04 100644 --- a/src/main/java/com/github/manasmods/manascore/ManasCore.java +++ b/src/main/java/com/github/manasmods/manascore/ManasCore.java @@ -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; @@ -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); diff --git a/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributeHandler.java b/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributeHandler.java index a2a34e14..a6df71ee 100644 --- a/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributeHandler.java +++ b/src/main/java/com/github/manasmods/manascore/attribute/ManasCoreAttributeHandler.java @@ -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(); diff --git a/src/main/java/com/github/manasmods/manascore/config/ManasCoreConfig.java b/src/main/java/com/github/manasmods/manascore/config/ManasCoreConfig.java deleted file mode 100644 index af7f9b59..00000000 --- a/src/main/java/com/github/manasmods/manascore/config/ManasCoreConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.manasmods.manascore.config; - -import lombok.Getter; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; -import org.apache.commons.lang3.tuple.Pair; - -public class ManasCoreConfig { - public static final ManasCoreConfig INSTANCE; - public static final ForgeConfigSpec SPEC; - - static { - Pair pair = new ForgeConfigSpec.Builder().configure(ManasCoreConfig::new); - INSTANCE = pair.getKey(); - SPEC = pair.getValue(); - } - - @Getter - private final IntValue anvilExpLimit; - - private ManasCoreConfig(ForgeConfigSpec.Builder builder) { - builder.push("anvil"); - - this.anvilExpLimit = builder - .comment("Max EXP a survival player can spend in an anvil recipe", "-1 = unlimited") - .defineInRange("expLimit", 40, -1, 1_000_000); - - builder.pop(); - } -} diff --git a/src/main/java/com/github/manasmods/manascore/core/MixinAnvilMenu.java b/src/main/java/com/github/manasmods/manascore/core/MixinAnvilMenu.java deleted file mode 100644 index 2e00dd51..00000000 --- a/src/main/java/com/github/manasmods/manascore/core/MixinAnvilMenu.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.github.manasmods.manascore.core; - -import com.github.manasmods.manascore.config.ManasCoreConfig; -import net.minecraft.world.inventory.AnvilMenu; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; - -@Mixin(AnvilMenu.class) -public class MixinAnvilMenu { - @ModifyConstant(method = "createResult", constant = @Constant(intValue = 40, ordinal = 2)) - private int maxEnchantmentLevel(int original) { - int limit = ManasCoreConfig.INSTANCE.getAnvilExpLimit().get(); - if (limit == -1) return 1_000_000; - return limit; - } -} diff --git a/src/main/java/com/github/manasmods/manascore/core/MixinAnvilScreen.java b/src/main/java/com/github/manasmods/manascore/core/MixinAnvilScreen.java deleted file mode 100644 index a255e3b8..00000000 --- a/src/main/java/com/github/manasmods/manascore/core/MixinAnvilScreen.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.github.manasmods.manascore.core; - -import com.github.manasmods.manascore.config.ManasCoreConfig; -import net.minecraft.client.gui.screens.inventory.AnvilScreen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; - -@Mixin(AnvilScreen.class) -public class MixinAnvilScreen { - @ModifyConstant(method = "renderLabels", constant = @Constant(intValue = 40)) - private int maxEnchantmentLevel(int original) { - int limit = ManasCoreConfig.INSTANCE.getAnvilExpLimit().get(); - if (limit == -1) return 1_000_000; - return limit; - } -} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index da1611d1..fbeb9936 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -3,7 +3,7 @@ loaderVersion = "${forgeLoaderVersion}" license = "GPL-3" issueTrackerURL = "https://github.com/ManasMods/ManasCore/issues" #optional [[mods]] #mandatory -modId = "${modId}" #mandatory +modId = "manascore" #mandatory version = "${modVersion}" displayName = "ManasCore" #mandatory updateJSONURL="https://api.modrinth.com/updates/wRRSWpd1/forge_updates.json" #optional @@ -15,24 +15,18 @@ description = ''' Utility and Core Library for Manas Mods ''' #@formatter:off -[[dependencies.${modId}]] #optional +[[dependencies.manascore]] #optional modId="forge" #mandatory mandatory=true #mandatory versionRange="${forgeLoaderVersion}" #mandatory ordering="NONE" side="BOTH" # Here's another dependency -[[dependencies.${modId}]] +[[dependencies.manascore]] modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version versionRange="${minecraftVersionCheck}" ordering="NONE" side="BOTH" -[[dependencies.${modId}]] - modId="mixinextras" - mandatory=true - versionRange="[${mixinExtrasVersion},)" - ordering="NONE" - side="BOTH" ##@formatter:on \ No newline at end of file diff --git a/src/main/resources/manascore.mixins.json b/src/main/resources/manascore.mixins.json index 15495f9a..3ad3ed77 100644 --- a/src/main/resources/manascore.mixins.json +++ b/src/main/resources/manascore.mixins.json @@ -6,7 +6,6 @@ "refmap": "manascore.refmap.json", "mixins": [ "BlockLootAccessor", - "MixinAnvilMenu", "MixinLivingEntity", "MixinServerLevel", "RegistryBuilderAccessor", @@ -14,7 +13,6 @@ ], "client": [ "AbstractContainerScreenAccessor", - "MixinAnvilScreen", "MixinMinecraft" ], "injectors": {