diff options
| author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-11-03 19:25:29 +0100 |
|---|---|---|
| committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-11-03 19:25:29 +0100 |
| commit | 87304c5f763e328fdc447d9c9d2cf9d7779b0658 (patch) | |
| tree | 33100f1531e2039f97d16706c97769ba70d67a4d /src/main/java/com/detrav/net | |
| parent | f04832f47680f4a164d242e02389f04813075a78 (diff) | |
| download | GT5-Unofficial-87304c5f763e328fdc447d9c9d2cf9d7779b0658.tar.gz GT5-Unofficial-87304c5f763e328fdc447d9c9d2cf9d7779b0658.tar.bz2 GT5-Unofficial-87304c5f763e328fdc447d9c9d2cf9d7779b0658.zip | |
fixed small ores showing up on non-small ore screen
+autogenerated a color for every registered fluid
+version increase
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Diffstat (limited to 'src/main/java/com/detrav/net')
| -rw-r--r-- | src/main/java/com/detrav/net/DetravProPickPacket00.java | 66 |
1 files changed, 12 insertions, 54 deletions
diff --git a/src/main/java/com/detrav/net/DetravProPickPacket00.java b/src/main/java/com/detrav/net/DetravProPickPacket00.java index 703ae581c4..fc4555075a 100644 --- a/src/main/java/com/detrav/net/DetravProPickPacket00.java +++ b/src/main/java/com/detrav/net/DetravProPickPacket00.java @@ -11,14 +11,11 @@ import com.google.common.io.ByteStreams; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.ORES; - -import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; -import java.lang.reflect.Field; import java.util.HashMap; /* @@ -36,47 +33,8 @@ public class DetravProPickPacket00 extends DetravPacket { public int chunkZ; public int size; public int ptype; - HashMap<Byte,Short>[][] map = null; - public static HashMap<Integer, short[]> fluidColors = null; - - public static void reFillFluidColors(){ - if( fluidColors == null ) { // Should probably be put somewhere else, but I suck at Java - fluidColors = new HashMap<Integer, short[]>(); - - 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( Materials.LiquidAir.mFluid.getID(), new short[]{0x40,0x80,0x40} ); - fluidColors.put( FluidRegistry.LAVA.getID(), new short[]{0xFF,0x00,0x00} ); - -/* - 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 HashMap<Byte,Short>[][] map = null; + public static HashMap<Integer, short[]> fluidColors = new HashMap<>(); @Override public int getPacketID() { @@ -130,7 +88,7 @@ public class DetravProPickPacket00 extends DetravPacket { for (int j = 0; j < aSize; j++) { byte kSize = aData.readByte(); if(kSize == 0) continue; - packet.map[i][j] = new HashMap<Byte, Short>(); + packet.map[i][j] = new HashMap<>(); for (int k = 0; k < kSize; k++) { packet.map[i][j].put(aData.readByte(),aData.readShort()); checkOut++; @@ -214,7 +172,7 @@ public class DetravProPickPacket00 extends DetravPacket { raster.setSample(i, j, 2, rgba[2]); raster.setSample(i, j, 3, 255); if (!ores.containsKey(name)) - ores.put(name, (0xFF << 24) + ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); + ores.put(name, ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); } else if (meta<=0){ name = GT_LanguageManager.getTranslation("bw.blockores.01." + (meta*-1) + ".name"); @@ -229,7 +187,7 @@ public class DetravProPickPacket00 extends DetravPacket { raster.setSample(i, j, 2, rgba[2]); raster.setSample(i, j, 3, 255); if (!ores.containsKey(name)) - ores.put(name, (0xFF << 24) + ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); + ores.put(name, ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); } else { if (pMaterial == null) { exception++; @@ -244,7 +202,7 @@ public class DetravProPickPacket00 extends DetravPacket { raster.setSample(i, j, 2, rgba[2]); raster.setSample(i, j, 3, 255); if (!ores.containsKey(name)) - ores.put(name, (0xFF << 24) + ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); + ores.put(name,((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); } } } @@ -271,8 +229,8 @@ public class DetravProPickPacket00 extends DetravPacket { raster.setSample(i, j, 2, 255); raster.setSample(i, j, 3, 255); } else { - metas[0] = map[i][j].get(Byte.valueOf((byte)1)); // fluidID - metas[1] = map[i][j].get(Byte.valueOf((byte)2)); // Size of the field + metas[0] = map[i][j].get((byte) 1); // fluidID + metas[1] = map[i][j].get((byte) 2); // Size of the field String name = null; short[] rgba = null; @@ -288,7 +246,7 @@ public class DetravProPickPacket00 extends DetravPacket { } if (!ores.containsKey(name)) - ores.put(name, (0xFF << 24) + ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); + ores.put(name, ((rgba[0] & 0xFF) << 16) + ((rgba[1] & 0xFF) << 8) + ((rgba[2] & 0xFF))); int k = (i % 16); // Variables used to locate within a chunk. int l = (j % 16); @@ -319,7 +277,7 @@ public class DetravProPickPacket00 extends DetravPacket { } break; case 3: - ores.put("Pollution", (0xFF << 24) + ((0 & 0xFF) << 16) + ((0 & 0xFF) << 8) + ((0 & 0xFF))); + ores.put("Pollution", ((0 & 0xFF) << 16) + ((0 & 0xFF) << 8) + ((0 & 0xFF))); for (int i = 0; i < wh; i++) for (int j = 0; j < wh; j++) { if (map[i][j] == null) { |
