aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2019-03-27 08:23:29 +0100
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2019-03-27 08:23:29 +0100
commita0bfd778cc565865f31653e4c82b9c219a3fe69c (patch)
tree569dd04ae1bc2ca5a9cbeee013fa25843d41c35d /src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
parente2c8a04abd39d3d3be2256156adb16938a26dea8 (diff)
downloadGT5-Unofficial-a0bfd778cc565865f31653e4c82b9c219a3fe69c.tar.gz
GT5-Unofficial-a0bfd778cc565865f31653e4c82b9c219a3fe69c.tar.bz2
GT5-Unofficial-a0bfd778cc565865f31653e4c82b9c219a3fe69c.zip
1.0.7
+ updated Java 7 -> 8 + Buffered Input from cfg + refractor, code improvements + small ores completely working + added tooltip + added logger + added ic2 to gradle + updated gradle deps + restored base gt compability + small ore csv (untested) Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Diffstat (limited to 'src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java')
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java104
1 files changed, 65 insertions, 39 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
index 18aca0e5d8..6dc155e9fd 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
@@ -1,19 +1,17 @@
package pers.gwyog.gtneioreplugin.util;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces;
-import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
-import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
public class GT5OreSmallHelper {
public static boolean restrictBiomeSupport = false;
@@ -21,8 +19,9 @@ public class GT5OreSmallHelper {
public static List<ItemStack> oreSmallList = new ArrayList<ItemStack>();
public static HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<String, OreSmallWrapper>();
public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>();
- public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>();
-
+ public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>();
+ public static HashMap<OreSmallWrapper, String> bufferedDims = new HashMap<>();
+
public GT5OreSmallHelper() {
checkExtraSupport();
ItemStack stack;
@@ -30,68 +29,95 @@ public class GT5OreSmallHelper {
short meta;
for (GT_Worldgen worldGen : GregTech_API.sWorldgenList)
if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces) {
- GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces)worldGen;
+ GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces) worldGen;
meta = worldGenSmallPieces.mMeta;
- if (meta<0)
- break;
+ if (meta < 0)
+ break;
material = GregTech_API.sGeneratedMaterials[meta];
mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces));
if (!mapOreMetaToOreDrops.keySet().contains(meta)) {
List<ItemStack> stackList = new ArrayList<ItemStack>();
stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
- oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000));
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
+ stackList.add(stack);
+ }
+ oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + 16000));
mapOreMetaToOreDrops.put(meta, stackList);
}
}
+ for (OreSmallWrapper oreSmallWrapper : mapOreSmallWrapper.values()) {
+ bufferedDims.put(oreSmallWrapper, GT5CFGHelper.GT5CFGSmallOres(oreSmallWrapper.oreGenName));
+ }
}
-
+
private static void checkExtraSupport() {
- Class clazzGTOreSmall = null;
+ Class clazzGTOreSmall = null;
+ try {
+ clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces");
+ } catch (ClassNotFoundException e) {
+ }
+ if (clazzGTOreSmall != null) {
try {
- clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces");
- } catch (ClassNotFoundException e) {}
- if (clazzGTOreSmall != null) {
- try {
- Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome");;
- restrictBiomeSupport = true;
- } catch (Exception e) {}
- try {
- Field fieldGCMoon = clazzGTOreSmall.getField("mMoon");
- Field fieldGCMars = clazzGTOreSmall.getField("mMars");
- gcBasicSupport = true;
- } catch (Exception e) {}
- }
+ Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome");
+ restrictBiomeSupport = true;
+ } catch (Exception e) {
+ }
+ try {
+ Field fieldGCMoon = clazzGTOreSmall.getField("mMoon");
+ Field fieldGCMars = clazzGTOreSmall.getField("mMars");
+ gcBasicSupport = true;
+ } catch (Exception e) {
+ }
+ }
}
-
+
public static Materials[] getDroppedDusts() {
return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone};
}
-
+
public class OreSmallWrapper {
public String oreGenName;
public short oreMeta;
public String worldGenHeightRange;
public short amountPerChunk;
public String restrictBiome;
-
+
public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) {
this.oreGenName = worldGen.mWorldGenName;
this.oreMeta = worldGen.mMeta;
this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
this.amountPerChunk = worldGen.mAmount;
- }
}
}
+}