aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/enums
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/enums')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java123
1 files changed, 73 insertions, 50 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java
index 050081fc82..9647b00578 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/CustomOrePrefix.java
@@ -3,23 +3,31 @@ package gtPlusPlus.xmod.gregtech.api.enums;
import static gregtech.api.enums.GT_Values.B;
import gregtech.api.enums.OrePrefixes;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.lib.CORE;
import net.minecraftforge.common.util.EnumHelper;
-public class CustomOrePrefix {
+public enum CustomOrePrefix {
- public static CustomOrePrefix Milled;
-
- static {
- Milled = new CustomOrePrefix("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1);
- }
+ milled("Milled Ores", "Milled ", " Ore", true, true, false, false, false, false, false, false, false, true, B[3], -1, 64, -1);
- public static void init() {
- // Does nothing except run the static{} block
- }
-
+ private final String mRegularLocalName;
private final String mLocalizedMaterialPre;
+ private final String mLocalizedMaterialPost;
+ private final boolean mIsUnificatable;
+ private final boolean mIsMaterialBased;
+ private final boolean mIsSelfReferencing;
+ private final boolean mIsContainer;
+ private final boolean mDontUnificateActively;
+ private final boolean mIsUsedForBlocks;
+ private final boolean mAllowNormalRecycling;
+ private final boolean mGenerateDefaultItem;
+ private final boolean mIsEnchantable;
+ private final boolean mIsUsedForOreProcessing;
+ private final int mMaterialGenerationBits;
+ private final long mMaterialAmount;
+ private final int mDefaultStackSize;
+ private final int mTextureindex;
+
+ private OrePrefixes mSelfReference;
private CustomOrePrefix(
String aRegularLocalName,
@@ -38,52 +46,67 @@ public class CustomOrePrefix {
int aMaterialGenerationBits,
long aMaterialAmount,
int aDefaultStackSize,
- int aTextureindex) {
-
+ int aTextureindex) {
+
+ mRegularLocalName = aRegularLocalName;
mLocalizedMaterialPre = aLocalizedMaterialPre;
+ mLocalizedMaterialPost = aLocalizedMaterialPost;
+ mIsUnificatable = aIsUnificatable;
+ mIsMaterialBased = aIsMaterialBased;
+ mIsSelfReferencing = aIsSelfReferencing;
+ mIsContainer = aIsContainer;
+ mDontUnificateActively = aDontUnificateActively;
+ mIsUsedForBlocks = aIsUsedForBlocks;
+ mAllowNormalRecycling = aAllowNormalRecycling;
+ mGenerateDefaultItem = aGenerateDefaultItem;
+ mIsEnchantable = aIsEnchantable;
+ mIsUsedForOreProcessing = aIsUsedForOreProcessing;
+ mMaterialGenerationBits = aMaterialGenerationBits;
+ mMaterialAmount = aMaterialAmount;
+ mDefaultStackSize = aDefaultStackSize;
+ mTextureindex = aTextureindex;
- // Add this to the GT Enum
- EnumHelper.addEnum(OrePrefixes.class, aLocalizedMaterialPre, new Object[] {
- aRegularLocalName,
- aLocalizedMaterialPre,
- aLocalizedMaterialPost,
- aIsUnificatable,
- aIsMaterialBased,
- aIsSelfReferencing,
- aIsContainer,
- aDontUnificateActively,
- aIsUsedForBlocks,
- aAllowNormalRecycling,
- aGenerateDefaultItem,
- aIsEnchantable,
- aIsUsedForOreProcessing,
- aMaterialGenerationBits,
- aMaterialAmount,
- aDefaultStackSize,
- aTextureindex}
- );
+ }
+
+ public final boolean addToEnum() {
- Logger.INFO("Registered custom OrePrefixes '"+aLocalizedMaterialPre+"'. Success? "+checkEntryWasAdded(this));
+ mSelfReference = EnumHelper.addEnum(OrePrefixes.class, this.name(),
+ new Class[] {
+ String.class,
+ String.class, String.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ boolean.class, boolean.class, boolean.class,
+ int.class, long.class, int.class, int.class
+ },
+ new Object[] {
+ mRegularLocalName,
+ mLocalizedMaterialPre,
+ mLocalizedMaterialPost,
+ mIsUnificatable,
+ mIsMaterialBased,
+ mIsSelfReferencing,
+ mIsContainer,
+ mDontUnificateActively,
+ mIsUsedForBlocks,
+ mAllowNormalRecycling,
+ mGenerateDefaultItem,
+ mIsEnchantable,
+ mIsUsedForOreProcessing,
+ mMaterialGenerationBits,
+ mMaterialAmount,
+ mDefaultStackSize,
+ mTextureindex});
+ return mSelfReference != null;
}
- private static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) {
- for (OrePrefixes o :OrePrefixes.values()) {
- if (o.mLocalizedMaterialPre.equals(aCustomPrefixObject.mLocalizedMaterialPre)) {
- return true;
- }
- }
- return false;
+ public static final boolean checkEntryWasAdded(CustomOrePrefix aCustomPrefixObject) {
+ return aCustomPrefixObject.mSelfReference != null;
}
- public static OrePrefixes get(CustomOrePrefix aCustomPrefixObject) {
- for (OrePrefixes o :OrePrefixes.values()) {
- if (o.mLocalizedMaterialPre.equals(aCustomPrefixObject.mLocalizedMaterialPre)) {
- return o;
- }
- }
- CORE.crash("Tried to obtain an invalid custom OrePrefixes object");
- return null;
+ public OrePrefixes get() {
+ return mSelfReference;
}
}