aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java140
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/openComputers/AvrArchitecture.java3
-rw-r--r--src/main/java/com/github/technus/tectech/font/TecTechFontRender.java439
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MainLoader.java24
-rw-r--r--src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java8
-rw-r--r--src/main/java/com/github/technus/tectech/loader/TecTechConfig.java9
-rw-r--r--src/main/java/com/github/technus/tectech/loader/gui/CreativeTabTecTech.java4
-rw-r--r--src/main/java/com/github/technus/tectech/loader/gui/ModGuiHandler.java33
-rw-r--r--src/main/java/com/github/technus/tectech/loader/recipe/Assembler.java35
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/ComponentLoader.java23
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/avr/SidedRedstone.java304
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/commands/ConvertFloat.java82
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/commands/ConvertInteger.java82
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataHandler.java392
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java100
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/IChunkMetaDataHandler.java47
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/PlayerDataMessage.java90
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java89
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/data/WorldData.java53
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java2
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java11
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java4
-rw-r--r--src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java3
-rw-r--r--src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java3
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/ClientProxy.java9
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/CommonProxy.java7
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java3
-rw-r--r--src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java9
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java165
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java22
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java78
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java41
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java79
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java42
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo38
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/util/CommonValues.java7
-rw-r--r--src/main/java/com/github/technus/tectech/util/Converter.java27
-rw-r--r--src/main/java/com/github/technus/tectech/util/TT_Utility.java563
52 files changed, 59 insertions, 3074 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);
- }
-
- 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<GT_Recipe> 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<IGregTechTileEntity, SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- 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<SidedRedstone> {
-
- @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<String> 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<String> getCommandAliases() {
- return aliases;
- }
-
- @Override
- public String getCommandName() {
- return aliases.get(0);
- }
-
- @Override
- public List<String> 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<String> 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<String> getCommandAliases() {
- return aliases;
- }
-
- @Override
- public String getCommandName() {
- return aliases.get(0);
- }
-
- @Override
- public List<String> 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<Integer, HashMap<ChunkCoordIntPair, NBTChunk>> dimensionWiseChunkData = new HashMap<>();
- private final HashMap<String, HashMap<Integer, ChunkHashMap>> dimensionWiseMetaChunkData = new HashMap<>();
- private final HashMap<String, IChunkMetaDataHandler> metaDataHandlerHashMap = new HashMap<>();
- private final ArrayList<IChunkMetaDataHandler> pushSyncHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> pullSyncHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> serverHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> worldHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> playerHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> clientHandlers = new ArrayList<>();
- private final ArrayList<IChunkMetaDataHandler> renderHandlers = new ArrayList<>();
-
- private HashMap<ChunkCoordIntPair, NBTChunk> getOrCreateDimensionWiseChunkData(int dim) {
- return dimensionWiseChunkData.computeIfAbsent(dim, m -> {
- HashMap<ChunkCoordIntPair, NBTChunk> map = new HashMap<>();
- for (Map.Entry<String, IChunkMetaDataHandler> 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<ChunkCoordIntPair, NBTChunk> 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.dimensionId;
- HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory = getOrCreateDimensionWiseChunkData(dimId);
- ChunkCoordIntPair chunkCoordIntPair = event.getChunk().getChunkCoordIntPair();
- Set<String> loadedKeys = loadedTag.func_150296_c();
- NBTChunk chunkMemory = dimensionMemory.get(chunkCoordIntPair);
- if (chunkMemory == null) {
- chunkMemory = new NBTChunk(loadedTag, true);
- dimensionMemory.put(chunkCoordIntPair, chunkMemory);
- for (String s : loadedKeys) {
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, loadedTag.getCompoundTag(s));
- }
- } else if (!chunkMemory.isLoaded) {
- chunkMemory.isLoaded = true;
-
- Set<String> tagsDuplicated = new HashSet<>(loadedKeys);
- tagsDuplicated.retainAll(chunkMemory.data.func_150296_c());
-
- if (tagsDuplicated.isEmpty()) {
- for (String s : loadedKeys) {
- NBTTagCompound tag = loadedTag.getCompoundTag(s);
- chunkMemory.data.setTag(s, tag);
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, tag);
- }
- } else {
- for (String s : loadedKeys) {
- NBTTagCompound memory = chunkMemory.data.getCompoundTag(s);
- if (tagsDuplicated.contains(s)) {
- metaDataHandlerHashMap.get(s).mergeData(memory, loadedTag.getCompoundTag(s));
- } else {
- chunkMemory.data.setTag(s, loadedTag.getCompoundTag(s));
- dimensionWiseMetaChunkData.get(s).get(dimId).putLoaded(chunkCoordIntPair, memory);
- }
- }
- }
- }
- }
-
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public void onLoadChunk(ChunkEvent.Load aEvent) {
- if (aEvent.world.isRemote && !Minecraft.getMinecraft().isSingleplayer()) { // we already have the data!
- pullSyncHandlers.forEach(chunkMetaDataHandler -> chunkMetaDataHandler.pullData(aEvent));
- }
- }
-
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public void onUnloadChunk(ChunkEvent.Unload aEvent) {
- if (aEvent.world.isRemote && !Minecraft.getMinecraft().isSingleplayer()) { // we need all data if running local
- // server!
- pullSyncHandlers.forEach(
- chunkMetaDataHandler -> dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName())
- .get(aEvent.world.provider.dimensionId).remove(aEvent.getChunk().getChunkCoordIntPair()));
- }
- }
-
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public void onClientTickEvent(TickEvent.ClientTickEvent aEvent) {
- clientHandlers.forEach(
- chunkMetaDataHandler -> chunkMetaDataHandler
- .tickClient(dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
- }
-
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public void onRenderTickEvent(TickEvent.RenderTickEvent aEvent) {
- renderHandlers.forEach(
- chunkMetaDataHandler -> chunkMetaDataHandler
- .tickRender(dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
- }
-
- @SubscribeEvent
- public void onServerTickEvent(TickEvent.ServerTickEvent aEvent) {
- serverHandlers.forEach(
- chunkMetaDataHandler -> chunkMetaDataHandler
- .tickServer(dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
- }
-
- // Ticks only on server side (but must be present for client server)
- @SubscribeEvent
- public void onWorldTickEvent(TickEvent.WorldTickEvent aEvent) {
- int dim = aEvent.world.provider.dimensionId;
- pushSyncHandlers.forEach(chunkMetaDataHandler -> {
- ChunkHashMap data = dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()).get(dim);
- int cycle = chunkMetaDataHandler.pushPayloadSpreadPeriod();
- int epoch = (int) (aEvent.world.getTotalWorldTime() % cycle);
- ArrayList<ChunkCoordIntPair> work;
- if (epoch == 0) {
- int per = data.dirtyBoys.size() / cycle;
- int mod = data.dirtyBoys.size() % cycle;
- Iterator<ChunkCoordIntPair> iter = data.dirtyBoys.iterator();
- for (int periodWork = 0; periodWork < cycle; periodWork++) {
- work = data.workLoad.get(periodWork);
- for (int i = 0; i < per; i++) {
- work.add(iter.next());
- }
- if (periodWork < mod) {
- work.add(iter.next());
- }
- }
- data.dirtyBoys.clear();
- }
- work = data.workLoad.get(epoch);
- chunkMetaDataHandler.pushPayload(aEvent.world, work);
- work.clear();
- });
- worldHandlers.forEach(
- chunkMetaDataHandler -> chunkMetaDataHandler
- .tickWorld(dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
- }
-
- @SubscribeEvent
- public void onPlayerTickEvent(TickEvent.PlayerTickEvent aEvent) {
- playerHandlers.forEach(
- chunkMetaDataHandler -> chunkMetaDataHandler
- .tickPlayer(dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
- }
-
- public void clearData() {
- dimensionWiseChunkData.clear();
- dimensionWiseMetaChunkData.forEach((k, v) -> v.clear());
- }
-
- public IChunkMetaDataHandler getChunkMetaDataHandler(String s) {
- return metaDataHandlerHashMap.get(s);
- }
-
- public void registerChunkMetaDataHandler(IChunkMetaDataHandler handler) {
- metaDataHandlerHashMap.put(handler.getTagName(), handler);
- dimensionWiseMetaChunkData.put(handler.getTagName(), new HashMap<>());
- Class<?> clazz = handler.getClass();
- try {
- if (clazz.getMethod("tickServer", HashMap.class, TickEvent.ServerTickEvent.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- serverHandlers.add(handler);
- }
- if (clazz.getMethod("tickPlayer", HashMap.class, TickEvent.PlayerTickEvent.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- playerHandlers.add(handler);
- }
- if (clazz.getMethod("pushData", World.class, ChunkCoordIntPair.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- pushSyncHandlers.add(handler);
- }
- if (clazz.getMethod("tickWorld", HashMap.class, TickEvent.WorldTickEvent.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- worldHandlers.add(handler);
- }
- } catch (NoSuchMethodException e) {
- throw new RuntimeException("Cannot register common event handlers!", e);
- }
- if (FMLCommonHandler.instance().getSide().isClient()) {
- try {
- if (clazz.getMethod("pullData", ChunkEvent.Load.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- pullSyncHandlers.add(handler);
- }
- if (clazz.getMethod("tickClient", HashMap.class, TickEvent.ClientTickEvent.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- clientHandlers.add(handler);
- }
- if (clazz.getMethod("tickRender", HashMap.class, TickEvent.RenderTickEvent.class).getDeclaringClass()
- != IChunkMetaDataHandler.class) {
- renderHandlers.add(handler);
- }
- } catch (NoSuchMethodException e) {
- throw new RuntimeException("Cannot register client event handlers!", e);
- }
- }
- }
-
- public NBTTagCompound removeChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk) {
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).remove(chunk);
- }
-
- public NBTTagCompound getChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk) {
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).get(chunk);
- }
-
- public NBTTagCompound putChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk,
- NBTTagCompound data) {
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world).put(chunk, data);
- }
-
- public NBTTagCompound createIfAbsentChunkData(IChunkMetaDataHandler handler, int world, ChunkCoordIntPair chunk) {
- return dimensionWiseMetaChunkData.get(handler.getTagName()).get(world)
- .computeIfAbsent(chunk, chunkCoordIntPair -> handler.createData());
- }
-
- public HashMap<Integer, ChunkHashMap> getChunkData(IChunkMetaDataHandler chunkMetaDataHandler) {
- return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName());
- }
-
- public ChunkHashMap getChunkData(IChunkMetaDataHandler chunkMetaDataHandler, int world) {
- return dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()).get(world);
- }
-
- public static final class ChunkHashMap implements Map<ChunkCoordIntPair, NBTTagCompound> {
-
- private final HashMap<ChunkCoordIntPair, NBTChunk> storage;
- private final HashMap<ChunkCoordIntPair, NBTTagCompound> storageMeta = new HashMap<>(1024);
- private final HashSet<ChunkCoordIntPair> dirtyBoys = new HashSet<>(1024);
- private final ArrayList<ArrayList<ChunkCoordIntPair>> workLoad = new ArrayList<>();
- private final String meta;
-
- private ChunkHashMap(IChunkMetaDataHandler meta, HashMap<ChunkCoordIntPair, NBTChunk> storage) {
- this.storage = storage;
- this.meta = meta.getTagName();
- for (int i = 0; i < meta.pushPayloadSpreadPeriod(); i++) {
- workLoad.add(new ArrayList<>(128));
- }
- }
-
- public void markForTransmissionToClient(ChunkCoordIntPair chunk) {
- dirtyBoys.add(chunk);
- }
-
- private void putLoaded(ChunkCoordIntPair key, NBTTagCompound value) {
- storageMeta.put(key, value);
- }
-
- @Override
- public NBTTagCompound remove(Object key) {
- NBTTagCompound compound = storageMeta.remove(key);
- if (compound != null) {
- NBTChunk chunk = storage.get(key);
- chunk.data.removeTag(meta);
- if (chunk.data.hasNoTags()) {
- storage.remove(key);
- }
- }
- return compound;
- }
-
- @Override
- public NBTTagCompound put(ChunkCoordIntPair key, NBTTagCompound value) {
- if (value == null) {
- return remove(key);
- }
- NBTChunk chunk = storage.get(key);
- if (chunk == null) {
- NBTTagCompound base = new NBTTagCompound();
- base.setTag(meta, value);
- storage.put(key, new NBTChunk(base, false));
- } else {
- chunk.data.setTag(meta, value);
- }
- return storageMeta.put(key, value);
- }
-
- @Override
- public int size() {
- return storageMeta.size();
- }
-
- @Override
- public boolean isEmpty() {
- return storageMeta.isEmpty();
- }
-
- @Override
- public NBTTagCompound get(Object key) {
- return storageMeta.get(key);
- }
-
- @SuppressWarnings("unlikely-arg-type")
- @Override
- public void clear() {
- storageMeta.entrySet().forEach(this::remove);
- }
-
- @Override
- public void putAll(Map<? extends ChunkCoordIntPair, ? extends NBTTagCompound> m) {
- m.forEach(this::put);
- }
-
- @Override
- public boolean containsKey(Object key) {
- return storageMeta.containsKey(key);
- }
-
- @Override
- public boolean containsValue(Object value) {
- return storageMeta.containsValue(value);
- }
-
- @Override
- public Set<ChunkCoordIntPair> keySet() {
- return storageMeta.keySet();
- }
-
- @Override
- public Collection<NBTTagCompound> values() {
- return storageMeta.values();
- }
-
- @Override
- public Set<Entry<ChunkCoordIntPair, NBTTagCompound>> entrySet() {
- return storageMeta.entrySet();
- }
- }
-
- private static final class NBTChunk {
-
- private final NBTTagCompound data;
- private boolean isLoaded;
-
- private NBTChunk(NBTTagCompound data, boolean isLoaded) {
- if (data == null) {
- data = new NBTTagCompound();
- }
- this.data = data;
- this.isLoaded = isLoaded;
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java b/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java
deleted file mode 100644
index 4f8b7a11d9..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/data/ChunkDataMessage.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.github.technus.tectech.mechanics.data;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraftforge.event.world.ChunkEvent;
-
-import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.util.TT_Utility;
-
-import cpw.mods.fml.common.network.ByteBufUtils;
-import cpw.mods.fml.common.network.simpleimpl.IMessage;
-import cpw.mods.fml.common.network.simpleimpl.MessageContext;
-import eu.usrv.yamcore.network.client.AbstractClientMessageHandler;
-import eu.usrv.yamcore.network.server.AbstractServerMessageHandler;
-import io.netty.buffer.ByteBuf;
-
-public class ChunkDataMessage implements IMessage {
-
- int worldId;
- ChunkCoordIntPair chunk;
- NBTTagCompound data;
- IChunkMetaDataHandler handler;
-
- public ChunkDataMessage() {}
-
- @Override
- public void fromBytes(ByteBuf pBuffer) {
- NBTTagCompound tag = ByteBufUtils.readTag(pBuffer);
- worldId = tag.getInteger("wId");
- chunk = new ChunkCoordIntPair(tag.getInteger("posx"), tag.getInteger("posz"));
- handler = TecTech.chunkDataHandler.getChunkMetaDataHandler(tag.getString("handle"));
- if (tag.hasKey("data")) {
- data = tag.getCompoundTag("data");
- }
- }
-
- @Override
- public void toBytes(ByteBuf pBuffer) {
- NBTTagCompound tag = new NBTTagCompound();
- tag.setInteger("wId", worldId);
- tag.setInteger("posx", chunk.chunkXPos);
- tag.setInteger("posz", chunk.chunkZPos);
- tag.setString("handle", handler.getTagName());
- if (data != null) {
- tag.setTag("data", data);
- }
- ByteBufUtils.writeTag(pBuffer, tag);
- }
-
- public static class ChunkDataQuery extends ChunkDataMessage {
-
- public ChunkDataQuery() {}
-
- public ChunkDataQuery(ChunkEvent.Load aEvent, IChunkMetaDataHandler handler) {
- worldId = aEvent.world.provider.dimensionId;
- chunk = aEvent.getChunk().getChunkCoordIntPair();
- this.handler = handler;
- }
- }
-
- public static class ChunkDataData extends ChunkDataMessage {
-
- public ChunkDataData() {}
-
- public ChunkDataData(int worldId, ChunkCoordIntPair chunk, IChunkMetaDataHandler handler) {
- this.worldId = worldId;
- this.chunk = chunk;
- this.handler = handler;
- this.data = TecTech.chunkDataHandler.getChunkData(handler, worldId, chunk);
- }
-
- public ChunkDataData(ChunkDataQuery query) {
- worldId = query.worldId;
- chunk = query.chunk;
- handler = query.handler;
- data = TecTech.chunkDataHandler.getChunkData(handler, worldId, chunk);
- }
- }
-
- public static class ClientHandler extends AbstractClientMessageHandler<ChunkDataData> {
-
- @Override
- public IMessage handleClientMessage(EntityPlayer pPlayer, ChunkDataData pMessage, MessageContext pCtx) {
- if (TT_Utility.checkChunkExist(pPlayer.worldObj, pMessage.chunk)) {
- TecTech.chunkDataHandler
- .putChunkData(pMessage.handler, pMessage.worldId, pMessage.chunk, pMessage.data);
- }
- return null;
- }
- }
-
- public static class ServerHandler extends AbstractServerMessageHandler<ChunkDataQuery> {
-
- @Override
- public IMessage handleServerMessage(EntityPlayer pPlayer, ChunkDataQuery pMessage, MessageContext pCtx) {
- return new ChunkDataData(pMessage);
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/IChunkMetaDataHandler.java b/src/main/java/com/github/technus/tectech/mechanics/data/IChunkMetaDataHandler.java
deleted file mode 100644
index e172b5da32..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/data/IChunkMetaDataHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.github.technus.tectech.mechanics.data;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraftforge.event.world.ChunkEvent;
-
-import cpw.mods.fml.common.gameevent.TickEvent;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-public interface IChunkMetaDataHandler {
-
- String getTagName();
-
- void mergeData(NBTTagCompound target, NBTTagCompound loadedData);
-
- NBTTagCompound createData();
-
- @SideOnly(Side.CLIENT)
- default void pullData(ChunkEvent.Load aEvent) {}
-
- default void pushData(World world, ChunkCoordIntPair chunk) {}
-
- default void pushPayload(World world, ArrayList<ChunkCoordIntPair> chunk) {
- chunk.forEach(chunkCoordIntPair -> pushData(world, chunkCoordIntPair));
- }
-
- default int pushPayloadSpreadPeriod() {
- return 20; // must be a constant!
- }
-
- @SideOnly(Side.CLIENT)
- default void tickRender(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.RenderTickEvent event) {}
-
- @SideOnly(Side.CLIENT)
- default void tickClient(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ClientTickEvent event) {}
-
- default void tickServer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event) {}
-
- default void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent event) {}
-
- default void tickPlayer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.PlayerTickEvent event) {}
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerDataMessage.java b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerDataMessage.java
deleted file mode 100644
index 2aa4d2544c..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerDataMessage.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.github.technus.tectech.mechanics.data;
-
-import static java.nio.charset.Charset.forName;
-
-import java.util.UUID;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
-
-import com.github.technus.tectech.TecTech;
-
-import cpw.mods.fml.common.network.ByteBufUtils;
-import cpw.mods.fml.common.network.simpleimpl.IMessage;
-import cpw.mods.fml.common.network.simpleimpl.MessageContext;
-import eu.usrv.yamcore.network.client.AbstractClientMessageHandler;
-import eu.usrv.yamcore.network.server.AbstractServerMessageHandler;
-import io.netty.buffer.ByteBuf;
-
-public class PlayerDataMessage implements IMessage {
-
- NBTTagCompound data;
- UUID uuid1, uuid2;
-
- public PlayerDataMessage() {}
-
- @Override
- public void fromBytes(ByteBuf pBuffer) {
- NBTTagCompound tag = ByteBufUtils.readTag(pBuffer);
- uuid1 = UUID.fromString(tag.getString("id1"));
- uuid2 = UUID.fromString(tag.getString("id2"));
- if (tag.hasKey("data")) {
- data = tag.getCompoundTag("data");
- }
- }
-
- @Override
- public void toBytes(ByteBuf pBuffer) {
- NBTTagCompound tag = new NBTTagCompound();
- tag.setString("id1", uuid1.toString());
- tag.setString("id2", uuid2.toString());
- if (data != null) {
- tag.setTag("data", data);
- }
- ByteBufUtils.writeTag(pBuffer, tag);
- }
-
- public static class PlayerDataQuery extends PlayerDataMessage {
-
- public PlayerDataQuery() {}
-
- public PlayerDataQuery(EntityPlayer player) {
- uuid1 = player.getUniqueID();
- uuid2 = UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(forName("UTF-8")));
- }
- }
-
- public static class PlayerDataData extends PlayerDataMessage {
-
- public PlayerDataData() {}
-
- public PlayerDataData(EntityPlayer player) {
- uuid1 = player.getUniqueID();
- uuid2 = UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(forName("UTF-8")));
- data = TecTech.playerPersistence.getDataOrSetToNewTag(player);
- }
-
- public PlayerDataData(PlayerDataQuery query) {
- uuid1 = query.uuid1;
- uuid2 = query.uuid2;
- data = TecTech.playerPersistence.getDataOrSetToNewTag(uuid1, uuid2);
- }
- }
-
- public static class ClientHandler extends AbstractClientMessageHandler<PlayerDataData> {
-
- @Override
- public IMessage handleClientMessage(EntityPlayer pPlayer, PlayerDataData pMessage, MessageContext pCtx) {
- TecTech.playerPersistence.putDataOrSetToNewTag(pMessage.uuid1, pMessage.uuid2, pMessage.data);
- return null;
- }
- }
-
- public static class ServerHandler extends AbstractServerMessageHandler<PlayerDataQuery> {
-
- @Override
- public IMessage handleServerMessage(EntityPlayer pPlayer, PlayerDataQuery pMessage, MessageContext pCtx) {
- return new PlayerDataData(pMessage);
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java b/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java
deleted file mode 100644
index 78367717e1..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/data/PlayerPersistence.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.github.technus.tectech.mechanics.data;
-
-import static java.nio.charset.Charset.forName;
-
-import java.util.HashMap;
-import java.util.UUID;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.world.WorldServer;
-
-import com.github.technus.tectech.loader.NetworkDispatcher;
-import com.github.technus.tectech.util.TT_Utility;
-
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.PlayerEvent;
-
-public class PlayerPersistence {
-
- private final HashMap<UUID, NBTTagCompound> map = new HashMap<>();
- private final String extension;
-
- public PlayerPersistence(String extension) {
- this.extension = extension;
- }
-
- public NBTTagCompound getDataOrSetToNewTag(UUID uuid1, UUID uuid2) {
- NBTTagCompound tag = map.get(uuid1);
- if (tag != null) {
- return tag;
- }
- tag = map.get(uuid2);
- if (tag != null) {
- return tag;
- }
- tag = TT_Utility.getPlayerData(uuid1, uuid2, extension);
- if (tag == null) {
- tag = new NBTTagCompound();
- }
- map.put(uuid1, tag);
- map.put(uuid2, tag);
- return tag;
- }
-
- public NBTTagCompound getDataOrSetToNewTag(EntityPlayer player) {
- return getDataOrSetToNewTag(
- player.getUniqueID(),
- UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(forName("UTF-8"))));
- }
-
- public void putDataOrSetToNewTag(UUID uuid1, UUID uuid2, NBTTagCompound tagCompound) {
- if (tagCompound == null) {
- tagCompound = new NBTTagCompound();
- }
- map.put(uuid1, tagCompound);
- map.put(uuid2, tagCompound);
- }
-
- public void putDataOrSetToNewTag(EntityPlayer player, NBTTagCompound tagCompound) {
- putDataOrSetToNewTag(
- player.getUniqueID(),
- UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(forName("UTF-8"))),
- tagCompound);
- }
-
- public void saveData(EntityPlayer player) {
- TT_Utility.savePlayerFile(player, extension, getDataOrSetToNewTag(player));
- }
-
- @SubscribeEvent
- public void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
- if (!event.player.worldObj.isRemote) {
- for (WorldServer worldServer : MinecraftServer.getServer().worldServers) {
- for (Object playerEntity : worldServer.playerEntities) {
- NetworkDispatcher.INSTANCE.sendTo(
- new PlayerDataMessage.PlayerDataData((EntityPlayer) playerEntity),
- (EntityPlayerMP) event.player);
- }
- }
- NetworkDispatcher.INSTANCE.sendToAll(new PlayerDataMessage.PlayerDataData(event.player));
- }
- }
-
- public void clearData() {
- map.clear();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/data/WorldData.java b/src/main/java/com/github/technus/tectech/mechanics/data/WorldData.java
deleted file mode 100644
index 5da5516087..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/data/WorldData.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.github.technus.tectech.mechanics.data;
-
-import java.util.Objects;
-
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-
-public final class WorldData {
-
- private final World world;
- private final Chunk chunk;
- private final ChunkCoordIntPair coordIntPair;
-
- public WorldData(World world, Chunk data) {
- this.world = world;
- this.chunk = data;
- coordIntPair = data.getChunkCoordIntPair();
- }
-
- public WorldData(World world, ChunkCoordIntPair data) {
- this.world = world;
- this.coordIntPair = data;
- chunk = world.getChunkFromChunkCoords(data.chunkXPos, data.chunkZPos);
- }
-
- public World getWorld() {
- return world;
- }
-
- public Chunk getChunk() {
- return chunk;
- }
-
- public ChunkCoordIntPair getCoordIntPair() {
- return coordIntPair;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- WorldData worldData = (WorldData) o;
- return world.provider.dimensionId == worldData.world.provider.dimensionId
- && coordIntPair.chunkXPos == worldData.coordIntPair.chunkXPos
- && coordIntPair.chunkZPos == worldData.coordIntPair.chunkXPos;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(world.provider.dimensionId, coordIntPair);
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java
index 9cca6b2660..01ef4560ee 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/dataTransport/DataPacket.java
@@ -14,7 +14,7 @@ import com.gtnewhorizon.structurelib.util.Vec3Impl;
public abstract class DataPacket<T> {
private static final byte MAX_HISTORY = 64;
- private Set<Vec3Impl> trace = new LinkedHashSet<>();
+ private final Set<Vec3Impl> trace = new LinkedHashSet<>();
protected T content;
diff --git a/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java b/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java
deleted file mode 100644
index 71e69d57e4..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/pipe/IConnectsToElementalPipe.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.github.technus.tectech.mechanics.pipe;
-
-import net.minecraftforge.common.util.ForgeDirection;
-
-/**
- * Created by Tec on 26.02.2017.
- */
-public interface IConnectsToElementalPipe {
-
- boolean canConnect(ForgeDirection side);
-}
diff --git a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java
index 2278722308..9eca0d1022 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/tesla/ITeslaConnectable.java
@@ -117,12 +117,12 @@ public interface ITeslaConnectable extends ITeslaConnectableSimple {
if (origin.isOverdriveEnabled()) {
outputVoltageInjectable = origin.getTeslaOutputVoltage();
outputVoltageConsumption = origin.getTeslaOutputVoltage()
- + (distance * origin.getTeslaEnergyLossPerBlock())
+ + ((long) distance * origin.getTeslaEnergyLossPerBlock())
+ (long) Math.round(
origin.getTeslaOutputVoltage() * origin.getTeslaOverdriveLossCoefficient());
} else {
outputVoltageInjectable = origin.getTeslaOutputVoltage()
- - (distance * origin.getTeslaEnergyLossPerBlock());
+ - ((long) distance * origin.getTeslaEnergyLossPerBlock());
outputVoltageConsumption = origin.getTeslaOutputVoltage();
}
diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java
index a0edad5fc4..e87350b2b9 100644
--- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java
+++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java
@@ -186,8 +186,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler {
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip,
int aRecipeIndex) {
TemplateRecipeHandler.CachedRecipe tObject = arecipes.get(aRecipeIndex);
- if (tObject instanceof CachedDefaultRecipe) {
- CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
+ if (tObject instanceof CachedDefaultRecipe tRecipe) {
for (PositionedStack tStack : tRecipe.mOutputs) {
if (aStack == tStack.item) {
if (!(tStack instanceof FixedPositionedStack) || ((FixedPositionedStack) tStack).mChance <= 0
diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java
index 49ea22e5fe..04558efad8 100644
--- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java
+++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java
@@ -186,8 +186,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler {
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip,
int aRecipeIndex) {
TemplateRecipeHandler.CachedRecipe tObject = arecipes.get(aRecipeIndex);
- if (tObject instanceof CachedDefaultRecipe) {
- CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject;
+ if (tObject instanceof CachedDefaultRecipe tRecipe) {
for (PositionedStack tStack : tRecipe.mOutputs) {
if (aStack == tStack.item) {
if (!(tStack instanceof FixedPositionedStack) || ((FixedPositionedStack) tStack).mChance <= 0
diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
index 9555fb7129..0baf9a3f24 100644
--- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
@@ -4,7 +4,6 @@ import static com.github.technus.tectech.TecTech.RANDOM;
import static com.github.technus.tectech.thing.casing.TT_Container_Casings.eyeOfHarmonyRenderBlock;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.GuiNewChat;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
@@ -170,12 +169,4 @@ public class ClientProxy extends CommonProxy {
em_particle(w, box.maxX, box.minY, box.minZ);
}
- @Override
- public EntityClientPlayerMP getPlayer() {
- return Minecraft.getMinecraft().thePlayer;
- }
-
- public boolean isThePlayer(EntityPlayer player) {
- return getPlayer() == player;
- }
}
diff --git a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
index 51284a8684..a8803ed788 100644
--- a/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/CommonProxy.java
@@ -80,11 +80,4 @@ public class CommonProxy implements IGuiHandler {
return false;
}
- public EntityPlayer getPlayer() {
- return null;
- }
-
- public boolean isThePlayer(EntityPlayer player) {
- return false;
- }
}
diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
index bf27d57af1..083897cc2d 100644
--- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
+++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java
@@ -118,8 +118,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
tAlts[i] = null;
tPersistentHash = tPersistentHash * 31 + GT_Utility.persistentHash(tInputs[i], true, false);
continue;
- } else if (obj instanceof ItemStack[]) {
- ItemStack[] aStacks = (ItemStack[]) obj;
+ } else if (obj instanceof ItemStack[]aStacks) {
if (aStacks.length > 0) {
tInputs[i] = aStacks[0];
tAlts[i] = Arrays.copyOf(aStacks, aStacks.length);
@@ -129,8 +128,7 @@ public class TT_recipeAdder extends GT_RecipeAdder {
tPersistentHash *= 31;
continue;
}
- } else if (obj instanceof Object[]) {
- Object[] objs = (Object[]) obj;
+ } else if (obj instanceof Object[]objs) {
List<ItemStack> tList;
if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) {
try {
diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java
index 0323262883..df9fa1fc4f 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java
@@ -18,7 +18,7 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
*/
public final class QuantumStuffRender implements ISimpleBlockRenderingHandler {
- private static Tessellator tes = Tessellator.instance;
+ private static final Tessellator tes = Tessellator.instance;
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
diff --git a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
index 7a4071480c..7fe0d144f9 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
@@ -32,9 +32,7 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
- if (!(tile instanceof TileEyeOfHarmony)) return;
-
- TileEyeOfHarmony EOHRenderTile = (TileEyeOfHarmony) tile;
+ if (!(tile instanceof TileEyeOfHarmony EOHRenderTile)) return;
// Render outer space layer.
diff --git a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
index 527cc8ca15..889d1dc4ae 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
@@ -68,14 +68,6 @@ public class TileEyeOfHarmony extends TileEntity {
private long tier = 9;
- public void incrementSize() {
- size += 1.5f;
- }
-
- public void increaseRotationSpeed() {
- rotationSpeed++;
- }
-
public float getSize() {
return size;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
index 3847407427..b32f0e8061 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsBA0.java
@@ -27,16 +27,16 @@ import gregtech.common.blocks.GT_Material_Casings;
// Mostly tesla coils, also 2 eye of harmony casings.
public class GT_Block_CasingsBA0 extends GT_Block_Casings_Abstract {
- private static IIcon[] tM0 = new IIcon[2];
- private static IIcon[] tM1 = new IIcon[2];
- private static IIcon[] tM2 = new IIcon[2];
- private static IIcon[] tM3 = new IIcon[2];
- private static IIcon[] tM4 = new IIcon[2];
- private static IIcon[] tM5 = new IIcon[2];
- private static IIcon[] tM6 = new IIcon[2];
+ private static final IIcon[] tM0 = new IIcon[2];
+ private static final IIcon[] tM1 = new IIcon[2];
+ private static final IIcon[] tM2 = new IIcon[2];
+ private static final IIcon[] tM3 = new IIcon[2];
+ private static final IIcon[] tM4 = new IIcon[2];
+ private static final IIcon[] tM5 = new IIcon[2];
+ private static final IIcon[] tM6 = new IIcon[2];
private static IIcon tM7;
- private static IIcon[] tM8 = new IIcon[2];
- private static IIcon[] tM9 = new IIcon[2];
+ private static final IIcon[] tM8 = new IIcon[2];
+ private static final IIcon[] tM9 = new IIcon[2];
private static IIcon EOH_INNER;
private static IIcon EOH_OUTER;
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
index 2d83a6f6ec..eef50af257 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java
@@ -31,7 +31,7 @@ public class GT_Block_CasingsTT extends GT_Block_Casings_Abstract {
public static final short textureOffset = texturePage << 7; // Start of PAGE 8 (which is the 9th page) (8*128)
private static IIcon eM0, eM1, eM1s, eM2, eM2s, eM3, eM3s, eM4, eM5, eM6, eM7, eM7s, eM8, eM9, eM10, eM11, eM12,
eM13, eM14;
- private static IIcon[] debug = new IIcon[6];
+ private static final IIcon[] debug = new IIcon[6];
public GT_Block_CasingsTT() {
super(GT_Item_CasingsTT.class, "gt.blockcasingsTT", GT_Material_Casings.INSTANCE);
diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
index 87c0ce7ae1..9c2cb7f928 100644
--- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
+++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Item_CasingsBA0.java
@@ -105,7 +105,7 @@ public class GT_Item_CasingsBA0 extends GT_Item_Casings_Abstract {
break;
default:
aList.add("Damn son where did you get that!?");
- aList.add(EnumChatFormatting.BLUE.toString() + "From outer space... I guess...");
+ aList.add(EnumChatFormatting.BLUE + "From outer space... I guess...");
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java
index 72e38ed75d..9b12b10c44 100644
--- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java
+++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_EnderFluidLink.java
@@ -59,8 +59,7 @@ public class GT_Cover_TM_EnderFluidLink extends GT_CoverBehavior {
@Override
public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable,
ICoverable aTileEntity, long aTimer) {
- if ((aTileEntity instanceof IFluidHandler)) {
- IFluidHandler fluidHandlerSelf = (IFluidHandler) aTileEntity;
+ if ((aTileEntity instanceof IFluidHandler fluidHandlerSelf)) {
IFluidHandler fluidHandlerEnder = getEnderFluidContainer(getEnderLinkTag((IFluidHandler) aTileEntity));
if (testBit(aCoverVariable, IMPORT_EXPORT_MASK)) {
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java
index 400ad54984..316cf34b88 100644
--- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java
+++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java
@@ -17,8 +17,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior {
public boolean isCoverPlaceable(ForgeDirection side, ItemStack aStack, ICoverable aTileEntity) {
IMetaTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0)
.getMetaTileEntity();
- if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) {
- GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset;
+ if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM multi) {
return !multi.ePowerPassCover;
}
return false;
@@ -28,8 +27,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior {
public void placeCover(ForgeDirection side, ItemStack aCover, ICoverable aTileEntity) {
IMetaTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0)
.getMetaTileEntity();
- if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) {
- GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset;
+ if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM multi) {
multi.ePowerPassCover = true;
multi.ePowerPass = true;
}
@@ -41,8 +39,7 @@ public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior {
boolean aForced) {
IMetaTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0)
.getMetaTileEntity();
- if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) {
- GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset;
+ if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM multi) {
multi.ePowerPassCover = false;
multi.ePowerPass = false;
}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
index 0154a12a9a..8a755c6841 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/EuMeterGT.java
@@ -51,7 +51,7 @@ public class EuMeterGT extends Item {
return aPlayer instanceof EntityPlayerMP;
}
if (aPlayer instanceof EntityPlayerMP && !aPlayer.isSneaking() && tTileEntity instanceof IGregTechTileEntity) {
- String clientLocale = "en_US";
+ String clientLocale;
try {
EntityPlayerMP player = (EntityPlayerMP) aPlayer;
clientLocale = (String) FieldUtils.readField(player, "translator", true);
diff --git a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java
deleted file mode 100644
index 791ff0102e..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package com.github.technus.tectech.thing.item.gui;
-
-import static com.github.technus.tectech.Reference.MODID;
-import static org.lwjgl.opengl.GL11.*;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.audio.PositionedSoundRecord;
-import net.minecraft.client.audio.SoundHandler;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.util.ResourceLocation;
-
-import com.github.technus.tectech.TecTech;
-import com.github.technus.tectech.font.TecTechFontRender;
-
-/**
- * Created by danie_000 on 17.12.2017.
- */
-public class ScanDisplayScreen extends GuiScreen {
-
- private static final int sizeX = 240, sizeY = 220, renderedLines = 10;
- private int baseX, baseY;
- private Button up, down, pgUp, pgDown;
- private final String[] lines = { "" };
- private int firstLine;
-
- private static final ResourceLocation[] BACKGROUNDS = new ResourceLocation[] {
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen1.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen2.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen3.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen4.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen5.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen6.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen7.png"),
- new ResourceLocation(MODID + ":textures/gui/scanDisplayScreen8.png") };
- private static final ResourceLocation ITEM = new ResourceLocation(MODID + ":textures/gui/scanDisplayItem.png");
-
- public ScanDisplayScreen() {}
-
- @Override
- public void drawScreen(int x, int y, float partialTicks) {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- mc.getTextureManager().bindTexture(ITEM);
- long tick = System.currentTimeMillis() / 150;
- int itick = (int) (tick % 12);
- drawTexturedModalRect(baseX + 99, baseY + 189, 32 * (itick / 6), 32 * (itick % 6), 32, 32);
- mc.getTextureManager().bindTexture(BACKGROUNDS[(int) (tick % 8)]);
- drawTexturedModalRect(baseX, baseY, 0, 0, sizeX, sizeY);
- glDisable(GL_BLEND);
- super.drawScreen(x, y, partialTicks);
-
- itick = (TecTech.RANDOM.nextInt(0x66) << 16) + 0x77EEFF;
- int textBaseX = baseX + 20;
- int textBaseXX = baseX + 95;
- int textBaseY = baseY + 28;
- for (int i = firstLine - 1, j = 8; i >= 0 && j != 0; i--, j /= 2) {
- int equalPos = lines[i].indexOf('=');
- if (equalPos >= 0) {
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY - 8 + j, 200, itick);
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY - 8 + j, 200, itick);
- } else {
- TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY - 8 + j, 200, itick);
- }
- }
- for (int i = firstLine, j = 0; i < lines.length && j < renderedLines; i++, j++) {
- textBaseY += 9;
- int equalPos = lines[i].indexOf('=');
- if (equalPos >= 0) {
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY, 200, itick);
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY, 200, itick);
- } else {
- TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY, 200, itick);
- }
- }
- for (int i = firstLine + renderedLines, j = 8; i < lines.length && j != 0; i++, j /= 2) {
- int equalPos = lines[i].indexOf('=');
- if (equalPos >= 0) {
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(0, equalPos), textBaseX, textBaseY + 17 - j, 200, itick);
- TecTechFontRender.INSTANCE
- .drawSplitString(lines[i].substring(equalPos), textBaseXX, textBaseY + 17 - j, 200, itick);
- } else {
- TecTechFontRender.INSTANCE.drawSplitString(lines[i], textBaseX, textBaseY + 17 - j, 200, itick);
- }
- }
- TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(firstLine), textBaseX, baseY + 146, 200, itick);
- TecTechFontRender.INSTANCE.drawSplitString(Integer.toString(lines.length), textBaseX, baseY + 157, 200, itick);
- }
-
- @Override
- public boolean doesGuiPauseGame() {
- return false;
- }
-
- @Override
- public void initGui() {
- baseX = (width - sizeX) / 2;
- baseY = (height - sizeY) / 2 - 12;
- int buttonBaseY = baseY + 145;
- buttonList.add(pgUp = new Button(0, baseX + 77, buttonBaseY, 0, 220));
- buttonList.add(up = new Button(1, baseX + 99, buttonBaseY, 20, 220));
- buttonList.add(down = new Button(2, baseX + 121, buttonBaseY, 40, 220));
- buttonList.add(pgDown = new Button(3, baseX + 143, buttonBaseY, 60, 220));
- }
-
- @Override
- protected void actionPerformed(GuiButton button) {
- if (lines.length <= renderedLines) {
- return;
- }
- if (button == pgUp) {
- firstLine -= renderedLines;
- } else if (button == up) {
- firstLine--;
- } else if (button == down) {
- firstLine++;
- } else if (button == pgDown) {
- firstLine += renderedLines;
- }
- if (firstLine > lines.length - renderedLines) {
- firstLine = lines.length - renderedLines;
- }
- if (firstLine < 0) {
- firstLine = 0;
- }
- }
-
- private static class Button extends GuiButton {
-
- int u, v;
-
- Button(int id, int x, int y, int u, int v) {
- super(id, x, y, 20, 20, "");
- this.u = u;
- this.v = v;
- }
-
- @Override
- public void drawButton(Minecraft mc, int xPos, int yPos) {
- if (visible) {
- field_146123_n = xPos >= xPosition && yPos >= yPosition
- && xPos < xPosition + width
- && yPos < yPosition + height;
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- mc.getTextureManager().bindTexture(BACKGROUNDS[0]);
- drawTexturedModalRect(xPosition, yPosition, u + getHoverState(field_146123_n) * 80, v, width, height);
- glDisable(GL_BLEND);
- glEnable(GL_BLEND);
- }
- }
-
- // play cool sound fx
- @Override
- public void func_146113_a(SoundHandler soundHandler) {
- soundHandler
- .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(MODID + ":fx_click"), 1.0F));
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java
deleted file mode 100644
index a284f46a5e..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/IElementalItem.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.github.technus.tectech.thing.item.renderElemental;
-
-import static com.github.technus.tectech.util.TT_Utility.getSomeString;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-public interface IElementalItem {
-
- default String getSymbol(ItemStack stack, int index) {
- try {
- NBTTagCompound tNBT = stack.getTagCompound();
- if (tNBT != null && tNBT.hasKey("symbols")) {
- return getSomeString(tNBT.getCompoundTag("symbols"), index);
- } else {
- return null;
- }
- } catch (Exception e) {
- return "#!";
- }
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java b/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java
deleted file mode 100644
index 0a072e3872..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/item/renderElemental/RenderElementalName.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.github.technus.tectech.thing.item.renderElemental;
-
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-import net.minecraftforge.client.IItemRenderer;
-
-import org.lwjgl.opengl.GL11;
-
-import com.github.technus.tectech.font.TecTechFontRender;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-@SideOnly(Side.CLIENT)
-public class RenderElementalName implements IItemRenderer {
-
- public static final RenderElementalName INSTANCE = new RenderElementalName();
-
- public boolean handleRenderType(final ItemStack itemStack, final IItemRenderer.ItemRenderType type) {
- return type == ItemRenderType.INVENTORY;
- }
-
- public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack itemStack,
- final IItemRenderer.ItemRendererHelper helper) {
- return false;
- }
-
- public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack itemStack, final Object... data) {
- GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glEnable(GL11.GL_ALPHA_TEST);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glPushMatrix();
- Item item = itemStack.getItem();
- final Tessellator tessellator = Tessellator.instance;
- for (int i = 0; i < item.getRenderPasses(itemStack.getItemDamage()); i++) {
- IIcon icon = item.getIcon(itemStack, i);
- tessellator.startDrawingQuads();
- tessellator.addVertexWithUV(0.0, 0.0, 0.0, icon.getMinU(), icon.getMinV());
- tessellator.addVertexWithUV(0.0, 16, 0.0, icon.getMinU(), icon.getMaxV());
- tessellator.addVertexWithUV(16, 16, 0.0, icon.getMaxU(), icon.getMaxV());
- tessellator.addVertexWithUV(16, 0.0, 0.0, icon.getMaxU(), icon.getMinV());
- tessellator.draw();
- }
- String sym = ((IElementalItem) item).getSymbol(itemStack, (int) (System.currentTimeMillis() / 1000));
- if (sym != null) {
- if (sym.length() > 4) {
- sym = "...";
- }
-
- GL11.glPushMatrix();
- GL11.glTranslatef(.8F, .8F, 0F);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(-1.6f, 0, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(0, -1.6f, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(0, 1.6f, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glPopMatrix();
-
- GL11.glPushMatrix();
- GL11.glTranslatef(.4F, .4F, 0F);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(-.8f, 0, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(0, -.8f, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glTranslatef(0, .8f, 0);
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0x222200);
- GL11.glPopMatrix();
-
- TecTechFontRender.INSTANCE.drawSplitString(sym, 0, 0, 16, 0xffff00);
- }
- GL11.glPopMatrix();
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
index b75f2355d0..e8ea498bde 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Capacitor.java
@@ -41,7 +41,7 @@ public class GT_MetaTileEntity_Hatch_Capacitor extends GT_MetaTileEntity_Hatch i
private static Textures.BlockIcons.CustomIcon TM_H;
private static Textures.BlockIcons.CustomIcon TM_H_ACTIVE;
- private static Map<String, GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> componentBinds = new HashMap<>();
+ private static final Map<String, GT_MetaTileEntity_Hatch_Capacitor.CapacitorComponent> componentBinds = new HashMap<>();
public GT_MetaTileEntity_Hatch_Capacitor(int aID, String aName, String aNameRegional, int aTier) {
super(
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
index e08b83ea19..cde75ebaf8 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java
@@ -55,7 +55,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch implem
private static Textures.BlockIcons.CustomIcon EM_R_ACTIVE;
public int heat = 0;
private float overClock = 1, overVolt = 1;
- private static Map<String, RackComponent> componentBinds = new HashMap<>();
+ private static final Map<String, RackComponent> componentBinds = new HashMap<>();
private String clientLocale = "en_US";
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
index 5de86299b0..924255c5cb 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java
@@ -145,7 +145,7 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB
protected CheckRecipeResult checkProcessing_EM() {
if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) {
mEUt = -(int) V[slave ? 6 : 4];
- eAmpereFlow = 1 + eStacksDataOutputs.size() * eDataAccessHatches.size();
+ eAmpereFlow = 1 + (long) eStacksDataOutputs.size() * eDataAccessHatches.size();
mMaxProgresstime = 20;
mEfficiencyIncrease = 10000;
return SimpleCheckRecipeResult.ofSuccess("providing_data");
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
index 4ed3520b8a..a28cb98274 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java
@@ -232,8 +232,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
@Override
public boolean check(GT_MetaTileEntity_TM_teslaCoil t, World world, int x, int y, int z) {
TileEntity tBase = world.getTileEntity(x, y, z);
- if (tBase instanceof BaseMetaPipeEntity) {
- BaseMetaPipeEntity tPipeBase = (BaseMetaPipeEntity) tBase;
+ if (tBase instanceof BaseMetaPipeEntity tPipeBase) {
if (tPipeBase.isInvalidTileEntity()) return false;
return tPipeBase.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame;
}
@@ -257,9 +256,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock
public boolean placeBlock(GT_MetaTileEntity_TM_teslaCoil t, World world, int x, int y, int z,
ItemStack trigger) {
ItemStack tFrameStack = GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Titanium, 1);
- if (!GT_Utility.isStackValid(tFrameStack) || !(tFrameStack.getItem() instanceof ItemBlock))
+ if (!GT_Utility.isStackValid(tFrameStack)
+ || !(tFrameStack.getItem() instanceof ItemBlock tFrameStackItem))
return false;
- ItemBlock tFrameStackItem = (ItemBlock) tFrameStack.getItem();
return tFrameStackItem.placeBlockAt(
tFrameStack,
null,
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index 534b0d6d1a..43b47b0a00 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -574,7 +574,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM
* <p>
* good place to update parameter statuses, default implementation handles it well
*
- * @param machineBusy is machine doing SHIT
+ * @param machineBusy is machine doing stuff
*/
protected void parametersStatusesWrite_EM(boolean machineBusy) { // todo unimplement?
if (!machineBusy) {
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java
index d253978bff..03311da922 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/LedStatus.java
@@ -16,8 +16,8 @@ public enum LedStatus {
STATUS_TOO_HIGH(() -> EnumChatFormatting.RED + "Too High", false), //
STATUS_HIGH(() -> EnumChatFormatting.GOLD + "High", true), //
STATUS_UNDEFINED(() -> EnumChatFormatting.GRAY + "Unknown", false),
- STATUS_NEUTRAL(() -> EnumChatFormatting.WHITE + "Neutral", true), //
- STATUS_WTF(() -> { return LedStatus.values()[TecTech.RANDOM.nextInt(9)].name.get(); }, false); //
+ STATUS_NEUTRAL(() -> EnumChatFormatting.WHITE + "Neutral", true),
+ STATUS_WTF(() -> LedStatus.values()[TecTech.RANDOM.nextInt(9)].name.get(), false);
public final Supplier<String> name;
public final boolean isOk;
@@ -61,41 +61,4 @@ public enum LedStatus {
return STATUS_OK;
}
- public static LedStatus fromLimitsExclusiveOuterBoundary(double value, double min, double low, double high,
- double max, double... excludedNumbers) {
- if (value <= min) return STATUS_TOO_LOW;
- if (value >= max) return STATUS_TOO_HIGH;
-
- if (value < low) return STATUS_LOW;
- if (value > high) return STATUS_HIGH;
- for (double val : excludedNumbers) {
- if (val == value) return STATUS_WRONG;
- }
- if (Double.isNaN(value)) return STATUS_WRONG;
- return STATUS_OK;
- }
-
- public static LedStatus fromLimitsInclusiveBoundary(double value, double min, double max,
- double... excludedNumbers) {
- if (value < min) return STATUS_TOO_LOW;
- if (value > max) return STATUS_TOO_HIGH;
-
- for (double val : excludedNumbers) {
- if (val == value) return STATUS_WRONG;
- }
- if (Double.isNaN(value)) return STATUS_WRONG;
- return STATUS_OK;
- }
-
- public static LedStatus fromLimitsExclusiveBoundary(double value, double min, double max,
- double... excludedNumbers) {
- if (value <= min) return STATUS_TOO_LOW;
- if (value >= max) return STATUS_TOO_HIGH;
-
- for (double val : excludedNumbers) {
- if (val == value) return STATUS_WRONG;
- }
- if (Double.isNaN(value)) return STATUS_WRONG;
- return STATUS_OK;
- }
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java
deleted file mode 100644
index 26d49f6314..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/MultiblockControl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.github.technus.tectech.thing.metaTileEntity.multi.base;
-
-/**
- * Created by danie_000 on 23.12.2017.
- */
-public class MultiblockControl<T> {
-
- private final boolean shouldExplode;
- private final T value;
- private final int eUt;
- private final int amperes;
- private final int requiredData;
- private final int effIncrease;
- private final int maxProgressTime;
- private final int pollutionToAdd;
- private final double excessMass;
-
- public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime,
- int pollutionToAdd, double excessMass, boolean shouldExplode) {
- this.value = value;
- this.eUt = eUt;
- this.amperes = amperes;
- this.requiredData = requiredData;
- this.effIncrease = effIncrease;
- this.maxProgressTime = maxProgressTime;
- this.pollutionToAdd = pollutionToAdd;
- this.excessMass = excessMass;
- this.shouldExplode = shouldExplode;
- }
-
- public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime,
- int pollutionToAdd, double excessMass) {
- this(value, eUt, amperes, requiredData, effIncrease, maxProgressTime, pollutionToAdd, excessMass, false);
- }
-
- public MultiblockControl(T value, int eUt, int amperes, int requiredData, int effIncrease, int maxProgressTime) {
- this(value, eUt, amperes, requiredData, effIncrease, maxProgressTime, 0, 0);
- }
-
- public MultiblockControl(double excessMass) {
- this(null, 0, 0, 0, 0, 0, 0, excessMass, true);
- }
-
- public T getValue() {
- return value;
- }
-
- public int getEUT() {
- return eUt;
- }
-
- public int getAmperage() {
- return amperes;
- }
-
- public int getRequiredData() {
- return requiredData;
- }
-
- public int getEffIncrease() {
- return effIncrease;
- }
-
- public int getMaxProgressTime() {
- return maxProgressTime;
- }
-
- public int getPollutionToAdd() {
- return pollutionToAdd;
- }
-
- public double getExcessMass() {
- return excessMass;
- }
-
- public boolean shouldExplode() {
- return shouldExplode;
- }
-}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
index 69013f4c13..94ffbd3e5d 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java
@@ -43,23 +43,12 @@ public class Parameters {
this.parent = parent;
}
- public boolean trySetParameters(int hatch, double parameter0, double parameter1) {
+ public void trySetParameters(int hatch, double parameter0, double parameter1) {
Group p = groups[hatch];
if (parent.mMaxProgresstime <= 0 || (p != null && p.updateWhileRunning)) {
iParamsIn[hatch] = parameter0;
iParamsIn[hatch + 10] = parameter1;
- return true;
}
- return false;
- }
-
- public boolean trySetParameters(int hatchNo, int parameterId, double parameter) {
- Group p = groups[hatchNo];
- if (parent.mMaxProgresstime <= 0 || (p != null && p.updateWhileRunning)) {
- iParamsIn[hatchNo + 10 * parameterId] = parameter;
- return true;
- }
- return false;
}
public void setToDefaults(int hatch, boolean defaultIn, boolean defaultOut) {
@@ -84,35 +73,6 @@ public class Parameters {
}
}
- public void ClearDefinitions() {
- parameterInArrayList.clear();
- parameterOutArrayList.clear();
- for (int i = 0; i < groups.length; i++) {
- groups[i] = null;
- }
- }
-
- public void removeGroup(Group group) {
- if (group == groups[group.hatchNo]) {
- removeGroup(group.hatchNo);
- } else {
- throw new IllegalArgumentException("Group does not exists in this parametrization!");
- }
- }
-
- public void removeGroup(int hatchNo) {
- Group hatch = groups[hatchNo];
- if (hatch != null) {
- for (Group.ParameterOut p : hatch.parameterOut) {
- parameterOutArrayList.remove(p);
- }
- for (Group.ParameterIn p : hatch.parameterIn) {
- parameterInArrayList.remove(p);
- }
- groups[hatchNo] = null;
- }
- }
-
public Group getGroup(int hatchNo, boolean updateWhileRunning) {
return groups[hatchNo] != null ? groups[hatchNo] : new Group(hatchNo, updateWhileRunning);
}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo
deleted file mode 100644
index a195157a17..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo
+++ /dev/null
@@ -1,38 +0,0 @@
-forcefields
-colorizer -> aka colorable 'bloodmoon' in a box HAARP, holograms?
-gravity wells/entity accelerators
-reverse expand ore processing by scanning ores XD
-quark laseration
-quantum color separator
-antimatter weaponry
-tesla coils...
-
-starter manual book?
-design reader station - singleblock
-
-quantum dislocator - to move GT tiles?
-
-GT infusion altar
-magic matter compounds
-
-Fucking regular multiblock container for EM... - hightier - with selection of what u want
-
-usefull for things like i am not really there blocks
-BlockFakeLight.java
-
-for turrets:
-floodlightb
-
-mega - projects
-
-
-
-fix eu/t checks if needs maintenance!!!
-
-make microwave grinder cap autosmelting based on power
-
-iterative halflife formula:
-
-=prev qty* 2^(-t diff / t half)
-
-actual ion cannons
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java
index febeafd754..aa49872b9a 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_WetTransformer.java
@@ -11,10 +11,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public class GT_MetaTileEntity_WetTransformer extends GT_MetaTileEntity_TT_Transformer {
- public GT_MetaTileEntity_WetTransformer(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier);
- }
-
public GT_MetaTileEntity_WetTransformer(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
diff --git a/src/main/java/com/github/technus/tectech/util/CommonValues.java b/src/main/java/com/github/technus/tectech/util/CommonValues.java
index 44f755d6b3..346fad64db 100644
--- a/src/main/java/com/github/technus/tectech/util/CommonValues.java
+++ b/src/main/java/com/github/technus/tectech/util/CommonValues.java
@@ -16,19 +16,12 @@ public final class CommonValues {
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 byte DECAY_AT = 0; // hatches compute decays
- public static final byte MULTI_PURGE_1_AT = 2; // multiblocks clean their hatches 1
public static final byte MOVE_AT = 4; // move stuff around
public static final byte RECIPE_AT = 6; // move stuff around
- public static final byte MULTI_PURGE_2_AT = 8; // multiblocks clean their hatches 2
- public static final byte OVERFLOW_AT = 10; // then hatches clean themselves
// - 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 DISPERSE_AT = 14; // overflow hatches perform disperse
public static final byte TRANSFER_AT = 16;
- public static final long[] AatV = new long[] { 268435455, 67108863, 16777215, 4194303, 1048575, 262143, 65535,
- 16383, 4095, 1023, 255, 63, 15, 3, 1, 1 };
public static final String[] VN = GT_Values.VN;
public static final long[] V = GT_Values.V;
diff --git a/src/main/java/com/github/technus/tectech/util/Converter.java b/src/main/java/com/github/technus/tectech/util/Converter.java
index 53ef4761ab..d0da11d405 100644
--- a/src/main/java/com/github/technus/tectech/util/Converter.java
+++ b/src/main/java/com/github/technus/tectech/util/Converter.java
@@ -10,35 +10,12 @@ public final class Converter {
private Converter() {}
- public static void writeInts(int[] array, ByteArrayOutputStream byteArrayOutputStream) {
- try {
- DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
- for (int i = 0; i < array.length; i++) {
- dataOutputStream.writeInt(array[i]);
- }
- dataOutputStream.flush();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static void readInts(ByteArrayInputStream byteArrayInputStream, int[] array) {
- try {
- DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream);
- for (int i = 0; i < array.length; i++) {
- array[i] = dataInputStream.readInt();
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
public static byte[] writeInts(int[] array) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream(array.length * 4);
DataOutputStream dos = new DataOutputStream(bos);
- for (int i = 0; i < array.length; i++) {
- dos.writeInt(array[i]);
+ for (int j : array) {
+ dos.writeInt(j);
}
return bos.toByteArray();
diff --git a/src/main/java/com/github/technus/tectech/util/TT_Utility.java b/src/main/java/com/github/technus/tectech/util/TT_Utility.java
index eeee29e269..ba87811364 100644
--- a/src/main/java/com/github/technus/tectech/util/TT_Utility.java
+++ b/src/main/java/com/github/technus/tectech/util/TT_Utility.java
@@ -1,48 +1,15 @@
package com.github.technus.tectech.util;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.lang.reflect.Array;
import java.lang.reflect.Field;
-import java.nio.charset.StandardCharsets;
import java.util.Formatter;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.function.Function;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
-import net.minecraft.inventory.Container;
-import net.minecraft.inventory.ICrafting;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraft.world.storage.IPlayerFileData;
-import net.minecraft.world.storage.SaveHandler;
-import net.minecraftforge.fluids.FluidStack;
-import org.apache.commons.lang3.StringUtils;
-
-import com.github.technus.tectech.TecTech;
-
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.registry.GameRegistry;
-import gregtech.api.GregTech_API;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Utility;
/**
* Created by Tec on 21.03.2017.
@@ -61,28 +28,10 @@ public final class TT_Utility {
locale -> new Formatter(STRING_BUILDER, locale));
}
- public static String formatNumberShortExp(double value) {
- return getFormatter().format("%.3E", value).toString();
- }
-
public static String formatNumberExp(double value) {
return getFormatter().format("%+.5E", value).toString();
}
- public static String formatNumberIntHex(int value) {
- return getFormatter().format("%08X", value).toString();
- }
-
- @SuppressWarnings("ComparatorMethodParameterNotUsed")
- public static <K, V extends Comparable<? super V>> SortedSet<Map.Entry<K, V>> entriesSortedByValues(Map<K, V> map) {
- SortedSet<Map.Entry<K, V>> sortedEntries = new TreeSet<>((e1, e2) -> {
- int res = e1.getValue().compareTo(e2.getValue());
- return res != 0 ? res : 1; // Special fix to preserve items with equal values
- });
- sortedEntries.addAll(map.entrySet());
- return sortedEntries;
- }
-
public static int bitStringToInt(String bits) {
if (bits == null) {
return 0;
@@ -110,86 +59,6 @@ public final class TT_Utility {
return Double.parseDouble(str);
}
- private static final String SUPER_SCRIPT = "\u207D\u207E*\u207A,\u207B./\u2070\u00B9\u00B2\u00B3\u2074\u2075\u2076\u2077\u2078\u2079:;<\u207C";
- private static final String SUB_SCRIPT = "\u208D\u208E*\u208A,\u208B./\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089:;<\u208C";
-
- public static String toSubscript(String s) {
- STRING_BUILDER.setLength(0);
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if (c >= '(' && c <= '=') {
- STRING_BUILDER.append(SUB_SCRIPT.charAt(c - '('));
- } else {
- STRING_BUILDER.append(c);
- }
- }
- return STRING_BUILDER.toString();
- }
-
- public static String toSuperscript(String s) {
- STRING_BUILDER.setLength(0);
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if (c >= '(' && c <= '=') {
- STRING_BUILDER.append(SUPER_SCRIPT.charAt(c - '('));
- } else {
- STRING_BUILDER.append(c);
- }
- }
- return STRING_BUILDER.toString();
- }
-
- public static double getValue(String in1) {
- String str = in1.toLowerCase();
- double val;
- try {
- if (str.contains("b")) {
- String[] split = str.split("b");
- val = TT_Utility.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", ""));
- } else if (str.contains("x")) {
- String[] split = str.split("x");
- val = TT_Utility.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", ""));
- } else {
- val = TT_Utility.stringToDouble(str);
- }
- return val;
- } catch (Exception e) {
- return 0;
- }
- }
-
- public static String intBitsToString(int number) {
- StringBuilder result = new StringBuilder(16);
-
- for (int i = 31; i >= 0; i--) {
- int mask = 1 << i;
- result.append((number & mask) != 0 ? "1" : "0");
-
- if (i % 8 == 0) {
- result.append(' ');
- }
- }
- result.replace(result.length() - 1, result.length(), "");
-
- return result.toString();
- }
-
- public static String intBitsToShortString(int number) {
- StringBuilder result = new StringBuilder(35);
-
- for (int i = 31; i >= 0; i--) {
- int mask = 1 << i;
- result.append((number & mask) != 0 ? ":" : ".");
-
- if (i % 8 == 0) {
- result.append('|');
- }
- }
- result.replace(result.length() - 1, result.length(), "");
-
- return result.toString();
- }
-
public static String longBitsToShortString(long number) {
StringBuilder result = new StringBuilder(71);
@@ -210,118 +79,6 @@ public final class TT_Utility {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
- public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes,
- FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs,
- ItemStack... givenInputs) {
- if (!GregTech_API.sPostloadFinished) {
- return false;
- }
- if (requiredFluidInputs.length > 0 && givenFluidInputs == null) {
- return false;
- }
- int amt;
- for (FluidStack tFluid : requiredFluidInputs) {
- if (tFluid != null) {
- boolean temp = true;
- amt = tFluid.amount;
- for (FluidStack aFluid : givenFluidInputs) {
- if (aFluid != null && aFluid.isFluidEqual(tFluid)) {
- if (aDontCheckStackSizes) {
- temp = false;
- break;
- }
- amt -= aFluid.amount;
- if (amt < 1) {
- temp = false;
- break;
- }
- }
- }
- if (temp) {
- return false;
- }
- }
- }
-
- if (requiredInputs.length > 0 && givenInputs == null) {
- return false;
- }
- for (ItemStack tStack : requiredInputs) {
- if (tStack != null) {
- amt = tStack.stackSize;
- boolean temp = true;
- for (ItemStack aStack : givenInputs) {
- if (GT_Utility.areUnificationsEqual(aStack, tStack, true)
- || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) {
- if (aDontCheckStackSizes) {
- temp = false;
- break;
- }
- amt -= aStack.stackSize;
- if (amt < 1) {
- temp = false;
- break;
- }
- }
- }
- if (temp) {
- return false;
- }
- }
- }
-
- if (aDecreaseStacksizeBySuccess) {
- if (givenFluidInputs != null) {
- for (FluidStack tFluid : requiredFluidInputs) {
- if (tFluid != null) {
- amt = tFluid.amount;
- for (FluidStack aFluid : givenFluidInputs) {
- if (aFluid != null && aFluid.isFluidEqual(tFluid)) {
- if (aDontCheckStackSizes) {
- aFluid.amount -= amt;
- break;
- }
- if (aFluid.amount < amt) {
- amt -= aFluid.amount;
- aFluid.amount = 0;
- } else {
- aFluid.amount -= amt;
- break;
- }
- }
- }
- }
- }
- }
-
- if (givenInputs != null) {
- for (ItemStack tStack : requiredInputs) {
- if (tStack != null) {
- amt = tStack.stackSize;
- for (ItemStack aStack : givenInputs) {
- if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility
- .areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) {
- if (aDontCheckStackSizes) {
- aStack.stackSize -= amt;
- break;
- }
- if (aStack.stackSize < amt) {
- amt -= aStack.stackSize;
- aStack.stackSize = 0;
- } else {
- aStack.stackSize -= amt;
- break;
- }
- }
- }
- }
- }
- }
- }
-
- return true;
- }
-
public static String getUniqueIdentifier(ItemStack is) {
return GameRegistry.findUniqueIdentifierFor(is.getItem()).modId + ':' + is.getUnlocalizedName();
}
@@ -339,123 +96,6 @@ public final class TT_Utility {
return b;
}
- public static String[] splitButDifferent(String string, String delimiter) {
- String[] strings = new String[StringUtils.countMatches(string, delimiter) + 1];
- int lastEnd = 0;
- for (int i = 0; i < strings.length - 1; i++) {
- int nextEnd = string.indexOf(delimiter, lastEnd);
- strings[i] = string.substring(lastEnd, nextEnd);
- lastEnd = nextEnd + delimiter.length();
- }
- strings[strings.length - 1] = string.substring(lastEnd);
- return strings;
- }
-
- public static String[] unpackStrings(NBTTagCompound nbt) {
- String[] strings = new String[nbt.getInteger("i")];
- for (int i = 0; i < strings.length; i++) {
- strings[i] = nbt.getString(Integer.toString(i));
- }
- return strings;
- }
-
- public static String getSomeString(NBTTagCompound nbt, int index) {
- return nbt.getString(Integer.toString(index % nbt.getInteger("i")));
- }
-
- public static NBTTagCompound packStrings(String... info) {
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.setInteger("i", info.length);
- for (int i = 0; i < info.length; i++) {
- nbt.setString(Integer.toString(i), info[i]);
- }
- return nbt;
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T[] unpackNBT(Class<T> tClass, Function<NBTTagCompound, T> converter, NBTTagCompound nbt) {
- T[] objects = (T[]) Array.newInstance(tClass, nbt.getInteger("i"));
- for (int i = 0; i < objects.length; i++) {
- objects[i] = converter.apply(nbt.getCompoundTag(Integer.toString(i)));
- }
- return objects;
- }
-
- @SafeVarargs
- public static <T> NBTTagCompound packNBT(Function<T, NBTTagCompound> converter, T... info) {
- NBTTagCompound nbt = new NBTTagCompound();
- nbt.setInteger("i", info.length);
- for (int i = 0; i < info.length; i++) {
- nbt.setTag(Integer.toString(i), converter.apply(info[i]));
- }
- return nbt;
- }
-
- public static boolean areBitsSet(int setBits, int testedValue) {
- return (testedValue & setBits) == setBits;
- }
-
- public static class ItemStack_NoNBT implements Comparable<ItemStack_NoNBT> {
-
- public final Item mItem;
- public final int mStackSize;
- public final int mMetaData;
-
- public ItemStack_NoNBT(Item aItem, long aStackSize, long aMetaData) {
- this.mItem = aItem;
- this.mStackSize = (byte) ((int) aStackSize);
- this.mMetaData = (short) ((int) aMetaData);
- }
-
- public ItemStack_NoNBT(ItemStack aStack) {
- if (aStack == null) {
- mItem = null;
- mStackSize = mMetaData = 0;
- } else {
- mItem = aStack.getItem();
- mStackSize = aStack.stackSize;
- mMetaData = Items.feather.getDamage(aStack);
- }
- }
-
- @Override
- public int compareTo(ItemStack_NoNBT o) {
- if (mMetaData > o.mMetaData) return 1;
- if (mMetaData < o.mMetaData) return -1;
- if (mStackSize > o.mStackSize) return 1;
- if (mStackSize < o.mStackSize) return -1;
- if (mItem != null && o.mItem != null)
- return mItem.getUnlocalizedName().compareTo(o.mItem.getUnlocalizedName());
- if (mItem == null && o.mItem == null) return 0;
- if (mItem != null) return 1;
- return -1;
- }
-
- @Override
- public boolean equals(Object aStack) {
- return aStack == this || (aStack instanceof ItemStack_NoNBT
- && ((mItem == ((ItemStack_NoNBT) aStack).mItem) || ((ItemStack_NoNBT) aStack).mItem
- .getUnlocalizedName().equals(this.mItem.getUnlocalizedName()))
- && ((ItemStack_NoNBT) aStack).mStackSize == this.mStackSize
- && ((ItemStack_NoNBT) aStack).mMetaData == this.mMetaData);
- }
-
- @Override
- public int hashCode() {
- return (mItem != null ? mItem.getUnlocalizedName().hashCode() : 0) ^ (mMetaData << 16) ^ (mStackSize << 24);
- }
-
- @Override
- public String toString() {
- return Integer.toString(hashCode()) + ' '
- + (mItem == null ? "null" : mItem.getUnlocalizedName())
- + ' '
- + mMetaData
- + ' '
- + mStackSize;
- }
- }
-
public static void setTier(int tier, Object me) {
try {
Field field = GT_MetaTileEntity_TieredMachineBlock.class.getField("mTier");
@@ -466,17 +106,6 @@ public final class TT_Utility {
}
}
- public static StringBuilder receiveString(StringBuilder previousValue, int startIndex, int index, int value) {
- int sizeReq = index - startIndex;
- if (value == 0) {
- previousValue.setLength(Math.min(previousValue.length(), sizeReq));
- } else {
- previousValue.setLength(Math.max(previousValue.length(), sizeReq));
- previousValue.setCharAt(sizeReq, (char) value);
- }
- return previousValue;
- }
-
@Deprecated
public static double receiveDouble(double previousValue, int startIndex, int index, int value) {
return Double.longBitsToDouble(receiveLong(Double.doubleToLongBits(previousValue), startIndex, index, value));
@@ -485,44 +114,26 @@ public final class TT_Utility {
public static long receiveLong(long previousValue, int startIndex, int index, int value) {
value &= 0xFFFF;
switch (index - startIndex) {
- case 0:
+ case 0 -> {
previousValue &= 0xFFFF_FFFF_FFFF_0000L;
previousValue |= value;
- break;
- case 1:
+ }
+ case 1 -> {
previousValue &= 0xFFFF_FFFF_0000_FFFFL;
previousValue |= (long) value << 16;
- break;
- case 2:
+ }
+ case 2 -> {
previousValue &= 0xFFFF_0000_FFFF_FFFFL;
previousValue |= (long) value << 32;
- break;
- case 3:
+ }
+ case 3 -> {
previousValue &= 0x0000_FFFF_FFFF_FFFFL;
previousValue |= (long) value << 48;
- break;
+ }
}
return previousValue;
}
- public static void sendString(StringBuilder string, Container container, ICrafting crafter, int startIndex) {
- for (int i = 0; i < string.length(); i++) {
- crafter.sendProgressBarUpdate(container, startIndex++, string.charAt(i));
- }
- crafter.sendProgressBarUpdate(container, startIndex, 0);
- }
-
- public static void sendDouble(double value, Container container, ICrafting crafter, int startIndex) {
- sendLong(Double.doubleToLongBits(value), container, crafter, startIndex);
- }
-
- public static void sendLong(long value, Container container, ICrafting crafter, int startIndex) {
- crafter.sendProgressBarUpdate(container, startIndex++, (int) (value & 0xFFFFL));
- crafter.sendProgressBarUpdate(container, startIndex++, (int) ((value & 0xFFFF0000L) >>> 16));
- crafter.sendProgressBarUpdate(container, startIndex++, (int) ((value & 0xFFFF00000000L) >>> 32));
- crafter.sendProgressBarUpdate(container, startIndex, (int) ((value & 0xFFFF000000000000L) >>> 48));
- }
-
@Deprecated
public static float receiveFloat(float previousValue, int startIndex, int index, int value) {
return Float.intBitsToFloat(receiveInteger(Float.floatToIntBits(previousValue), startIndex, index, value));
@@ -531,27 +142,18 @@ public final class TT_Utility {
public static int receiveInteger(int previousValue, int startIndex, int index, int value) {
value &= 0xFFFF;
switch (index - startIndex) {
- case 0:
+ case 0 -> {
previousValue &= 0xFFFF_0000;
previousValue |= value;
- break;
- case 1:
+ }
+ case 1 -> {
previousValue &= 0x0000_FFFF;
previousValue |= value << 16;
- break;
+ }
}
return previousValue;
}
- public static void sendFloat(float value, Container container, ICrafting crafter, int startIndex) {
- sendInteger(Float.floatToIntBits(value), container, crafter, startIndex);
- }
-
- public static void sendInteger(int value, Container container, ICrafting crafter, int startIndex) {
- crafter.sendProgressBarUpdate(container, startIndex++, (int) (value & 0xFFFFL));
- crafter.sendProgressBarUpdate(container, startIndex, (value & 0xFFFF0000) >>> 16);
- }
-
public static String doubleToString(double value) {
if (value == (long) value) {
return Long.toString((long) value);
@@ -559,145 +161,4 @@ public final class TT_Utility {
return Double.toString(value);
}
- public static boolean checkChunkExist(World world, ChunkCoordIntPair chunk) {
- int x = chunk.getCenterXPos();
- int z = chunk.getCenterZPosition();
- return world.checkChunksExist(x, 0, z, x, 0, z);
- }
-
- public static NBTTagCompound getPlayerData(UUID uuid1, UUID uuid2, String extension) {
- try {
- if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
- if (uuid1 != null && uuid2 != null) {
- IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0)
- .getSaveHandler().getSaveHandler();
- SaveHandler sh = (SaveHandler) playerNBTManagerObj;
- File dir = ObfuscationReflectionHelper.getPrivateValue(
- SaveHandler.class,
- sh,
- new String[] { "playersDirectory", "field_75771_c" });
- String id1 = uuid1.toString();
- NBTTagCompound tagCompound = read(new File(dir, id1 + "." + extension));
- if (tagCompound != null) {
- return tagCompound;
- }
- tagCompound = readBackup(new File(dir, id1 + "." + extension + "_bak"));
- if (tagCompound != null) {
- return tagCompound;
- }
- String id2 = uuid2.toString();
- tagCompound = read(new File(dir, id2 + "." + extension));
- if (tagCompound != null) {
- return tagCompound;
- }
- tagCompound = readBackup(new File(dir, id2 + "." + extension + "_bak"));
- if (tagCompound != null) {
- return tagCompound;
- }
- }
- }
- } catch (Exception ignored) {}
- return new NBTTagCompound();
- }
-
- public static void savePlayerFile(EntityPlayer player, String extension, NBTTagCompound data) {
- try {
- if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
- if (player != null) {
- IPlayerFileData playerNBTManagerObj = MinecraftServer.getServer().worldServerForDimension(0)
- .getSaveHandler().getSaveHandler();
- SaveHandler sh = (SaveHandler) playerNBTManagerObj;
- File dir = ObfuscationReflectionHelper.getPrivateValue(
- SaveHandler.class,
- sh,
- new String[] { "playersDirectory", "field_75771_c" });
- String id1 = player.getUniqueID().toString();
- write(new File(dir, id1 + "." + extension), data);
- write(new File(dir, id1 + "." + extension + "_bak"), data);
- String id2 = UUID.nameUUIDFromBytes(player.getCommandSenderName().getBytes(StandardCharsets.UTF_8))
- .toString();
- write(new File(dir, id2 + "." + extension), data);
- write(new File(dir, id2 + "." + extension + "_bak"), data);
- }
- }
- } catch (Exception ignored) {}
- }
-
- private static NBTTagCompound read(File file) {
- if (file != null && file.exists()) {
- try (FileInputStream fileInputStream = new FileInputStream(file)) {
- return CompressedStreamTools.readCompressed(fileInputStream);
- } catch (Exception var9) {
- TecTech.LOGGER.error("Cannot read NBT File: " + file.getAbsolutePath());
- }
- }
- return null;
- }
-
- private static NBTTagCompound readBackup(File file) {
- if (file != null && file.exists()) {
- try (FileInputStream fileInputStream = new FileInputStream(file)) {
- return CompressedStreamTools.readCompressed(fileInputStream);
- } catch (Exception var9) {
- TecTech.LOGGER.error("Cannot read NBT File: " + file.getAbsolutePath());
- return new NBTTagCompound();
- }
- }
- return null;
- }
-
- private static void write(File file, NBTTagCompound tagCompound) {
- if (file != null) {
- if (tagCompound == null) {
- if (file.exists()) file.delete();
- } else {
- try (FileOutputStream fileOutputStream = new FileOutputStream(file)) {
- CompressedStreamTools.writeCompressed(tagCompound, fileOutputStream);
- } catch (Exception var9) {
- TecTech.LOGGER.error("Cannot write NBT File: " + file.getAbsolutePath());
- }
- }
- }
- }
-
- public static AxisAlignedBB fromChunkCoordIntPair(ChunkCoordIntPair chunkCoordIntPair) {
- int x = chunkCoordIntPair.chunkXPos << 4;
- int z = chunkCoordIntPair.chunkZPos << 4;
- return AxisAlignedBB.getBoundingBox(x, -128, z, x + 16, 512, z + 16);
- }
-
- public static AxisAlignedBB fromChunk(Chunk chunk) {
- int x = chunk.xPosition << 4;
- int z = chunk.zPosition << 4;
- return AxisAlignedBB.getBoundingBox(x, -128, z, x + 16, 512, z + 16);
- }
-
- public static String getConcated(String[] strings, String separator) {
- StringBuilder stringBuilder = new StringBuilder();
- for (String string : strings) {
- stringBuilder.append(string).append(separator);
- }
- int length = stringBuilder.length();
- if (length >= separator.length()) {
- stringBuilder.setLength(length - separator.length());
- }
- return stringBuilder.toString();
- }
-
- public static double getMagnitude3D(double[] in) {
- return Math.sqrt(in[0] * in[0] + in[1] * in[1] + in[2] * in[2]);
- }
-
- public static void normalize3D(double[] in, double[] out) {
- double mag = getMagnitude3D(in);
- out[0] = in[0] / mag;
- out[1] = in[1] / mag;
- out[2] = in[2] / mag;
- }
-
- public static void crossProduct3D(double[] inA, double[] inB, double[] out) {
- out[0] = inA[1] * inB[2] - inA[2] * inB[1];
- out[1] = inA[2] * inB[0] - inA[0] * inB[2];
- out[2] = inA[0] * inB[1] - inA[1] * inB[0];
- }
}