aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2022-12-30 03:24:19 +0000
committerGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2022-12-30 03:24:19 +0000
commitcbbff6a79392233475dabac74422d94469f64354 (patch)
tree814d27614979b540f5a4201d8056aba74556484e /src/main/java
parentc8cc68a608c6580f61fd3ccf5869eace55620afc (diff)
downloadGT5-Unofficial-cbbff6a79392233475dabac74422d94469f64354.tar.gz
GT5-Unofficial-cbbff6a79392233475dabac74422d94469f64354.tar.bz2
GT5-Unofficial-cbbff6a79392233475dabac74422d94469f64354.zip
Fix animation not replacing itself
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java16
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java39
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java46
3 files changed, 91 insertions, 10 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
index 8b24371965..7d0b3252df 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java
@@ -46,9 +46,10 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(starLayer0);
- float starRed = 1.0f;
- float starGreen = 1.0f;
- float starBlue = 1.0f;
+
+ float starRed = EOHRenderTile.getColour().getRed() / 255.0f;
+ float starGreen = EOHRenderTile.getColour().getGreen() / 255.0f;
+ float starBlue = EOHRenderTile.getColour().getBlue() / 255.0f;
GL11.glScalef(scale, scale, scale);
@@ -84,11 +85,16 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
-
GL11.glColor4d(starRed, starGreen, starBlue, 0.1F);
-
GL11.glPopMatrix();
+
+ if (!tile.getWorldObj().isRemote)
+
+ {
+ // todo check
+ tile.getWorldObj().spawnParticle("reddust", x, y, z, 1.0, 1.0, 1.0);
+ }
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
index d30136f52d..7219e9da2c 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java
@@ -7,6 +7,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
+import java.awt.*;
+
+import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_EyeOfHarmony.errorStar;
+
public class TileEyeOfHarmony extends TileEntity {
// Prevent culling when block is out of frame so model can remain active.
@@ -25,11 +29,20 @@ public class TileEyeOfHarmony extends TileEntity {
private float size = 1;
private float rotationSpeed = 0;
-
+ private Color colour = errorStar;
public void incrementSize() {
size += 1.5f;
}
+
+ public void setColour(Color colour) {
+ this.colour = colour;
+ }
+
+ public Color getColour() {
+ return colour;
+ }
+
public void increaseRotationSpeed() {
rotationSpeed++;
}
@@ -42,21 +55,41 @@ public class TileEyeOfHarmony extends TileEntity {
return rotationSpeed;
}
- private static final String rotationSpeedNBTTag = "EOH:rotationSpeed";
- private static final String sizeNBTTag = "EOH:size";
+ private static final String EOHNBTTag = "EOH:";
+ private static final String rotationSpeedNBTTag = EOHNBTTag + "rotationSpeed";
+ private static final String sizeNBTTag = EOHNBTTag + "size";
+ private static final String sizeRedNBTTag = EOHNBTTag + "red";
+ private static final String sizeGreenNBTTag = EOHNBTTag + "green";
+ private static final String sizeBlueNBTTag = EOHNBTTag + "blue";
+
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
+
+ // Save other stats.
compound.setFloat(rotationSpeedNBTTag, rotationSpeed);
compound.setFloat(sizeNBTTag, size);
+
+ // Save colour info.
+ compound.setInteger(sizeRedNBTTag, colour.getRed());
+ compound.setInteger(sizeGreenNBTTag, colour.getBlue());
+ compound.setInteger(sizeBlueNBTTag, colour.getGreen());
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
+
+ // Load other stats.
rotationSpeed = compound.getFloat(rotationSpeedNBTTag);
size = compound.getFloat(sizeNBTTag);
+
+ // Load colour info.
+ int red = compound.getInteger(sizeRedNBTTag);
+ int green = compound.getInteger(sizeGreenNBTTag);
+ int blue = compound.getInteger(sizeBlueNBTTag);
+ colour = new Color(red, green, blue);
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
index dfbd1098e6..c55d0df22b 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java
@@ -41,7 +41,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME;
+
+import java.awt.*;
import java.util.*;
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
@@ -1782,10 +1786,47 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
double zOffset = 16 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
double yOffset = 16 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
+ this.getBaseMetaTileEntity().getWorld().setBlock((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset), Blocks.air);
this.getBaseMetaTileEntity().getWorld().setBlock((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset), eyeOfHarmonyRenderBlock);
TileEyeOfHarmony rendererTileEntity = (TileEyeOfHarmony) this.getBaseMetaTileEntity().getWorld().getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset));
- rendererTileEntity.setSize(100);
- rendererTileEntity.setRotationSpeed(100);
+
+ int recipeSpacetimeTier = (int) currentRecipe.getSpacetimeCasingTierRequired();
+
+ // Star is a larger size depending on the spacetime tier of the recipe.
+ rendererTileEntity.setSize((1 + recipeSpacetimeTier) * 0.5f);
+ // Star rotates faster the higher tier time dilation you use in the multi.
+ rendererTileEntity.setRotationSpeed((float) pow(2, 8-timeAccelerationFieldMetadata));
+ Color colour = getStarColour(recipeSpacetimeTier);
+ rendererTileEntity.setColour(colour);
+ }
+
+ private static final Color redStar = new Color(255, 0, 50);
+ private static final Color orangeStar = new Color(255, 102, 0);
+ private static final Color blueStar = new Color(96, 152, 234);
+ private static final Color whiteStar = new Color(200, 200, 200);
+ private static final Color blackStar = new Color(17, 8, 8);
+ public static final Color errorStar = new Color(222, 0, 255);
+
+ Color getStarColour(final int tier) {
+ switch (tier) {
+ case 0:
+ case 1:
+ return redStar;
+ case 2:
+ case 3:
+ return orangeStar;
+ case 4:
+ case 5:
+ return blueStar;
+ case 6:
+ case 7:
+ case 8:
+ return whiteStar;
+ case 9:
+ return blackStar;
+ default:
+ return errorStar;
+ }
}
private double successChance;
@@ -1828,6 +1869,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
super.outputAfterRecipe_EM();
}
+ // todo probably remove me.
private void pushComputation() {
if (computationStack.size() == computationTickCacheSize) {
computationStack.remove(0);