Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bootstrap/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"fabricloader": ">=0.12.0",
"minecraft": "${mc_version}",
"compose-multiplatform": "*",
"fabric-language-kotlin": ">=1.13.8+kotlin.2.3.0",
"fabric-api": "*"
"fabric-language-kotlin": ">=1.13.8+kotlin.2.3.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,49 +29,38 @@ public abstract class Mixin_ChatReceiveEvent {
@Unique private Component ocfg$nativeMessage;
@Unique private net.kyori.adventure.text.Component ocfg$postedMessage;

//? if >= 26.1 {
@Inject(
//? if >= 26.1 {
method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/multiplayer/chat/GuiMessageSource;Lnet/minecraft/client/multiplayer/chat/GuiMessageTag;)V",
//?} else {
/*method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/GuiMessageTag;)V",
*///?}
at = @At("HEAD"),
cancellable = true
)
//? if >= 26.1 {
public void chatReceiveCallback(Component message, MessageSignature signature, GuiMessageSource source, GuiMessageTag tag, CallbackInfo ci) {
if (ocfg$post(message)) {
ci.cancel();
}
}

@ModifyVariable(
method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/multiplayer/chat/GuiMessageSource;Lnet/minecraft/client/multiplayer/chat/GuiMessageTag;)V",
at = @At("HEAD"),
ordinal = 0,
argsOnly = true
)
public Component modifyMessage(Component message) {
return ocfg$consume(message);
}
//?} else {
/*@Inject(
method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/GuiMessageTag;)V",
at = @At("HEAD"),
cancellable = true
)
public void chatReceiveCallback(Component message, MessageSignature signature, GuiMessageTag tag, CallbackInfo ci) {
/*public void chatReceiveCallback(Component message, MessageSignature signature, GuiMessageTag tag, CallbackInfo ci) {
*///?}
if (ocfg$post(message)) {
ci.cancel();
}
}

@ModifyVariable(
method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/GuiMessageTag;)V",
//? if >= 26.1 {
method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/multiplayer/chat/GuiMessageSource;Lnet/minecraft/client/multiplayer/chat/GuiMessageTag;)V",
//?} else {
/*method = "addMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/MessageSignature;Lnet/minecraft/client/GuiMessageTag;)V",
*///?}
at = @At("HEAD"),
ordinal = 0,
argsOnly = true
)
public Component modifyMessage(Component message) {
return ocfg$consume(message);
}
*///?}

