diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-10-15 15:47:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-15 16:47:12 +0200 |
| commit | 1fc7c5554e3070fec978966f2504316fd9f7e9d0 (patch) | |
| tree | e89785e72b2d108f4d154635ce22ec8b705b53b4 /src | |
| parent | 0b598ed71ecba0855d8278532ec68f6b3730fd3b (diff) | |
| download | GT5-Unofficial-1fc7c5554e3070fec978966f2504316fd9f7e9d0.tar.gz GT5-Unofficial-1fc7c5554e3070fec978966f2504316fd9f7e9d0.tar.bz2 GT5-Unofficial-1fc7c5554e3070fec978966f2504316fd9f7e9d0.zip | |
More cleaning (#246)
* Remove unused font renderer
* Remove unused gui stuff
* Remove deprecated recipes for parametrizers and change creative tab item to high power casing. More iconic for the mod imo.
* Remove commands that are only used for a deprecated block
* Remove some unused config option for disabling GT material stuff
* TecTech chunk custom saving thing? Not entirely sure why this exists, it seems to serve no purpose?
* Clean up some unused code
* Remove a bunch of random stuff
* Seems unused?
* Spotless
* More cleaning + spotless, random unused stuff
* No swearing
* Update buildscript
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Diffstat (limited to 'src')
55 files changed, 59 insertions, 16032 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 8eacdbb965..b3adb46c2c 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -3,20 +3,11 @@ package com.github.technus.tectech; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static gregtech.api.enums.Mods.COFHCore; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.Collection; -import java.util.Iterator; - import net.minecraftforge.common.MinecraftForge; import com.github.technus.tectech.loader.MainLoader; import com.github.technus.tectech.loader.TecTechConfig; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; -import com.github.technus.tectech.mechanics.commands.ConvertFloat; -import com.github.technus.tectech.mechanics.commands.ConvertInteger; -import com.github.technus.tectech.mechanics.data.ChunkDataHandler; -import com.github.technus.tectech.mechanics.data.PlayerPersistence; import com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData; import com.github.technus.tectech.nei.IMCForNEI; import com.github.technus.tectech.proxy.CommonProxy; @@ -30,12 +21,8 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; import eu.usrv.yamcore.auxiliary.IngameErrorLog; import eu.usrv.yamcore.auxiliary.LogHelper; -import gregtech.GT_Mod; -import gregtech.common.GT_Proxy; @Mod( modid = Reference.MODID, @@ -63,12 +50,9 @@ public class TecTech { public static final LogHelper LOGGER = new LogHelper(Reference.MODID); public static CreativeTabTecTech creativeTabTecTech; - private static IngameErrorLog moduleAdminErrorLogs; public static TecTechConfig configTecTech; public static EnderWorldSavedData enderWorldSavedData; - public static ChunkDataHandler chunkDataHandler; - public static PlayerPersistence playerPersistence; /** * For Loader.isModLoaded checks during the runtime @@ -77,17 +61,8 @@ public class TecTech { public static final byte tectechTexturePage1 = 8; - public static void AddLoginError(String pMessage) { - if (moduleAdminErrorLogs != null) { - moduleAdminErrorLogs.AddErrorLogOnAdminJoin(pMessage); - } - } - - static { - MainLoader.staticLoad(); - } - @Mod.EventHandler + @SuppressWarnings("unused") public void PreLoad(FMLPreInitializationEvent PreEvent) { LOGGER.setDebugOutput(true); @@ -103,17 +78,9 @@ public class TecTech { if (configTecTech.MOD_ADMIN_ERROR_LOGS) { LOGGER.setDebugOutput(DEBUG_MODE); LOGGER.debug("moduleAdminErrorLogs is enabled"); - moduleAdminErrorLogs = new IngameErrorLog(); + IngameErrorLog moduleAdminErrorLogs = new IngameErrorLog(); } - playerPersistence = new PlayerPersistence("tec"); - FMLCommonHandler.instance().bus().register(playerPersistence); - MinecraftForge.EVENT_BUS.register(playerPersistence); - - chunkDataHandler = new ChunkDataHandler(); - FMLCommonHandler.instance().bus().register(chunkDataHandler); - MinecraftForge.EVENT_BUS.register(chunkDataHandler); - enderWorldSavedData = new EnderWorldSavedData(); FMLCommonHandler.instance().bus().register(enderWorldSavedData); MinecraftForge.EVENT_BUS.register(enderWorldSavedData); @@ -122,124 +89,27 @@ public class TecTech { } @Mod.EventHandler + @SuppressWarnings("unused") public void Load(FMLInitializationEvent event) { hasCOFH = COFHCore.isModLoaded(); - if (configTecTech.DISABLE_MATERIAL_LOADING_FFS) { - try { - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - Field field = GT_Proxy.class.getDeclaredField("mEvents"); - field.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.set(GT_Mod.gregtechproxy, new Collection<Object>() { - - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return true; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator<Object> iterator() { - return new Iterator<Object>() { - - @Override - public boolean hasNext() { - return false; - } - - @Override - public Object next() { - return null; - } - }; - } - - @Override - public Object[] toArray() { - return new Object[0]; - } - - @Override - public boolean add(Object o) { - return false; - } - - @Override - public boolean remove(Object o) { - return false; - } - - @Override - public boolean addAll(Collection<?> c) { - return false; - } - - @Override - public void clear() {} - - @Override - public boolean retainAll(Collection<?> c) { - return false; - } - - @Override - public boolean removeAll(Collection<?> c) { - return false; - } - - @Override - public boolean containsAll(Collection<?> c) { - return false; - } - - @SuppressWarnings("unchecked") - @Override - public Object[] toArray(Object[] a) { - return new Object[0]; - } - }); - } catch (NoSuchFieldException | IllegalAccessException e) { - LOGGER.error(Reference.MODID + " could not disable material loading!"); - } - } - MainLoader.load(); MainLoader.addAfterGregTechPostLoadRunner(); IMCForNEI.IMCSender(); } @Mod.EventHandler + @SuppressWarnings("unused") public void PostLoad(FMLPostInitializationEvent PostEvent) { MainLoader.postLoad(); } @Mod.EventHandler - public void serverLoad(FMLServerStartingEvent pEvent) { - pEvent.registerServerCommand(new ConvertInteger()); - pEvent.registerServerCommand(new ConvertFloat()); - } - - @Mod.EventHandler + @SuppressWarnings("unused") public void onLoadCompleted(FMLLoadCompleteEvent event) { eyeOfHarmonyRecipeStorage = new EyeOfHarmonyRecipeStorage(); } public static EyeOfHarmonyRecipeStorage eyeOfHarmonyRecipeStorage = null; - @Mod.EventHandler - public void onServerAboutToStart(FMLServerAboutToStartEvent aEvent) { - chunkDataHandler.clearData(); - playerPersistence.clearData(); - } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java index bb745216d3..f38c788b5e 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java +++ b/src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java @@ -62,8 +62,7 @@ public class AvrArchitecture implements Architecture { int memory = 0; for (ItemStack component : components) { Item driver = Driver.driverFor(component); - if (driver instanceof Memory) { - Memory memoryDriver = (Memory) driver; + if (driver instanceof Memory memoryDriver) { memory += memoryDriver.amount(component) * 256; // in integers } // else if (driver instanceof DriverEEPROM$) { diff --git a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java b/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java deleted file mode 100644 index 4f41e36fdc..0000000000 --- a/src/main/java/com/github/technus/tectech/font/TecTechFontRender.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.github.technus.tectech.font; - -import java.io.IOException; -import java.io.InputStream; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import com.ibm.icu.text.ArabicShaping; -import com.ibm.icu.text.ArabicShapingException; -import com.ibm.icu.text.Bidi; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class TecTechFontRender extends FontRenderer { - - public static final TecTechFontRender INSTANCE = new TecTechFontRender(); - - private static final float DISTANCE_L = .125F; - private static final float DISTANCE_L2 = DISTANCE_L * 2F; - - private static final float DISTANCE_M = 0.06F; - private static final float DISTANCE_M2 = DISTANCE_M * 2F; - - private static final float DISTANCE_A = 0.06F; - private static final float DISTANCE_A2 = DISTANCE_A * 2F; - - private TecTechFontRender() { - super( - Minecraft.getMinecraft().gameSettings, - new ResourceLocation("textures/font/ascii.png"), - Minecraft.getMinecraft().renderEngine, - false); - } - - private void resetStyles() { - this.randomStyle = false; - this.boldStyle = false; - this.italicStyle = false; - this.underlineStyle = false; - this.strikethroughStyle = false; - } - - private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_) { - if (p_78258_1_ == null) { - return 0; - } else { - if (this.bidiFlag) { - p_78258_1_ = this.bidiReorder(p_78258_1_); - } - - if ((p_78258_4_ & -67108864) == 0) { - p_78258_4_ |= -16777216; - } - - if (p_78258_5_) { - p_78258_4_ = (p_78258_4_ & 16579836) >> 2 | p_78258_4_ & -16777216; - } - - this.red = (float) (p_78258_4_ >> 16 & 255) / 255.0F; - this.blue = (float) (p_78258_4_ >> 8 & 255) / 255.0F; - this.green = (float) (p_78258_4_ & 255) / 255.0F; - this.alpha = (float) (p_78258_4_ >> 24 & 255) / 255.0F; - this.setColor(this.red, this.blue, this.green, this.alpha); - this.posX = (float) p_78258_2_; - this.posY = (float) p_78258_3_; - this.renderStringAtPos(p_78258_1_, p_78258_5_); - return (int) this.posX; - } - } - - private String bidiReorder(String p_147647_1_) { - try { - Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); - bidi.setReorderingMode(0); - return bidi.writeReordered(2); - } catch (ArabicShapingException var3) { - return p_147647_1_; - } - } - - private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) { - for (int i = 0; i < p_78255_1_.length(); ++i) { - char c0 = p_78255_1_.charAt(i); - int j; - int k; - if (c0 == 167 && i + 1 < p_78255_1_.length()) { - j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); - if (j < 16) { - this.randomStyle = false; - this.boldStyle = false; - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; - if (j < 0 || j > 15) { - j = 15; - } - - if (p_78255_2_) { - j += 16; - } - - k = this.colorCode[j]; - this.textColor = k; - this.setColor( - (float) (k >> 16) / 255.0F, - (float) (k >> 8 & 255) / 255.0F, - (float) (k & 255) / 255.0F, - this.alpha); - } else if (j == 16) { - this.randomStyle = true; - } else if (j == 17) { - this.boldStyle = true; - } else if (j == 18) { - this.strikethroughStyle = true; - } else if (j == 19) { - this.underlineStyle = true; - } else if (j == 20) { - this.italicStyle = true; - } else if (j == 21) { - this.randomStyle = false; - this.boldStyle = false; - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; - this.setColor(this.red, this.blue, this.green, this.alpha); - } - - ++i; - } else { - j = "\u00C0\u00C1\u00C2\u00C8\u00CA\u00CB\u00CD\u00D3\u00D4\u00D5\u00DA\u00DF\u00E3\u00F5\u011F\u0130\u0131\u0152\u0153\u015E\u015F\u0174\u0175\u017E\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\u03B2\u0393\u03C0\u03A3\u03C3\u03BC\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u2205\u2208\u2229\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u0000" - .indexOf(c0); - if (this.randomStyle && j != -1) { - do { - k = this.fontRandom.nextInt(this.charWidth.length); - } while (this.charWidth[j] != this.charWidth[k]); - - j = k; - } - - float f1 = this.unicodeFlag ? 0.5F : 1.0F; - boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; - if (flag1) { - this.posX -= f1; - this.posY -= f1; - } - - float f = this.renderCharAtPos(j, c0, this.italicStyle); - if (flag1) { - this.posX += f1; - this.posY += f1; - } - - if (this.boldStyle) { - this.posX += f1; - if (flag1) { - this.posX -= f1; - this.posY -= f1; - } - - this.renderCharAtPos(j, c0, this.italicStyle); - this.posX -= f1; - if (flag1) { - this.posX += f1; - this.posY += f1; - } - - ++f; - } - - this.doDraw(f); - } - } - } - - @Override - protected void doDraw(float f) { - Tessellator tessellator = Tessellator.instance; - - if (this.strikethroughStyle) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - tessellator.startDrawingQuads(); - tessellator.addVertex(this.posX, this.posY + (float) (this.FONT_HEIGHT / 2), 0.0D); - tessellator.addVertex(this.posX + f, this.posY + (float) (this.FONT_HEIGHT / 2), 0.0D); - tessellator.addVertex(this.posX + f, this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F, 0.0D); - tessellator.addVertex(this.posX, this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F, 0.0D); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - if (this.underlineStyle) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - tessellator.startDrawingQuads(); - int l = this.underlineStyle ? -1 : 0; - tessellator.addVertex(this.posX + (float) l, this.posY + (float) this.FONT_HEIGHT, 0.0D); - tessellator.addVertex(this.posX + f, this.posY + (float) this.FONT_HEIGHT, 0.0D); - tessellator.addVertex(this.posX + f, this.posY + (float) this.FONT_HEIGHT - 1.0F, 0.0D); - tessellator.addVertex(this.posX + (float) l, this.posY + (float) this.FONT_HEIGHT - 1.0F, 0.0D); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } |
