mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Fix Magnet pulling fake item entities (#59)
This commit is contained in:
1 parent
07ed88515e
commit
f7cac98ad5
2 files changed
+16
-1
No files matched your search
@@ -29,6 +29,7 @@ import com.brandon3055.draconicevolution.common.items.ItemDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.integration.ModHelper;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
@@ -112,7 +113,7 @@ public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
boolean playSound = false;
|
||||
|
||||
for (EntityItem item : items) {
|
||||
if (item.getEntityItem() == null) {
|
||||
if (item.getEntityItem() == null || ModHelper.isAE2EntityFloatingItem(item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.tileentity.TileEntity;
|
||||
@@ -21,6 +22,7 @@ public class ModHelper {
|
||||
// private static boolean isRotaryCraftInstalled;
|
||||
private static final boolean isGregTechInstalled;
|
||||
private static final boolean isBartworkdsInstalled;
|
||||
private static final boolean isAE2Installed;
|
||||
|
||||
private static Item cleaver;
|
||||
private static Item avaritiaSword;
|
||||
@@ -28,6 +30,7 @@ public class ModHelper {
|
||||
|
||||
private static Class<?> bwores;
|
||||
private static Class<?> GTores;
|
||||
private static Class<?> AE2FItem;
|
||||
|
||||
static {
|
||||
isTConInstalled = Loader.isModLoaded("TConstruct");
|
||||
@@ -35,8 +38,10 @@ public class ModHelper {
|
||||
// isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft");
|
||||
isGregTechInstalled = Loader.isModLoaded("gregtech");
|
||||
isBartworkdsInstalled = Loader.isModLoaded("bartworks");
|
||||
isAE2Installed = Loader.isModLoaded("appliedenergistics2");
|
||||
final String GT_ORE_CLASS = "gregtech.common.blocks.TileEntityOres";
|
||||
final String BW_ORE_CLASS = "bartworks.system.material.BWMetaGeneratedOres";
|
||||
final String AE2_FITEM_CLASS = "appeng.entity.EntityFloatingItem";
|
||||
if (isGregTechInstalled) try {
|
||||
GTores = Class.forName(GT_ORE_CLASS);
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -47,6 +52,11 @@ public class ModHelper {
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.error("Couldn't reflect class " + BW_ORE_CLASS);
|
||||
}
|
||||
if (isAE2Installed) try {
|
||||
AE2FItem = Class.forName(AE2_FITEM_CLASS);
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.error("Couldn't reflect class " + AE2_FITEM_CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isHoldingCleaver(EntityPlayer player) {
|
||||
@@ -112,4 +122,8 @@ public class ModHelper {
|
||||
public static boolean isGregTechTileEntityOre(TileEntity te) {
|
||||
return isGregTechInstalled && GTores.isInstance(te) || isBartworkdsInstalled && bwores.isInstance(te);
|
||||
}
|
||||
|
||||
public static boolean isAE2EntityFloatingItem(EntityItem item) {
|
||||
return isAE2Installed && AE2FItem.isInstance(item);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user