generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
尝试修复矿车预览鬼畜的bug 重构代码拆分了一些mixin 增加了支持在灵魂出窍的情况下移动投影的功能
- Loading branch information
Showing
6 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
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: 23 additions & 0 deletions
23
...asaGadget/mixin/litematica/feature/nudgeSelectionSupportFreeCamera/MixinInputHandler.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,23 @@ | ||
package com.plusls.MasaGadget.mixin.litematica.feature.nudgeSelectionSupportFreeCamera; | ||
|
||
import com.plusls.MasaGadget.MasaGadgetMixinPlugin; | ||
import fi.dy.masa.litematica.event.InputHandler; | ||
import fi.dy.masa.tweakeroo.config.FeatureToggle; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(value = InputHandler.class, remap = false) | ||
public class MixinInputHandler { | ||
@ModifyVariable(method = "nudgeSelection", at = @At(value = "HEAD"), ordinal = 0) | ||
static private PlayerEntity modifyPlayer(PlayerEntity oldPlayerEntity) { | ||
if (MasaGadgetMixinPlugin.isTweakerooLoaded && FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { | ||
return (PlayerEntity) MinecraftClient.getInstance().getCameraEntity(); | ||
} else { | ||
return oldPlayerEntity; | ||
} | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...asaGadget/mixin/tweakeroo/feature/inventoryPreviewSupportFreeCamera/MixinRenderUtils.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,28 @@ | ||
package com.plusls.MasaGadget.mixin.tweakeroo.feature.inventoryPreviewSupportFreeCamera; | ||
|
||
import fi.dy.masa.tweakeroo.config.FeatureToggle; | ||
import fi.dy.masa.tweakeroo.renderer.RenderUtils; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.util.UUID; | ||
|
||
@Mixin(value = RenderUtils.class, remap = false) | ||
public abstract class MixinRenderUtils { | ||
@Redirect(method = "renderInventoryOverlay", | ||
at = @At(value = "INVOKE", | ||
target = "Lnet/minecraft/world/World;getPlayerByUuid(Ljava/util/UUID;)Lnet/minecraft/entity/player/PlayerEntity;", | ||
ordinal = 0, remap = true)) | ||
private static PlayerEntity redirectGetPlayerByUuid(World world, UUID uuid) { | ||
// support free camera | ||
if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { | ||
return (PlayerEntity) MinecraftClient.getInstance().getCameraEntity(); | ||
} else { | ||
return world.getPlayerByUuid(uuid); | ||
} | ||
} | ||
} |
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
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