forked from Vivecraft/VivecraftMod
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
combine some only slightly differing forge/fabric mixins into the com…
…mon source, with mixin groups move forge model loading to forge events backport forge overlay handling from 1.19
- Loading branch information
Showing
14 changed files
with
107 additions
and
196 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
27 changes: 27 additions & 0 deletions
27
common/src/main/java/org/vivecraft/mixin/client/OptionVRMixin.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,27 @@ | ||
package org.vivecraft.mixin.client; | ||
|
||
import org.spongepowered.asm.mixin.injection.Group; | ||
import org.vivecraft.ClientDataHolder; | ||
import net.minecraft.client.*; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
|
||
@Mixin(Option.class) | ||
public abstract class OptionVRMixin { | ||
|
||
@Group(name = "reinitFrameBuffers", min = 1, max = 1) | ||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;allChanged()V", remap = true), method = "method_32552", remap = false, expect = 0) | ||
private static void reinitFabric(Options options, Option option, GraphicsStatus graphicsStatus, CallbackInfo ci) { | ||
ClientDataHolder.getInstance().vrRenderer.reinitFrameBuffers("gfx setting change"); | ||
} | ||
|
||
@Group(name = "reinitFrameBuffers", min = 1, max = 1) | ||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;allChanged()V",remap = true), method = "m_193661_", remap = false, expect = 0) | ||
private static void reinitForge(Options options, Option option, GraphicsStatus graphicsStatus, CallbackInfo ci) { | ||
ClientDataHolder.getInstance().vrRenderer.reinitFrameBuffers("gfx setting change"); | ||
} | ||
|
||
} |
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
45 changes: 0 additions & 45 deletions
45
fabric/src/main/java/org/vivecraft/fabric/mixin/FabricMinecraftVRMixin.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
fabric/src/main/java/org/vivecraft/fabric/mixin/client/FabricOptionVRMixin.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
22 changes: 22 additions & 0 deletions
22
forge/src/main/java/org/vivecraft/forge/event/ClientEvents.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,22 @@ | ||
package org.vivecraft.forge.event; | ||
|
||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.client.event.ModelRegistryEvent; | ||
import net.minecraftforge.client.model.ForgeModelBakery; | ||
import net.minecraftforge.eventbus.api.SubscribeEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import org.vivecraft.ClientDataHolder; | ||
import org.vivecraft.gameplay.trackers.CameraTracker; | ||
import org.vivecraft.gameplay.trackers.TelescopeTracker; | ||
|
||
@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) | ||
public class ClientEvents { | ||
@SubscribeEvent | ||
public static void registerModels(ModelRegistryEvent event) { | ||
ForgeModelBakery.addSpecialModel(TelescopeTracker.scopeModel); | ||
ForgeModelBakery.addSpecialModel(ClientDataHolder.thirdPersonCameraModel); | ||
ForgeModelBakery.addSpecialModel(ClientDataHolder.thirdPersonCameraDisplayModel); | ||
ForgeModelBakery.addSpecialModel(CameraTracker.cameraModel); | ||
ForgeModelBakery.addSpecialModel(CameraTracker.cameraDisplayModel); | ||
} | ||
} |
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
32 changes: 8 additions & 24 deletions
32
forge/src/main/java/org/vivecraft/forge/mixin/ForgeIngameGuiVRMixin.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 |
---|---|---|
@@ -1,36 +1,20 @@ | ||
package org.vivecraft.forge.mixin; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraftforge.client.gui.ForgeIngameGui; | ||
import net.minecraftforge.client.gui.IIngameOverlay; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ForgeIngameGui.class) | ||
public abstract class ForgeIngameGuiVRMixin { | ||
|
||
@Inject(at = @At("HEAD"), method = "lambda$static$0", remap = false, cancellable = true) | ||
private static void noVignette(CallbackInfo ci) { | ||
ci.cancel(); | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "lambda$static$1", remap = false, cancellable = true) | ||
private static void noSpyglass(CallbackInfo ci) { | ||
ci.cancel(); | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "lambda$static$2", remap = false, cancellable = true) | ||
private static void noHelmet(CallbackInfo ci) { | ||
ci.cancel(); | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "lambda$static$3", remap = false, cancellable = true) | ||
private static void noFreeze(CallbackInfo ci) { | ||
ci.cancel(); | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "lambda$static$4", remap = false, cancellable = true) | ||
private static void noPortal(CallbackInfo ci) { | ||
ci.cancel(); | ||
@Inject(method = "pre(Lnet/minecraftforge/client/gui/IIngameOverlay;Lcom/mojang/blaze3d/vertex/PoseStack;)Z", at = @At("HEAD"), remap = false, cancellable = true) | ||
private void noStuff(IIngameOverlay overlay, PoseStack poseStack, CallbackInfoReturnable<Boolean> info) { | ||
if (overlay == ForgeIngameGui.VIGNETTE_ELEMENT || overlay == ForgeIngameGui.SPYGLASS_ELEMENT || overlay == ForgeIngameGui.HELMET_ELEMENT || overlay == ForgeIngameGui.FROSTBITE_ELEMENT || overlay == ForgeIngameGui.PORTAL_ELEMENT) { | ||
info.setReturnValue(true); | ||
} | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
forge/src/main/java/org/vivecraft/forge/mixin/ForgeMinecraftVRMixin.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
forge/src/main/java/org/vivecraft/forge/mixin/client/ForgeOptionVRMixin.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...src/main/java/org/vivecraft/forge/mixin/client/resources/model/ForgeModelBakeryMixin.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
|
||
], | ||
"client": [ | ||
"client.resources.model.ForgeModelBakeryMixin" | ||
], | ||
"server": [ | ||
], | ||
|
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