aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2023-01-02 04:39:43 +0000
committerGTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>2023-01-02 04:39:43 +0000
commit6f7669214cd2036cbe79a08476379e25e5207598 (patch)
treef843862ea2f165d0dabbf9f2ea940e59ae141fe6 /src/main
parent724be45ca70994582ed19f6e5205153fa0a05066 (diff)
downloadGT5-Unofficial-6f7669214cd2036cbe79a08476379e25e5207598.tar.gz
GT5-Unofficial-6f7669214cd2036cbe79a08476379e25e5207598.tar.bz2
GT5-Unofficial-6f7669214cd2036cbe79a08476379e25e5207598.zip
Working rotation with cleaner maths
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java11
-rw-r--r--src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java3
4 files changed, 14 insertions, 8 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java b/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java
index 42cb9a45ed..64261ca12c 100644
--- a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java
+++ b/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java
@@ -17,6 +17,7 @@ public class EyeOfHarmonyBlock extends Block {
public EyeOfHarmonyBlock() {
super(Material.iron);
this.setResistance(20f);
+ this.setHardness(-1.0f);
this.setCreativeTab(TecTech.creativeTabEM);
this.setBlockName("Eye of Harmony Renderer");
this.setLightLevel(100.0f); // todo check
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 6224593a25..3ae0e0f377 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
@@ -13,6 +13,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
+import org.lwjgl.Sys;
import org.lwjgl.opengl.GL11;
public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
@@ -40,9 +41,9 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
if (EOHRenderTile.getOrbitingBody() != null) {
// Render orbiting body.
GL11.glPushMatrix();
- GL11.glRotatef((System.currentTimeMillis() / 32) % 360, 0F, 1F, 0F);
+ GL11.glRotatef((0.1f*EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F);
GL11.glTranslated(-1 - EOHRenderTile.getSize() * pow(1.05f, 2), 0, 0);
- GL11.glRotatef((System.currentTimeMillis() / 2) % 360, 0F, 1F, 0F);
+ GL11.glRotatef((0.1f*EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F);
renderBlockInWorld(EOHRenderTile.getOrbitingBody(), 0, 0.7f);
GL11.glPopMatrix();
}
@@ -107,10 +108,8 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer {
float starBlue = EOHRenderTile.getColour().getBlue() / 255.0f;
GL11.glColor4f(starRed, starGreen, starBlue, alpha);
- // Spin the star around according to the multis time dilation tier.
- if ((int) EOHRenderTile.getRotationSpeed() != 0) {
- GL11.glRotatef((System.currentTimeMillis() / (int) EOHRenderTile.getRotationSpeed()) % 360, 0F, 0F, 1F);
- }
+ // Spin the star around according to the multi time dilation tier.
+ GL11.glRotatef((0.03f * EOHRenderTile.angle * EOHRenderTile.getRotationSpeed()) % 360.0f, 0F, 0F, 1F);
modelCustom.renderAll();
GL11.glDisable(GL11.GL_BLEND);
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 77a4ae5433..a0090d9706 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
@@ -75,6 +75,13 @@ public class TileEyeOfHarmony extends TileEntity {
return rotationSpeed;
}
+ @Override
+ public void updateEntity() {
+ angle += 10.0f;
+ }
+
+ public float angle;
+
private static final String EOHNBTTag = "EOH:";
private static final String rotationSpeedNBTTag = EOHNBTTag + "rotationSpeed";
private static final String sizeNBTTag = EOHNBTTag + "size";
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 10972eb6a4..9f565d5aa0 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
@@ -1794,8 +1794,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl
// Star rotates faster the higher tier time dilation you use in the multi.
// Lower value = faster rotation speed.
- rendererTileEntity.setRotationSpeed(
- (float) pow(2, currentRecipe.getRocketTier() - timeAccelerationFieldMetadata));
+ rendererTileEntity.setRotationSpeed((1 + timeAccelerationFieldMetadata)/2.0f);
// Colour of tier determined by star tier.
Color colour = getStarColour((int) currentRecipe.getRocketTier());