diff options
| author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-09-02 23:17:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-02 23:17:17 +0200 |
| commit | 1b820de08a05070909a267e17f033fcf58ac8710 (patch) | |
| tree | 02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/net/glease/ggfab/util | |
| parent | afd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff) | |
| download | GT5-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/net/glease/ggfab/util')
| -rw-r--r-- | src/main/java/net/glease/ggfab/util/GGUtils.java | 78 | ||||
| -rw-r--r-- | src/main/java/net/glease/ggfab/util/OverclockHelper.java | 75 |
2 files changed, 0 insertions, 153 deletions
diff --git a/src/main/java/net/glease/ggfab/util/GGUtils.java b/src/main/java/net/glease/ggfab/util/GGUtils.java deleted file mode 100644 index 20181f9ba8..0000000000 --- a/src/main/java/net/glease/ggfab/util/GGUtils.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.glease.ggfab.util; - -import java.util.StringJoiner; - -import net.minecraft.util.ChunkCoordinates; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public class GGUtils { - - public static boolean isValidTile(IGregTechTileEntity tile) { - return tile != null && !tile.isDead() - && tile.getMetaTileEntity() != null - && tile.getMetaTileEntity() - .getBaseMetaTileEntity() == tile; - } - - public static boolean isValidTile(IMetaTileEntity mte) { - return mte != null && mte.getBaseMetaTileEntity() != null - && mte.getBaseMetaTileEntity() - .getMetaTileEntity() == mte - && !mte.getBaseMetaTileEntity() - .isDead(); - } - - public static ChunkCoordinates translate(ChunkCoordinates origin, ForgeDirection direction) { - return new ChunkCoordinates( - origin.posX + direction.offsetX, - origin.posY + direction.offsetY, - origin.posZ + direction.offsetZ); - } - - public static String formatTileInfo(String prefix, IMetaTileEntity mte, String delimiter, String suffix) { - if (!isValidTile(mte)) return prefix + "N/A" + suffix; - StringJoiner sj = new StringJoiner(delimiter, prefix, suffix); - IGregTechTileEntity til = mte.getBaseMetaTileEntity(); - sj.add(String.valueOf(til.getXCoord())); - sj.add(String.valueOf(til.getYCoord())); - sj.add(String.valueOf(til.getZCoord())); - return sj.toString(); - } - - public static String formatTileInfo(String prefix, IGregTechTileEntity tile, String delimiter, String suffix) { - if (!isValidTile(tile)) return prefix + "N/A" + suffix; - StringJoiner sj = new StringJoiner(delimiter, prefix, suffix); - sj.add(String.valueOf(tile.getXCoord())); - sj.add(String.valueOf(tile.getYCoord())); - sj.add(String.valueOf(tile.getZCoord())); - return sj.toString(); - } - - /** - * convert lowerCamelCase to any of snake case or normal sentence - */ - public static String processSentence(String src, Character separator, boolean capitalize, boolean firstCapitalize) { - if (src == null) throw new IllegalArgumentException(); - if (src.isEmpty()) return ""; - StringBuilder out = new StringBuilder(src.length()); - if (firstCapitalize) out.append(Character.toUpperCase(src.charAt(0))); - else out.append(src.charAt(0)); - for (int i = 1; i < src.length(); i++) { - char ch = src.charAt(i); - if (Character.isUpperCase(ch)) { - if (separator != null) out.append(separator.charValue()); - if (capitalize) { - out.append(ch); - } else { - out.append(Character.toLowerCase(ch)); - } - } else { - out.append(ch); - } - } - return out.toString(); - } -} diff --git a/src/main/java/net/glease/ggfab/util/OverclockHelper.java b/src/main/java/net/glease/ggfab/util/OverclockHelper.java deleted file mode 100644 index c47103f253..0000000000 --- a/src/main/java/net/glease/ggfab/util/OverclockHelper.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.glease.ggfab.util; - -import gregtech.api.util.GT_Utility; - -public class OverclockHelper { - - public static OverclockOutput normalOverclock(long recipeEUt, int duration, long inputVoltage, boolean perfectOC) { - if (recipeEUt > inputVoltage) return null; - int recipeTier = Math.max(1, GT_Utility.getTier(recipeEUt)); // ULV no overclock - int machineTier = GT_Utility.getTier(inputVoltage); - int shift = perfectOC ? 2 : 1; - while (recipeTier < machineTier && duration > 1) { - duration >>= shift; - recipeEUt <<= 2; - recipeTier++; - } - return new OverclockOutput(recipeEUt, duration); - } - - public static OverclockOutput laserOverclock(long recipeEUt, int duration, long inputEUt, - float penaltyIncreaseFactor) { - if (recipeEUt > inputEUt) return null; - float currentPenalty = 4 + penaltyIncreaseFactor; - // 2/(n+k) overclock until energy hatch is crying - // must ensure it doesn't go to negative after overclock - while (recipeEUt * currentPenalty > 0 && recipeEUt * currentPenalty < inputEUt && duration > 1) { - duration >>= 1; - recipeEUt *= currentPenalty; - currentPenalty += penaltyIncreaseFactor; - } - return new OverclockOutput(recipeEUt, duration); - } - - public static final class OverclockOutput { - - private final long mEUt; - private final int mDuration; - - public OverclockOutput(long aEUt, int aDuration) { - this.mEUt = aEUt; - this.mDuration = aDuration; - } - - public long getEUt() { - return mEUt; - } - - public int getDuration() { - return mDuration; - } - - @Override - public String toString() { - return mEUt + "@" + mDuration + "ticks"; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof OverclockOutput)) return false; - - OverclockOutput that = (OverclockOutput) o; - - if (mEUt != that.mEUt) return false; - return mDuration == that.mDuration; - } - - @Override - public int hashCode() { - int result = (int) (mEUt ^ (mEUt >>> 32)); - result = 31 * result + mDuration; - return result; - } - } -} |
