Skip to content

Commit

Permalink
Merge branch '1.20.1/dev' into 1.21.1/dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	neoforge/build.gradle.kts
#	vanillinNeoForge/build.gradle.kts
  • Loading branch information
Jozufozu committed Jan 21, 2025
2 parents 1a89f36 + 5472f1a commit 6fc8d8d
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import net.fabricmc.loom.task.AbstractRemapJarTask
import net.fabricmc.loom.task.RemapJarTask
import net.fabricmc.loom.task.RemapSourcesJarTask
import org.gradle.api.Action
import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.publish.PublishingExtension
Expand All @@ -30,14 +31,23 @@ class JarTaskSet(
val remapSources: TaskProvider<RemapSourcesJarTask>
) {

fun publish(artifactId: String) {
project.the<PublishingExtension>().publications {
register<MavenPublication>("${name}RemapMaven") {
artifact(remapJar)
artifact(remapSources)
artifact(javadocJar)
this.artifactId = artifactId
}
fun publishWithRawSources(action: Action<MavenPublication>): NamedDomainObjectProvider<MavenPublication> {
return publish(sources, action)
}

fun publishWithRemappedSources(action: Action<MavenPublication>): NamedDomainObjectProvider<MavenPublication> {
return publish(remapSources, action)
}

private fun publish(
sourceJar: TaskProvider<out Jar>,
action: Action<MavenPublication>
): NamedDomainObjectProvider<MavenPublication> {
return project.the<PublishingExtension>().publications.register<MavenPublication>("${name}RemapMaven") {
artifact(remapJar)
artifact(sourceJar)
artifact(javadocJar)
action.execute(this)
}
}

Expand Down
37 changes: 35 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ jarSets {
// For publishing.
create("api", api, lib).apply {
addToAssemble()
publish("flywheel-common-intermediary-api-${property("artifact_minecraft_version")}")
publishWithRemappedSources {
artifactId = "flywheel-common-intermediary-api-${property("artifact_minecraft_version")}"
}

configureJar {
manifest {
Expand All @@ -75,7 +77,38 @@ jarSets {
targetNamespace = "named"
}

publish("flywheel-common-mojmap-api-${property("artifact_minecraft_version")}")
publishWithRawSources {
artifactId = "flywheel-common-mojmap-api-${property("artifact_minecraft_version")}"
}
}
}

create("vanillin", vanillin).apply {
addToAssemble()
publishWithRemappedSources {
artifactId = "vanillin-common-intermediary-${property("artifact_minecraft_version")}"
groupId = property("vanillin_group") as String
}

configureJar {
manifest {
attributes("Fabric-Loom-Remap" to "true")
}
}

// Don't publish the un-remapped jars because they don't have the correct manifest populated by Loom.
forkRemap("vanillinMojmap").apply {
addToAssemble()
configureRemap {
// "named" == mojmap
// We're probably remapping from named to named so Loom should noop this.
targetNamespace = "named"
}

publishWithRawSources {
artifactId = "vanillin-common-mojmap-${property("artifact_minecraft_version")}"
groupId = property("vanillin_group") as String
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.engine_room.flywheel.lib.instance;

import org.joml.AxisAngle4f;
import org.joml.Matrix4f;
import org.joml.Matrix4fc;
import org.joml.Quaternionfc;
Expand All @@ -9,6 +10,7 @@
import dev.engine_room.flywheel.api.instance.InstanceHandle;
import dev.engine_room.flywheel.api.instance.InstanceType;
import dev.engine_room.flywheel.lib.transform.Affine;
import net.minecraft.core.Direction;

public class TransformedInstance extends ColoredLitInstance implements Affine<TransformedInstance> {
public final Matrix4f pose = new Matrix4f();
Expand All @@ -17,12 +19,6 @@ public TransformedInstance(InstanceType<? extends TransformedInstance> type, Ins
super(type, handle);
}

@Override
public TransformedInstance rotateAround(Quaternionfc quaternion, float x, float y, float z) {
pose.rotateAround(quaternion, x, y, z);
return this;
}

@Override
public TransformedInstance translate(float x, float y, float z) {
pose.translate(x, y, z);
Expand Down Expand Up @@ -84,4 +80,80 @@ public TransformedInstance setZeroTransform() {
pose.zero();
return this;
}

@Override
public TransformedInstance rotateAround(Quaternionfc quaternion, float x, float y, float z) {
pose.rotateAround(quaternion, x, y, z);
return this;
}

@Override
public TransformedInstance rotateCentered(float radians, float axisX, float axisY, float axisZ) {
pose.translate(Affine.CENTER, Affine.CENTER, Affine.CENTER)
.rotate(radians, axisX, axisY, axisZ)
.translate(-Affine.CENTER, -Affine.CENTER, -Affine.CENTER);
return this;
}

@Override
public TransformedInstance rotateXCentered(float radians) {
pose.translate(Affine.CENTER, Affine.CENTER, Affine.CENTER)
.rotateX(radians)
.translate(-Affine.CENTER, -Affine.CENTER, -Affine.CENTER);
return this;
}

@Override
public TransformedInstance rotateYCentered(float radians) {
pose.translate(Affine.CENTER, Affine.CENTER, Affine.CENTER)
.rotateY(radians)
.translate(-Affine.CENTER, -Affine.CENTER, -Affine.CENTER);
return this;
}

@Override
public TransformedInstance rotateZCentered(float radians) {
pose.translate(Affine.CENTER, Affine.CENTER, Affine.CENTER)
.rotateZ(radians)
.translate(-Affine.CENTER, -Affine.CENTER, -Affine.CENTER);
return this;
}

@Override
public TransformedInstance rotate(float radians, float axisX, float axisY, float axisZ) {
pose.rotate(radians, axisX, axisY, axisZ);
return this;
}

@Override
public TransformedInstance rotate(AxisAngle4f axisAngle) {
pose.rotate(axisAngle);
return this;
}

@Override
public TransformedInstance rotateX(float radians) {
pose.rotateX(radians);
return this;
}

@Override
public TransformedInstance rotateY(float radians) {
pose.rotateY(radians);
return this;
}

@Override
public TransformedInstance rotateZ(float radians) {
pose.rotateZ(radians);
return this;
}

@Override
public TransformedInstance rotateToFace(Direction facing) {
// Need to invert the step because the super default method rotates from North (-Z),
// but rotateTowards rotates from South (+Z)
pose.rotateTowards(-facing.getStepX(), -facing.getStepY(), -facing.getStepZ(), 0, 1, 0);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.mojang.math.Axis;

import net.minecraft.core.Direction;
import net.minecraft.util.Mth;

public interface Affine<Self extends Affine<Self>> extends Translate<Self>, Rotate<Self>, Scale<Self> {
default Self rotateAround(Quaternionfc quaternion, float x, float y, float z) {
Expand All @@ -15,19 +16,18 @@ default Self rotateAround(Quaternionfc quaternion, float x, float y, float z) {
}

default Self rotateAround(Quaternionfc quaternion, Vector3fc vec) {
return translate(vec.x(), vec.y(), vec.z()).rotate(quaternion)
.translateBack(vec.x(), vec.y(), vec.z());
return rotateAround(quaternion, vec.x(), vec.y(), vec.z());
}

default Self rotateCentered(Quaternionfc q) {
return rotateAround(q, CENTER, CENTER, CENTER);
}

default Self rotateCentered(float radians, Vector3fc axis) {
default Self rotateCentered(float radians, float axisX, float axisY, float axisZ) {
if (radians == 0) {
return self();
}
return rotateCentered(new Quaternionf().setAngleAxis(radians, axis.x(), axis.y(), axis.z()));
return rotateCentered(new Quaternionf().setAngleAxis(radians, axisX, axisY, axisZ));
}

default Self rotateCentered(float radians, Axis axis) {
Expand All @@ -37,10 +37,59 @@ default Self rotateCentered(float radians, Axis axis) {
return rotateCentered(axis.rotation(radians));
}

default Self rotateCentered(float radians, Vector3fc axis) {
return rotateCentered(radians, axis.x(), axis.y(), axis.z());
}

default Self rotateCentered(float radians, Direction.Axis axis) {
return rotateCentered(radians, Direction.fromAxisAndDirection(axis, Direction.AxisDirection.POSITIVE));
}

default Self rotateCentered(float radians, Direction axis) {
if (radians == 0) {
return self();
}
return rotateCentered(radians, axis.step());
return rotateCentered(radians, axis.getStepX(), axis.getStepY(), axis.getStepZ());
}

default Self rotateCenteredDegrees(float degrees, float axisX, float axisY, float axisZ) {
return rotateCentered(Mth.DEG_TO_RAD * degrees, axisX, axisY, axisZ);
}

default Self rotateCenteredDegrees(float degrees, Axis axis) {
return rotateCentered(Mth.DEG_TO_RAD * degrees, axis);
}

default Self rotateCenteredDegrees(float degrees, Vector3fc axis) {
return rotateCentered(Mth.DEG_TO_RAD * degrees, axis);
}

default Self rotateCenteredDegrees(float degrees, Direction axis) {
return rotateCentered(Mth.DEG_TO_RAD * degrees, axis);
}

default Self rotateCenteredDegrees(float degrees, Direction.Axis axis) {
return rotateCentered(Mth.DEG_TO_RAD * degrees, axis);
}

default Self rotateXCentered(float radians) {
return rotateCentered(radians, Axis.XP);
}

default Self rotateYCentered(float radians) {
return rotateCentered(radians, Axis.YP);
}

default Self rotateZCentered(float radians) {
return rotateCentered(radians, Axis.ZP);
}

default Self rotateXCenteredDegrees(float degrees) {
return rotateXCentered(Mth.DEG_TO_RAD * degrees);
}

default Self rotateYCenteredDegrees(float degrees) {
return rotateYCentered(Mth.DEG_TO_RAD * degrees);
}

default Self rotateZCenteredDegrees(float degrees) {
return rotateZCentered(Mth.DEG_TO_RAD * degrees);
}
}
Loading

0 comments on commit 6fc8d8d

Please sign in to comment.