aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/thing
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/tectech/thing')
-rw-r--r--src/main/java/tectech/thing/block/RenderForgeOfGods.java421
-rw-r--r--src/main/java/tectech/thing/block/TileEntityForgeOfGods.java176
-rw-r--r--src/main/java/tectech/thing/gui/TecTechUITextures.java28
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java464
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java16
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java332
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java101
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java21
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java16
9 files changed, 1293 insertions, 282 deletions
diff --git a/src/main/java/tectech/thing/block/RenderForgeOfGods.java b/src/main/java/tectech/thing/block/RenderForgeOfGods.java
index 976dd6da8e..04c46155c0 100644
--- a/src/main/java/tectech/thing/block/RenderForgeOfGods.java
+++ b/src/main/java/tectech/thing/block/RenderForgeOfGods.java
@@ -1,52 +1,427 @@
package tectech.thing.block;
-import static tectech.Reference.MODID;
-import static tectech.rendering.EOH.EOHRenderingUtils.renderStarLayer;
import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_0;
import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_1;
import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_2;
+import static tectech.thing.casing.TTCasingsContainer.GodforgeCasings;
-import java.awt.Color;
+import java.nio.FloatBuffer;
+import net.minecraft.client.renderer.ActiveRenderInfo;
+import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
+import org.joml.Matrix4fStack;
+import org.joml.Vector3f;
+import org.joml.Vector4f;
+import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL13;
+import org.lwjgl.opengl.GL15;
+import org.lwjgl.opengl.GL20;
+
+import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram;
+import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
+
+import tectech.Reference;
+import tectech.thing.metaTileEntity.multi.ForgeOfGodsRingsStructureString;
+import tectech.thing.metaTileEntity.multi.ForgeOfGodsStructureString;
+import tectech.util.StructureVBO;
+import tectech.util.TextureUpdateRequester;
public class RenderForgeOfGods extends TileEntitySpecialRenderer {
- public static IModelCustom starModel;
+ private static ShaderProgram starProgram;
+ private static IModelCustom starModel;
+ private static float modelNormalize = .0067f * 2;
+
+ private static boolean initialized = false;
+ private static int u_Color = -1, u_ModelMatrix = -1, u_Gamma = -1;
+ private Matrix4fStack starModelMatrix = new Matrix4fStack(3);
+
+ private static ShaderProgram beamProgram;
+ private static int a_VertexID = -1;
+ private static int u_BeamModelMatrix = -1;
+ private static int u_CameraPosition = -1, u_SegmentArray = -1, u_SegmentQuads = -1;
+ private static int u_BeamIntensity = -1, u_BeamColor = -1, u_BeamTime = -1;
+ private static int beam_vboID = -1;
+ private static int maxSegments = -1;
+ private static final int beamSegmentQuads = 16;
+ private static Matrix4fStack beamModelMatrix = new Matrix4fStack(2);
+
+ private VertexBuffer ringOne, ringTwo, ringThree;
+ // These are nudges/translations for each ring to align with the structure
+ private static final Vector3f ringOneNudge = new Vector3f(0, -1, 0);
+ private static final Vector3f ringTwoNudge = new Vector3f(0, -1, 0);
+ private static final Vector3f ringThreeNudge = new Vector3f(.5f, -1, 0);
+
+ private static ShaderProgram fadeBypassProgram;
+ private static TextureUpdateRequester textureUpdater;
+
+ private void init() {
+ try {
+ starProgram = new ShaderProgram(Reference.MODID, "shaders/star.vert.glsl", "shaders/star.frag.glsl");
+
+ u_Color = starProgram.getUniformLocation("u_Color");
+ u_Gamma = starProgram.getUniformLocation("u_Gamma");
+ u_ModelMatrix = starProgram.getUniformLocation("u_ModelMatrix");
+
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ return;
+ }
+
+ starModel = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.MODID, "models/Star.obj"));
+
+ try {
+ beamProgram = new ShaderProgram(
+ Reference.MODID,
+ "shaders/gorgeBeam.vert.glsl",
+ "shaders/gorgeBeam.frag.glsl");
- public RenderForgeOfGods() {
- starModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj"));
+ u_BeamModelMatrix = beamProgram.getUniformLocation("u_ModelMatrix");
+ u_CameraPosition = beamProgram.getUniformLocation("u_CameraPosition");
+ u_SegmentQuads = beamProgram.getUniformLocation("u_SegmentQuads");
+ u_SegmentArray = beamProgram.getUniformLocation("u_SegmentArray");
+ u_BeamColor = beamProgram.getUniformLocation("u_Color");
+ u_BeamIntensity = beamProgram.getUniformLocation("u_Intensity");
+ u_BeamTime = beamProgram.getUniformLocation("u_Time");
+
+ a_VertexID = beamProgram.getAttribLocation("a_VertexID");
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ return;
+ }
+
+ beamProgram.use();
+ GL20.glUniform1f(u_SegmentQuads, (float) beamSegmentQuads);
+ maxSegments = 10;// GL20.glGetActiveUniformSize(beamProgram.getProgram(), u_SegmentArray);
+
+ FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * beamSegmentQuads * 6 * 3);
+
+ for (int i = 0; i < maxSegments; i++) {
+ for (int j = 0; j < beamSegmentQuads; j++) {
+ for (int v = 0; v < 6; v++) {
+ int segID = i * beamSegmentQuads * 6;
+ int quadID = j * 6;
+ int vertID = segID + quadID + v;
+ buffer.put(vertID);
+ buffer.put(0);
+ buffer.put(0);
+ }
+ }
+ }
+
+ buffer.flip();
+ beam_vboID = GL15.glGenBuffers();
+ GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, beam_vboID);
+ GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
+ GL20.glVertexAttribPointer(a_VertexID, 1, GL11.GL_FLOAT, false, 3 * Float.BYTES, 0);
+ GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
+
+ GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
+ ShaderProgram.clear();
+ initialized = true;
}
- @Override
- public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
- if (!(tile instanceof TileEntityForgeOfGods)) return;
+ private void initRings() {
+ StructureVBO ringStructure = (new StructureVBO()).addMapping('H', BlockGodforgeGlass.INSTANCE, 0)
+ .addMapping('B', GodforgeCasings, 0)
+ .addMapping('C', GodforgeCasings, 1)
+ .addMapping('D', GodforgeCasings, 2)
+ .addMapping('E', GodforgeCasings, 3)
+ .addMapping('G', GodforgeCasings, 5)
+ .addMapping('K', GodforgeCasings, 6)
+ .addMapping('I', GodforgeCasings, 7);
- {
- GL11.glPushMatrix();
- GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
- GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
- GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glDisable(GL11.GL_BLEND);
+ ringOne = ringStructure.assignStructure(ForgeOfGodsStructureString.FIRST_RING)
+ .build();
+ ringTwo = ringStructure.assignStructure(ForgeOfGodsRingsStructureString.SECOND_RING)
+ .build();
+ ringThree = ringStructure.assignStructure(ForgeOfGodsRingsStructureString.THIRD_RING)
+ .build();
- // Innermost layer should be opaque
- enableOpaqueColorInversion();
- renderStarLayer(0, STAR_LAYER_0, new Color(1.0f, 0.4f, 0.05f, 1.0f), 1.0f, 25);
- disableOpaqueColorInversion();
+ fadeBypassProgram = new ShaderProgram(
+ Reference.MODID,
+ "shaders/fadebypass.vert.glsl",
+ "shaders/fadebypass.frag.glsl");
- enablePseudoTransparentColorInversion();
- renderStarLayer(1, STAR_LAYER_1, new Color(1.0f, 0.4f, 0.05f, 1.0f), 0.4f, 25);
- renderStarLayer(2, STAR_LAYER_2, new Color(1.0f, 0.4f, 0.05f, 1.0f), 0.2f, 25);
+ textureUpdater = ringStructure.getTextureUpdateRequestor();
+ }
+
+ public void RenderStarLayer(Vector4f color, ResourceLocation texture, float size, Vector3f rotationAxis,
+ float degrees) {
+ starModelMatrix.pushMatrix();
+ starModelMatrix.rotate((degrees / 180f * ((float) Math.PI)), rotationAxis.x, rotationAxis.y, rotationAxis.z);
+ starModelMatrix.scale(size, size, size);
+
+ this.bindTexture(texture);
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+
+ // Enable transparency if needed
+ if (color.w < 1 && color.w > 0) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(false); // Disable depth writing for transparency
+ }
+
+ FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16);
+ GL20.glUniformMatrix4(u_ModelMatrix, false, starModelMatrix.get(matrixBuffer));
+ GL20.glUniform4f(u_Color, color.x, color.y, color.z, color.w);
+ starModel.renderAll();
+ GL11.glPopAttrib();
+ starModelMatrix.popMatrix();
+ }
+
+ public void RenderEntireStar(TileEntityForgeOfGods tile, double x, double y, double z, float timer) {
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL13.glActiveTexture(GL13.GL_TEXTURE0);
+ GL11.glDisable(GL11.GL_LIGHTING);
+
+ starProgram.use();
+
+ float cx = (float) x + .5f;
+ float cy = (float) y + .5f;
+ float cz = (float) z + .5f;
+ float size = modelNormalize;
+ starModelMatrix.clear();
+ starModelMatrix.translate(cx, cy, cz);
+
+ size *= tile.getStarRadius();
- GL11.glPopAttrib();
+ timer *= tile.getRotationSpeed();
+
+ float r = tile.getColorR(), g = tile.getColorG(), b = tile.getColorB();
+ GL20.glUniform1f(u_Gamma, tile.getGamma());
+ RenderStarLayer(
+ new Vector4f(r, g, b, 1f),
+ STAR_LAYER_0,
+ size,
+ new Vector3f(0F, 1F, 1).normalize(),
+ 130 + (timer) % 360000);
+ RenderStarLayer(
+ new Vector4f(r, g, b, 0.4f),
+ STAR_LAYER_1,
+ size * 1.02f,
+ new Vector3f(1F, 1F, 0F).normalize(),
+ -49 + (timer) % 360000);
+ RenderStarLayer(
+ new Vector4f(r, g, b, 0.2f),
+ STAR_LAYER_2,
+ size * 1.04f,
+ new Vector3f(1F, 0F, 1F).normalize(),
+ 67 + (timer) % 360000);
+
+ ShaderProgram.clear();
+ GL11.glPopAttrib();
+ }
+
+ public void bufferSoftBeam(TileEntityForgeOfGods tile) {
+ FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * 3);
+
+ float angle = tile.getStartAngle();
+ float radius = tile.getStarRadius() * 1.1f;
+ float startx = -radius * ((float) Math.cos(angle));
+ float starty = radius * ((float) Math.sin(angle));
+
+ buffer.put(starty);
+ buffer.put(startx);
+ buffer.put(0);
+
+ for (int i = tile.getRingCount() - 1; i >= 0; i--) {
+ buffer.put(tile.getLenRadius(i));
+ buffer.put(tile.getLensDistance(i));
+ buffer.put(1f);
+ }
+
+ buffer.put(TileEntityForgeOfGods.BACK_PLATE_RADIUS);
+ buffer.put(TileEntityForgeOfGods.BACK_PLATE_DISTANCE);
+ buffer.put(-.05f);
+
+ buffer.rewind();
+ GL20.glUniform3(u_SegmentArray, buffer);
+ }
+
+ public void bufferIntenseBeam(TileEntityForgeOfGods tile) {
+ FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * 3);
+ float angle = tile.getStartAngle();
+ float radius = tile.getStarRadius() * 1.05f;
+ float startx = -radius * ((float) Math.cos(angle));
+ float starty = radius * ((float) Math.sin(angle));
+
+ // first lens means the one closest to the star
+ int firstLens = tile.getRingCount() - 1;
+
+ float nextx = tile.getLensDistance(firstLens);
+ float nexty = tile.getLenRadius(firstLens) * .75f;
+
+ float backx = Math.max(-radius, (nextx + radius) / 2);
+ float backy = TileEntityForgeOfGods.interpolate(startx, nextx, starty, nexty, backx);
+
+ buffer.put(backy);
+ buffer.put(backx);
+ buffer.put(0);
+
+ float transparency = .2f;
+ for (int i = tile.getRingCount() - 1; i >= 0; i--) {
+ buffer.put(tile.getLenRadius(i) / 2);
+ buffer.put(tile.getLensDistance(i));
+ buffer.put(transparency);
+ transparency += .3f;
+ }
+
+ float currx = tile.getLensDistance(0);
+ float curry = tile.getLenRadius(0) / 2;
+ float lastx = TileEntityForgeOfGods.BACK_PLATE_DISTANCE;
+ float lasty = Math.min(tile.getLenRadius(firstLens), TileEntityForgeOfGods.BACK_PLATE_RADIUS);
+
+ float midx = lastx + 8f;
+ float midy = TileEntityForgeOfGods.interpolate(currx, lastx, curry, lasty, midx);
+
+ buffer.put(midy);
+ buffer.put(midx);
+ buffer.put(transparency);
+
+ buffer.put(lasty);
+ buffer.put(lastx);
+ buffer.put(0f);
+
+ buffer.rewind();
+ GL20.glUniform3(u_SegmentArray, buffer);
+ // return buffer;
+ }
+
+ public void RenderBeamSegment(TileEntityForgeOfGods tile, double x, double y, double z, float timer) {
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ // GL11.glDisable(GL11.GL_TEXTURE_2D);
+ // GL11.glDisable(GL11.GL_CULL_FACE);
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL13.glActiveTexture(GL13.GL_TEXTURE0);
+ this.bindTexture(new ResourceLocation(Reference.MODID, "models/spaceLayer.png"));
+
+ float cx = (float) x + .5f;
+ float cy = (float) y + .5f;
+ float cz = (float) z + .5f;
+ beamModelMatrix.clear();
+ beamModelMatrix.translate(cx, cy, cz);
+
+ beamModelMatrix.rotate(
+ tile.getRotAngle() / 180 * ((float) Math.PI),
+ tile.getRotAxisX(),
+ tile.getRotAxisY(),
+ tile.getRotAxisZ());
+ beamModelMatrix.rotate((float) Math.PI / 2f, 0, 1, 0);
+
+ beamProgram.use();
+
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(false); // Disable depth writing for transparency
+
+ bufferSoftBeam(tile);
+
+ FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16);
+ GL20.glUniformMatrix4(u_BeamModelMatrix, false, beamModelMatrix.get(matrixBuffer));
+
+ beamModelMatrix.invert();
+
+ Vector4f cameraPosition = new Vector4f(
+ ActiveRenderInfo.objectX,
+ ActiveRenderInfo.objectY,
+ ActiveRenderInfo.objectZ,
+ 1);
+ cameraPosition = beamModelMatrix.transform(cameraPosition);
+ GL20.glUniform3f(u_CameraPosition, cameraPosition.x, cameraPosition.y, cameraPosition.z);
+ GL20.glUniform3f(u_BeamColor, tile.getColorR(), tile.getColorG(), tile.getColorB());
+ GL20.glUniform1f(u_BeamIntensity, 2);
+ GL20.glUniform1f(u_BeamTime, timer);
+
+ GL20.glEnableVertexAttribArray(a_VertexID);
+ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
+
+ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, maxSegments * beamSegmentQuads * 6);
+
+ GL20.glUniform3f(u_BeamColor, 1, 1, 1);
+ GL20.glUniform1f(u_BeamIntensity, 4);
+ bufferIntenseBeam(tile);
+ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, maxSegments * beamSegmentQuads * 6);
+
+ GL20.glDisableVertexAttribArray(a_VertexID);
+ GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
+
+ GL11.glPopAttrib();
+ ShaderProgram.clear();
+ }
+
+ private void RenderRings(TileEntityForgeOfGods tile, double x, double y, double z, float timer) {
+ bindTexture(TextureMap.locationBlocksTexture);
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ textureUpdater.requestUpdate();
+ fadeBypassProgram.use();
+
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + .5f, y + .5f, z + .5f);
+ GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ());
+ GL11.glRotatef(timer / 6 * 7, 1, 0, 0);
+ GL11.glTranslated(ringOneNudge.x, ringOneNudge.y, ringOneNudge.z);
+
+ ringOne.render();
+ GL11.glPopMatrix();
+ if (tile.getRingCount() > 1) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + .5f, y + .5f, z + .5f);
+ GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ());
+ GL11.glRotatef(-timer / 4 * 5, 1, 0, 0);
+ GL11.glTranslated(ringTwoNudge.x, ringTwoNudge.y, ringTwoNudge.z);
+ ringTwo.render();
GL11.glPopMatrix();
+
+ if (tile.getRingCount() > 2) {
+ GL11.glPushMatrix();
+ GL11.glTranslated(x + .5f, y + .5f, z + .5f);
+ GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ());
+ GL11.glRotatef(timer * 3, 1, 0, 0);
+ GL11.glTranslated(ringThreeNudge.x, ringThreeNudge.y, ringThreeNudge.z);
+ ringThree.render();
+ GL11.glPopMatrix();
+ }
}
+ ShaderProgram.clear();
+ GL11.glPopAttrib();
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
+ if (!(tile instanceof TileEntityForgeOfGods forgeTile)) return;
+ if (forgeTile.getRingCount() < 1) return;
+
+ if (!initialized) {
+ init();
+ initRings();
+ if (!initialized) return;
+ }
+
+ // Based on system time to prevent tps issues from causing stutters
+ // Need to look into different timing system to prevent stutters based on tps issues
+ // But prevent bypassing the pause menu
+ long millis = System.currentTimeMillis() % (1000 * 36000);
+ float timer = millis / (50f); // to ticks
+
+ RenderEntireStar(forgeTile, x, y, z, timer);
+ RenderRings(forgeTile, x, y, z, timer);
+
+ RenderBeamSegment(forgeTile, x, y, z, timer);
+
}
public static void enablePseudoTransparentColorInversion() {
diff --git a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java
index 7c671b8a31..dfe4bab143 100644
--- a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java
+++ b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java
@@ -6,11 +6,32 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation;
public class TileEntityForgeOfGods extends TileEntity {
- private float size = 10;
+ private float radius = 32;
private float rotationSpeed = 10;
+ private int ringCount = 1;
+ private float colorR = .7f, colorG = .8f, colorB = 1f, gamma = 3f;
+ private float rotAngle = 0, rotAxisX = 1, rotAxisY = 0, rotAxisZ = 0;
+
+ private static final String NBT_TAG = "FOG:";
+ private static final String ROTATION_SPEED_NBT_TAG = NBT_TAG + "ROTATION";
+ private static final String SIZE_NBT_TAG = NBT_TAG + "RADIUS";
+ private static final String RINGS_NBT_TAG = NBT_TAG + "RINGS";
+ private static final String COLOR_RED_NBT_TAG = NBT_TAG + "COLOR_RED";
+ private static final String COLOR_GREEN_NBT_TAG = NBT_TAG + "COLOR_GREEN";
+ private static final String COLOR_BLUE_NBT_TAG = NBT_TAG + "COLOR_BLUE";
+ private static final String COLOR_GAMMA_NBT_TAG = NBT_TAG + "COLOR_GAMMA";
+ private static final String ROT_ANGLE_NBT_TAG = NBT_TAG + "ROT_ANGLE";
+ private static final String ROT_AXIS_X_NBT_TAG = NBT_TAG + "ROT_AXIS_X";
+ private static final String ROT_AXIS_Y_NBT_TAG = NBT_TAG + "ROT_AXIS_Y";
+ private static final String ROT_AXIS_Z_NBT_TAG = NBT_TAG + "ROT_AXIS_Z";
+
+ public static final float BACK_PLATE_DISTANCE = -121.5f, BACK_PLATE_RADIUS = 13f;
@Override
public AxisAlignedBB getRenderBoundingBox() {
@@ -19,53 +40,156 @@ public class TileEntityForgeOfGods extends TileEntity {
@Override
public double getMaxRenderDistanceSquared() {
- return 25600;
+ return 51200;
}
- public void setRenderSize(float size) {
- this.size = size;
+ public void setStarRadius(float size) {
+ this.radius = size;
}
- public void setRenderRotationSpeed(float rotationSpeed) {
- this.rotationSpeed = rotationSpeed;
+ public float getStarRadius() {
+ return radius;
}
- public float getRenderSize() {
- return size;
+ public float getRotationSpeed() {
+ return rotationSpeed;
}
- public float getRenderRotationSpeed() {
- return rotationSpeed;
+ public void setRotationSpeed(float speed) {
+ this.rotationSpeed = speed;
}
- @Override
- public void updateEntity() {
- angle += 10.0f;
+ public float getColorR() {
+ return colorR;
+ }
+
+ public float getColorG() {
+ return colorG;
+ }
+
+ public float getColorB() {
+ return colorB;
+ }
+
+ public float getGamma() {
+ return gamma;
+ }
+
+ public void setColor(float r, float g, float b) {
+ setColor(r, g, b, 1);
+ }
+
+ public void setColor(float r, float g, float b, float gamma) {
+ colorR = r;
+ colorG = g;
+ colorB = b;
+ this.gamma = gamma;
+ }
+
+ public int getRingCount() {
+ return ringCount;
+ }
+
+ public void setRingCount(int count) {
+ if (ringCount < 1) return;
+ ringCount = count;
+ }
+
+ public float getRotAngle() {
+ return rotAngle;
+ }
+
+ public float getRotAxisX() {
+ return rotAxisX;
+ }
+
+ public float getRotAxisY() {
+ return rotAxisY;
}
- // Used to track the rotation of the star
- public float angle;
+ public float getRotAxisZ() {
+ return rotAxisZ;
+ }
- private static final String FOG_NBT_TAG = "FOG:";
- private static final String ROTATION_SPEED_NBT_TAG = FOG_NBT_TAG + "renderRotationSpeed";
- private static final String SIZE_NBT_TAG = FOG_NBT_TAG + "renderSize";
+ public void setRenderRotation(Rotation rotation, ForgeDirection direction) {
+ switch (direction) {
+ case SOUTH -> rotAngle = 90;
+ case NORTH -> rotAngle = 90;
+ case WEST -> rotAngle = 0;
+ case EAST -> rotAngle = 180;
+ case UP -> rotAngle = -90;
+ case DOWN -> rotAngle = -90;
+ }
+ rotAxisX = 0;
+ rotAxisY = direction.offsetZ + direction.offsetX;
+ rotAxisZ = direction.offsetY;
+
+ updateToClient();
+ }
+
+ public float getLensDistance(int lensID) {
+ return switch (lensID) {
+ case 0 -> -61.5f;
+ case 1 -> -54.5f;
+ case 2 -> -44.5f;
+ default -> throw new IllegalStateException("Unexpected value: " + lensID);
+ };
+ }
+
+ public float getLenRadius(int lensID) {
+ return switch (lensID) {
+ case 0 -> 1.1f;
+ case 1 -> 3.5f;
+ case 2 -> 5f;
+ default -> throw new IllegalStateException("Unexpected value: " + lensID);
+ };
+ }
+
+ public float getStartAngle() {
+ float x = -getLensDistance(getRingCount() - 1);
+ float y = getLenRadius(getRingCount() - 1);
+ float alpha = (float) Math.atan2(y, x);
+ float beta = (float) Math.asin(radius / Math.sqrt(x * x + y * y));
+ return alpha + ((float) Math.PI / 2 - beta);
+ }
+
+ public static float interpolate(float x0, float x1, float y0, float y1, float x) {
+ return y0 + ((x - x0) * (y1 - y0)) / (x1 - x0);
+ }
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
-
- // Save stats
compound.setFloat(ROTATION_SPEED_NBT_TAG, rotationSpeed);
- compound.setFloat(SIZE_NBT_TAG, size);
+ compound.setFloat(SIZE_NBT_TAG, radius);
+ compound.setInteger(RINGS_NBT_TAG, ringCount);
+ compound.setFloat(COLOR_RED_NBT_TAG, colorR);
+ compound.setFloat(COLOR_GREEN_NBT_TAG, colorG);
+ compound.setFloat(COLOR_BLUE_NBT_TAG, colorB);
+ compound.setFloat(COLOR_GAMMA_NBT_TAG, gamma);
+ compound.setFloat(ROT_ANGLE_NBT_TAG, rotAngle);
+ compound.setFloat(ROT_AXIS_X_NBT_TAG, rotAxisX);
+ compound.setFloat(ROT_AXIS_Y_NBT_TAG, rotAxisY);
+ compound.setFloat(ROT_AXIS_Z_NBT_TAG, rotAxisZ);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
-
- // Load stats
rotationSpeed = compound.getFloat(ROTATION_SPEED_NBT_TAG);
- size = compound.getFloat(SIZE_NBT_TAG);
+ radius = compound.getFloat(SIZE_NBT_TAG);
+
+ ringCount = compound.getInteger(RINGS_NBT_TAG);
+ if (ringCount < 1) ringCount = 1;
+
+ colorR = compound.getFloat(COLOR_RED_NBT_TAG);
+ colorG = compound.getFloat(COLOR_GREEN_NBT_TAG);
+ colorB = compound.getFloat(COLOR_BLUE_NBT_TAG);
+ gamma = compound.getFloat(COLOR_GAMMA_NBT_TAG);
+ rotAngle = compound.getFloat(ROT_ANGLE_NBT_TAG);
+ rotAxisX = compound.getFloat(ROT_AXIS_X_NBT_TAG);
+ rotAxisY = compound.getFloat(ROT_AXIS_Y_NBT_TAG);
+ rotAxisZ = compound.getFloat(ROT_AXIS_Z_NBT_TAG);
}
@Override
@@ -79,4 +203,8 @@ public class TileEntityForgeOfGods extends TileEntity {
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
+
+ public void updateToClient() {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
}
diff --git a/src/main/java/tectech/thing/gui/TecTechUITextures.java b/src/main/java/tectech/thing/gui/TecTechUITextures.java
index d4bc73f8e1..f2774dc42f 100644
--- a/src/main/java/tectech/thing/gui/TecTechUITextures.java
+++ b/src/main/java/tectech/thing/gui/TecTechUITextures.java
@@ -23,6 +23,7 @@ public class TecTechUITextures {
public static final UITexture BACKGROUND_GLOW_BLUE = UITexture.fullImage(MODID, "gui/background/blue_glow");
public static final UITexture BACKGROUND_GLOW_GREEN = UITexture.fullImage(MODID, "gui/background/green_glow");
public static final UITexture BACKGROUND_GLOW_WHITE = UITexture.fullImage(MODID, "gui/background/white_glow");
+ public static final UITexture BACKGROUND_GLOW_RAINBOW = UITexture.fullImage(MODID, "gui/background/rainbow_glow");
public static final UITexture BACKGROUND_SPACE = UITexture.fullImage(MODID, "gui/background/space");
public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16");
@@ -82,6 +83,7 @@ public class TecTechUITextures {
public static final UITexture OVERLAY_BUTTON_BATTERY_OFF = UITexture
.fullImage(MODID, "gui/overlay_button/battery_off");
public static final UITexture OVERLAY_BUTTON_FLAG = UITexture.fullImage(MODID, "gui/overlay_button/flag");
+ public static final UITexture OVERLAY_BUTTON_HEART = UITexture.fullImage(MODID, "gui/overlay_button/heart");
public static final UITexture OVERLAY_CYCLIC_BLUE = UITexture.fullImage(MODID, "gui/overlay_button/cyclic_blue");
public static final UITexture OVERLAY_EJECTION_LOCKED = UITexture
.fullImage(MODID, "gui/overlay_button/eject_disabled");
@@ -162,11 +164,26 @@ public class TecTechUITextures {
public static final UITexture PICTURE_PARAMETER_GRAY = UITexture.fullImage(MODID, "gui/picture/parameter_gray");
public static final UITexture PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE = UITexture
.fullImage(MODID, "gui/picture/uncertainty/monitor_multimachine");
- public static final UITexture PICTURE_UPGRADE_CONNECTOR_FULL = UITexture.fullImage(MODID, "gui/picture/connector");
- public static final UITexture PICTURE_UPGRADE_CONNECTOR_EMPTY = UITexture
- .fullImage(MODID, "gui/picture/connector_empty");
- public static final UITexture PICTURE_UPGRADE_CONNECTOR_SWITCH = UITexture
- .fullImage(MODID, "gui/picture/connector_switch");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_PURPLE = UITexture
+ .fullImage(MODID, "gui/picture/connector_purple");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_GREEN = UITexture
+ .fullImage(MODID, "gui/picture/connector_green");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_ORANGE = UITexture
+ .fullImage(MODID, "gui/picture/connector_orange");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_BLUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_blue");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_RED = UITexture
+ .fullImage(MODID, "gui/picture/connector_red");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_PURPLE_OPAQUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_purple_opaque");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_GREEN_OPAQUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_green_opaque");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_ORANGE_OPAQUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_orange_opaque");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_BLUE_OPAQUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_blue_opaque");
+ public static final UITexture PICTURE_UPGRADE_CONNECTOR_RED_OPAQUE = UITexture
+ .fullImage(MODID, "gui/picture/connector_red_opaque");
public static final UITexture SLOT_OUTLINE_GREEN = UITexture.fullImage(MODID, "gui/picture/green_selector");
public static final UITexture PICTURE_GODFORGE_MILESTONE_CHARGE = UITexture
.fullImage(MODID, "gui/picture/milestone_charge");
@@ -176,6 +193,7 @@ public class TecTechUITextures {
.fullImage(MODID, "gui/picture/milestone_catalyst");
public static final UITexture PICTURE_GODFORGE_MILESTONE_COMPOSITION = UITexture
.fullImage(MODID, "gui/picture/milestone_composition");
+ public static final UITexture PICTURE_GODFORGE_THANKS = UITexture.fullImage(MODID, "gui/picture/thanks");
public static final UITexture PICTURE_GODFORGE_MILESTONE_CHARGE_GLOW = UITexture
.fullImage(MODID, "gui/picture/milestone_charge_glow");
public static final UITexture PICTURE_GODFORGE_MILESTONE_CONVERSION_GLOW = UITexture
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java
index 181ee0d6d4..d55bf32e90 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java
@@ -38,6 +38,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -50,9 +51,9 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
-import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
+import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Color;
@@ -66,12 +67,14 @@ import com.gtnewhorizons.modularui.api.widget.Widget;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn;
+import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.FluidNameHolderWidget;
import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.Scrollable;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
+import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget;
@@ -97,6 +100,7 @@ import gregtech.common.tileentities.machines.MTEHatchInputBusME;
import gregtech.common.tileentities.machines.MTEHatchInputME;
import gregtech.common.tileentities.machines.MTEHatchOutputBusME;
import tectech.TecTech;
+import tectech.loader.TecTechConfig;
import tectech.thing.block.BlockGodforgeGlass;
import tectech.thing.block.TileEntityForgeOfGods;
import tectech.thing.gui.TecTechUITextures;
@@ -150,6 +154,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
private static final int INDIVIDUAL_MILESTONE_WINDOW_ID = 14;
private static final int MANUAL_INSERTION_WINDOW_ID = 15;
private static final int GENERAL_INFO_WINDOW_ID = 16;
+ private static final int SPECIAL_THANKS_WINDOW_ID = 17;
private static final int TEXTURE_INDEX = 960;
private static final int[] FIRST_SPLIT_UPGRADES = new int[] { 12, 13, 14 };
private static final Integer[] UPGRADE_MATERIAL_ID_CONVERSION = { 0, 5, 7, 11, 26, 29, 30 };
@@ -178,10 +183,9 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
private static final ItemStack STELLAR_FUEL = Avaritia.isModLoaded() ? getModItem(Avaritia.ID, "Resource", 1, 8)
: GTOreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 1);
- private final boolean debugMode = false;
+ private final boolean debugMode = TecTechConfig.DEBUG_MODE;
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
- if (mMachine) return -1;
int realBudget = elementBudget >= 1000 ? elementBudget : Math.min(1000, elementBudget * 5);
// 1000 blocks max per placement.
int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 63, 14, 1, realBudget, env, false, true);
@@ -241,7 +245,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
HatchElementBuilder.<MTEForgeOfGods>builder()
.atLeast(moduleElement.Module)
.casingIndex(TEXTURE_INDEX)
- .dot(3)
+ .dot(2)
.buildAndChain(GodforgeCasings, 0))
.addElement('K', ofBlock(GodforgeCasings, 6))
.addElement('L', ofBlock(Blocks.air, 0))
@@ -309,7 +313,6 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
moduleHatches.clear();
-
// Check structure of multi
if (isRenderActive) {
if (!structureCheck_EM(STRUCTURE_PIECE_SHAFT, 63, 14, 1)
@@ -324,7 +327,6 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
if (internalBattery != 0 && !isRenderActive) {
createRenderer();
}
-
// Check there is 1 input bus
if (mInputBusses.size() != 1) {
return false;
@@ -340,7 +342,6 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
return false;
}
}
-
// Make sure there are no energy hatches
{
if (mEnergyHatches.size() > 0) {
@@ -360,19 +361,38 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
if (isUpgradeActive(26)) {
if (checkPiece(STRUCTURE_PIECE_SECOND_RING, 55, 11, -67)) {
ringAmount = 2;
+ destroySecondRing();
+ UpdateRenderer();
}
if (isRenderActive && ringAmount >= 2 && !checkPiece(STRUCTURE_PIECE_SECOND_RING_AIR, 55, 11, -67)) {
destroyRenderer();
}
+ } else {
+ if (ringAmount == 3) {
+ buildThirdRing();
+ }
+ if (ringAmount >= 2) {
+ ringAmount = 1;
+ UpdateRenderer();
+ buildSecondRing();
+ }
}
if (isUpgradeActive(29)) {
if (checkPiece(STRUCTURE_PIECE_THIRD_RING, 47, 13, -76)) {
ringAmount = 3;
+ destroyThirdRing();
+ UpdateRenderer();
}
if (isRenderActive && ringAmount == 3 && !checkPiece(STRUCTURE_PIECE_THIRD_RING_AIR, 47, 13, -76)) {
destroyRenderer();
}
+ } else {
+ if (ringAmount == 3) {
+ ringAmount = 2;
+ UpdateRenderer();
+ buildThirdRing();
+ }
}
return true;
@@ -548,6 +568,38 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
}
}
+ private TileEntityForgeOfGods getRenderer() {
+ IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity();
+
+ int x = gregTechTileEntity.getXCoord();
+ int y = gregTechTileEntity.getYCoord();
+ int z = gregTechTileEntity.getZCoord();
+
+ double xOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetX;
+ double zOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
+ double yOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetY;
+
+ TileEntity tile = this.getBaseMetaTileEntity()
+ .getWorld()
+ .getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset));
+
+ if (tile instanceof TileEntityForgeOfGods forgeTile) {
+ return forgeTile;
+ }
+ return null;
+ }
+
+ private void UpdateRenderer() {
+ TileEntityForgeOfGods tile = getRenderer();
+ if (tile == null) return;
+
+ tile.setRingCount(ringAmount);
+ tile.setStarRadius(20);
+ tile.setRotationSpeed(5);
+
+ tile.updateToClient();
+ }
+
private void createRenderer() {
IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity();
@@ -570,24 +622,24 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
.getWorld()
.getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset));
- rendererTileEntity.setRenderSize(20);
- rendererTileEntity.setRenderRotationSpeed(5);
-
switch (ringAmount) {
case 2 -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59);
- buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67);
+ destroyFirstRing();
+ destroySecondRing();
}
case 3 -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59);
- buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67);
- buildPiece(STRUCTURE_PIECE_THIRD_RING_AIR, null, false, 47, 13, -76);
+ destroyFirstRing();
+ destroySecondRing();
+ destroyThirdRing();
}
default -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59);
+ destroyFirstRing();
}
}
+ rendererTileEntity.setRenderRotation(getRotation(), getDirection());
+ UpdateRenderer();
+
isRenderActive = true;
}
@@ -609,26 +661,65 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
switch (ringAmount) {
case 2 -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59);
- buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67);
+ buildFirstRing();
+ buildSecondRing();
}
case 3 -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59);
- buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67);
- buildPiece(STRUCTURE_PIECE_THIRD_RING, null, false, 47, 13, -76);
+ buildFirstRing();
+ buildSecondRing();
+ buildThirdRing();
}
default -> {
- buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59);
+ buildFirstRing();
}
}
isRenderActive = false;
}
+ private void destroyFirstRing() {
+ buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59);
+ }
+
+ private void destroySecondRing() {
+ buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67);
+ }
+
+ private void destroyThirdRing() {
+ buildPiece(STRUCTURE_PIECE_THIRD_RING_AIR, null, false, 47, 13, -76);
+ }
+
+ private void buildFirstRing() {
+ buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59);
+ }
+
+ private void buildSecondRing() {
+ buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67);
+ }
+
+ private void buildThirdRing() {
+ buildPiece(STRUCTURE_PIECE_THIRD_RING, null, false, 47, 13, -76);
+ }
+
+ @Override
+ public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (!debugMode) return;
+ if (isRenderActive) {
+ destroyRenderer();
+ isRenderActive = false;
+ } else {
+ ringAmount = 3;
+ createRenderer();
+ isRenderActive = true;
+ }
+ }
+
@Override
public void onBlockDestroyed() {
super.onBlockDestroyed();
- destroyRenderer();
+ if (isRenderActive) {
+ destroyRenderer();
+ }
}
@Override
@@ -673,6 +764,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
buildContext.addSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID, this::createIndividualMilestoneWindow);
buildContext.addSyncedWindow(MANUAL_INSERTION_WINDOW_ID, this::createManualInsertionWindow);
buildContext.addSyncedWindow(GENERAL_INFO_WINDOW_ID, this::createGeneralInfoWindow);
+ buildContext.addSyncedWindow(SPECIAL_THANKS_WINDOW_ID, this::createSpecialThanksWindow);
builder.widget(
new ButtonWidget().setOnClick(
(clickData, widget) -> {
@@ -765,6 +857,17 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
.setSize(18, 18)
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.clickhere"))
.setPos(172, 67)
+ .setTooltipShowUpDelay(TOOLTIP_DELAY))
+ .widget(
+ new ButtonWidget().setOnClick(
+ (clickData, widget) -> {
+ if (!widget.isClient()) widget.getContext()
+ .openSyncedWindow(SPECIAL_THANKS_WINDOW_ID);
+ })
+ .setSize(16, 16)
+ .addTooltip(translateToLocal("fog.button.thanks.tooltip"))
+ .setBackground(TecTechUITextures.OVERLAY_BUTTON_HEART)
+ .setPos(8, 69)
.setTooltipShowUpDelay(TOOLTIP_DELAY));
}
@@ -1277,6 +1380,11 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
return new ButtonWidget().setOnClick((clickData, widget) -> {
currentMilestoneID = milestoneID;
if (!widget.isClient()) {
+ if (widget.getContext()
+ .isWindowOpen(INDIVIDUAL_MILESTONE_WINDOW_ID)) {
+ widget.getContext()
+ .closeWindow(INDIVIDUAL_MILESTONE_WINDOW_ID);
+ }
widget.getContext()
.openSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID);
}
@@ -1297,11 +1405,11 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
private int currentColorCode = 0;
private int currentMilestoneBG = 0;
private int gravitonShardCost = 0;
- private int[] prereqUpgrades = new int[] {};
+ private int[][] prereqUpgrades = new int[31][];
private int[] followupUpgrades = new int[] {};
- private boolean allPrereqRequired = false;
private boolean isUpradeSplitStart = false;
private boolean doesCurrentUpgradeRequireExtraMats = false;
+ private boolean[] allPrereqRequired = new boolean[31];
private boolean[] upgrades = new boolean[31];
private boolean[] materialPaidUpgrades = new boolean[7];
@@ -1310,6 +1418,44 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
final int PARENT_WIDTH = 300;
final int PARENT_HEIGHT = 300;
ModularWindow.Builder builder = ModularWindow.builder(PARENT_WIDTH, PARENT_HEIGHT);
+
+ scrollable.widget(createUpgradeConnectorLine(new Pos2d(143, 71), 45, 0, 0, 0, 1))
+ .widget(createUpgradeConnectorLine(new Pos2d(124, 124), 60, 27, 0, 1, 2))
+ .widget(createUpgradeConnectorLine(new Pos2d(162, 124), 60, 333, 0, 1, 3))
+ .widget(createUpgradeConnectorLine(new Pos2d(94, 184), 60, 27, 0, 2, 4))
+ .widget(createUpgradeConnectorLine(new Pos2d(130, 184), 60, 336, 0, 2, 5))
+ .widget(createUpgradeConnectorLine(new Pos2d(156, 184), 60, 24, 0, 3, 5))
+ .widget(createUpgradeConnectorLine(new Pos2d(192, 184), 60, 333, 0, 3, 6))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 251), 45, 0, 0, 5, 7))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 311), 45, 0, 0, 7, 9))
+ .widget(createUpgradeConnectorLine(new Pos2d(78, 250), 110, 5, 4, 4, 8))
+ .widget(createUpgradeConnectorLine(new Pos2d(110, 290), 80, 40, 4, 7, 8))
+ .widget(createUpgradeConnectorLine(new Pos2d(208, 250), 110, 355, 4, 6, 10))
+ .widget(createUpgradeConnectorLine(new Pos2d(176, 290), 80, 320, 4, 7, 10))
+ .widget(createUpgradeConnectorLine(new Pos2d(100, 355), 80, 313, 0, 8, 11))
+ .widget(createUpgradeConnectorLine(new Pos2d(186, 355), 80, 47, 0, 10, 11))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 430), 48, 0, 2, 11, 13))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 490), 48, 0, 2, 13, 18))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 550), 48, 0, 2, 18, 21))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 610), 48, 0, 2, 21, 23))
+ .widget(createUpgradeConnectorLine(new Pos2d(110, 410), 80, 40, 1, 11, 12))
+ .widget(createUpgradeConnectorLine(new Pos2d(83, 490), 48, 0, 1, 12, 17))
+ .widget(createUpgradeConnectorLine(new Pos2d(83, 550), 48, 0, 1, 17, 20))
+ .widget(createUpgradeConnectorLine(new Pos2d(101, 590), 80, 320, 1, 20, 23))
+ .widget(createUpgradeConnectorLine(new Pos2d(53, 536), 35, 45, 1, 17, 16))
+ .widget(createUpgradeConnectorLine(new Pos2d(176, 410), 80, 320, 3, 11, 14))
+ .widget(createUpgradeConnectorLine(new Pos2d(203, 490), 48, 0, 3, 14, 19))
+ .widget(createUpgradeConnectorLine(new Pos2d(203, 550), 48, 0, 3, 19, 22))
+ .widget(createUpgradeConnectorLine(new Pos2d(185, 590), 80, 40, 3, 22, 23))
+ .widget(createUpgradeConnectorLine(new Pos2d(233, 476), 35, 315, 3, 14, 15))
+ .widget(createUpgradeConnectorLine(new Pos2d(143, 670), 48, 0, 0, 23, 24))
+ .widget(createUpgradeConnectorLine(new Pos2d(101, 707), 75, 62.3f, 0, 24, 25))
+ .widget(createUpgradeConnectorLine(new Pos2d(53, 772), 78, 0, 0, 25, 26))
+ .widget(createUpgradeConnectorLine(new Pos2d(95, 837), 75, 297.7f, 0, 26, 27))
+ .widget(createUpgradeConnectorLine(new Pos2d(191, 837), 75, 62.3f, 0, 27, 28))
+ .widget(createUpgradeConnectorLine(new Pos2d(233, 772), 78, 0, 0, 28, 29))
+ .widget(createUpgradeConnectorLine(new Pos2d(191, 747), 75, 62.3f, 0, 29, 30));
+
scrollable
.widget(
createUpgradeBox(
@@ -1725,6 +1871,14 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
.setPos(4, 4))
.widget(
ButtonWidget.closeWindowButton(true)
+ .setOnClick((data, widget) -> {
+ if (!widget.isClient()) {
+ widget.getWindow()
+ .closeWindow();
+ widget.getContext()
+ .closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
+ }
+ })
.setPos(282, 4));
if (debugMode) {
builder.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
@@ -1881,10 +2035,9 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
int unlockedPrereqUpgrades = 0;
- int unlockedFollowupUpgrades = 0;
int unlockedSplitUpgrades = 0;
if (!upgrades[currentUpgradeID]) {
- for (int prereqUpgrade : prereqUpgrades) {
+ for (int prereqUpgrade : prereqUpgrades[currentUpgradeID]) {
if (upgrades[prereqUpgrade]) {
unlockedPrereqUpgrades++;
}
@@ -1892,14 +2045,14 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
if (!doesCurrentUpgradeRequireExtraMats
|| materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(currentUpgradeID)]) {
- if (allPrereqRequired) {
- if (unlockedPrereqUpgrades == prereqUpgrades.length
+ if (allPrereqRequired[currentUpgradeID]) {
+ if (unlockedPrereqUpgrades == prereqUpgrades[currentUpgradeID].length
&& gravitonShardsAvailable >= gravitonShardCost) {
gravitonShardsAvailable -= gravitonShardCost;
gravitonShardsSpent += gravitonShardCost;
upgrades[currentUpgradeID] = true;
}
- } else if (unlockedPrereqUpgrades > 0 || prereqUpgrades.length == 0) {
+ } else if (unlockedPrereqUpgrades > 0 || prereqUpgrades[currentUpgradeID].length == 0) {
if (isUpradeSplitStart) {
for (int splitUpgrade : FIRST_SPLIT_UPGRADES) {
if (upgrades[splitUpgrade]) {
@@ -1916,11 +2069,34 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
}
}
} else {
+ int unlockedFollowupUpgrades = 0;
+ int unlockedNeighboringUpgrades = 0;
+ boolean doesFollowupRequireAllPrereqs = false;
+ boolean canFollowupSpareAConnection = true;
+
for (int followupUpgrade : followupUpgrades) {
if (upgrades[followupUpgrade]) {
unlockedFollowupUpgrades++;
}
+ if (allPrereqRequired[followupUpgrade]) {
+ doesFollowupRequireAllPrereqs = true;
+ }
+ int[] currentPrereqs = prereqUpgrades[followupUpgrade];
+ for (int prereqUpgrade : currentPrereqs) {
+ if (upgrades[prereqUpgrade]) {
+ unlockedNeighboringUpgrades++;
+ }
+ }
+ if (unlockedNeighboringUpgrades <= 1) {
+ canFollowupSpareAConnection = false;
+ }
+ unlockedNeighboringUpgrades = 0;
}
+
+ if (!doesFollowupRequireAllPrereqs && followupUpgrades.length > 0 && canFollowupSpareAConnection) {
+ unlockedFollowupUpgrades = 0;
+ }
+
if (unlockedFollowupUpgrades == 0) {
gravitonShardsAvailable += gravitonShardCost;
gravitonShardsSpent -= gravitonShardCost;
@@ -1936,10 +2112,11 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
return new IDrawable[] { GTUITextures.BUTTON_STANDARD };
}
})
- .addTooltip(translateToLocal("fog.upgrade.confirm"))
+ .dynamicTooltip(this::constructionStatus)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.addChild(
- new TextWidget(translateToLocal("fog.upgrade.confirm")).setTextAlignment(Alignment.Center)
+ TextWidget.dynamicText(this::constructionStatusText)
+ .setTextAlignment(Alignment.Center)
.setScale(0.7f)
.setMaxWidth(36)
.setPos(3, 5))
@@ -2006,18 +2183,27 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
private Widget createUpgradeBox(int upgradeID, int colorCode, int milestone, int[] prerequisiteUpgradeIDs,
boolean requireAllPrerequisites, int[] followingUpgradeIDs, boolean isStartOfSplit,
boolean requiresExtraMaterials, int shardCost, Pos2d pos, IWidgetBuilder<?> builder) {
+ prereqUpgrades[upgradeID] = prerequisiteUpgradeIDs;
+ allPrereqRequired[upgradeID] = requireAllPrerequisites;
return new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
currentUpgradeID = upgradeID;
currentColorCode = colorCode;
currentMilestoneBG = milestone;
gravitonShardCost = shardCost;
- prereqUpgrades = prerequisiteUpgradeIDs;
- allPrereqRequired = requireAllPrerequisites;
followupUpgrades = followingUpgradeIDs;
isUpradeSplitStart = isStartOfSplit;
doesCurrentUpgradeRequireExtraMats = requiresExtraMaterials;
- if (!widget.isClient()) widget.getContext()
- .openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
+ if (!widget.isClient()) {
+ // unfortunately this is the easiest way to prevent this window desyncing. it causes the window to
+ // reposition itself on the screen which would be a good thing to not do.
+ if (widget.getContext()
+ .isWindowOpen(INDIVIDUAL_UPGRADE_WINDOW_ID)) {
+ widget.getContext()
+ .closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
+ }
+ widget.getContext()
+ .openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
+ }
})
.setSize(40, 15)
.setBackground(() -> {
@@ -2041,6 +2227,44 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
builder);
}
+ private Widget createUpgradeConnectorLine(Pos2d pos, int length, float rotationAngle, int colorCode,
+ int startUpgradeID, int endUpgradeID) {
+ return new DrawableWidget()
+ .setDrawable(
+ () -> (upgrades[startUpgradeID] && upgrades[endUpgradeID])
+ ? coloredLine(colorCode, true).withRotationDegree(rotationAngle)
+ : coloredLine(colorCode, false).withRotationDegree(rotationAngle))
+ .setPos(pos)
+ .setSize(6, length);
+ }
+
+ private IDrawable coloredLine(int colorCode, boolean opaque) {
+ IDrawable line;
+ switch (colorCode) {
+ case 1 -> {
+ line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE_OPAQUE
+ : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE;
+ }
+ case 2 -> {
+ line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE_OPAQUE
+ : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE;
+ }
+ case 3 -> {
+ line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN_OPAQUE
+ : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN;
+ }
+ case 4 -> {
+ line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED_OPAQUE
+ : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED;
+ }
+ default -> {
+ line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE_OPAQUE
+ : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE;
+ }
+ }
+ return line;
+ }
+
protected ModularWindow createManualInsertionWindow(final EntityPlayer player) {
ItemStack[] inputs = godforgeUpgradeMats.get(currentUpgradeID);
final int WIDTH = 189;
@@ -2121,25 +2345,26 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
.setPos(5, 82)
.setSize(179, 16));
+ IItemHandlerModifiable upgradeMatsHandler = new ItemStackHandler(12);
int uniqueItems = inputs.length;
for (int i = 0; i < 12; i++) {
int index = i;
int cleanDiv4 = index / 4;
if (i < uniqueItems) {
+ ItemStack stack = inputs[index];
+ if (stack != null) {
+ stack = stack.copy();
+ stack.stackSize = 1;
+ upgradeMatsHandler.setStackInSlot(index, stack);
+ }
builder.widget(
new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_PRESSED)
.setPos(5 + cleanDiv4 * 36, 6 + index % 4 * 18)
.setSize(18, 18));
columnList.get(cleanDiv4)
.addChild(
- new ItemDrawable().setItem(inputs[index])
- .asWidget()
- .dynamicTooltip(() -> {
- List<String> tooltip = new ArrayList<>();
- tooltip.add(inputs[index] != null ? inputs[index].getDisplayName() : "");
- return tooltip;
- })
- .setSize(16, 16));
+ new SlotWidget(upgradeMatsHandler, index).setAccess(false, false)
+ .disableInteraction());
columnList.get(cleanDiv4 + 3)
.addChild(
new TextWidget("x" + inputs[i].stackSize).setTextAlignment(Alignment.CenterLeft)
@@ -2155,9 +2380,9 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
int counter = 0;
for (DynamicPositionedColumn column : columnList) {
- int spacing = 2;
- int xCord = 1 + counter * 36;
- int yCord = 1;
+ int spacing = 0;
+ int xCord = counter * 36;
+ int yCord = 0;
if (counter > 2) {
spacing = 10;
xCord = 19 + (counter - 3) * 36;
@@ -2336,6 +2561,137 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
return builder.build();
}
+ protected ModularWindow createSpecialThanksWindow(final EntityPlayer player) {
+ final int WIDTH = 200;
+ final int HEIGHT = 200;
+ ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
+
+ builder.setBackground(TecTechUITextures.BACKGROUND_GLOW_RAINBOW);
+ builder.setDraggable(true);
+ builder.widget(
+ ButtonWidget.closeWindowButton(true)
+ .setPos(184, 4))
+ .widget(
+ new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_GODFORGE_THANKS)
+ .setPos(50, 50)
+ .setSize(100, 100))
+ .widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.contributors"))
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.Center)
+ .setScale(1f)
+ .setPos(0, 5)
+ .setSize(200, 15))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lead"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 30)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.cloud")).setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.AQUA)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 40)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.programming"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 55)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.DARK_AQUA + translateToLocal("gt.blockmachines.multimachine.FOG.teg")
+ + " "
+ + EnumChatFormatting.RESET
+ + translateToLocal("gt.blockmachines.multimachine.FOG.serenybiss")).setScale(0.8f)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 67)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.textures"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 85)
+ .setSize(100, 10))
+ .widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.ant")).setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GREEN)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 95)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.rendering"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 110)
+ .setSize(100, 10))
+ .widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.bucket")).setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.WHITE)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 120)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lore"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 135)
+ .setSize(100, 10))
+ .widget(
+ delenoName().setSpace(-1)
+ .setAlignment(MainAxisAlignment.SPACE_BETWEEN)
+ .setPos(7, 145)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(
+ EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.playtesting"))
+ .setScale(0.8f)
+ .setDefaultColor(EnumChatFormatting.GOLD)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 160)
+ .setSize(100, 10))
+ .widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.misi")).setScale(0.8f)
+ .setDefaultColor(0xffc26f)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(7, 170)
+ .setSize(60, 10))
+ .widget(
+ new TextWidget(EnumChatFormatting.ITALIC + translateToLocal("gt.blockmachines.multimachine.FOG.thanks"))
+ .setScale(0.8f)
+ .setDefaultColor(0xbbbdbd)
+ .setTextAlignment(Alignment.Center)
+ .setPos(90, 140)
+ .setSize(100, 60));
+ return builder.build();
+ }
+
+ private DynamicPositionedRow delenoName() {
+ DynamicPositionedRow nameRow = new DynamicPositionedRow();
+ String deleno = translateToLocal("gt.blockmachines.multimachine.FOG.deleno");
+ int[] colors = new int[] { 0xffffff, 0xf6fff5, 0xecffec, 0xe3ffe2, 0xd9ffd9, 0xd0ffcf };
+
+ for (int i = 0; i < 6; i++) {
+ nameRow.addChild(
+ new TextWidget(Character.toString(deleno.charAt(i))).setDefaultColor(colors[i])
+ .setScale(0.8f)
+ .setTextAlignment(Alignment.CenterLeft));
+ }
+ return nameRow;
+ }
+
@Override
public MultiblockTooltipBuilder createTooltip() {
final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
@@ -2475,7 +2831,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
EnumChatFormatting.GOLD + "36" + EnumChatFormatting.GRAY + " Stellar Energy Siphon Casing")
.addStructureInfo("--------------------------------------------")
.addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Hatch")
- .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus")
+ .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus (ME)")
.addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Bus")
.addStructureInfo("--------------------------------------------")
.toolTipFinisher(CommonValues.GODFORGE_MARK);
@@ -2888,6 +3244,18 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable,
: new Text("");
}
+ private Text constructionStatusText() {
+ return upgrades[currentUpgradeID] ? new Text(translateToLocal("fog.upgrade.respec"))
+ : new Text(translateToLocal("fog.upgrade.confirm"));
+ }
+
+ private List<String> constructionStatus() {
+ if (upgrades[currentUpgradeID]) {
+ return ImmutableList.of(translateToLocal("fog.upgrade.respec"));
+ }
+ return ImmutableList.of(translateToLocal("fog.upgrade.confirm"));
+ }
+
private List<String> upgradeMaterialRequirements() {
if (materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(currentUpgradeID)]) {
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java
index 67561466ab..c5d546d448 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java
@@ -264,7 +264,21 @@ public class MTEBaseModule extends TTMultiblockBase {
@Override
public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- return structureCheck_EM(STRUCTURE_PIECE_MAIN, 3, 3, 0);
+
+ if (!structureCheck_EM(STRUCTURE_PIECE_MAIN, 3, 3, 0)) {
+ return false;
+ }
+
+ if (this instanceof MTEExoticModule) {
+ if (mOutputHatches.size() < 1) {
+ return false;
+ }
+ if (mOutputBusses.size() < 1) {
+ return false;
+ }
+ }
+
+ return true;
}
@Override
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java
index c94549a575..ee8b5396ad 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java
@@ -26,6 +26,7 @@ import java.util.stream.Stream;
import javax.annotation.Nonnull;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -36,14 +37,24 @@ import net.minecraftforge.oredict.OreDictionary;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import com.google.common.collect.ImmutableList;
+import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
+import com.gtnewhorizons.modularui.api.fluids.FluidTanksHandler;
+import com.gtnewhorizons.modularui.api.fluids.IFluidTanksHandler;
+import com.gtnewhorizons.modularui.api.math.Alignment;
+import com.gtnewhorizons.modularui.api.math.Pos2d;
+import com.gtnewhorizons.modularui.api.math.Size;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder;
import com.gtnewhorizons.modularui.api.widget.Widget;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
+import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
+import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget;
+import com.gtnewhorizons.modularui.common.widget.TextWidget;
import gregtech.api.enums.MaterialsUEVplus;
import gregtech.api.enums.TierEU;
@@ -61,6 +72,7 @@ import gregtech.api.util.GTRecipe;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import tectech.recipe.TecTechRecipeMaps;
+import tectech.thing.gui.TecTechUITextures;
import tectech.util.CommonValues;
import tectech.util.GodforgeMath;
@@ -68,24 +80,23 @@ public class MTEExoticModule extends MTEBaseModule {
private int numberOfFluids = 0;
private int numberOfItems = 0;
- private long wirelessEUt = 0;
+ private long ticker = 0;
private long EUt = 0;
private long actualParallel = 0;
private boolean recipeInProgress = false;
+ private boolean recipeRegenerated = false;
private boolean magmatterMode = false;
private FluidStack[] randomizedFluidInput = new FluidStack[] {};
private ItemStack[] randomizedItemInput = new ItemStack[] {};
List<FluidStack> inputPlasmas = new ArrayList<>();
private GTRecipe plasmaRecipe = null;
- private static RecipeMap<RecipeMapBackend> tempRecipeMap = RecipeMapBuilder.of("bye")
- .maxIO(0, 0, 7, 2)
- .disableRegisterNEI()
- .build();
- private static final RecipeMap<RecipeMapBackend> emptyRecipeMap = RecipeMapBuilder.of("hey")
+ private BigInteger powerForRecipe = BigInteger.ZERO;
+ private static RecipeMap<RecipeMapBackend> tempRecipeMap = RecipeMapBuilder.of("godforgeExoticTempRecipeMap")
.maxIO(0, 0, 7, 2)
.disableRegisterNEI()
.build();
private static final int NUMBER_OF_INPUTS = 7;
+ private static final int INPUT_LIST_WINDOW_ID = 10;
public MTEExoticModule(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -108,56 +119,12 @@ public class MTEExoticModule extends MTEBaseModule {
@Override
protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) {
if (!recipeInProgress) {
- actualParallel = getMaxParallel();
- FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000 * actualParallel);
- tempRecipeMap = emptyRecipeMap;
+
if (magmatterMode) {
- randomizedItemInput = getRandomItemInputs(exoticModuleMagmatterItemMap, 1);
- numberOfItems = 1;
- numberOfFluids = 2;
- int timeAmount = GodforgeMath.getRandomIntInRange(1, 50);
- int spaceAmount = GodforgeMath.getRandomIntInRange(51, 100);
- randomizedFluidInput = new FluidStack[] { MaterialsUEVplus.Time.getMolten(timeAmount * 1000L),
- MaterialsUEVplus.Space.getMolten(spaceAmount * 1000L) };
- inputPlasmas = new ArrayList<>(
- Arrays.asList(
- convertItemToPlasma(randomizedItemInput, (spaceAmount - timeAmount) * actualParallel)));
- inputPlasmas.add(MaterialsUEVplus.Time.getMolten(timeAmount * actualParallel));
- inputPlasmas.add(MaterialsUEVplus.Space.getMolten(spaceAmount * actualParallel));
- outputFluid = MaterialsUEVplus.MagMatter.getMolten(144 * actualParallel);
+ plasmaRecipe = generateMagmatterRecipe();
} else {
- numberOfFluids = GodforgeMath.getRandomIntInRange(0, NUMBER_OF_INPUTS);
- numberOfItems = NUMBER_OF_INPUTS - numberOfFluids;
- randomizedFluidInput = getRandomFluidInputs(exoticModulePlasmaFluidMap, numberOfFluids);
- randomizedItemInput = getRandomItemInputs(exoticModulePlasmaItemMap, numberOfItems);
-
- if (numberOfFluids != 0) {
- for (FluidStack fluidStack : randomizedFluidInput) {
- fluidStack.amount = 1000 * GodforgeMath.getRandomIntInRange(1, 64);
- }
- }
-
- if (numberOfItems != 0) {
- for (ItemStack itemStack : randomizedItemInput) {
- itemStack.stackSize = GodforgeMath.getRandomIntInRange(1, 64);
- }
- }
-
- inputPlasmas = new ArrayList<>(
- Arrays.asList(convertItemToPlasma(randomizedItemInput, actualParallel)));
- inputPlasmas.addAll(Arrays.asList(convertFluidToPlasma(randomizedFluidInput, actualParallel)));
+ plasmaRecipe = generateQuarkGluonRecipe();
}
- plasmaRecipe = new GTRecipe(
- false,
- null,
- null,
- null,
- null,
- inputPlasmas.toArray(new FluidStack[0]),
- new FluidStack[] { outputFluid },
- 10 * SECONDS * (int) actualParallel,
- (int) TierEU.RECIPE_MAX,
- 0);
tempRecipeMap.add(plasmaRecipe);
}
@@ -168,46 +135,32 @@ public class MTEExoticModule extends MTEBaseModule {
@NotNull
@Override
protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) {
- if (!recipeInProgress) {
- maxParallel = 1;
- wirelessEUt = (long) recipe.mEUt * maxParallel;
- if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) {
- tempRecipeMap = emptyRecipeMap;
- return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration);
+ if (!recipeInProgress || recipeRegenerated) {
+ powerForRecipe = BigInteger.valueOf(getProcessingVoltage())
+ .multiply(BigInteger.valueOf(recipe.mDuration * actualParallel));
+ if (getUserEU(userUUID).compareTo(powerForRecipe) < 0) {
+ tempRecipeMap.getBackend()
+ .clearRecipes();
+ return CheckRecipeResultRegistry.insufficientStartupPower(powerForRecipe);
}
if (numberOfFluids != 0) {
for (FluidStack fluidStack : randomizedFluidInput) {
dumpFluid(
mOutputHatches,
- new FluidStack(
- fluidStack.getFluid(),
- (int) (fluidStack.amount / 1000 * actualParallel)),
+ new FluidStack(fluidStack.getFluid(), fluidStack.amount / 1000),
false);
}
}
if (numberOfItems != 0) {
- long multiplier = actualParallel;
- if (magmatterMode) {
- multiplier = 1;
- }
for (ItemStack itemStack : randomizedItemInput) {
- int stacksize = (int) (itemStack.stackSize * multiplier);
- ItemStack tmpItem = itemStack.copy();
- // split itemStacks > 64
- while (stacksize >= 64) {
- tmpItem.stackSize = 64;
- addOutput(tmpItem);
- stacksize -= 64;
- }
- tmpItem.stackSize = stacksize;
- addOutput(tmpItem);
-
+ addOutput(itemStack);
}
}
recipeInProgress = true;
+ recipeRegenerated = false;
}
if (new HashSet<>(Arrays.asList(inputFluids)).containsAll(inputPlasmas)) {
return CheckRecipeResultRegistry.SUCCESSFUL;
@@ -218,17 +171,19 @@ public class MTEExoticModule extends MTEBaseModule {
@NotNull
@Override
protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) {
- wirelessEUt = (long) recipe.mEUt * maxParallel;
- if (!addEUToGlobalEnergyMap(userUUID, -calculatedEut * duration)) {
- return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration);
+ EUt = calculatedEut;
+ powerForRecipe = BigInteger.valueOf(EUt)
+ .multiply(BigInteger.valueOf(duration * actualParallel));
+
+ if (!addEUToGlobalEnergyMap(userUUID, powerForRecipe.negate())) {
+ return CheckRecipeResultRegistry.insufficientStartupPower(powerForRecipe);
}
- addToPowerTally(
- BigInteger.valueOf(calculatedEut)
- .multiply(BigInteger.valueOf(duration)));
+
+ addToPowerTally(powerForRecipe);
addToRecipeTally(calculatedParallels);
- EUt = calculatedEut;
setCalculatedEut(0);
- tempRecipeMap = emptyRecipeMap;
+ tempRecipeMap.getBackend()
+ .clearRecipes();
recipeInProgress = false;
return CheckRecipeResultRegistry.SUCCESSFUL;
}
@@ -257,6 +212,72 @@ public class MTEExoticModule extends MTEBaseModule {
return TecTechRecipeMaps.godforgeExoticMatterRecipes;
}
+ private GTRecipe generateQuarkGluonRecipe() {
+ actualParallel = getMaxParallel();
+ tempRecipeMap.getBackend()
+ .clearRecipes();
+ numberOfFluids = GodforgeMath.getRandomIntInRange(0, NUMBER_OF_INPUTS);
+ numberOfItems = NUMBER_OF_INPUTS - numberOfFluids;
+ randomizedFluidInput = getRandomFluidInputs(exoticModulePlasmaFluidMap, numberOfFluids);
+ randomizedItemInput = getRandomItemInputs(exoticModulePlasmaItemMap, numberOfItems);
+
+ if (numberOfFluids != 0) {
+ for (FluidStack fluidStack : randomizedFluidInput) {
+ fluidStack.amount = 1000 * GodforgeMath.getRandomIntInRange(1, 64);
+ }
+ }
+
+ if (numberOfItems != 0) {
+ for (ItemStack itemStack : randomizedItemInput) {
+ itemStack.stackSize = 9 * GodforgeMath.getRandomIntInRange(1, 7);
+ }
+ }
+
+ inputPlasmas = new ArrayList<>(Arrays.asList(convertItemToPlasma(randomizedItemInput, 1)));
+ inputPlasmas.addAll(Arrays.asList(convertFluidToPlasma(randomizedFluidInput, 1)));
+
+ return new GTRecipe(
+ false,
+ null,
+ null,
+ null,
+ null,
+ inputPlasmas.toArray(new FluidStack[0]),
+ new FluidStack[] { MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000 * actualParallel) },
+ 10 * SECONDS,
+ (int) TierEU.RECIPE_MAX,
+ 0);
+ }
+
+ private GTRecipe generateMagmatterRecipe() {
+ actualParallel = getMaxParallel();
+ tempRecipeMap.getBackend()
+ .clearRecipes();
+ randomizedItemInput = getRandomItemInputs(exoticModuleMagmatterItemMap, 1);
+ numberOfItems = 1;
+ numberOfFluids = 2;
+ int timeAmount = GodforgeMath.getRandomIntInRange(1, 50);
+ int spaceAmount = GodforgeMath.getRandomIntInRange(51, 100);
+ randomizedFluidInput = new FluidStack[] { MaterialsUEVplus.Time.getMolten(timeAmount * 1000L),
+ MaterialsUEVplus.Space.getMolten(spaceAmount * 1000L) };
+ inputPlasmas = new ArrayList<>(
+ Arrays.asList(convertItemToPlasma(randomizedItemInput, spaceAmount - timeAmount)));
+ inputPlasmas.add(MaterialsUEVplus.Time.getMolten(timeAmount));
+ inputPlasmas.add(MaterialsUEVplus.Space.getMolten(spaceAmount));
+
+ return new GTRecipe(
+ false,
+ null,
+ null,
+ null,
+ null,
+ inputPlasmas.toArray(new FluidStack[0]),
+ new FluidStack[] { MaterialsUEVplus.MagMatter.getMolten(576 * actualParallel) },
+ 10 * SECONDS,
+ (int) TierEU.RECIPE_MAX,
+ 0);
+ }
+
private FluidStack[] getRandomFluidInputs(HashMap<FluidStack, Integer> fluidMap, int numberOfFluids) {
int cumulativeWeight = 0;
@@ -370,6 +391,7 @@ public class MTEExoticModule extends MTEBaseModule {
NBT.setBoolean("recipeInProgress", recipeInProgress);
NBT.setBoolean("magmatterMode", magmatterMode);
+ NBT.setLong("maxParallel", actualParallel);
// Store damage values/stack sizes of input plasmas
NBTTagCompound fluidStackListNBTTag = new NBTTagCompound();
@@ -395,6 +417,7 @@ public class MTEExoticModule extends MTEBaseModule {
recipeInProgress = NBT.getBoolean("recipeInProgress");
magmatterMode = NBT.getBoolean("magmatterMode");
+ actualParallel = NBT.getLong("maxParallel");
// Load damage values/fluid amounts of input plasmas and convert back to fluids
NBTTagCompound tempFluidTag = NBT.getCompoundTag("inputPlasmas");
@@ -410,10 +433,10 @@ public class MTEExoticModule extends MTEBaseModule {
inputPlasmas.add(new FluidStack(fluidStack, fluidAmount));
}
- FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000);
+ FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000L * actualParallel);
if (magmatterMode) {
- outputFluid = MaterialsUEVplus.MagMatter.getMolten(144);
+ outputFluid = MaterialsUEVplus.MagMatter.getMolten(576L * actualParallel);
}
tempRecipeMap.add(
@@ -433,12 +456,122 @@ public class MTEExoticModule extends MTEBaseModule {
}
@Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ ticker++;
+ }
+
+ @Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ builder.widget(
+ new DrawableWidget().setPos(8, 69)
+ .setSize(16, 16)
+ .addTooltip(translateToLocal("fog.button.exoticinputs.tooltip"))
+ .setTooltipShowUpDelay(TOOLTIP_DELAY));
super.addUIWidgets(builder, buildContext);
+ buildContext.addSyncedWindow(INPUT_LIST_WINDOW_ID, this::createInputListWindow);
builder.widget(magmatterSwitch(builder));
+ builder.widget(createExpectedInputsButton());
+ builder.widget(
+ new DrawableWidget().setDrawable(ModularUITextures.ICON_INFO)
+ .setPos(8, 69)
+ .setSize(16, 16));
}
+ protected ModularWindow createInputListWindow(final EntityPlayer player) {
+ final int WIDTH = 100;
+ final int HEIGHT = 60;
+ final int PARENT_WIDTH = getGUIWidth();
+ final int PARENT_HEIGHT = getGUIHeight();
+ final Pos2d[] slotPositions = new Pos2d[] { new Pos2d(23, 35), new Pos2d(41, 35), new Pos2d(59, 35),
+ new Pos2d(14, 17), new Pos2d(32, 17), new Pos2d(50, 17), new Pos2d(68, 17) };
+ ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
+ builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT);
+ builder.setGuiTint(getGUIColorization());
+ builder.setDraggable(true);
+ builder.setPos(
+ (size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT))
+ .add(Alignment.TopLeft.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT)))
+ .subtract(100, -47));
+
+ IFluidTanksHandler tanksHandler = new FluidTanksHandler(7, 128000);
+ for (int i = 0; i < 7; i++) {
+ if (i < inputPlasmas.size()) {
+ FluidStack plasma = inputPlasmas.get(i);
+ tanksHandler.setFluidInTank(i, plasma.getFluid(), plasma.amount);
+ }
+ builder.widget(
+ new DrawableWidget().setDrawable(ModularUITextures.FLUID_SLOT)
+ .setSize(18, 18)
+ .setPos(slotPositions[i]))
+ .widget(
+ new FluidSlotWidget(tanksHandler, i).setInteraction(false, false)
+ .setSize(18, 18)
+ .setPos(slotPositions[i])
+ .attachSyncer(
+ new FakeSyncWidget.BooleanSyncer(() -> recipeInProgress, val -> recipeInProgress = val),
+ builder,
+ (widget, val) -> widget.checkNeedsRebuild()));
+ }
+
+ builder.widget(
+ new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.expectedinputs"))
+ .setDefaultColor(EnumChatFormatting.BLACK)
+ .setTextAlignment(Alignment.Center)
+ .setSize(100, 9)
+ .setPos(0, 6));
+
+ builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ if (!widget.isClient() && ticker > 1200) {
+
+ if (magmatterMode) {
+ plasmaRecipe = generateMagmatterRecipe();
+ } else {
+ plasmaRecipe = generateQuarkGluonRecipe();
+ }
+ recipeRegenerated = true;
+ tempRecipeMap.add(plasmaRecipe);
+
+ for (int i = 0; i < 7; i++) {
+ if (i < inputPlasmas.size()) {
+ FluidStack plasma = inputPlasmas.get(i);
+ tanksHandler.setFluidInTank(i, plasma.getFluid(), plasma.amount);
+ }
+ }
+ ticker = 0;
+ widget.getContext()
+ .closeWindow(INPUT_LIST_WINDOW_ID);
+ widget.getContext()
+ .openSyncedWindow(INPUT_LIST_WINDOW_ID);
+ }
+ })
+ .setPlayClickSound(true)
+ .setBackground(TecTechUITextures.OVERLAY_CYCLIC_BLUE)
+ .dynamicTooltip(this::refreshTooltip)
+ .setTooltipShowUpDelay(TOOLTIP_DELAY)
+ .setSize(16, 16)
+ .setPos(5, 37)
+ .attachSyncer(
+ new FakeSyncWidget.LongSyncer(() -> ticker, val -> ticker = val),
+ builder,
+ (widget, val) -> widget.notifyTooltipChange()));
+
+ return builder.build();
+ }
+
+ private Widget createExpectedInputsButton() {
+ return new ButtonWidget().setOnClick((clickData, widget) -> {
+ if (!widget.isClient()) {
+ widget.getContext()
+ .openSyncedWindow(INPUT_LIST_WINDOW_ID);
+ }
+ })
+ .setPlayClickSound(true)
+ .setSize(16, 16)
+ .setPos(8, 69);
+ }
+
protected ButtonWidget magmatterSwitch(IWidgetBuilder<?> builder) {
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {
if (isMagmatterCapable) {
@@ -482,6 +615,18 @@ public class MTEExoticModule extends MTEBaseModule {
return (ButtonWidget) button;
}
+ private List<String> refreshTooltip() {
+ if (ticker > 1200) {
+ return ImmutableList.of(translateToLocal("fog.button.reciperefresh.tooltip"));
+ }
+
+ return ImmutableList.of(
+ translateToLocal("fog.button.refreshtimer.tooltip") + " "
+ + (int) Math.ceil((1200 - ticker) / 20d)
+ + " "
+ + translateToLocal("fog.button.seconds"));
+ }
+
public boolean isMagmatterModeOn() {
return magmatterMode;
}
@@ -519,6 +664,8 @@ public class MTEExoticModule extends MTEBaseModule {
.addStructureInfo(
EnumChatFormatting.GOLD + "5" + EnumChatFormatting.GRAY + " Celestial Matter Guidance Casing")
.addStructureInfo(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " Stellar Energy Siphon Casing")
+ .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Hatch")
+ .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus")
.toolTipFinisher(CommonValues.GODFORGE_MARK);
return tt;
}
@@ -535,9 +682,16 @@ public class MTEExoticModule extends MTEBaseModule {
+ formatNumbers(mMaxProgresstime / 20)
+ RESET
+ " s");
- str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t");
+ str.add(
+ "Currently using: " + RED
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt * actualParallel) : "0")
+ + RESET
+ + " EU/t");
str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel()));
- str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(getMaxParallel()));
+ str.add(
+ YELLOW + "Current Parallel: "
+ + RESET
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(getMaxParallel()) : "0"));
str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus()));
str.add(YELLOW + "Energy multiplier: " + RESET + formatNumbers(getEnergyDiscount()));
str.add(YELLOW + "Recipe time divisor per non-perfect OC: " + RESET + formatNumbers(getOverclockTimeFactor()));
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java
index 5cdb0bc95c..e9907a8626 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java
@@ -1,11 +1,6 @@
package tectech.thing.metaTileEntity.multi.godforge_modules;
-import static gregtech.api.util.GTOreDictUnificator.getAssociation;
-import static gregtech.api.util.GTRecipeBuilder.BUCKETS;
-import static gregtech.api.util.GTRecipeBuilder.INGOTS;
import static gregtech.api.util.GTUtility.formatNumbers;
-import static gregtech.api.util.ParallelHelper.addFluidsLong;
-import static gregtech.api.util.ParallelHelper.addItemsLong;
import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap;
import static gregtech.common.misc.WirelessNetworkManager.getUserEU;
import static net.minecraft.util.EnumChatFormatting.GREEN;
@@ -18,25 +13,20 @@ import java.util.ArrayList;
import javax.annotation.Nonnull;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.oredict.OreDictionary;
import org.jetbrains.annotations.NotNull;
-import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
-import gregtech.api.objects.ItemData;
+import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
-import gregtech.api.util.ParallelHelper;
+import tectech.recipe.TecTechRecipeMaps;
import tectech.util.CommonValues;
public class MTEMoltenModule extends MTEBaseModule {
@@ -63,12 +53,9 @@ public class MTEMoltenModule extends MTEBaseModule {
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {
- private FluidStack[] meltableItems;
-
@NotNull
@Override
protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) {
-
if (recipe.mSpecialValue > getHeat()) {
return CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue);
}
@@ -76,31 +63,6 @@ public class MTEMoltenModule extends MTEBaseModule {
if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) {
return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration);
}
-
- meltableItems = new FluidStack[recipe.mOutputs.length];
- for (int i = 0; i < recipe.mOutputs.length; i++) {
- ItemStack item = recipe.getOutput(i);
- if (item == null) {
- continue;
- }
- // if this is null it has to be a gt++ material
- ItemData data = getAssociation(item);
- Materials mat = data == null ? null : data.mMaterial.mMaterial;
- if (mat != null) {
- if (mat.mStandardMoltenFluid != null) {
- meltableItems[i] = mat.getMolten(INGOTS);
- } else if (mat.mFluid != null) {
- meltableItems[i] = mat.getFluid(BUCKETS);
- }
- } else {
- String dict = OreDictionary.getOreName(OreDictionary.getOreIDs(item)[0]);
- // substring 8 because ingotHot is 8 characters long
- String strippedOreDict = dict.substring(8);
- meltableItems[i] = FluidRegistry
- .getFluidStack("molten." + strippedOreDict.toLowerCase(), INGOTS);
- }
- }
-
return CheckRecipeResultRegistry.SUCCESSFUL;
}
@@ -132,47 +94,6 @@ public class MTEMoltenModule extends MTEBaseModule {
setCalculatedEut(0);
return CheckRecipeResultRegistry.SUCCESSFUL;
}
-
- @Nonnull
- @Override
- protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) {
- return super.createParallelHelper(recipe).setCustomItemOutputCalculation(currentParallel -> {
- ArrayList<ItemStack> outputItems = new ArrayList<>();
- for (int i = 0; i < recipe.mOutputs.length; i++) {
- ItemStack item = recipe.getOutput(i);
- if (item == null || meltableItems[i] != null) {
- continue;
- }
- ItemStack itemToAdd = item.copy();
- addItemsLong(outputItems, itemToAdd, (long) item.stackSize * currentParallel);
- }
- return outputItems.toArray(new ItemStack[0]);
- })
- .setCustomFluidOutputCalculation(currentParallel -> {
- ArrayList<FluidStack> fluids = new ArrayList<>();
-
- for (int i = 0; i < recipe.mOutputs.length; i++) {
- FluidStack fluid = meltableItems[i];
- if (fluid == null) {
- continue;
- }
- FluidStack fluidToAdd = fluid.copy();
- long fluidAmount = (long) fluidToAdd.amount * recipe.mOutputs[i].stackSize
- * currentParallel;
- addFluidsLong(fluids, fluidToAdd, fluidAmount);
- }
-
- for (int i = 0; i < recipe.mFluidOutputs.length; i++) {
- FluidStack fluid = recipe.getFluidOutput(i);
- if (fluid == null) {
- continue;
- }
- FluidStack fluidToAdd = fluid.copy();
- addFluidsLong(fluids, fluidToAdd, (long) fluidToAdd.amount * currentParallel);
- }
- return fluids.toArray(new FluidStack[0]);
- });
- }
};
}
@@ -187,6 +108,11 @@ public class MTEMoltenModule extends MTEBaseModule {
}
@Override
+ public RecipeMap<?> getRecipeMap() {
+ return TecTechRecipeMaps.godforgeMoltenRecipes;
+ }
+
+ @Override
public String[] getInfoData() {
ArrayList<String> str = new ArrayList<>();
str.add(
@@ -198,9 +124,16 @@ public class MTEMoltenModule extends MTEBaseModule {
+ formatNumbers(mMaxProgresstime / 20)
+ RESET
+ " s");
- str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t");
+ str.add(
+ "Currently using: " + RED
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0")
+ + RESET
+ + " EU/t");
str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel()));
- str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel));
+ str.add(
+ YELLOW + "Current Parallel: "
+ + RESET
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0"));
str.add(YELLOW + "Heat Capacity: " + RESET + formatNumbers(getHeat()));
str.add(YELLOW + "Effective Heat Capacity: " + RESET + formatNumbers(getHeatForOC()));
str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus()));
@@ -213,7 +146,7 @@ public class MTEMoltenModule extends MTEBaseModule {
public MultiblockTooltipBuilder createTooltip() {
final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
tt.addMachineType("Blast Smelter")
- .addInfo("Controller block for the Helioflux Meltig Core, a module of the Godforge.")
+ .addInfo("Controller block for the Helioflux Melting Core, a module of the Godforge.")
.addInfo("Must be part of a Godforge to function.")
.addInfo("Used for high temperature material liquefaction.")
.addInfo(TOOLTIP_BAR)
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java
index 7923089f8b..e0c2e8965c 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java
@@ -1,6 +1,8 @@
package tectech.thing.metaTileEntity.multi.godforge_modules;
import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
+import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_MULTISTEP;
+import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_TIER;
import static gregtech.api.util.GTUtility.formatNumbers;
import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap;
import static gregtech.common.misc.WirelessNetworkManager.getUserEU;
@@ -11,7 +13,6 @@ import static net.minecraft.util.EnumChatFormatting.YELLOW;
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Objects;
import javax.annotation.Nonnull;
@@ -42,6 +43,7 @@ import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
+import tectech.loader.TecTechConfig;
import tectech.recipe.TecTechRecipeMaps;
import tectech.util.CommonValues;
@@ -49,7 +51,7 @@ public class MTEPlasmaModule extends MTEBaseModule {
private long EUt = 0;
private int currentParallel = 0;
- private boolean debug = false;
+ private boolean debug = TecTechConfig.DEBUG_MODE;
private int inputMaxParallel = 0;
public MTEPlasmaModule(int aID, String aName, String aNameRegional) {
@@ -78,8 +80,8 @@ public class MTEPlasmaModule extends MTEBaseModule {
if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) {
return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration);
}
- if (recipe.mSpecialValue > getPlasmaTier()
- || Objects.equals(recipe.mSpecialItems.toString(), "true") && !isMultiStepPlasmaCapable) {
+ if (recipe.getMetadataOrDefault(FOG_PLASMA_TIER, 0) > getPlasmaTier()
+ || (recipe.getMetadataOrDefault(FOG_PLASMA_MULTISTEP, false) && !isMultiStepPlasmaCapable)) {
return SimpleCheckRecipeResult.ofFailure("missing_upgrades");
}
return CheckRecipeResultRegistry.SUCCESSFUL;
@@ -201,9 +203,16 @@ public class MTEPlasmaModule extends MTEBaseModule {
+ formatNumbers(mMaxProgresstime / 20)
+ RESET
+ " s");
- str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t");
+ str.add(
+ "Currently using: " + RED
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0")
+ + RESET
+ + " EU/t");
str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel()));
- str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel));
+ str.add(
+ YELLOW + "Current Parallel: "
+ + RESET
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0"));
str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus()));
str.add(YELLOW + "Energy multiplier: " + RESET + formatNumbers(getEnergyDiscount()));
str.add(YELLOW + "Recipe time divisor per non-perfect OC: " + RESET + formatNumbers(getOverclockTimeFactor()));
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java
index 8c45060653..08d99bde8c 100644
--- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java
+++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java
@@ -75,6 +75,11 @@ public class MTESmeltingModule extends MTEBaseModule {
return Arrays.asList(RecipeMaps.blastFurnaceRecipes, RecipeMaps.furnaceRecipes);
}
+ @Override
+ public int getRecipeCatalystPriority() {
+ return -10;
+ }
+
long wirelessEUt = 0;
@Override
@@ -200,9 +205,16 @@ public class MTESmeltingModule extends MTEBaseModule {
+ formatNumbers(mMaxProgresstime / 20)
+ RESET
+ " s");
- str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t");
+ str.add(
+ "Currently using: " + RED
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0")
+ + RESET
+ + " EU/t");
str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel()));
- str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel));
+ str.add(
+ YELLOW + "Current Parallel: "
+ + RESET
+ + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0"));
str.add(YELLOW + "Heat Capacity: " + RESET + formatNumbers(getHeat()));
str.add(YELLOW + "Effective Heat Capacity: " + RESET + formatNumbers(getHeatForOC()));
str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus()));