aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/util
diff options
context:
space:
mode:
authorNotAPenguin <michiel.vandeginste@gmail.com>2024-09-02 23:17:17 +0200
committerGitHub <noreply@github.com>2024-09-02 23:17:17 +0200
commit1b820de08a05070909a267e17f033fcf58ac8710 (patch)
tree02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/tectech/util
parentafd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff)
downloadGT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip
The Great Renaming (#3014)
* move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names
Diffstat (limited to 'src/main/java/tectech/util')
-rw-r--r--src/main/java/tectech/util/CommonValues.java28
-rw-r--r--src/main/java/tectech/util/Converter.java41
-rw-r--r--src/main/java/tectech/util/FluidStackLong.java29
-rw-r--r--src/main/java/tectech/util/GodforgeMath.java299
-rw-r--r--src/main/java/tectech/util/ItemStackLong.java28
-rw-r--r--src/main/java/tectech/util/TTUtility.java188
6 files changed, 613 insertions, 0 deletions
diff --git a/src/main/java/tectech/util/CommonValues.java b/src/main/java/tectech/util/CommonValues.java
new file mode 100644
index 0000000000..3d524e32fa
--- /dev/null
+++ b/src/main/java/tectech/util/CommonValues.java
@@ -0,0 +1,28 @@
+package tectech.util;
+
+import net.minecraft.util.EnumChatFormatting;
+
+/**
+ * Created by danie_000 on 11.01.2017.
+ */
+@SuppressWarnings("SpellCheckingInspection")
+public final class CommonValues {
+
+ public static final String TEC_MARK_SHORT = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech";
+ public static final String TEC_MARK_GENERAL = TEC_MARK_SHORT + EnumChatFormatting.BLUE + ": Interdimensional";
+ public static final String TEC_MARK_EM = TEC_MARK_SHORT + EnumChatFormatting.BLUE + ": Elemental Matter";
+ public static final String THETA_MOVEMENT = TEC_MARK_SHORT + EnumChatFormatting.BLUE + ": Theta Movement";
+ public static final String COSMIC_MARK = TEC_MARK_SHORT + EnumChatFormatting.BLUE + ": Cosmic";
+ public static final String GODFORGE_MARK = TEC_MARK_SHORT + EnumChatFormatting.BLUE + ": Project Godforge";
+
+ public static final byte MOVE_AT = 4; // move stuff around
+ public static final byte RECIPE_AT = 6; // move stuff around
+ // - in case some hatches are not in multiblock structure
+ public static final byte MULTI_CHECK_AT = 12; // multiblock checks its state
+ public static final byte TRANSFER_AT = 16;
+
+ public static final String[] EOH_TIER_FANCY_NAMES = { "Crude", "Primitive", "Stable", "Advanced", "Superb",
+ "Exotic", "Perfect", "Tipler", EnumChatFormatting.BOLD + "Gallifreyan" };
+
+ private CommonValues() {}
+}
diff --git a/src/main/java/tectech/util/Converter.java b/src/main/java/tectech/util/Converter.java
new file mode 100644
index 0000000000..70e116b108
--- /dev/null
+++ b/src/main/java/tectech/util/Converter.java
@@ -0,0 +1,41 @@
+package tectech.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+public final class Converter {
+
+ private Converter() {}
+
+ public static byte[] writeInts(int[] array) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream(array.length * 4);
+ DataOutputStream dos = new DataOutputStream(bos);
+ for (int j : array) {
+ dos.writeInt(j);
+ }
+
+ return bos.toByteArray();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static int[] readInts(byte[] array) {
+ try {
+ ByteArrayInputStream bis = new ByteArrayInputStream(array);
+ DataInputStream dataInputStream = new DataInputStream(bis);
+ int size = array.length / Integer.BYTES;
+ int[] res = new int[size];
+ for (int i = 0; i < size; i++) {
+ res[i] = dataInputStream.readInt();
+ }
+ return res;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/src/main/java/tectech/util/FluidStackLong.java b/src/main/java/tectech/util/FluidStackLong.java
new file mode 100644
index 0000000000..0a5f1b6759
--- /dev/null
+++ b/src/main/java/tectech/util/FluidStackLong.java
@@ -0,0 +1,29 @@
+package tectech.util;
+
+import net.minecraftforge.fluids.FluidStack;
+
+public class FluidStackLong {
+
+ public final FluidStack fluidStack;
+ public long amount;
+
+ public FluidStackLong(FluidStack fluidStack, long amount) {
+ this.fluidStack = fluidStack;
+ this.amount = amount;
+ }
+
+ // Copy constructor.
+ public FluidStackLong(FluidStackLong fluidStackLong) {
+ this.fluidStack = fluidStackLong.fluidStack;
+ this.amount = fluidStackLong.amount;
+ }
+
+ public long getFluidAmount() {
+ return amount;
+ }
+
+ public FluidStack getRegularFluidStack(FluidStackLong fluidStackLong, int amount) {
+ return new FluidStack(fluidStackLong.fluidStack, amount);
+ }
+
+}
diff --git a/src/main/java/tectech/util/GodforgeMath.java b/src/main/java/tectech/util/GodforgeMath.java
new file mode 100644
index 0000000000..a03dce248a
--- /dev/null
+++ b/src/main/java/tectech/util/GodforgeMath.java
@@ -0,0 +1,299 @@
+package tectech.util;
+
+import java.math.BigInteger;
+
+import tectech.thing.metaTileEntity.multi.MTEForgeOfGods;
+import tectech.thing.metaTileEntity.multi.godforge_modules.MTEBaseModule;
+import tectech.thing.metaTileEntity.multi.godforge_modules.MTEExoticModule;
+import tectech.thing.metaTileEntity.multi.godforge_modules.MTEMoltenModule;
+import tectech.thing.metaTileEntity.multi.godforge_modules.MTEPlasmaModule;
+import tectech.thing.metaTileEntity.multi.godforge_modules.MTESmeltingModule;
+
+public class GodforgeMath {
+
+ public static int getRandomIntInRange(int min, int max) {
+ return (int) (Math.random() * (max - min)) + min;
+ }
+
+ public static double calculateFuelConsumption(MTEForgeOfGods godforge) {
+ double upgradeFactor = 1;
+ if (godforge.isUpgradeActive(2)) {
+ upgradeFactor = 0.8;
+ }
+ if (godforge.getFuelType() == 0) {
+ return Math
+ .max(godforge.getFuelFactor() * 300 * Math.pow(1.15, godforge.getFuelFactor()) * upgradeFactor, 1);
+ }
+ if (godforge.getFuelType() == 1) {
+ return Math.max(godforge.getFuelFactor() * 2 * Math.pow(1.08, godforge.getFuelFactor()) * upgradeFactor, 1);
+ } else return Math.max(godforge.getFuelFactor() / 25 * upgradeFactor, 1);
+ }
+
+ public static int calculateStartupFuelConsumption(MTEForgeOfGods godforge) {
+ return (int) Math.max(godforge.getFuelFactor() * 25 * Math.pow(1.2, godforge.getFuelFactor()), 1);
+ }
+
+ public static int calculateMaxFuelFactor(MTEForgeOfGods godforge) {
+ int fuelCap = 5;
+ if (godforge.isUpgradeActive(27)) {
+ fuelCap = Integer.MAX_VALUE;
+ } else {
+ if (godforge.isUpgradeActive(9)) {
+ fuelCap += godforge.getTotalActiveUpgrades();
+ }
+ if (godforge.isUpgradeActive(3)) {
+ fuelCap *= 1.2;
+ }
+ }
+ return Math.max(fuelCap, 1);
+ }
+
+ public static int calculateEffectiveFuelFactor(MTEForgeOfGods godforge) {
+ int fuelFactor = godforge.getFuelFactor();
+ if (fuelFactor <= 43) {
+ return fuelFactor;
+ } else {
+ return 43 + (int) Math.floor(Math.pow((fuelFactor - 43), 0.4));
+ }
+ }
+
+ public static void calculateMaxHeatForModules(MTEBaseModule module, MTEForgeOfGods godforge) {
+ double logBase = 1.5;
+ int baseHeat = 12601;
+ if (godforge.isUpgradeActive(12)) {
+ if (module instanceof MTESmeltingModule) {
+ logBase = 1.12;
+ } else {
+ logBase = 1.18;
+ }
+ }
+ int recipeHeat = baseHeat + (int) (Math.log(godforge.getFuelFactor()) / Math.log(logBase) * 1000);
+ module.setHeatForOC(calculateOverclockHeat(module, godforge, recipeHeat));
+ module.setHeat(recipeHeat);
+ }
+
+ public static int calculateOverclockHeat(MTEBaseModule module, MTEForgeOfGods godforge, Integer recipeHeat) {
+ int actualHeat;
+ double exponent;
+ if (godforge.isUpgradeActive(20)) {
+ if (module instanceof MTESmeltingModule) {
+ exponent = 0.85;
+ } else {
+ exponent = 0.8;
+ }
+ if (recipeHeat > 30000) {
+ actualHeat = (int) Math.floor(30000 + Math.pow(recipeHeat - 30000, exponent));
+ } else {
+ actualHeat = recipeHeat;
+ }
+ } else if (godforge.isUpgradeActive(17)) {
+ actualHeat = Math.min(recipeHeat, 30000);
+ } else {
+ actualHeat = Math.min(recipeHeat, 15000);
+ }
+ return actualHeat;
+ }
+
+ public static void calculateSpeedBonusForModules(MTEBaseModule module, MTEForgeOfGods godforge) {
+ double speedBonus = 1;
+
+ if (godforge.isUpgradeActive(1)) {
+ speedBonus = Math.pow(module.getHeat(), -0.01);
+ }
+
+ if (godforge.isUpgradeActive(22)) {
+ if (module instanceof MTEPlasmaModule) {
+ speedBonus /= Math.pow(module.getMaxParallel(), 0.02);
+ } else {
+ speedBonus /= Math.pow(module.getMaxParallel(), 0.012);
+ }
+ }
+
+ if (module instanceof MTEExoticModule) {
+ if (godforge.isUpgradeActive(25)) {
+ speedBonus = Math.sqrt(speedBonus);
+ } else {
+ speedBonus = 1;
+ }
+ }
+
+ module.setSpeedBonus((float) speedBonus);
+ }
+
+ public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForgeOfGods godforge) {
+ int baseParallel = 0;
+ float fuelFactorMultiplier = 1;
+ float heatMultiplier = 1;
+ float upgradeAmountMultiplier = 1;
+ int node53 = 1;
+ boolean isMoltenOrSmeltingWithUpgrade = false;
+
+ if (module instanceof MTESmeltingModule) {
+ baseParallel = 1024;
+ }
+ if (module instanceof MTEMoltenModule) {
+ baseParallel = 512;
+ }
+ if (module instanceof MTEPlasmaModule) {
+ baseParallel = 384;
+ }
+ if (module instanceof MTEExoticModule) {
+ baseParallel = 36;
+ }
+
+ if (module instanceof MTEMoltenModule
+ || (module instanceof MTESmeltingModule && godforge.isUpgradeActive(16))) {
+ isMoltenOrSmeltingWithUpgrade = true;
+ }
+
+ if (godforge.isUpgradeActive(10)) {
+ node53 = 2;
+ }
+
+ if (godforge.isUpgradeActive(6)) {
+ if (godforge.isUpgradeActive(13)) {
+ if (isMoltenOrSmeltingWithUpgrade) {
+ fuelFactorMultiplier = 1 + calculateEffectiveFuelFactor(godforge) / 15f * 3;
+ } else {
+ fuelFactorMultiplier = 1 + calculateEffectiveFuelFactor(godforge) / 15f * 2;
+ }
+ } else {
+ fuelFactorMultiplier = 1 + calculateEffectiveFuelFactor(godforge) / 15f;
+ }
+ }
+
+ if (godforge.isUpgradeActive(18)) {
+ if (isMoltenOrSmeltingWithUpgrade) {
+ heatMultiplier = 1 + module.getHeat() / 15000f;
+ } else {
+ heatMultiplier = 1 + module.getHeat() / 25000f;
+ }
+ }
+
+ if (godforge.isUpgradeActive(21)) {
+ if (isMoltenOrSmeltingWithUpgrade) {
+ upgradeAmountMultiplier = 1 + godforge.getTotalActiveUpgrades() / 5f;
+ } else {
+ upgradeAmountMultiplier = 1 + godforge.getTotalActiveUpgrades() / 8f;
+ }
+ }
+
+ int maxParallel = (int) (baseParallel * node53
+ * fuelFactorMultiplier
+ * heatMultiplier
+ * upgradeAmountMultiplier);
+
+ if (module instanceof MTEExoticModule) {
+ if (godforge.isUpgradeActive(25)) {
+ maxParallel = (int) Math.max(9 * Math.floor(Math.sqrt(maxParallel) / 9), 36);
+ } else {
+ maxParallel = baseParallel;
+ }
+ }
+
+ module.setMaxParallel(maxParallel);
+ }
+
+ public static void calculateEnergyDiscountForModules(MTEBaseModule module, MTEForgeOfGods godforge) {
+ double fillRatioDiscount = 1;
+ double maxBatteryDiscount = 1;
+
+ if (godforge.isUpgradeActive(8)) {
+ maxBatteryDiscount = 1 - (1 - Math.pow(1.001, -0.01 * godforge.getMaxBatteryCharge())) / 20;
+ }
+
+ if (godforge.isUpgradeActive(19)) {
+ double fillRatioMinusZeroPointFive = (double) godforge.getBatteryCharge() / godforge.getMaxBatteryCharge()
+ - 0.5;
+ if (module instanceof MTEPlasmaModule) {
+ fillRatioDiscount = 1 - (Math.pow(fillRatioMinusZeroPointFive, 2) * (-0.6) + 0.15);
+ } else {
+ fillRatioDiscount = 1 - (Math.pow(fillRatioMinusZeroPointFive, 2) * (-0.6) + 0.15) * 2 / 3;
+ }
+ }
+
+ if (module instanceof MTEExoticModule) {
+ if (!godforge.isUpgradeActive(25)) {
+ fillRatioDiscount = 1;
+ maxBatteryDiscount = 1;
+ } else {
+ fillRatioDiscount = Math.sqrt(fillRatioDiscount);
+ maxBatteryDiscount = Math.sqrt(maxBatteryDiscount);
+ }
+ }
+
+ module.setEnergyDiscount((float) (fillRatioDiscount * maxBatteryDiscount));
+ }
+
+ public static void calculateProcessingVoltageForModules(MTEBaseModule module, MTEForgeOfGods godforge) {
+ long voltage = Integer.MAX_VALUE;
+
+ if (godforge.isUpgradeActive(4)) {
+ voltage += calculateEffectiveFuelFactor(godforge) * 100_000_000L;
+ }
+
+ if (godforge.isUpgradeActive(23)) {
+ voltage *= Math.pow(4, godforge.getRingAmount());
+ }
+
+ module.setProcessingVoltage(voltage);
+ }
+
+ public static void setMiscModuleParameters(MTEBaseModule module, MTEForgeOfGods godforge) {
+ int plasmaTier = 0;
+ double overclockTimeFactor = 2;
+
+ if (godforge.isUpgradeActive(30)) {
+ plasmaTier = 2;
+ } else if (godforge.isUpgradeActive(24)) {
+ plasmaTier = 1;
+ }
+
+ if (godforge.isUpgradeActive(14)) {
+ if (module instanceof MTEPlasmaModule) {
+ overclockTimeFactor = 2.3;
+ } else {
+ overclockTimeFactor = 2.15;
+ }
+ if (module instanceof MTEExoticModule) {
+ if (godforge.isUpgradeActive(25)) {
+ overclockTimeFactor = 2 + Math.pow(overclockTimeFactor - 2, 2);
+ } else {
+ overclockTimeFactor = 2;
+ }
+ }
+ }
+
+ module.setUpgrade83(godforge.isUpgradeActive(19));
+ module.setMultiStepPlasma(godforge.isUpgradeActive(15));
+ module.setPlasmaTier(plasmaTier);
+ module.setMagmatterCapable(godforge.isUpgradeActive(30));
+ module.setVoltageConfig(godforge.isUpgradeActive(28));
+ module.setOverclockTimeFactor(overclockTimeFactor);
+ }
+
+ public static boolean allowModuleConnection(MTEBaseModule module, MTEForgeOfGods godforge) {
+
+ if (module instanceof MTEMoltenModule && godforge.isUpgradeActive(5)) {
+ return true;
+ }
+
+ if (module instanceof MTEPlasmaModule && godforge.isUpgradeActive(7)) {
+ return true;
+ }
+
+ if (module instanceof MTEExoticModule && godforge.isUpgradeActive(11)) {
+ return true;
+ }
+
+ return module instanceof MTESmeltingModule;
+ }
+
+ public static void queryMilestoneStats(MTEBaseModule module, MTEForgeOfGods godforge) {
+ godforge.addTotalPowerConsumed(module.getPowerTally());
+ module.setPowerTally(BigInteger.ZERO);
+ godforge.addTotalRecipesProcessed(module.getRecipeTally());
+ module.setRecipeTally(0);
+
+ }
+}
diff --git a/src/main/java/tectech/util/ItemStackLong.java b/src/main/java/tectech/util/ItemStackLong.java
new file mode 100644
index 0000000000..010ce73262
--- /dev/null
+++ b/src/main/java/tectech/util/ItemStackLong.java
@@ -0,0 +1,28 @@
+package tectech.util;
+
+import net.minecraft.item.ItemStack;
+
+public class ItemStackLong {
+
+ public final ItemStack itemStack;
+ public long stackSize;
+
+ public ItemStackLong(ItemStack itemStack, long stackSize) {
+ this.itemStack = itemStack;
+ this.stackSize = stackSize;
+ }
+
+ // Copy constructor.
+ public ItemStackLong(ItemStackLong itemStackLong) {
+ this.itemStack = itemStackLong.itemStack;
+ this.stackSize = itemStackLong.stackSize;
+ }
+
+ public long getStackSize() {
+ return stackSize;
+ }
+
+ public long compareTo(ItemStackLong itemStackLong) {
+ return (stackSize - itemStackLong.stackSize);
+ }
+}
diff --git a/src/main/java/tectech/util/TTUtility.java b/src/main/java/tectech/util/TTUtility.java
new file mode 100644
index 0000000000..c933b37b82
--- /dev/null
+++ b/src/main/java/tectech/util/TTUtility.java
@@ -0,0 +1,188 @@
+package tectech.util;
+
+import static gregtech.api.enums.GTValues.V;
+
+import java.lang.reflect.Field;
+import java.math.BigInteger;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import net.minecraft.item.ItemStack;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.metatileentity.implementations.MTETieredMachineBlock;
+
+/**
+ * Created by Tec on 21.03.2017.
+ */
+public final class TTUtility {
+
+ private TTUtility() {}
+
+ private static final StringBuilder STRING_BUILDER = new StringBuilder();
+ private static final Map<Locale, Formatter> FORMATTER_MAP = new HashMap<>();
+
+ private static Formatter getFormatter() {
+ STRING_BUILDER.setLength(0);
+ return FORMATTER_MAP.computeIfAbsent(
+ Locale.getDefault(Locale.Category.FORMAT),
+ locale -> new Formatter(STRING_BUILDER, locale));
+ }
+
+ public static String formatNumberExp(double value) {
+ return getFormatter().format("%+.5E", value)
+ .toString();
+ }
+
+ public static String toExponentForm(BigInteger number) {
+ BigInteger abs = number.abs();
+ String strNum = abs.toString();
+ int exponent = strNum.length() - 1;
+ return (number.signum() == -1 ? "-" : "") + strNum.charAt(0) + "." + strNum.substring(1, 3) + "e" + exponent;
+
+ }
+
+ public static int bitStringToInt(String bits) {
+ if (bits == null) {
+ return 0;
+ }
+ if (bits.length() > 32) {
+ throw new NumberFormatException("Too long!");
+ }
+ return Integer.parseInt(bits, 2);
+ }
+
+ public static int hexStringToInt(String hex) {
+ if (hex == null) {
+ return 0;
+ }
+ if (hex.length() > 8) {
+ throw new NumberFormatException("Too long!");
+ }
+ return Integer.parseInt(hex, 16);
+ }
+
+ public static double stringToDouble(String str) {
+ if (str == null) {
+ return 0;
+ }
+ return Double.parseDouble(str);
+ }
+
+ public static String longBitsToShortString(long number) {
+ StringBuilder result = new StringBuilder(71);
+
+ for (int i = 63; i >= 0; i--) {
+ long mask = 1L << i;
+ result.append((number & mask) != 0 ? ":" : ".");
+
+ if (i % 8 == 0) {
+ result.append('|');
+ }
+ }
+ result.replace(result.length() - 1, result.length(), "");
+
+ return result.toString();
+ }
+
+ public static float map(float x, float in_min, float in_max, float out_min, float out_max) {
+ return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
+ }
+
+ public static String getUniqueIdentifier(ItemStack is) {
+ return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName();
+ }
+
+ public static byte getTier(long l) {
+ byte b = -1;
+
+ do {
+ ++b;
+ if (b >= V.length) {
+ return b;
+ }
+ } while (l > V[b]);
+
+ return b;
+ }
+
+ public static void setTier(int tier, Object me) {
+ try {
+ Field field = MTETieredMachineBlock.class.getField("mTier");
+ field.setAccessible(true);
+ field.set(me, (byte) tier);
+ } catch (Exception e) {
+ // e.printStackTrace();
+ }
+ }
+
+ @Deprecated
+ public static double receiveDouble(double previousValue, int startIndex, int index, int value) {
+ return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue), startIndex, index, value));
+ }
+
+ public static long receiveLong(long previousValue, int startIndex, int index, int value) {
+ value &= 0xFFFF;
+ switch (index - startIndex) {
+ case 0 -> {
+ previousValue &= 0xFFFF_FFFF_FFFF_0000L;
+ previousValue |= value;
+ }
+ case 1 -> {
+ previousValue &= 0xFFFF_FFFF_0000_FFFFL;
+ previousValue |= (long) value << 16;
+ }
+ case 2 -> {
+ previousValue &= 0xFFFF_0000_FFFF_FFFFL;
+ previousValue |= (long) value << 32;
+ }
+ case 3 -> {
+ previousValue &= 0x0000_FFFF_FFFF_FFFFL;
+ previousValue |= (long) value << 48;
+ }
+ }
+ return previousValue;
+ }
+
+ @Deprecated
+ public static float receiveFloat(float previousValue, int startIndex, int index, int value) {
+ return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue), startIndex, index, value));
+ }
+
+ public static int receiveInteger(int previousValue, int startIndex, int index, int value) {
+ value &= 0xFFFF;
+ switch (index - startIndex) {
+ case 0 -> {
+ previousValue &= 0xFFFF_0000;
+ previousValue |= value;
+ }
+ case 1 -> {
+ previousValue &= 0x0000_FFFF;
+ previousValue |= value << 16;
+ }
+ }
+ return previousValue;
+ }
+
+ public static String[][] appendStringArrays(String[][] firstArray, String[][] secondArray) {
+ int totalLength = firstArray.length + secondArray.length;
+ String[][] resultArray = new String[totalLength][];
+
+ System.arraycopy(firstArray, 0, resultArray, 0, firstArray.length);
+ System.arraycopy(secondArray, 0, resultArray, firstArray.length, secondArray.length);
+ return resultArray;
+ }
+
+ public static String[][] replaceLetters(String[][] array, String replacement) {
+ String[][] outputArray = new String[array.length][];
+ for (int i = 0; i < array.length; i++) {
+ outputArray[i] = new String[array[i].length];
+ for (int j = 0; j < array[i].length; j++) {
+ outputArray[i][j] = array[i][j].replaceAll("[A-Z]", replacement);
+ }
+ }
+ return outputArray;
+ }
+}