aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/detrav/utils
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-29 21:48:33 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-29 21:48:33 -0800
commitb68f567fa1353f4d9d852db1e71682cc882ec8ee (patch)
tree4786d95c4748744cd62a58aef57f7598e2deb9a6 /src/main/java/com/detrav/utils
parente3e13bd2c4db10bba303ce66332e004215548722 (diff)
downloadGT5-Unofficial-b68f567fa1353f4d9d852db1e71682cc882ec8ee.tar.gz
GT5-Unofficial-b68f567fa1353f4d9d852db1e71682cc882ec8ee.tar.bz2
GT5-Unofficial-b68f567fa1353f4d9d852db1e71682cc882ec8ee.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/com/detrav/utils')
-rw-r--r--src/main/java/com/detrav/utils/BartWorksHelper.java13
-rw-r--r--src/main/java/com/detrav/utils/DetravCreativeTab.java11
-rw-r--r--src/main/java/com/detrav/utils/FluidColors.java137
-rw-r--r--src/main/java/com/detrav/utils/GTppHelper.java93
4 files changed, 124 insertions, 130 deletions
diff --git a/src/main/java/com/detrav/utils/BartWorksHelper.java b/src/main/java/com/detrav/utils/BartWorksHelper.java
index 6f59ccb491..bac23893c1 100644
--- a/src/main/java/com/detrav/utils/BartWorksHelper.java
+++ b/src/main/java/com/detrav/utils/BartWorksHelper.java
@@ -1,22 +1,23 @@
package com.detrav.utils;
-import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores;
-import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres;
import net.minecraft.block.Block;
import net.minecraft.world.chunk.Chunk;
+import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores;
+import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres;
+
public class BartWorksHelper {
- public static boolean isOre(Block tBlock){
+ public static boolean isOre(Block tBlock) {
return tBlock instanceof BW_MetaGenerated_Ores;
}
- public static boolean isSmallOre(Block tBlock){
+ public static boolean isSmallOre(Block tBlock) {
return tBlock instanceof BW_MetaGenerated_SmallOres;
}
- public static short getMetaFromBlock(Chunk c, int x, int y, int z, Block tBlock){
- return (short) (tBlock.getDamageValue(c.worldObj,c.xPosition * 16 + x, y, c.zPosition * 16 + z)*-1);
+ public static short getMetaFromBlock(Chunk c, int x, int y, int z, Block tBlock) {
+ return (short) (tBlock.getDamageValue(c.worldObj, c.xPosition * 16 + x, y, c.zPosition * 16 + z) * -1);
}
}
diff --git a/src/main/java/com/detrav/utils/DetravCreativeTab.java b/src/main/java/com/detrav/utils/DetravCreativeTab.java
index 6d0830f2bb..ba79c55ab2 100644
--- a/src/main/java/com/detrav/utils/DetravCreativeTab.java
+++ b/src/main/java/com/detrav/utils/DetravCreativeTab.java
@@ -1,13 +1,15 @@
package com.detrav.utils;
-import com.detrav.items.DetravMetaGeneratedTool01;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
+import java.util.List;
+
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
-import java.util.List;
+import com.detrav.items.DetravMetaGeneratedTool01;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
/**
* Created by wital_000 on 19.03.2016.
@@ -23,7 +25,6 @@ public class DetravCreativeTab extends CreativeTabs {
return Items.stick;
}
-
@Override
@SideOnly(Side.CLIENT)
public void displayAllReleventItems(List p_78018_1_) {
diff --git a/src/main/java/com/detrav/utils/FluidColors.java b/src/main/java/com/detrav/utils/FluidColors.java
index 2a0ede49b9..a5cd94e492 100644
--- a/src/main/java/com/detrav/utils/FluidColors.java
+++ b/src/main/java/com/detrav/utils/FluidColors.java
@@ -1,96 +1,87 @@
package com.detrav.utils;
-import gregtech.api.enums.Materials;
-import net.minecraftforge.fluids.FluidRegistry;
+import static com.detrav.net.ProspectingPacket.fluidColors;
import java.util.Arrays;
import java.util.Objects;
-import static com.detrav.net.ProspectingPacket.fluidColors;
+import net.minecraftforge.fluids.FluidRegistry;
+
+import gregtech.api.enums.Materials;
public class FluidColors {
- public static void makeColors(){
+ public static void makeColors() {
reFillFluidColors();
- //ProgressManager.ProgressBar progressBar = ProgressManager.push("Making Fluid Colors", (int) (Materials.values().length + FluidRegistry.getRegisteredFluids().values().stream().filter(Objects::nonNull).count()));
- Arrays.stream(Materials.values()).forEach(
- mat -> {
- //progressBar.step(mat.mDefaultLocalName);
- if ( mat.getSolid(0) != null)
- fluidColors.putIfAbsent(mat.getSolid(0).getFluidID(), mat.mRGBa);
- if ( mat.getGas(0) != null)
- fluidColors.putIfAbsent(mat.getGas(0).getFluidID(), mat.mRGBa);
- if ( mat.getFluid(0) != null)
- fluidColors.putIfAbsent(mat.getFluid(0).getFluidID(), mat.mRGBa);
- if ( mat.getMolten(0) != null)
- fluidColors.putIfAbsent(mat.getMolten(0).getFluidID(), mat.mRGBa);
- }
- );
+ // ProgressManager.ProgressBar progressBar = ProgressManager.push("Making Fluid Colors", (int)
+ // (Materials.values().length +
+ // FluidRegistry.getRegisteredFluids().values().stream().filter(Objects::nonNull).count()));
+ Arrays.stream(Materials.values()).forEach(mat -> {
+ // progressBar.step(mat.mDefaultLocalName);
+ if (mat.getSolid(0) != null) fluidColors.putIfAbsent(mat.getSolid(0).getFluidID(), mat.mRGBa);
+ if (mat.getGas(0) != null) fluidColors.putIfAbsent(mat.getGas(0).getFluidID(), mat.mRGBa);
+ if (mat.getFluid(0) != null) fluidColors.putIfAbsent(mat.getFluid(0).getFluidID(), mat.mRGBa);
+ if (mat.getMolten(0) != null) fluidColors.putIfAbsent(mat.getMolten(0).getFluidID(), mat.mRGBa);
+ });
FluidRegistry.getRegisteredFluids().values().stream().filter(Objects::nonNull).forEach(fluid -> {
- // progressBar.step(fluid.getName());
- fluidColors.putIfAbsent(fluid.getID(), convertColorInt(fluid.getColor()));
- }
- );
- // ProgressManager.pop(progressBar);
+ // progressBar.step(fluid.getName());
+ fluidColors.putIfAbsent(fluid.getID(), convertColorInt(fluid.getColor()));
+ });
+ // ProgressManager.pop(progressBar);
}
- private static void reFillFluidColors(){
+ private static void reFillFluidColors() {
try {
// Should probably be put somewhere else, but I suck at Java
- fluidColors.put(Materials.NatruralGas.mGas.getID(), new short[]{0x00, 0xff, 0xff});
- fluidColors.put(Materials.OilLight.mFluid.getID(), new short[]{0xff, 0xff, 0x00});
- fluidColors.put(Materials.OilMedium.mFluid.getID(), new short[]{0x00, 0xFF, 0x00});
- fluidColors.put(Materials.OilHeavy.mFluid.getID(), new short[]{0xFF, 0x00, 0xFF});
- fluidColors.put(Materials.Oil.mFluid.getID(), new short[]{0x00, 0x00, 0x00});
- fluidColors.put(Materials.Helium_3.mGas.getID(), new short[]{0x80, 0x20, 0xe0});
- fluidColors.put(Materials.SaltWater.mFluid.getID(), new short[]{0x80, 0xff, 0x80});
- //fluidColors.put(Materials.Naquadah.getMolten(0).getFluid().getID(), new short[]{0x20, 0x20, 0x20});
- //fluidColors.put(Materials.NaquadahEnriched.getMolten(0).getFluid().getID(), new short[]{0x60, 0x60, 0x60});
- fluidColors.put(Materials.Lead.getMolten(0).getFluid().getID(), new short[]{0xd0, 0xd0, 0xd0});
- fluidColors.put(Materials.Chlorobenzene.mFluid.getID(), new short[]{0x40, 0x80, 0x40});
- fluidColors.put(FluidRegistry.getFluid("liquid_extra_heavy_oil").getID(), new short[]{0x00, 0x00, 0x50});
- fluidColors.put(Materials.Oxygen.mGas.getID(), new short[]{0x40, 0x40, 0xA0});
- fluidColors.put(Materials.Nitrogen.mGas.getID(), new short[]{0x00, 0x80, 0xd0});
- fluidColors.put(Materials.Methane.mGas.getID(), new short[]{0x80, 0x20, 0x20});
- fluidColors.put(Materials.Ethane.mGas.getID(), new short[]{0x40, 0x80, 0x20});
- fluidColors.put(Materials.Ethylene.mGas.getID(), new short[]{0xd0, 0xd0, 0xd0});
- fluidColors.put(FluidRegistry.LAVA.getID(), new short[]{0xFF, 0x00, 0x00});
- fluidColors.put(FluidRegistry.getFluid("unknowwater").getID(), new short[]{0x8A, 0x2B, 0xE2});
- fluidColors.put(Materials.Hydrogen.mGas.getID(), new short[]{0x32, 0x32, 0xD6});
- fluidColors.put(Materials.SulfuricAcid.mFluid.getID(), new short[]{0xFF, 0xB9, 0x0F});
- fluidColors.put(Materials.HydricSulfide.mFluid.getID(), new short[]{0xFF, 0x8F, 0x43});
- fluidColors.put(Materials.CarbonMonoxide.mGas.getID(), new short[]{0x10, 0x4E, 0x8B});
- fluidColors.put(Materials.CarbonDioxide.mGas.getID(), new short[]{0x69, 0x69, 0x69});
- fluidColors.put(FluidRegistry.getFluid("ic2distilledwater").getID(), new short[]{0x1E, 0x90, 0xFF});
- fluidColors.put(Materials.Deuterium.mGas.getID(), new short[]{0xFF, 0xE3, 0x9F});
- fluidColors.put(Materials.Iron.getMolten(0).getFluid().getID(), new short[]{0x8B, 0x88, 0x78});
- fluidColors.put(Materials.Tin.getMolten(0).getFluid().getID(), new short[]{0xE7, 0xE7, 0xE4});
- fluidColors.put(Materials.Copper.getMolten(0).getFluid().getID(), new short[]{0xFF, 0x7F, 0x24});
- fluidColors.put(FluidRegistry.getFluid("fluorine").getID(), new short[]{0x99, 0xC1, 0xAD});
- fluidColors.put(FluidRegistry.getFluid("hydrofluoricacid").getID(), new short[]{0x00, 0xCE, 0xD1});
- fluidColors.put(Materials.PhosphoricAcid.mFluid.getID(), new short[]{0xEE, 0x76, 0x00});
+ fluidColors.put(Materials.NatruralGas.mGas.getID(), new short[] { 0x00, 0xff, 0xff });
+ fluidColors.put(Materials.OilLight.mFluid.getID(), new short[] { 0xff, 0xff, 0x00 });
+ fluidColors.put(Materials.OilMedium.mFluid.getID(), new short[] { 0x00, 0xFF, 0x00 });
+ fluidColors.put(Materials.OilHeavy.mFluid.getID(), new short[] { 0xFF, 0x00, 0xFF });
+ fluidColors.put(Materials.Oil.mFluid.getID(), new short[] { 0x00, 0x00, 0x00 });
+ fluidColors.put(Materials.Helium_3.mGas.getID(), new short[] { 0x80, 0x20, 0xe0 });
+ fluidColors.put(Materials.SaltWater.mFluid.getID(), new short[] { 0x80, 0xff, 0x80 });
+ // fluidColors.put(Materials.Naquadah.getMolten(0).getFluid().getID(), new short[]{0x20, 0x20, 0x20});
+ // fluidColors.put(Materials.NaquadahEnriched.getMolten(0).getFluid().getID(), new short[]{0x60, 0x60,
+ // 0x60});
+ fluidColors.put(Materials.Lead.getMolten(0).getFluid().getID(), new short[] { 0xd0, 0xd0, 0xd0 });
+ fluidColors.put(Materials.Chlorobenzene.mFluid.getID(), new short[] { 0x40, 0x80, 0x40 });
+ fluidColors.put(FluidRegistry.getFluid("liquid_extra_heavy_oil").getID(), new short[] { 0x00, 0x00, 0x50 });
+ fluidColors.put(Materials.Oxygen.mGas.getID(), new short[] { 0x40, 0x40, 0xA0 });
+ fluidColors.put(Materials.Nitrogen.mGas.getID(), new short[] { 0x00, 0x80, 0xd0 });
+ fluidColors.put(Materials.Methane.mGas.getID(), new short[] { 0x80, 0x20, 0x20 });
+ fluidColors.put(Materials.Ethane.mGas.getID(), new short[] { 0x40, 0x80, 0x20 });
+ fluidColors.put(Materials.Ethylene.mGas.getID(), new short[] { 0xd0, 0xd0, 0xd0 });
+ fluidColors.put(FluidRegistry.LAVA.getID(), new short[] { 0xFF, 0x00, 0x00 });
+ fluidColors.put(FluidRegistry.getFluid("unknowwater").getID(), new short[] { 0x8A, 0x2B, 0xE2 });
+ fluidColors.put(Materials.Hydrogen.mGas.getID(), new short[] { 0x32, 0x32, 0xD6 });
+ fluidColors.put(Materials.SulfuricAcid.mFluid.getID(), new short[] { 0xFF, 0xB9, 0x0F });
+ fluidColors.put(Materials.HydricSulfide.mFluid.getID(), new short[] { 0xFF, 0x8F, 0x43 });
+ fluidColors.put(Materials.CarbonMonoxide.mGas.getID(), new short[] { 0x10, 0x4E, 0x8B });
+ fluidColors.put(Materials.CarbonDioxide.mGas.getID(), new short[] { 0x69, 0x69, 0x69 });
+ fluidColors.put(FluidRegistry.getFluid("ic2distilledwater").getID(), new short[] { 0x1E, 0x90, 0xFF });
+ fluidColors.put(Materials.Deuterium.mGas.getID(), new short[] { 0xFF, 0xE3, 0x9F });
+ fluidColors.put(Materials.Iron.getMolten(0).getFluid().getID(), new short[] { 0x8B, 0x88, 0x78 });
+ fluidColors.put(Materials.Tin.getMolten(0).getFluid().getID(), new short[] { 0xE7, 0xE7, 0xE4 });
+ fluidColors.put(Materials.Copper.getMolten(0).getFluid().getID(), new short[] { 0xFF, 0x7F, 0x24 });
+ fluidColors.put(FluidRegistry.getFluid("fluorine").getID(), new short[] { 0x99, 0xC1, 0xAD });
+ fluidColors.put(FluidRegistry.getFluid("hydrofluoricacid").getID(), new short[] { 0x00, 0xCE, 0xD1 });
+ fluidColors.put(Materials.PhosphoricAcid.mFluid.getID(), new short[] { 0xEE, 0x76, 0x00 });
- //possible nulls
- fluidColors.put(Materials.LiquidAir.mFluid.getID(), new short[]{0x99, 0x99, 0xEA});
- }catch (Exception ignored){}
-/*
- Set set = fluidColors.entrySet();
- Iterator iterator = set.iterator();
- System.out.println( "DETRAV SCANNER DEBUG" );
- while(iterator.hasNext()) {
- Map.Entry mentry = (Map.Entry) iterator.next();
- System.out.println( "key is: "+ (Integer)mentry.getKey() + " & Value is: " +
- ((short[])mentry.getValue())[0] + " " +
- ((short[])mentry.getValue())[1] + " " +
- ((short[])mentry.getValue())[2] );
- }
-*/
+ // possible nulls
+ fluidColors.put(Materials.LiquidAir.mFluid.getID(), new short[] { 0x99, 0x99, 0xEA });
+ } catch (Exception ignored) {}
+ /*
+ * Set set = fluidColors.entrySet(); Iterator iterator = set.iterator(); System.out.println(
+ * "DETRAV SCANNER DEBUG" ); while(iterator.hasNext()) { Map.Entry mentry = (Map.Entry) iterator.next();
+ * System.out.println( "key is: "+ (Integer)mentry.getKey() + " & Value is: " + ((short[])mentry.getValue())[0]
+ * + " " + ((short[])mentry.getValue())[1] + " " + ((short[])mentry.getValue())[2] ); }
+ */
}
- private static short[] convertColorInt(int color){
- return new short[]{(short) (color << 16 &0xff), (short) (color << 8 &0xff), (short) (color &0xff)};
+ private static short[] convertColorInt(int color) {
+ return new short[] { (short) (color << 16 & 0xff), (short) (color << 8 & 0xff), (short) (color & 0xff) };
}
}
diff --git a/src/main/java/com/detrav/utils/GTppHelper.java b/src/main/java/com/detrav/utils/GTppHelper.java
index 8e018ce386..59db67eac7 100644
--- a/src/main/java/com/detrav/utils/GTppHelper.java
+++ b/src/main/java/com/detrav/utils/GTppHelper.java
@@ -1,66 +1,67 @@
package com.detrav.utils;
+import java.util.HashMap;
+
+import net.minecraft.block.Block;
+
import gtPlusPlus.core.block.base.BlockBaseOre;
import gtPlusPlus.core.material.ALLOY;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.MISC_MATERIALS;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
-import net.minecraft.block.Block;
-
-import java.util.HashMap;
/**
* Created by bartimaeusnek on 19.04.2018.
*/
public class GTppHelper {
- public static final HashMap<Short,Material> decodeoresGTpp = new HashMap<>();
- public static final HashMap<Material,Short> encodeoresGTpp = new HashMap<>();
-
- public static void generate_OreIDs() {
- short n=0;
- for (; n < gtPlusPlus.core.material.ORES.class.getFields().length ; ++n) {
- try {
- Short i = (short) (n+1);
- Material m = ((Material)gtPlusPlus.core.material.ORES.class.getFields()[n].get(gtPlusPlus.core.material.ORES.class.getFields()[n]));
- decodeoresGTpp.put(i,m);
- encodeoresGTpp.put(m,i);
- } catch (Exception ignored) {}
- }
- // Manually add ores from other places than the ore class
- // Fluorite
- decodeoresGTpp.put((short) (++n + 1), FLUORIDES.FLUORITE);
- encodeoresGTpp.put(FLUORIDES.FLUORITE, (short) (n + 1));
- // Rare Earths
- decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_LOW);
- encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_LOW, (short) (n + 1));
- decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_MID);
- encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_MID, (short) (n + 1));
- decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_HIGH);
- encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_HIGH, (short) (n + 1));
- // Koboldite
- decodeoresGTpp.put((short) (++n + 1), ALLOY.KOBOLDITE);
- encodeoresGTpp.put(ALLOY.KOBOLDITE, (short) (n + 1));
- // Runite
- decodeoresGTpp.put((short) (++n + 1), ELEMENT.STANDALONE.RUNITE);
- encodeoresGTpp.put(ELEMENT.STANDALONE.RUNITE, (short) (n + 1));
- // Ancient granite
- decodeoresGTpp.put((short) (++n + 1), ELEMENT.STANDALONE.GRANITE);
- encodeoresGTpp.put(ELEMENT.STANDALONE.GRANITE, (short) (n + 1));
- }
+ public static final HashMap<Short, Material> decodeoresGTpp = new HashMap<>();
+ public static final HashMap<Material, Short> encodeoresGTpp = new HashMap<>();
- public static boolean isGTppBlock(Block tBlock){
- return tBlock instanceof BlockBaseOre;
- }
+ public static void generate_OreIDs() {
+ short n = 0;
+ for (; n < gtPlusPlus.core.material.ORES.class.getFields().length; ++n) {
+ try {
+ Short i = (short) (n + 1);
+ Material m = ((Material) gtPlusPlus.core.material.ORES.class.getFields()[n]
+ .get(gtPlusPlus.core.material.ORES.class.getFields()[n]));
+ decodeoresGTpp.put(i, m);
+ encodeoresGTpp.put(m, i);
+ } catch (Exception ignored) {}
+ }
+ // Manually add ores from other places than the ore class
+ // Fluorite
+ decodeoresGTpp.put((short) (++n + 1), FLUORIDES.FLUORITE);
+ encodeoresGTpp.put(FLUORIDES.FLUORITE, (short) (n + 1));
+ // Rare Earths
+ decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_LOW);
+ encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_LOW, (short) (n + 1));
+ decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_MID);
+ encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_MID, (short) (n + 1));
+ decodeoresGTpp.put((short) (++n + 1), MISC_MATERIALS.RARE_EARTH_HIGH);
+ encodeoresGTpp.put(MISC_MATERIALS.RARE_EARTH_HIGH, (short) (n + 1));
+ // Koboldite
+ decodeoresGTpp.put((short) (++n + 1), ALLOY.KOBOLDITE);
+ encodeoresGTpp.put(ALLOY.KOBOLDITE, (short) (n + 1));
+ // Runite
+ decodeoresGTpp.put((short) (++n + 1), ELEMENT.STANDALONE.RUNITE);
+ encodeoresGTpp.put(ELEMENT.STANDALONE.RUNITE, (short) (n + 1));
+ // Ancient granite
+ decodeoresGTpp.put((short) (++n + 1), ELEMENT.STANDALONE.GRANITE);
+ encodeoresGTpp.put(ELEMENT.STANDALONE.GRANITE, (short) (n + 1));
+ }
+ public static boolean isGTppBlock(Block tBlock) {
+ return tBlock instanceof BlockBaseOre;
+ }
- public static short getGTppMeta(Block tBlock){
- return (short) (GTppHelper.encodeoresGTpp.get(((BlockBaseOre) tBlock).getMaterialEx()) +7000);
- }
+ public static short getGTppMeta(Block tBlock) {
+ return (short) (GTppHelper.encodeoresGTpp.get(((BlockBaseOre) tBlock).getMaterialEx()) + 7000);
+ }
- public static String getGTppVeinName(Block tBlock){
- return tBlock.getLocalizedName();
- }
+ public static String getGTppVeinName(Block tBlock) {
+ return tBlock.getLocalizedName();
+ }
}