Block certain GT materials from being disenchanted (#77)

This commit is contained in:
Caedis authored and GitHub committed 2025-09-07 14:11:33 -03:00
1 parent 0e4101e4e5
commit 1ca5aff7d9
2 files changed
+14 -2

No files matched your search

@@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.inventory.SlotOutput;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import com.brandon3055.draconicevolution.integration.ModHelper;
public class ContainerDissEnchanter extends Container {
@@ -110,8 +111,9 @@ public class ContainerDissEnchanter extends Container {
@Override
public boolean isItemValid(ItemStack stack) {
return EnchantmentHelper.getEnchantments(stack).size() > 0
|| ItemNBTHelper.getInteger(stack, "RepairCost", 0) > 0;
return (EnchantmentHelper.getEnchantments(stack).size() > 0
|| ItemNBTHelper.getInteger(stack, "RepairCost", 0) > 0)
&& (!ModHelper.isGregTechEnchantmentItem(stack));
}
@Override
@@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.integration;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@@ -13,6 +14,7 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.hazards.Hazard;
import gregtech.api.items.MetaGeneratedTool;
/**
* Created by brandon3055 on 29/9/2015.
@@ -109,6 +111,14 @@ public class ModHelper {
return isGregTechInstalled && GTores.isInstance(te) || isBartworkdsInstalled && bwores.isInstance(te);
}
public static boolean isGregTechEnchantmentItem(ItemStack stack) {
if (stack == null) return false;
if (stack.getItem() == null) return false;
if (!isGregTechInstalled) return false;
return stack.getItem() instanceof MetaGeneratedTool;
}
public static boolean isAE2EntityFloatingItem(EntityItem item) {
return isAE2Installed && AE2FItem.isInstance(item);
}