-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
57 additions
and
48 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
42 changes: 42 additions & 0 deletions
42
src/main/java/uwu/lopyluna/create_dd/mixins/MixinEnchantmentHelper.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,42 @@ | ||
package uwu.lopyluna.create_dd.mixins; | ||
|
||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
import net.minecraft.world.item.enchantment.EnchantmentHelper; | ||
import net.minecraft.world.item.enchantment.Enchantments; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import uwu.lopyluna.create_dd.registry.DesiresTags; | ||
|
||
@Mixin(EnchantmentHelper.class) | ||
public class MixinEnchantmentHelper { | ||
|
||
|
||
@SuppressWarnings("deprecation") | ||
@Inject(method = "getMobLooting(Lnet/minecraft/world/entity/LivingEntity;)I", at = @At(value = "HEAD"), cancellable = true) | ||
private static void getMobLooting(LivingEntity pEntity, CallbackInfoReturnable<Integer> cir) { | ||
ItemStack stack = desires$isRightForItem(Enchantments.MOB_LOOTING, pEntity); | ||
if (stack != ItemStack.EMPTY) | ||
cir.setReturnValue((net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MOB_LOOTING, stack) * 3) + 1); | ||
} | ||
|
||
@SuppressWarnings("all") | ||
@Unique | ||
private static ItemStack desires$isRightForItem(Enchantment pEnchantment, LivingEntity pEntity) { | ||
Iterable<ItemStack> iterable = pEnchantment.getSlotItems(pEntity).values(); | ||
if (iterable == null) { | ||
return ItemStack.EMPTY; | ||
} else { | ||
ItemStack i = ItemStack.EMPTY; | ||
for(ItemStack itemstack : iterable) { | ||
if (!itemstack.isEmpty() && itemstack.is(DesiresTags.AllItemTags.ADDITIONAL_DROPS_TOOL.tag)) | ||
i = itemstack; | ||
} | ||
return i; | ||
} | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/uwu/lopyluna/create_dd/mixins/MixinForgeHooks.java
This file was deleted.
Oops, something went wrong.
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