From 8d1bb401d4351b6307130239229d83adda0fc441 Mon Sep 17 00:00:00 2001 From: StewStrong Date: Thu, 26 Sep 2024 22:23:48 -0700 Subject: [PATCH] It do run now tho :running: --- fabric/build.gradle | 10 +- .../trackOutlines/MixinTrackBlockOutline.java | 134 ------------------ .../valkyrienskies-fabric.mixins.json | 1 - forge/build.gradle | 6 +- .../trackOutlines/MixinTrackBlockOutline.java | 128 ----------------- .../valkyrienskies-forge.mixins.json | 1 - 6 files changed, 10 insertions(+), 270 deletions(-) delete mode 100644 fabric/src/main/java/org/valkyrienskies/mod/fabric/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java delete mode 100644 forge/src/main/java/org/valkyrienskies/mod/forge/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java diff --git a/fabric/build.gradle b/fabric/build.gradle index 0656e9102..e009120ce 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -72,13 +72,13 @@ dependencies { include("com.fasterxml:classmate:1.5.1") implementation("com.fasterxml:classmate:1.5.1") - // CC Restitched - //modImplementation("curse.maven:cc-restitched-462672:3908334"){ - // exclude module: "jsonschema.module.addon" - //} // CC Restitched - modImplementation("maven.modrinth:cc-tweaked:${cc_tweaked_version}") + modCompileOnly("maven.modrinth:cc-tweaked:${cc_tweaked_version}") + + // EMF compat + modImplementation("curse.maven:entity-model-features-844662:5696901") + modImplementation("curse.maven:entity-texture-features-fabric-568563:5697084") // Create compat modCompileOnly("com.simibubi.create:create-fabric-${minecraft_version}:${create_fabric_version}") { diff --git a/fabric/src/main/java/org/valkyrienskies/mod/fabric/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java b/fabric/src/main/java/org/valkyrienskies/mod/fabric/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java deleted file mode 100644 index 83ad26a3a..000000000 --- a/fabric/src/main/java/org/valkyrienskies/mod/fabric/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.valkyrienskies.mod.fabric.mixin.compat.create.client.trackOutlines; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.simibubi.create.content.trains.track.TrackBlockOutline; -import com.simibubi.create.content.trains.track.TrackBlockOutline.BezierPointSelection; -import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.Vec3; -import org.joml.Quaterniond; -import org.joml.Vector3d; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.valkyrienskies.core.api.ships.ClientShip; -import org.valkyrienskies.core.api.ships.Ship; -import org.valkyrienskies.mod.common.VSClientGameUtils; -import org.valkyrienskies.mod.common.VSGameUtilsKt; -import org.valkyrienskies.mod.common.util.VectorConversionsMCKt; - -@Mixin(TrackBlockOutline.class) -public class MixinTrackBlockOutline { - @Unique - private static Vec3 valkyrienskies$cameraVec3; - @Unique - private static Vec3 valkyrienskies$vec; - @Unique - private static Vec3 valkyrienskies$angles; - - @Inject(method = "drawCurveSelection", - at = @At(value = "INVOKE", - target = "Lcom/simibubi/create/content/trains/track/TrackBlockOutline$BezierPointSelection;angles()Lnet/minecraft/world/phys/Vec3;"), - locals = LocalCapture.CAPTURE_FAILHARD) - private static void harvestDrawCurveSelection(final PoseStack ms, final MultiBufferSource buffer, final Vec3 camera, - final CallbackInfo ci, final Minecraft mc, - final BezierPointSelection result, final VertexConsumer vb, final Vec3 vec) { - valkyrienskies$cameraVec3 = camera; - valkyrienskies$vec = result.vec(); - valkyrienskies$angles = result.angles(); - } - @ModifyArg(method = "drawCurveSelection", - at = @At(value = "INVOKE", - target = "Lcom/simibubi/create/content/trains/track/TrackBlockOutline;renderShape(Lnet/minecraft/world/phys/shapes/VoxelShape;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Ljava/lang/Boolean;)V"), - index = 1) - private static PoseStack redirectTransformStackTranslate(final PoseStack ms) { - - final Level level = Minecraft.getInstance().level; - if (level != null && valkyrienskies$vec != null) { - final ClientShip ship; - if ((ship = (ClientShip) VSGameUtilsKt.getShipManagingPos(level, valkyrienskies$vec)) != null) { - final Quaterniond rotation = new Quaterniond().identity(); - final Quaterniond yawQuat = new Quaterniond().rotateY(valkyrienskies$angles.y); - final Quaterniond pitchQuat = new Quaterniond().rotateX(valkyrienskies$angles.x); - - yawQuat.mul(pitchQuat, rotation); - ship.getRenderTransform().getShipToWorldRotation().mul(rotation, rotation); - - final Vector3d worldVec = ship.getRenderTransform().getShipToWorld() - .transformPosition( - new Vector3d(valkyrienskies$vec.x, valkyrienskies$vec.y + .125, valkyrienskies$vec.z), - new Vector3d()); - - ms.popPose(); - ms.pushPose(); - ms.translate(worldVec.x - valkyrienskies$cameraVec3.x, - worldVec.y - valkyrienskies$cameraVec3.y, - worldVec.z - valkyrienskies$cameraVec3.z); - ms.mulPose(VectorConversionsMCKt.toFloat(rotation)); - ms.translate(-.5, -.125f, -.5); - } - } - return ms; - } - - @Unique - private static Camera valkyrienskies$info; - @Unique - private static BlockHitResult valkyrienskies$hitResult; - - @ModifyArg(method = "drawCustomBlockSelection", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/level/border/WorldBorder;isWithinBounds(Lnet/minecraft/core/BlockPos;)Z")) - private static BlockPos modIsWithinBounds(final BlockPos blockPos) { - final Level level = Minecraft.getInstance().level; - if (level != null) { - final Ship ship; - if ((ship = VSGameUtilsKt.getShipManagingPos(level, blockPos)) != null) { - return BlockPos.containing(VectorConversionsMCKt.toMinecraft(ship.getShipToWorld() - .transformPosition(VectorConversionsMCKt.toJOMLD(blockPos)))); - } - } - return blockPos; - } - - @Inject(method = "drawCustomBlockSelection", - at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(DDD)V")) - private static void harvest(final LevelRenderer context, final Camera info, final HitResult hitResult, - final float partialTicks, - final PoseStack ms, final MultiBufferSource buffers, final CallbackInfoReturnable cir) { - valkyrienskies$info = info; - valkyrienskies$hitResult = (BlockHitResult) hitResult; - } - - @Redirect(method = "drawCustomBlockSelection", - at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(DDD)V")) - private static void redirectTranslate(final PoseStack instance, final double d, final double e, final double f) { - final Level level = Minecraft.getInstance().level; - if (level != null) { - final ClientShip ship; - if ((ship = (ClientShip) VSGameUtilsKt.getShipManagingPos(level, - valkyrienskies$hitResult.getBlockPos())) != null) { - final Vec3 camPos = valkyrienskies$info.getPosition(); - VSClientGameUtils.transformRenderWithShip(ship.getRenderTransform(), instance, - valkyrienskies$hitResult.getBlockPos(), - camPos.x, camPos.y, camPos.z); - } else { - instance.translate(d, e, f); - } - } else { - instance.translate(d, e, f); - } - } -} diff --git a/fabric/src/main/resources/valkyrienskies-fabric.mixins.json b/fabric/src/main/resources/valkyrienskies-fabric.mixins.json index 5683e9c76..a94f08387 100644 --- a/fabric/src/main/resources/valkyrienskies-fabric.mixins.json +++ b/fabric/src/main/resources/valkyrienskies-fabric.mixins.json @@ -7,7 +7,6 @@ "compat.create.MixinBlocks", "compat.create.MixinChuteBlockEntity", "compat.create.MixinControlledContraptionEntity", - "compat.create.client.trackOutlines.MixinTrackBlockOutline", "compat.create.client.MixinTrackBlockOutline", "compat.sodium.MixinRenderSectionManager", "feature.explosions.ClipContextMixin", diff --git a/forge/build.gradle b/forge/build.gradle index f0c093699..e07ddb2c9 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -74,11 +74,15 @@ dependencies { // Weather2 1.20.1 modImplementation("curse.maven:weather-storms-tornadoes-237746:5244118") - modImplementation("curse.maven:coroutil-237749:5010129") + modImplementation("curse.maven:coroutil-237749:5096038") // CC Tweaked modCompileOnly("maven.modrinth:cc-tweaked:${cc_tweaked_version}") + // EMF compat + modImplementation("curse.maven:entity-model-features-844662:5696899") + modImplementation("curse.maven:entity-texture-features-fabric-568563:5697083") + modCompileOnly("maven.modrinth:create-utilities:0.2.0+1.20.1") modImplementation("teamreborn:energy:${energy_version}") { transitive = false diff --git a/forge/src/main/java/org/valkyrienskies/mod/forge/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java b/forge/src/main/java/org/valkyrienskies/mod/forge/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java deleted file mode 100644 index de52ce15b..000000000 --- a/forge/src/main/java/org/valkyrienskies/mod/forge/mixin/compat/create/client/trackOutlines/MixinTrackBlockOutline.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.valkyrienskies.mod.forge.mixin.compat.create.client.trackOutlines; - -import com.llamalad7.mixinextras.sugar.Local; -import com.mojang.blaze3d.vertex.PoseStack; -import com.simibubi.create.content.trains.track.TrackBlockOutline; -import com.simibubi.create.content.trains.track.TrackBlockOutline.BezierPointSelection; -import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.event.RenderHighlightEvent.Block; -import org.joml.Quaterniond; -import org.joml.Vector3d; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.valkyrienskies.core.api.ships.ClientShip; -import org.valkyrienskies.core.api.ships.Ship; -import org.valkyrienskies.mod.common.VSClientGameUtils; -import org.valkyrienskies.mod.common.VSGameUtilsKt; -import org.valkyrienskies.mod.common.util.VectorConversionsMCKt; - -@Mixin(TrackBlockOutline.class) -public class MixinTrackBlockOutline { - @Unique - private static Vec3 valkyrienskies$cameraVec3; - @Unique - private static Vec3 valkyrienskies$vec; - @Unique - private static Vec3 valkyrienskies$angles; - - @Inject(method = "drawCurveSelection(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/phys/Vec3;)V", - at = @At(value = "INVOKE", - target = "Lcom/simibubi/create/content/trains/track/TrackBlockOutline$BezierPointSelection;angles()Lnet/minecraft/world/phys/Vec3;"), remap = false) - private static void harvestDrawCurveSelection(final PoseStack ms, final MultiBufferSource buffer, final Vec3 camera, final CallbackInfo ci, @Local - final BezierPointSelection result) { - valkyrienskies$cameraVec3 = camera; - valkyrienskies$vec = result.vec(); - valkyrienskies$angles = result.angles(); - } - - @ModifyArg(method = "drawCurveSelection(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/phys/Vec3;)V", - at = @At(value = "INVOKE", - target = "Lcom/simibubi/create/content/trains/track/TrackBlockOutline;renderShape(Lnet/minecraft/world/phys/shapes/VoxelShape;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Ljava/lang/Boolean;)V"), - index = 1, remap = false) - private static PoseStack redirectTransformStackTranslate(final PoseStack ms) { - - final Level level = Minecraft.getInstance().level; - if (level != null && valkyrienskies$vec != null) { - final ClientShip ship; - if ((ship = (ClientShip) VSGameUtilsKt.getShipManagingPos(level, valkyrienskies$vec)) != null) { - final Quaterniond rotation = new Quaterniond().identity(); - final Quaterniond yawQuat = new Quaterniond().rotateY(valkyrienskies$angles.y); - final Quaterniond pitchQuat = new Quaterniond().rotateX(valkyrienskies$angles.x); - - yawQuat.mul(pitchQuat, rotation); - ship.getRenderTransform().getShipToWorldRotation().mul(rotation, rotation); - - final Vector3d worldVec = ship.getRenderTransform().getShipToWorld() - .transformPosition( - new Vector3d(valkyrienskies$vec.x, valkyrienskies$vec.y + .125, valkyrienskies$vec.z), - new Vector3d()); - - ms.popPose(); - ms.pushPose(); - ms.translate(worldVec.x - valkyrienskies$cameraVec3.x, - worldVec.y - valkyrienskies$cameraVec3.y, - worldVec.z - valkyrienskies$cameraVec3.z); - ms.mulPose(VectorConversionsMCKt.toFloat(rotation)); - ms.translate(-.5, -.125f, -.5); - } - } - return ms; - } - - @Unique - private static Camera valkyrienskies$info; - @Unique - private static BlockHitResult valkyrienskies$hitResult; - - @ModifyArg(method = "drawCustomBlockSelection", at = @At(value = "INVOKE", - target = "Lnet/minecraft/world/level/border/WorldBorder;isWithinBounds(Lnet/minecraft/core/BlockPos;)Z")) - private static BlockPos modIsWithinBounds(final BlockPos blockPos) { - final Level level = Minecraft.getInstance().level; - if (level != null) { - final Ship ship; - if ((ship = VSGameUtilsKt.getShipManagingPos(level, blockPos)) != null) { - return BlockPos.containing(VectorConversionsMCKt.toMinecraft(ship.getShipToWorld() - .transformPosition(VectorConversionsMCKt.toJOMLD(blockPos)))); - } - } - return blockPos; - } - - @Inject(method = "drawCustomBlockSelection", - at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(DDD)V")) - private static void harvest(Block event, CallbackInfo ci) { - valkyrienskies$info = event.getCamera(); - valkyrienskies$hitResult = (BlockHitResult) event.getTarget(); - } - - @Redirect(method = "drawCustomBlockSelection", - at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(DDD)V")) - private static void redirectTranslate(final PoseStack instance, final double d, final double e, final double f) { - final Level level = Minecraft.getInstance().level; - if (level != null) { - final ClientShip ship; - if ((ship = (ClientShip) VSGameUtilsKt.getShipManagingPos(level, - valkyrienskies$hitResult.getBlockPos())) != null) { - final Vec3 camPos = valkyrienskies$info.getPosition(); - VSClientGameUtils.transformRenderWithShip(ship.getRenderTransform(), instance, - valkyrienskies$hitResult.getBlockPos(), - camPos.x, camPos.y, camPos.z); - } else { - instance.translate(d, e, f); - } - } else { - instance.translate(d, e, f); - } - } -} diff --git a/forge/src/main/resources/valkyrienskies-forge.mixins.json b/forge/src/main/resources/valkyrienskies-forge.mixins.json index aaec6d70f..07125e96e 100644 --- a/forge/src/main/resources/valkyrienskies-forge.mixins.json +++ b/forge/src/main/resources/valkyrienskies-forge.mixins.json @@ -7,7 +7,6 @@ "compat.create.MixinBlocks", "compat.create.MixinChuteBlockEntity", "compat.create.MixinControlledContraptionEntity", - "compat.create.client.trackOutlines.MixinTrackBlockOutline", "compat.immersivengineering.MixinBlockEntityInventory", "compat.integrateddynamics.MixinVoxelShapeComponents", "compat.modular_routers.MixinRouterMenu",