From 1fc7c5554e3070fec978966f2504316fd9f7e9d0 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:47:12 +0100 Subject: 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> --- .../java/com/github/technus/tectech/TecTech.java | 140 +---- .../openComputers/AvrArchitecture.java | 3 +- .../technus/tectech/font/TecTechFontRender.java | 439 ---------------- .../github/technus/tectech/loader/MainLoader.java | 24 +- .../technus/tectech/loader/NetworkDispatcher.java | 8 - .../technus/tectech/loader/TecTechConfig.java | 9 - .../tectech/loader/gui/CreativeTabTecTech.java | 4 +- .../technus/tectech/loader/gui/ModGuiHandler.java | 33 -- .../technus/tectech/loader/recipe/Assembler.java | 35 +- .../tectech/loader/thing/ComponentLoader.java | 23 - .../tectech/mechanics/avr/SidedRedstone.java | 304 ----------- .../tectech/mechanics/commands/ConvertFloat.java | 82 --- .../tectech/mechanics/commands/ConvertInteger.java | 82 --- .../tectech/mechanics/data/ChunkDataHandler.java | 392 -------------- .../tectech/mechanics/data/ChunkDataMessage.java | 100 ---- .../mechanics/data/IChunkMetaDataHandler.java | 47 -- .../tectech/mechanics/data/PlayerDataMessage.java | 90 ---- .../tectech/mechanics/data/PlayerPersistence.java | 89 ---- .../technus/tectech/mechanics/data/WorldData.java | 53 -- .../mechanics/dataTransport/DataPacket.java | 2 +- .../mechanics/pipe/IConnectsToElementalPipe.java | 11 - .../tectech/mechanics/tesla/ITeslaConnectable.java | 4 +- .../tectech/nei/TT_NEI_ResearchHandler.java | 3 +- .../technus/tectech/nei/TT_NEI_ScannerHandler.java | 3 +- .../github/technus/tectech/proxy/ClientProxy.java | 9 - .../github/technus/tectech/proxy/CommonProxy.java | 7 - .../technus/tectech/recipe/TT_recipeAdder.java | 6 +- .../tectech/thing/block/QuantumStuffRender.java | 2 +- .../tectech/thing/block/RenderEyeOfHarmony.java | 4 +- .../tectech/thing/block/TileEyeOfHarmony.java | 8 - .../tectech/thing/casing/GT_Block_CasingsBA0.java | 18 +- .../tectech/thing/casing/GT_Block_CasingsTT.java | 2 +- .../tectech/thing/casing/GT_Item_CasingsBA0.java | 2 +- .../thing/cover/GT_Cover_TM_EnderFluidLink.java | 3 +- .../thing/cover/GT_Cover_TM_PowerPassUpgrade.java | 9 +- .../technus/tectech/thing/item/EuMeterGT.java | 2 +- .../tectech/thing/item/gui/ScanDisplayScreen.java | 165 ------ .../thing/item/renderElemental/IElementalItem.java | 22 - .../item/renderElemental/RenderElementalName.java | 78 --- .../hatch/GT_MetaTileEntity_Hatch_Capacitor.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Rack.java | 2 +- .../multi/GT_MetaTileEntity_EM_dataBank.java | 2 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 7 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 2 +- .../thing/metaTileEntity/multi/base/LedStatus.java | 41 +- .../multi/base/MultiblockControl.java | 79 --- .../metaTileEntity/multi/base/Parameters.java | 42 +- .../tectech/thing/metaTileEntity/multi/other todo | 38 -- .../single/GT_MetaTileEntity_WetTransformer.java | 4 - .../github/technus/tectech/util/CommonValues.java | 7 - .../com/github/technus/tectech/util/Converter.java | 27 +- .../github/technus/tectech/util/TT_Utility.java | 563 +-------------------- 52 files changed, 59 insertions(+), 3074 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/font/TecTechFontRender.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java delete mode 100644 src/main/java/com/github/technus/tectech/loader/thing/ComponentLoader.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataHandler.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/IChunkMetaDataHandler.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/PlayerDataMessage.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/data/WorldData.java delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo (limited to 'src/main/java/com') 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() { - - @Override - public int size() { - return 0; - } - - @Override - public boolean isEmpty() { - return true; - } - - @Override - public boolean contains(Object o) { - return false; - } - - @Override - public Iterator iterator() { - return new Iterator() { - - @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); - } - - this.posX += (float) ((int) f); - } - - private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) { - return p_78278_2_ == ' ' ? 4.0F - : ("\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(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) - : this.renderUnicodeChar(p_78278_2_, p_78278_3_)); - } - - @Override - protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_) { - return super.renderDefaultChar(p_78266_1_, p_78266_2_); - } - - @Override - protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) { - return super.renderUnicodeChar(p_78277_1_, p_78277_2_); - } - - @Override - public int drawString(String str, int x, int y, int color, boolean dropShadow) { - switch (Minecraft.getMinecraft().gameSettings.guiScale) { - case 0: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - if (dropShadow) { - GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(-DISTANCE_A2, 0, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_A2, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(DISTANCE_A2, 0, 0F); - } - - GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(-DISTANCE_A2, 0, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_A2, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(DISTANCE_A2, 0, 0F); - - GL11.glPopMatrix(); - break; - case 1: - return Minecraft.getMinecraft().fontRenderer.drawString(str, x, y, color, dropShadow); - case 2: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - if (dropShadow) { - GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(-DISTANCE_M2, 0, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_M2, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(DISTANCE_M2, 0, 0F); - } - - GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(-DISTANCE_M2, 0, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_M2, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(DISTANCE_M2, 0, 0F); - - GL11.glPopMatrix(); - break; - case 3: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - if (dropShadow) { - GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(-DISTANCE_L2, 0, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_L2, 0F); - drawStringBack(str, x, y, color); - GL11.glTranslatef(DISTANCE_L2, 0, 0F); - } - - GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(-DISTANCE_L2, 0, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(0, -DISTANCE_L2, 0F); - drawStringFront(str, x, y, color); - GL11.glTranslatef(DISTANCE_L2, 0, 0F); - - GL11.glPopMatrix(); - break; - } - return drawStringFront(str, x, y, color); - } - - @Override - public void drawSplitString(String str, int x, int y, int maxWidth, int color) { - switch (Minecraft.getMinecraft().gameSettings.guiScale) { - case 0: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - GL11.glTranslatef(DISTANCE_A, DISTANCE_A, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(-DISTANCE_A2, 0, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(0, -DISTANCE_A2, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(DISTANCE_A2, 0, 0F); - - GL11.glPopMatrix(); - break; - case 1: - Minecraft.getMinecraft().fontRenderer.drawSplitString(str, x, y, maxWidth, color); - break; - case 2: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - GL11.glTranslatef(DISTANCE_M, DISTANCE_M, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(-DISTANCE_M2, 0, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(0, -DISTANCE_M2, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(DISTANCE_M2, 0, 0F); - - GL11.glPopMatrix(); - break; - case 3: - setUnicodeFlag(true); - y--; - GL11.glPushMatrix(); - - GL11.glTranslatef(DISTANCE_L, DISTANCE_L, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(-DISTANCE_L2, 0, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(0, -DISTANCE_L2, 0F); - super.drawSplitString(str, x, y, maxWidth, color); - GL11.glTranslatef(DISTANCE_L2, 0, 0F); - - GL11.glPopMatrix(); - break; - } - } - - @Override - protected void setColor(float r, float g, float b, float a) { - super.setColor(r, g, b, a); - } - - @Override - protected void enableAlpha() { - super.enableAlpha(); - } - - @Override - protected void bindTexture(ResourceLocation location) { - super.bindTexture(location); - } - - @Override - protected InputStream getResourceInputStream(ResourceLocation location) throws IOException { - return super.getResourceInputStream(location); - } - - private int drawStringFront(String text, int x, int y, int color) { - GL11.glEnable(3008); - resetStyles(); - return renderString(text, x, y, color, false); - } - - private int drawStringBack(String text, int x, int y, int color) { - GL11.glEnable(3008); - resetStyles(); - return renderString(text, x + 1, y + 1, color, true); - } - - @Override - public int getStringWidth(String p_78256_1_) { - if (Minecraft.getMinecraft().gameSettings.guiScale == 1) { - return Minecraft.getMinecraft().fontRenderer.getStringWidth(p_78256_1_); - } - if (p_78256_1_ == null) { - return 0; - } else { - int i = 0; - boolean flag = false; - - for (int j = 0; j < p_78256_1_.length(); ++j) { - char c0 = p_78256_1_.charAt(j); - int k = this.getCharWidth(c0); - - if (k < 0 && j < p_78256_1_.length() - 1) { - ++j; - c0 = p_78256_1_.charAt(j); - - if (c0 != 108 && c0 != 76) { - if (c0 == 114 || c0 == 82) { - flag = false; - } - } else { - flag = true; - } - - k = 0; - } - - i += k; - - if (flag && k > 0) { - ++i; - } - } - - return i; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 1afd1f9b01..d4e436157b 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -5,7 +5,6 @@ import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static gregtech.api.enums.Mods.NewHorizonsCoreMod; import static gregtech.api.enums.Mods.TwilightForest; -import java.util.Collection; import java.util.HashMap; import net.minecraft.block.Block; @@ -15,9 +14,7 @@ import net.minecraftforge.fluids.FluidStack; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.gui.CreativeTabTecTech; -import com.github.technus.tectech.loader.gui.ModGuiHandler; import com.github.technus.tectech.loader.recipe.BaseRecipeLoader; -import com.github.technus.tectech.loader.thing.ComponentLoader; import com.github.technus.tectech.loader.thing.CoverLoader; import com.github.technus.tectech.loader.thing.MachineLoader; import com.github.technus.tectech.loader.thing.ThingsLoader; @@ -25,24 +22,18 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.Textures; import cpw.mods.fml.common.ProgressManager; -import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; @SuppressWarnings("deprecation") public final class MainLoader { - public static DamageSource microwaving, elementalPollution, subspace; + public static DamageSource microwaving; private MainLoader() {} - public static void staticLoad() { - new ComponentLoader(); - } - public static void preLoad() { creativeTabTecTech = new CreativeTabTecTech("TecTech"); @@ -71,8 +62,6 @@ public final class MainLoader { progressBarLoad.step("Add damage types"); microwaving = new DamageSource("microwaving").setDamageBypassesArmor(); - elementalPollution = new DamageSource("elementalPollution").setDamageBypassesArmor(); - subspace = new DamageSource("subspace").setDamageBypassesArmor().setDamageIsAbsolute(); LOGGER.info("Damage types addition Done"); progressBarLoad.step("Register Packet Dispatcher"); @@ -80,7 +69,6 @@ public final class MainLoader { LOGGER.info("Packet Dispatcher registered"); progressBarLoad.step("Register GUI Handler"); - NetworkRegistry.INSTANCE.registerGuiHandler(instance, new ModGuiHandler()); proxy.registerRenderInfo(); LOGGER.info("GUI Handler registered"); @@ -180,16 +168,6 @@ public final class MainLoader { } } - public static int getFuelValue(FluidStack aLiquid) { - if (aLiquid == null || GT_Recipe.GT_Recipe_Map.sTurbineFuels == null) return 0; - FluidStack tLiquid; - Collection tRecipeList = GT_Recipe.GT_Recipe_Map.sPlasmaFuels.mRecipeList; - if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) - if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) - if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue; - return 0; - } - private static void safeSetResistance(Block block, float resistance) { if (block != null) { block.setResistance(resistance); diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java index 1f53928360..c195364d91 100644 --- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java +++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java @@ -2,8 +2,6 @@ package com.github.technus.tectech.loader; import static com.github.technus.tectech.Reference.MODID; -import com.github.technus.tectech.mechanics.data.ChunkDataMessage; -import com.github.technus.tectech.mechanics.data.PlayerDataMessage; import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage; import com.github.technus.tectech.mechanics.spark.RendererMessage; @@ -22,12 +20,6 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher registerMessage(PipeActivityMessage.ServerHandler.class, PipeActivityMessage.PipeActivityQuery.class); registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class); - registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class); - registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class); - - registerMessage(PlayerDataMessage.ServerHandler.class, PlayerDataMessage.PlayerDataQuery.class); - registerMessage(PlayerDataMessage.ClientHandler.class, PlayerDataMessage.PlayerDataData.class); - registerMessage(RendererMessage.ClientHandler.class, RendererMessage.RendererData.class); } } diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index 4f3e632365..5d9c890299 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -13,8 +13,6 @@ public class TecTechConfig extends ConfigManager { // final static to allow compiler to remove the debug code when this is false public static boolean DEBUG_MODE = false; public static boolean POWERLESS_MODE = false; - public boolean DISABLE_MATERIAL_LOADING_FFS; - public boolean BOOM_ENABLE; public boolean DISABLE_BLOCK_HARDNESS_NERF; public boolean EASY_SCAN; @@ -49,8 +47,6 @@ public class TecTechConfig extends ConfigManager { @Override protected void PreInit() { - DISABLE_MATERIAL_LOADING_FFS = false; - BOOM_ENABLE = true; DISABLE_BLOCK_HARDNESS_NERF = false; EASY_SCAN = false; @@ -89,11 +85,6 @@ public class TecTechConfig extends ConfigManager { .getBoolean("DebugMode", "debug", DEBUG_MODE, "Enables logging and other purely debug features"); POWERLESS_MODE = _mainConfig .getBoolean("PowerlessMode", "debug", POWERLESS_MODE, "Enables 0EU/t multi block machinery"); - DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean( - "DisableMaterialLoading", - "debug", - DISABLE_MATERIAL_LOADING_FFS, - "Set to true to disable gregtech material processing"); BOOM_ENABLE = _mainConfig.getBoolean( "BoomEnable", diff --git a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java index 064be82414..5928e1f50c 100644 --- a/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java +++ b/src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java @@ -7,7 +7,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import com.github.technus.tectech.thing.CustomItemList; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,7 +22,7 @@ public class CreativeTabTecTech extends CreativeTabs { @SideOnly(Side.CLIENT) @Override public Item getTabIconItem() { - return Item.getItemFromBlock(QuantumGlassBlock.INSTANCE); + return Item.getItemFromBlock(GT_Block_CasingsTT.getBlockById(0)); // High power casing } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java b/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java deleted file mode 100644 index 9a8731860b..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.github.technus.tectech.loader.gui; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import com.github.technus.tectech.thing.item.gui.ScanDisplayScreen; - -import cpw.mods.fml.common.network.IGuiHandler; - -/** - * Created by danie_000 on 17.12.2017. - */ -public class ModGuiHandler implements IGuiHandler { - - public static final int SCAN_DISPLAY_SCREEN_ID = 0; - public static final int PROGRAMMER_DISPLAY_SCREEN_ID = 1; - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return null; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - if (ID == SCAN_DISPLAY_SCREEN_ID) { - return new ScanDisplayScreen(); - } else if (ID == PROGRAMMER_DISPLAY_SCREEN_ID) { - return new GuiScreen(); - } - return null; - } -} diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java b/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java index ab64731627..fd3549fdb8 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java @@ -51,7 +51,7 @@ public class Assembler implements Runnable { 200, 500000); - // recipe for ass line data hatches + // recipe for assline data hatches RA.addAssemblerRecipe( ItemList.Hatch_DataAccess_EV.get(1), CustomItemList.dataIn_Hatch.get(1), @@ -2349,39 +2349,6 @@ public class Assembler implements Runnable { } } - // Parameterizer - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { CustomItemList.eM_Computer_Casing.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Master, 1), - CustomItemList.DATApipe.get(4), ItemList.Cover_Screen.get(1), - new ItemStack(Blocks.stone_button, 16), GT_Utility.getIntegratedCircuit(1), }, - Materials.Iridium.getMolten(2592), - CustomItemList.Parametrizer_Hatch.get(1), - 800, - 122880); - - // Parametrizer X - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { CustomItemList.eM_Computer_Casing.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Ultimate, 1), - CustomItemList.DATApipe.get(6), ItemList.Cover_Screen.get(1), - new ItemStack(Blocks.stone_button, 32), GT_Utility.getIntegratedCircuit(2), }, - Materials.Iridium.getMolten(2592), - CustomItemList.ParametrizerX_Hatch.get(1), - 800, - 122880); - - // Parametrizer tXt - GT_Values.RA.addAssemblerRecipe( - new ItemStack[] { CustomItemList.eM_Computer_Casing.get(1), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Bio, 1), CustomItemList.DATApipe.get(8), - ItemList.Cover_Screen.get(2), new ItemStack(Blocks.stone_button, 64), - GT_Utility.getIntegratedCircuit(3), }, - Materials.Iridium.getMolten(2592), - CustomItemList.ParametrizerTXT_Hatch.get(1), - 800, - 122880); - // Tesla Capacitor { // LV Tesla Capacitor diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ComponentLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ComponentLoader.java deleted file mode 100644 index 610df445f8..0000000000 --- a/src/main/java/com/github/technus/tectech/loader/thing/ComponentLoader.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.github.technus.tectech.loader.thing; - -import gregtech.api.enums.Materials; -import gregtech.api.interfaces.IMaterialHandler; - -public class ComponentLoader implements IMaterialHandler { - - public ComponentLoader() { - Materials.add(this); - } - - @Override - public void onComponentInit() { - // example - // OrePrefixes.ring.enableComponent(Materials.RedAlloy); - } - - @Override - public void onComponentIteration(Materials materials) {} - - @Override - public void onMaterialsInit() {} -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java b/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java deleted file mode 100644 index 86313e4303..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.github.technus.tectech.mechanics.avr; - -import net.minecraftforge.common.util.ForgeDirection; - -import com.github.technus.avrClone.AvrCore; -import com.github.technus.avrClone.registerPackages.IInterrupt; -import com.github.technus.avrClone.registerPackages.IRegister; -import com.github.technus.avrClone.registerPackages.IRegisterBit; -import com.github.technus.avrClone.registerPackages.RegisterPackageSync; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -public class SidedRedstone extends RegisterPackageSync { - - public static final RSINT RSINT = new RSINT(); - - public SidedRedstone(int offset) { - super(offset, Register.values().length); - addRegisters(Register.values()); - addBits(RegisterBitsPCMSK.values()); - addBits(RegisterBitsPCFR.values()); - addBits(RegisterBitsPCINT.values()); - addBits(RegisterBitsPNEW.values()); - addBits(RegisterBitsPOLD.values()); - addInterrupts(RSINT); - } - - @Override - public void preSync(AvrCore core, IGregTechTileEntity iGregTechTileEntity) { - int addr = this.getOffset(); - int sides = 0; - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - int val = iGregTechTileEntity.getInternalInputRedstoneSignal(side); - sides |= (val > 0 ? 1 : 0) << side.ordinal(); - core.setDataValue(addr++, iGregTechTileEntity.getInputRedstoneSignal(side)); - core.setDataValue(addr++, val); - addr++; - } - int sidesOld = core.getDataValue(Register.PNEW.getAddress(this)); - core.setDataValue(Register.POLD.getAddress(this), sidesOld); - core.setDataValue(Register.PNEW.getAddress(this), sides); - - if (core.getInterruptEnable()) { - int pcint = core.getDataValue(Register.PCINT.getAddress(this)); - int changesDetected = 0; - switch (pcint & 0b1100) { // PCISC1 PCISC0 - case 0b0000: // low - changesDetected = ~sides & core.getDataValue(Register.PCMSK.getAddress(this)); - break; - case 0b0100: // any - changesDetected = (sides ^ sidesOld) & core.getDataValue(Register.PCMSK.getAddress(this)); - break; - case 0b1000: // falling - changesDetected = ~sides & sidesOld & core.getDataValue(Register.PCMSK.getAddress(this)); - break; - case 0b1100: // rising - changesDetected = sides & ~sidesOld & core.getDataValue(Register.PCMSK.getAddress(this)); - break; - } - - core.setDataValue( - Register.PCFR.getAddress(this), - core.getDataValue(Register.PCFR.getAddress(this) | changesDetected)); - - if (changesDetected > 0) { - if (core.getDataBitsOr(Register.PCINT.getAddress(this), RegisterBitsPCINT.PCEN.mask)) { - core.setDataBits(Register.PCINT.getAddress(this), RegisterBitsPCINT.PCIF.mask); - } - } - } - } - - @Override - public void postSync(AvrCore core, IGregTechTileEntity iGregTechTileEntity) { - int addr = this.getOffset(); - for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - iGregTechTileEntity.setOutputRedstoneSignal(side, (byte) core.getDataValue(addr)); // allows edge detection - // hack? - addr += 3; - } - } - - public enum Register implements IRegister { - - PIN0, - PINT0, - PORT0, - PIN1, - PINT1, - PORT1, - PIN2, - PINT2, - PORT2, - PIN3, - PINT3, - PORT3, - PIN4, - PINT4, - PORT4, - PIN5, - PINT5, - PORT5, - PCMSK, - PCFR, - PCINT, - PNEW, - POLD; - - public final int relativeOffset; - - Register() { - this.relativeOffset = ordinal(); - } - - @Override - public int getAddress(SidedRedstone registerPackage) { - return registerPackage.getOffset() + relativeOffset; - } - } - - public enum RegisterBitsPCMSK implements IRegisterBit { - - PCINT0, - PCINT1, - PCINT2, - PCINT3, - PCINT4, - PCINT5; - - private final int bit, mask; - - RegisterBitsPCMSK() { - bit = ordinal(); - mask = 1 << bit; - } - - @Override - public int getBitPosition() { - return bit; - } - - @Override - public int getBitMask() { - return mask; - } - - @Override - public int getOffset(SidedRedstone registerPackage) { - return 18; - } - } - - public enum RegisterBitsPCFR implements IRegisterBit { - - PCF0, - PCF1, - PCF2, - PCF3, - PCF4, - PCF5; - - private final int bit, mask; - - RegisterBitsPCFR() { - bit = ordinal(); - mask = 1 << bit; - } - - @Override - public int getBitPosition() { - return bit; - } - - @Override - public int getBitMask() { - return mask; - } - - @Override - public int getOffset(SidedRedstone registerPackage) { - return 19; - } - } - - public enum RegisterBitsPCINT implements IRegisterBit { - - PCIF, - PCEN, - PCISC0, - PCISC1; - - private final int bit, mask; - - RegisterBitsPCINT() { - bit = ordinal(); - mask = 1 << bit; - } - - @Override - public int getBitPosition() { - return bit; - } - - @Override - public int getBitMask() { - return mask; - } - - @Override - public int getOffset(SidedRedstone registerPackage) { - return 20; - } - } - - public enum RegisterBitsPNEW implements IRegisterBit { - - PNEW0, - PNEW1, - PNEW2, - PNEW3, - PNEW4, - PNEW5; - - private final int bit, mask; - - RegisterBitsPNEW() { - bit = ordinal(); - mask = 1 << bit; - } - - @Override - public int getBitPosition() { - return bit; - } - - @Override - public int getBitMask() { - return mask; - } - - @Override - public int getOffset(SidedRedstone registerPackage) { - return 21; - } - } - - public enum RegisterBitsPOLD implements IRegisterBit { - - POLD0, - POLD1, - POLD2, - POLD3, - POLD4, - POLD5; - - private final int bit, mask; - - RegisterBitsPOLD() { - bit = ordinal(); - mask = 1 << bit; - } - - @Override - public int getBitPosition() { - return bit; - } - - @Override - public int getBitMask() { - return mask; - } - - @Override - public int getOffset(SidedRedstone registerPackage) { - return 22; - } - } - - public static class RSINT implements IInterrupt { - - @Override - public int getVector() { - return 1; - } - - @Override - public boolean getTrigger(AvrCore core, SidedRedstone registerPackage) { - return (core.getDataValue(Register.PCINT.getAddress(registerPackage)) & 1) == 1; - } - - @Override - public void setTrigger(AvrCore core, SidedRedstone registerPackage, boolean value) { - int val = core.getDataValue(Register.PCINT.getAddress(registerPackage)); - core.setDataValue( - Register.PCINT.getAddress(registerPackage), - value ? val | RegisterBitsPCINT.PCIF.mask : val & ~RegisterBitsPCINT.PCIF.mask); - } - - @Override - public String name() { - return "RSINT"; - } - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java deleted file mode 100644 index f42f37dae6..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.github.technus.tectech.mechanics.commands; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.util.TT_Utility; - -public class ConvertFloat implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public ConvertFloat() { - aliases.add("convert_float"); - aliases.add("c_f"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if (args.length == 1) { - try { - float value = Float.parseFloat(args[0]); - sender.addChatMessage( - new ChatComponentText( - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD - + TT_Utility.intBitsToShortString(Float.floatToIntBits(value)) - + " " - + EnumChatFormatting.RESET - + EnumChatFormatting.BLUE - + value)); - } catch (Exception e) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Float " + args[0])); - } - } else { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } - } - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "c_f Float"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java b/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java deleted file mode 100644 index 4d4f55e20e..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.github.technus.tectech.mechanics.commands; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; - -import com.github.technus.tectech.util.TT_Utility; - -public class ConvertInteger implements ICommand { - - ArrayList aliases = new ArrayList<>(); - - public ConvertInteger() { - aliases.add("convert_integer"); - aliases.add("c_i"); - } - - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!sender.getEntityWorld().isRemote) { - if (args.length == 1) { - try { - int value = Integer.parseInt(args[0]); - sender.addChatMessage( - new ChatComponentText( - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD - + TT_Utility.intBitsToShortString(value) - + " " - + EnumChatFormatting.RESET - + EnumChatFormatting.BLUE - + value)); - } catch (Exception e) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Invalid Integer " + args[0])); - } - } else { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - } - } - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public List getCommandAliases() { - return aliases; - } - - @Override - public String getCommandName() { - return aliases.get(0); - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { - return null; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "c_i Integer"; - } - - @Override - public int compareTo(Object o) { - if (o instanceof ICommand) { - return getCommandName().compareTo(((ICommand) o).getCommandName()); - } - return 0; - } - - @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { - return true; - } -} diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataHandler.java deleted file mode 100644 index b152a0c008..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataHandler.java +++ /dev/null @@ -1,392 +0,0 @@ -package com.github.technus.tectech.mechanics.data; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraftforge.event.world.ChunkDataEvent; -import net.minecraftforge.event.world.ChunkEvent; -import net.minecraftforge.event.world.WorldEvent; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ChunkDataHandler { - - private final String BASE_TAG_NAME = "TecTechData"; - private final HashMap> dimensionWiseChunkData = new HashMap<>(); - private final HashMap> dimensionWiseMetaChunkData = new HashMap<>(); - private final HashMap metaDataHandlerHashMap = new HashMap<>(); - private final ArrayList pushSyncHandlers = new ArrayList<>(); - private final ArrayList pullSyncHandlers = new ArrayList<>(); - private final ArrayList serverHandlers = new ArrayList<>(); - private final ArrayList worldHandlers = new ArrayList<>(); - private final ArrayList playerHandlers = new ArrayList<>(); - private final ArrayList clientHandlers = new ArrayList<>(); - private final ArrayList renderHandlers = new ArrayList<>(); - - private HashMap getOrCreateDimensionWiseChunkData(int dim) { - return dimensionWiseChunkData.computeIfAbsent(dim, m -> { - HashMap map = new HashMap<>(); - for (Map.Entry meta : metaDataHandlerHashMap.entrySet()) { - dimensionWiseMetaChunkData.get(meta.getKey()).put(dim, new ChunkHashMap(meta.getValue(), map)); - } - return map; - }); - } - - @SubscribeEvent - public void onWorldLoad(WorldEvent.Load event) { - int dim = event.world.provider.dimensionId; - getOrCreateDimensionWiseChunkData(dim); - } - - @SubscribeEvent - public void handleChunkSaveEvent(ChunkDataEvent.Save event) { - HashMap dimensionData = dimensionWiseChunkData - .get(event.world.provider.dimensionId); - NBTChunk chunkData = dimensionData != null ? dimensionData.get(event.getChunk().getChunkCoordIntPair()) : null; - if (chunkData == null) { - event.getData().removeTag(BASE_TAG_NAME); - } else { - chunkData.isLoaded = true; - // make a copy of chunk data. this tag will be serialized on another thread. not making a copy might - // cause the other thread to encounter ConcurrentModificationException. - event.getData().setTag(BASE_TAG_NAME, chunkData.data.copy()); - } - } - - @SubscribeEvent - public void handleChunkLoadEvent(ChunkDataEvent.Load event) { - NBTTagCompound loadedTag = event.getData().getCompoundTag(BASE_TAG_NAME); - if (loadedTag.hasNoTags()) { - return; - } - int dimId = event.world.provider.dimension