mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-25 20:22:19 +00:00
Block certain GT materials from being disenchanted (#77)
This commit is contained in:
1 parent
0e4101e4e5
commit
1ca5aff7d9
2 files changed
+14
-2
No files matched your search
+4
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user