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

Commit

Permalink
Fix stuff, properly fix #98 #97
Browse files Browse the repository at this point in the history
  • Loading branch information
AnOpenSauceDev committed May 27, 2024
1 parent 7f13b76 commit 302eaa1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ repositories {

dependencies {

modApi "com.terraformersmc:modmenu:9.0.0"
modApi( "me.shedaniel.cloth:cloth-config-fabric:13.0.121")
modApi "com.terraformersmc:modmenu:10.0.0-beta.1"
modApi( "me.shedaniel.cloth:cloth-config-fabric:14.0.126")
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
yarn_mappings=1.20.6+build.3
loader_version=0.15.11

# Fabric API
fabric_version=0.98.0+1.20.6
fabric_version=0.99.0+1.20.6

# LibMCdev
libmcdev_version=1.4.2
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/modrinth/methane/Methane.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onInitialize() {



if(Methane.settings.destructiveSettings.DestroySky || Methane.settings.destructiveSettings.DestroyWeather || Methane.settings.destructiveSettings.destructiveweatheroptimizations || Methane.settings.destructiveSettings.RenderLayerSkips){
if(Methane.settings.destructiveSettings.DestroyWeather || Methane.settings.destructiveSettings.destructiveweatheroptimizations || Methane.settings.destructiveSettings.RenderLayerSkips){
Methane.MethaneLogger.warn("One or more destructive Methane renderer features are being used. You might experience unusual bugs with other mods.");
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/modrinth/methane/MethaneSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public static class DestructiveSettings{
@Comment("Whether or not we calculate rainfall in biomes (breaks a lot of rain effects, but has performance benefits)")
public boolean destructiveweatheroptimizations = false;

@Comment("Deletes the sky (NOT the same as sky fog), and gives a small performance boost. Will also remove the sun + moon")
public boolean DestroySky;

@Comment("Forcefully deletes weather.")
public boolean DestroyWeather;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.modrinth.methane.mixin;

import com.modrinth.methane.Methane;
import net.minecraft.world.chunk.light.ChunkLightProvider;
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.CallbackInfoReturnable;

@Mixin(ChunkLightProvider.class)
public class ChunkLightProviderMixin {

@Inject(method = "doLightUpdates", at = @At("HEAD"),cancellable = true)
public void hack(CallbackInfoReturnable<Integer> cir){

if(!Methane.settings.useOldLightingEngine && Methane.ModActive){
cir.cancel();
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import com.modrinth.methane.Methane;
import net.minecraft.client.MinecraftClient;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.scoreboard.ScoreboardDisplaySlot;
import net.minecraft.scoreboard.ScoreboardEntry;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkSectionPos;
import net.minecraft.world.HeightLimitView;
Expand Down Expand Up @@ -42,12 +45,13 @@ boolean isNotInSinglePlayer(){ // we lose out on a lot of performance, but savin
@Inject(method = "doLightUpdates",at =@At("HEAD"),cancellable = true)
public void doLightUpdates(CallbackInfoReturnable<Integer> cir) {
if(Methane.ModActive && !Methane.settings.useOldLightingEngine)
cir.cancel();
cir.setReturnValue(0);
}

@Inject(method = "getLight", at = @At("HEAD"),cancellable = true)
public void forceLight(BlockPos pos, int ambientDarkness, CallbackInfoReturnable<Integer> cir){
if(Methane.ModActive) {
cir.setReturnValue(15);
cir.cancel();
}
}
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/com/modrinth/methane/mixin/WorldRendererMixin.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.modrinth.methane.mixin;

import com.modrinth.methane.Methane;
import com.modrinth.methane.MethaneSettings;
import net.minecraft.block.BlockRenderType;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -14,15 +11,6 @@
@Mixin(value = WorldRenderer.class,priority = 1000)
public class WorldRendererMixin {

/*
@Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At("HEAD"),cancellable = true)
public void deletesky(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback, CallbackInfo ci){
if(Methane.settings.destructiveSettings.DestroySky)
ci.cancel();
}
*/

@Inject(method = "renderWeather", at = @At("HEAD"),cancellable = true)
public void delWeather(LightmapTextureManager manager, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci){
if(Methane.settings.destructiveSettings.DestroyWeather)
Expand All @@ -37,6 +25,7 @@ public void debugDeleteLayers(RenderLayer renderLayer, double x, double y, doubl
Methane.MethaneDebugger.LogWarning("skipped renderlayer + " + renderLayer);
ci.cancel();
}

}


Expand Down
1 change: 1 addition & 0 deletions src/main/resources/methane.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"compatibilityLevel": "JAVA_17",
"mixins": [
"BackgroundRendererMixin",
"ChunkLightProviderMixin",
"GameRendererMixin",
"LightingProviderMixin",
"LightmapTextureManagerMixin",
Expand Down

0 comments on commit 302eaa1

Please sign in to comment.