-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix early crash when enchantability is checked before AE2 is initiali…
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package appeng.hooks; | ||
|
||
import net.minecraft.world.item.Item; | ||
|
||
import appeng.core.definitions.AEParts; | ||
import appeng.items.parts.PartItem; | ||
|
||
public final class EnchantmentHooks { | ||
private EnchantmentHooks() { | ||
} | ||
|
||
public static boolean isDiggerEnchantable(Item item) { | ||
// The instanceof check here tries to avoid class-init of AEParts until it is called for an actual AE item | ||
// Otherwise it might try to initialize all AE Parts | ||
if (item instanceof PartItem) { | ||
return isAnnihilationPlane(item); | ||
} | ||
return false; | ||
} | ||
|
||
private static boolean isAnnihilationPlane(Item item) { | ||
return item == AEParts.ANNIHILATION_PLANE.asItem(); | ||
} | ||
} |
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