Skip to content

Commit

Permalink
finished mixin required for Implosion enchantment
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Aug 31, 2023
1 parent 8ec2f18 commit 816fe53
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ dependencies{
exclude(group: "net.fabricmc.fabric-api")
exclude(group: "com.github.LlamaLad7")
}
implementation("io.github.llamalad7:mixinextras-common:0.2.0-beta.11")
annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0-beta.11")
modImplementation("com.github.Trins-mods:CT-Fabric-Fluid-Support:${project.ct_fabric_fluid_support_hash}")
modImplementation("io.github.feltmc:fabricated-forge-tag-extensions:${rootProject.fabricated_forge_hash}") { transitive false }
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}"
Expand Down
23 changes: 23 additions & 0 deletions common/src/main/java/muramasa/antimatter/mixin/PlayerMixin.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
package muramasa.antimatter.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import muramasa.antimatter.Data;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.monster.Creeper;
import net.minecraft.world.entity.monster.Ghast;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(Player.class)
public class PlayerMixin {
@WrapOperation(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;getDamageBonus(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/MobType;)F"))
private float redirectDamageBonus(ItemStack stack, MobType type, Operation<Float> original, Entity target){
if (target instanceof LivingEntity living){
if (living instanceof Creeper || living instanceof Ghast){
type = Data.CREEPER;
}
}
return original.call(stack, type);
}
}
1 change: 1 addition & 0 deletions common/src/main/resources/antimatter.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"IngredientAccessor",
"ItemStackMixin",
"LeavesBlockMixin",
"PlayerMixin",
"RepairItemRecipeMixin",
"ServerBlockUpdateMixin",
"SimpleReloadInstanceMixin"
Expand Down
1 change: 1 addition & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies {
modImplementation("earth.terrarium:botarium-forge-1.18.2:${project.botarium_version}")
modImplementation(include("com.gtnewhorizon.structurelib:structurelib-forge:${project.structurelib_version}-${project.minecraft_version}"))
modImplementation(include("com.teamresourceful.resourcefullib:resourcefullib-forge-1.18.2:${project.resourcefullib_version}"))
modImplementation(include("io.github.llamalad7:mixinextras-forge:0.2.0-beta.11"))
modImplementation("dev.latvian.mods:kubejs-forge:${rootProject.kubejs_version}")
modImplementation("curse.maven:the-one-probe-245211:${rootProject.top_forge_file}")
}
Expand Down

0 comments on commit 816fe53

Please sign in to comment.