Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Commit

Permalink
toasts fix, use newer libMCdev version.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnOpenSauceDev committed Nov 24, 2023
1 parent e940e40 commit deb529f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ org.gradle.jvmargs=-Xmx1G
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.24
libmcdev_version=1.1.1
libmcdev_version=1.1.2

#Fabric api
fabric_version=0.90.4+1.20.2

# Mod Properties
mod_version=3.1.0
mod_version=3.2.0
maven_group=com.modrinth
archives_base_name=methane

2 changes: 2 additions & 0 deletions src/main/java/com/modrinth/methane/MethaneSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class MethaneSettings implements ConfigData {
@Comment("Use the old Methane lighting 'engine', has a smaller performance boost, but can fix compatibility with some mods and a few bugs.")
public boolean useOldLightingEngine = false;

public boolean disableToasts = true;

@ConfigEntry.Gui.CollapsibleObject
public FogSettings fogSettings = new FogSettings();

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/modrinth/methane/mixin/KillToasts.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
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(value = ToastManager.class,priority = 4500) // take priority over other mixins (and The Open Sauce Toast Killer)
public class KillToasts { // basically the entire source code of The Open Sauce Toast Killer is here.

@Inject(method = "draw",at = @At("HEAD"),cancellable = true)
public void killToasts(DrawContext context, CallbackInfo ci){
//Debug.Log("Killed a toast that tried to draw");
ci.cancel();
if(Methane.settings.disableToasts) ci.cancel();
}

/**
Expand All @@ -28,7 +29,7 @@ public void killToasts(DrawContext context, CallbackInfo ci){
*/
@Overwrite
public void add(Toast toast){
Methane.MethaneDebugger.Log("prevented a toast from loading");
if(Methane.settings.disableToasts) Methane.MethaneDebugger.Log("prevented a toast from loading");
}


Expand All @@ -38,10 +39,9 @@ static class Entry<T extends Toast> { // inner class of ToastManager
* @author AnOpenSauceDev
* @reason remove toast rendering logic
*/
@Overwrite
public boolean draw(int x, DrawContext context) { // lie about drawing
Methane.MethaneDebugger.Log("prevented a toast from drawing!");
return true;
@Inject(method = "draw", at=@At("HEAD"),cancellable = true)
public void draw(int x, DrawContext context, CallbackInfoReturnable<Boolean> cir) { // lie about drawing
if(Methane.settings.disableToasts) cir.setReturnValue(true);
}
}

Expand Down

0 comments on commit deb529f

Please sign in to comment.