This commit is contained in:
gnembon committed 2022-10-26 23:26:27 +02:00
1 parent 1c2b1dfa2a
commit e0b6aae07b
9 files changed
+30 -30

No files matched your search

@@ -988,7 +988,7 @@ public class WorldAccess {
// copy of ServerWorld.createExplosion #TRACK#
Explosion explosion = new Explosion(cc.s.getLevel(), source, null, null, pos.x, pos.y, pos.z, powah, createFire, mode){
@Override
public @Nullable LivingEntity getSourceMob() {
public @Nullable LivingEntity getIndirectSourceEntity() {
return theAttacker;
}
};
@@ -13,7 +13,7 @@ import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat.Mode;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import java.util.HashMap;
import java.util.Locale;
@@ -283,9 +283,9 @@ public class ShapesRenderer
matrices.translate(v1.x - cx, v1.y - cy, v1.z - cz);
ShapeDirection.rotatePoseStackByShapeDirection(matrices, shape.facing, camera1, isitem ? v1 : v1.add(0.5, 0.5, 0.5));
if (shape.tilt != 0.0f) matrices.mulPose(Vector3f.ZP.rotationDegrees(-shape.tilt));
if (shape.lean != 0.0f) matrices.mulPose(Vector3f.XP.rotationDegrees(-shape.lean));
if (shape.turn != 0.0f) matrices.mulPose(Vector3f.YP.rotationDegrees( shape.turn));
if (shape.tilt != 0.0f) matrices.mulPose(Axis.ZP.rotationDegrees(-shape.tilt));
if (shape.lean != 0.0f) matrices.mulPose(Axis.XP.rotationDegrees(-shape.lean));
if (shape.turn != 0.0f) matrices.mulPose(Axis.YP.rotationDegrees( shape.turn));
matrices.scale(shape.scaleX, shape.scaleY, shape.scaleZ);
if (!isitem)
@@ -295,7 +295,7 @@ public class ShapesRenderer
}
else {
// items seems to be flipped by default
matrices.mulPose(Vector3f.YP.rotationDegrees(180));
matrices.mulPose(Axis.YP.rotationDegrees(180));
}
RenderSystem.depthMask(true);
@@ -447,9 +447,9 @@ public class ShapesRenderer
matrices.scale(shape.size* 0.0025f, -shape.size*0.0025f, shape.size*0.0025f);
//RenderSystem.scalef(shape.size* 0.0025f, -shape.size*0.0025f, shape.size*0.0025f);
if (shape.tilt!=0.0f) matrices.mulPose(Vector3f.ZP.rotationDegrees(shape.tilt));
if (shape.lean!=0.0f) matrices.mulPose(Vector3f.XP.rotationDegrees(shape.lean));
if (shape.turn!=0.0f) matrices.mulPose(Vector3f.YP.rotationDegrees(shape.turn));
if (shape.tilt!=0.0f) matrices.mulPose(Axis.ZP.rotationDegrees(shape.tilt));
if (shape.lean!=0.0f) matrices.mulPose(Axis.XP.rotationDegrees(shape.lean));
if (shape.turn!=0.0f) matrices.mulPose(Axis.YP.rotationDegrees(shape.turn));
matrices.translate(-10*shape.indent, -10*shape.height-9, (-10*renderEpsilon)-10*shape.raise);
//if (visibleThroughWalls) RenderSystem.disableDepthTest();
matrices.scale(-1, 1, 1);
@@ -1,7 +1,7 @@
package carpet.script.utils.shapes;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.minecraft.client.Camera;
import net.minecraft.world.phys.Vec3;
@@ -34,11 +34,11 @@ public enum ShapeDirection {
public static void rotatePoseStackByShapeDirection(PoseStack poseStack, ShapeDirection shapeDirection, Camera camera, Vec3 objectPos) {
switch (shapeDirection) {
case NORTH -> {}
case SOUTH -> poseStack.mulPose(Vector3f.YP.rotationDegrees(180));
case EAST -> poseStack.mulPose(Vector3f.YP.rotationDegrees(270));
case WEST -> poseStack.mulPose(Vector3f.YP.rotationDegrees(90));
case UP -> poseStack.mulPose(Vector3f.XP.rotationDegrees(90));
case DOWN -> poseStack.mulPose(Vector3f.XP.rotationDegrees(-90));
case SOUTH -> poseStack.mulPose(Axis.YP.rotationDegrees(180));
case EAST -> poseStack.mulPose(Axis.YP.rotationDegrees(270));
case WEST -> poseStack.mulPose(Axis.YP.rotationDegrees(90));
case UP -> poseStack.mulPose(Axis.XP.rotationDegrees(90));
case DOWN -> poseStack.mulPose(Axis.XP.rotationDegrees(-90));
case CAMERA -> poseStack.mulPose(camera.rotation());
case PLAYER -> {
final Vec3 vector = objectPos.subtract(camera.getPosition());
@@ -52,8 +52,8 @@ public enum ShapeDirection {
// that should work somehow but it doesn't for some reason
//matrices.mulPose(new Quaternion( -rotY, rotX, 0, false));
poseStack.mulPose(Vector3f.YP.rotation(rotX));
poseStack.mulPose(Vector3f.XP.rotation(-rotY));
poseStack.mulPose(Axis.YP.rotation(rotX));
poseStack.mulPose(Axis.XP.rotation(-rotY));
}
}
}