@Unique
private boolean ocfg$post(Component message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//? if >= 26.2 {
@Mixin(Hud.class)
@Mixin(Hud.class)
//? } else {
/*@Mixin(Gui.class)
*///? }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
//? if >= 1.21.10
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
//? < 26.2 {
/*import net.minecraft.client.renderer.MultiBufferSource;
*///? }
//? if < 1.21.9
//import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.world.entity.LivingEntity;
//? if < 1.21.2
//import net.minecraft.world.entity.LivingEntity;
import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.RenderLivingEvent;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -21,15 +21,9 @@
//? }
//? if >= 1.21.2
import net.minecraft.client.renderer.entity.state.LivingEntityRenderState;
//? if < 1.21.2
//import net.minecraft.client.Minecraft;

@Mixin(LivingEntityRenderer.class)
public class Mixin_RenderLivingEntityEvent<
T extends LivingEntity
//? >= 1.21.2
, S extends LivingEntityRenderState
> {
public class Mixin_RenderLivingEntityEvent {
@Inject(
//? >= 1.21.9 {
//~ if >= 26.1 'state/Camera' -> 'state/level/Camera'
Expand All @@ -41,26 +35,13 @@ public class Mixin_RenderLivingEntityEvent<
at = @At("HEAD"),
cancellable = true
)
private void onPreEntityRenderCallback(
//? >= 1.21.2 {
S entity,
//? } else
//T entity,
//? <= 1.21.1 {
/*float entityYaw,
float partialTicks,
*///? }
//? >= 1.21.9 {
PoseStack matrixStack,
SubmitNodeCollector renderQueue,
CameraRenderState cameraState,
//? } else {
/*PoseStack matrixStack,
MultiBufferSource buffer,
int packedLight,
*///? }
CallbackInfo ci
) {
//? if >= 1.21.9 {
private void onPreEntityRenderCallback(LivingEntityRenderState entity, PoseStack matrixStack, SubmitNodeCollector renderQueue, CameraRenderState cameraState, CallbackInfo ci) {
//?} elif >= 1.21.2 {
/*private void onPreEntityRenderCallback(LivingEntityRenderState entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
*///?} else {
/*private void onPreEntityRenderCallback(LivingEntity entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
*///?}

//? >= 1.21.2 {
double x = entity.x;
Expand Down Expand Up @@ -89,26 +70,13 @@ private void onPreEntityRenderCallback(
//method = "render(Lnet/minecraft/world/entity/LivingEntity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
at = @At("TAIL")
)
private void onPostEntityRenderCallback(
//? >= 1.21.2 {
S entity,
//? } else
//T entity,
//? <= 1.21.1 {
/*float entityYaw,
float partialTicks,
*///? }
//? >= 1.21.9 {
PoseStack matrixStack,
SubmitNodeCollector renderQueue,
CameraRenderState cameraState,
//? } else {
/*PoseStack matrixStack,
MultiBufferSource buffer,
int packedLight,
*///? }
CallbackInfo ci
) {
//? if >= 1.21.9 {
private void onPostEntityRenderCallback(LivingEntityRenderState entity, PoseStack matrixStack, SubmitNodeCollector renderQueue, CameraRenderState cameraState, CallbackInfo ci) {
//?} elif >= 1.21.2 {
/*private void onPostEntityRenderCallback(LivingEntityRenderState entity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
*///?} else {
/*private void onPostEntityRenderCallback(LivingEntity entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
*///?}
//? >= 1.21.2 {
double x = entity.x;
double y = entity.y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ private SoundInstance onPlaySoundCallback(SoundInstance value) {
String name = value.getSound().getLocation().toString();
SoundPlayedEvent event = new SoundPlayedEvent(name, null, value);
EventManager.INSTANCE.post(event);

Object modified = event.getSound();
if (modified instanceof SoundInstance) {
return (SoundInstance) modified;
}
}

return value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package org.polyfrost.oneconfig.internal.mixin.skia;

import com.mojang.blaze3d.platform.Window;
import net.minecraft.client.Minecraft;
import org.polyfrost.oneconfig.internal.ui.compose.SkiaCtx;
import org.polyfrost.oneconfig.internal.ui.compose.SkiaFontRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ public class Mixin_SkiaFrame {
SkiaCtx.INSTANCE.recreateSurface(this.framebufferWidth, this.framebufferHeight);
}

//? if >= 26.1 {
//? } else if >= 1.21.4 {
/*@Inject(method = "updateDisplay(Lcom/mojang/blaze3d/TracyFrameCapture;)V", at = @At("HEAD"))
void impl$onDraw(CallbackInfo ci) {
if (!SkiaCtx.INSTANCE.isVulkanMode()) {
SkiaCtx.INSTANCE.draw();
}
}
*///? } else {
/*@Inject(method = "updateDisplay()V", at = @At("HEAD"))
//? if < 26.1 {
/*//? if >= 1.21.4 {
@Inject(method = "updateDisplay(Lcom/mojang/blaze3d/TracyFrameCapture;)V", at = @At("HEAD"))
//?} else {
/^@Inject(method = "updateDisplay()V", at = @At("HEAD"))
^///?}
void impl$onDraw(CallbackInfo ci) {
if (!SkiaCtx.INSTANCE.isVulkanMode()) {
SkiaCtx.INSTANCE.draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ internal object GLInterfaceFactory {
LibFFI.ffi_type_pointer,
LibFFI.ffi_type_pointer,
)
//? if >=26.1
//? if >= 26.3 {
/*private val DESCRIPTOR: Callback.Descriptor = Callback.Descriptor(GetProcCallbackI::class.java, MethodHandles.lookup(), CALL_INTERFACE)
*///?} elif >= 26.1
private val DESCRIPTOR: Callback.Descriptor = Callback.Descriptor(MethodHandles.lookup(), CALL_INTERFACE)
}
}
Expand Down
3 changes: 2 additions & 1 deletion minecraft/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
},
"depends": {
"fabricloader": ">=0.12.0",
"minecraft": "${fabric_mc_version}"
"minecraft": "${fabric_mc_version}",
"fabric-api": "*"
},
"custom": {
"modmenu": {
Expand Down
Loading