Helix tree blocks & cubozoa rotations (WIP)

This commit is contained in:
paulevsGitch 2020-12-09 23:06:55 +03:00
parent 03b2f912b6
commit 27668f27a1
8 changed files with 14 additions and 0 deletions

View file

@ -8,7 +8,9 @@ import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.entity.feature.EyesFeatureRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
import ru.betterend.BetterEnd;
import ru.betterend.entity.EntityCubozoa;
import ru.betterend.entity.model.ModelEntityCubozoa;
@ -54,6 +56,15 @@ public class RendererEntityCubozoa extends MobEntityRenderer<EntityCubozoa, Mode
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(j));
}*/
@Override
protected void setupTransforms(EntityCubozoa squidEntity, MatrixStack matrixStack, float f, float g, float h) {
Vec3d velocity = squidEntity.getVelocity();
Vec3d flat = new Vec3d(velocity.getX(), 0, velocity.getZ());
float angle = (float) Math.acos(velocity.dotProduct(flat) / (velocity.length() * flat.length()));
matrixStack.multiply(Vector3f.POSITIVE_X.getRadialQuaternion(angle));
//matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(squidEntity.yaw));
}
static {
TEXTURE[0] = BetterEnd.makeID("textures/entity/cubozoa/cubozoa.png");
TEXTURE[1] = BetterEnd.makeID("textures/entity/cubozoa/cubozoa_sulphur.png");