-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed create valuebox rendering on ships (#637)
- Loading branch information
Showing
7 changed files
with
45 additions
and
51 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...on/src/main/java/org/valkyrienskies/mod/mixin/mod_compat/create/client/MixinValueBox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.valkyrienskies.mod.mixin.mod_compat.create.client; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBox; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.core.BlockPos; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.valkyrienskies.core.api.ships.ClientShip; | ||
import org.valkyrienskies.mod.common.VSClientGameUtils; | ||
|
||
@Mixin(ValueBox.class) | ||
public class MixinValueBox { | ||
|
||
@Shadow | ||
protected BlockPos pos; | ||
|
||
@WrapOperation( | ||
method = "render", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(DDD)V", | ||
ordinal = 0 | ||
) | ||
) | ||
public void wrapOpTranslate(final PoseStack instance, final double x, final double y, final double z, final Operation<Void> operation) { | ||
final ClientShip ship = VSClientGameUtils.getClientShip(x, y, z); | ||
if (ship != null) { | ||
final var camera = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); | ||
VSClientGameUtils.transformRenderWithShip(ship.getRenderTransform(), instance, pos.getX(),pos.getY(),pos.getZ(), camera.x, camera.y, camera.z ); | ||
} else { | ||
operation.call(instance, x, y, z); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
...src/main/java/org/valkyrienskies/mod/fabric/mixin/compat/create/client/MixinValueBox.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
.../src/main/java/org/valkyrienskies/mod/forge/mixin/compat/create/client/MixinValueBox.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters