Skip to content

Commit

Permalink
Fix broken item rotations
Browse files Browse the repository at this point in the history
  • Loading branch information
micdoodle8 committed Apr 17, 2020
1 parent f7c93b5 commit f3533a2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
{
if (cameraTransformType == TransformType.GUI)
{
Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F);
Vector3f trans = new Vector3f(-0.15F, 0.0F, -0.15F);
Matrix4f ret = new Matrix4f();
ret.setIdentity();
Matrix4f mul = new Matrix4f();
Expand All @@ -47,7 +47,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
mul.setTranslation(trans);
ret.mul(mul);
mul.setIdentity();
mul.rotY(ClientUtil.getMilliseconds() / 1000.0F);
mul.rotY(ClientUtil.getClientTimeTotal() / 1000.0F);
ret.mul(mul);
mul.setIdentity();
trans.scale(-1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
@SideOnly(Side.CLIENT)
public class ClientUtil
{
public static long getMilliseconds()
public static long getClientTimeTotal()
{
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
return (long) (Minecraft.getMinecraft().world.getTotalWorldTime() * 66.666666666666);
}

public static void addVariant(String modID, String name, String... variants)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
mul.setTranslation(trans);
ret.mul(mul);
mul.setIdentity();
mul.rotY(ClientUtil.getMilliseconds() / 1000.0F);
mul.rotY(ClientUtil.getClientTimeTotal() / 1000.0F);
ret.mul(mul);
mul.setIdentity();
trans.scale(-1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
{
if (cameraTransformType == TransformType.GUI)
{
Vector3f trans = new Vector3f(-0.08F, 0.0F, -0.08F);
Vector3f trans = new Vector3f(-0.15F, 0.0F, -0.15F);
Matrix4f ret = new Matrix4f();
ret.setIdentity();
Matrix4f mul = new Matrix4f();
Expand All @@ -47,7 +47,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
mul.setTranslation(trans);
ret.mul(mul);
mul.setIdentity();
mul.rotY(ClientUtil.getMilliseconds() / 1000.0F);
mul.rotY(ClientUtil.getClientTimeTotal() / 1000.0F);
ret.mul(mul);
mul.setIdentity();
trans.scale(-1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
{
if (cameraTransformType == TransformType.GUI)
{
Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F);
Vector3f trans = new Vector3f(-0.15F, 0.0F, -0.15F);
Matrix4f ret = new Matrix4f();
ret.setIdentity();
Matrix4f mul = new Matrix4f();
Expand All @@ -47,7 +47,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
mul.setTranslation(trans);
ret.mul(mul);
mul.setIdentity();
mul.rotY(ClientUtil.getMilliseconds() / 1000.0F);
mul.rotY(ClientUtil.getClientTimeTotal() / 1000.0F);
ret.mul(mul);
mul.setIdentity();
trans.scale(-1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void onBodyRender(CelestialBodyRenderEvent.Pre renderEvent)
{
if (renderEvent.celestialBody.equals(AsteroidsModule.planetAsteroids))
{
GL11.glRotatef(ClientUtil.getMilliseconds() / 10.0F % 360, 0, 0, 1);
GL11.glRotatef(ClientUtil.getClientTimeTotal() / 10.0F % 360, 0, 0, 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package micdoodle8.mods.galacticraft.planets.mars.client.render.item;

import micdoodle8.mods.galacticraft.core.Constants;
import micdoodle8.mods.galacticraft.core.util.ClientUtil;
import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraftforge.common.model.TRSRTransformation;

import org.lwjgl.Sys;

import javax.vecmath.Matrix4f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3f;
Expand All @@ -24,7 +23,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
{
if (cameraTransformType == TransformType.GUI)
{
Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F);
Vector3f trans = new Vector3f(-0.15F, 0.0F, -0.15F);
Matrix4f ret = new Matrix4f();
ret.setIdentity();
Matrix4f mul = new Matrix4f();
Expand All @@ -48,7 +47,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType)
mul.setTranslation(trans);
ret.mul(mul);
mul.setIdentity();
mul.rotY(Sys.getTime() / 1000.0F);
mul.rotY(ClientUtil.getClientTimeTotal() / 1000.0F);
ret.mul(mul);
mul.setIdentity();
trans.scale(-1.0F);
Expand Down

0 comments on commit f3533a2

Please sign in to comment.