Skip to content

Commit

Permalink
Implement Infernal Mobs sticky pedestal compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Sep 19, 2023
1 parent 06c5b6d commit e80f5f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ All changes are toggleable via the config file.
* **Duplication Fixes:** Fixes various duplication exploits
* **Infernal Mobs**
* **Sticky Recall Compatibility:** Enables compatibility between Infernal Mobs' Sticky effect and Capsule's Recall enchantment
* **Sticky Pedestal Compatibility:** Enables compatibility between Infernal Mobs' Sticky effect and Reliquary's Pedestal
* **Iron Backpacks**
* **Duplication Fixes:** Fixes various duplication exploits
* **Item Stages**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,11 @@ public static class InfernalMobsCategory
@Config.Name("Sticky Recall Compatibility")
@Config.Comment("Enables compatibility between Infernal Mobs' Sticky effect and Capsule's Recall enchantment")
public boolean utIMStickyRecallToggle = true;

@Config.RequiresMcRestart
@Config.Name("Sticky Pedestal Compatibility")
@Config.Comment("Enables compatibility between Infernal Mobs' Sticky effect and Reliquary's Pedestal")
public boolean utIMStickyPedestalToggle = true;
}

public static class IronBackpacksCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;

import atomicstryker.infernalmobs.common.mods.MM_Sticky;
import mod.acgaming.universaltweaks.UniversalTweaks;
Expand All @@ -15,12 +18,23 @@
public class UTInfernalMobsStickyMixin
{
@Redirect(method = "onHurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/item/EntityItem;setPickupDelay(I)V"))
public void utInfernalMobsSticky(EntityItem entityItem, int ticks)
public void utInfernalMobsStickyRecall(EntityItem entityItem, int ticks)
{
if (!UTConfig.MOD_INTEGRATION.INFERNAL_MOBS.utIMStickyRecallToggle) entityItem.setPickupDelay(ticks);
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTInfernalMobsSticky ::: Set pickup delay");
Enchantment recall = Enchantment.getEnchantmentByLocation("capsule:recall");
if (recall != null && EnchantmentHelper.getEnchantmentLevel(recall, entityItem.getItem()) > 0) entityItem.setNoPickupDelay();
else entityItem.setPickupDelay(ticks);
}

@Redirect(method = "onHurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/DamageSource;getTrueSource()Lnet/minecraft/entity/Entity;", ordinal = 0))
public Entity utInfernalMobsStickyPedestal(DamageSource source)
{
if (UTConfig.MOD_INTEGRATION.INFERNAL_MOBS.utIMStickyPedestalToggle)
{
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTInfernalMobsSticky ::: Get true source");
if (source.getTrueSource() instanceof EntityPlayer && ((EntityPlayer) source.getTrueSource()).getName().equals("reliquary_pedestal_fake_player")) return null;
}
return source.getTrueSource();
}
}

0 comments on commit e80f5f3

Please sign in to comment.