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