-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Removing Armor Plus Fragment Drops
- Loading branch information
1 parent
86c00b9
commit 6e14c06
Showing
8 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/nomiceu/nomilabs/mixin/armorplus/CommonEventHandlerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.nomiceu.nomilabs.mixin.armorplus; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.event.entity.living.LivingDropsEvent; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import com.nomiceu.nomilabs.config.LabsConfig; | ||
import com.sofodev.armorplus.common.events.CommonEventHandler; | ||
import com.sofodev.armorplus.common.registry.items.ItemFragment; | ||
|
||
/** | ||
* Allows disabling of fragment drops. | ||
*/ | ||
@Mixin(value = CommonEventHandler.class, remap = false) | ||
public class CommonEventHandlerMixin { | ||
|
||
@Inject(method = "registerMobDrop", at = @At("HEAD"), cancellable = true) | ||
private static void disableFragmentDrops(LivingDropsEvent event, boolean enableDrop, ItemStack drop, | ||
CallbackInfo ci) { | ||
if (LabsConfig.modIntegration.disableArmorPlusFragDrops && drop.getItem() instanceof ItemFragment) | ||
ci.cancel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"package": "com.nomiceu.nomilabs.mixin.armorplus", | ||
"refmap": "mixins.nomilabs.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"CommonEventHandlerMixin" | ||
], | ||
"client": [], | ||
"server": [] | ||
} |