-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1c3f09
commit c378abd
Showing
7 changed files
with
119 additions
and
7 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.betterfpsdist.mixin; | ||
|
||
import net.minecraftforge.fml.loading.FMLLoader; | ||
import org.objectweb.asm.tree.ClassNode; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; | ||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class MixinConfig implements IMixinConfigPlugin | ||
{ | ||
@Override | ||
public void onLoad(final String mixinPackage) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public String getRefMapperConfig() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean shouldApplyMixin(final String targetClassName, final String mixinClassName) | ||
{ | ||
if (targetClassName.equals("net.minecraft.client.renderer.LevelRenderer")) | ||
{ | ||
return FMLLoader.getLoadingModList().getModFileById("magnesium") == null && | ||
FMLLoader.getLoadingModList().getModFileById("sodium") == null; | ||
} | ||
|
||
return FMLLoader.getLoadingModList().getModFileById("magnesium") != null || | ||
FMLLoader.getLoadingModList().getModFileById("sodium") != null; | ||
} | ||
|
||
@Override | ||
public void acceptTargets(final Set<String> myTargets, final Set<String> otherTargets) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public List<String> getMixins() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public void preApply(final String targetClassName, final ClassNode targetClass, final String mixinClassName, final IMixinInfo mixinInfo) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void postApply(final String targetClassName, final ClassNode targetClass, final String mixinClassName, final IMixinInfo mixinInfo) | ||
{ | ||
|
||
} | ||
} |
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,45 @@ | ||
package com.betterfpsdist.mixin; | ||
|
||
import com.betterfpsdist.config.ConfigurationCache; | ||
import me.jellysquid.mods.sodium.client.render.chunk.RenderSection; | ||
import me.jellysquid.mods.sodium.client.render.chunk.RenderSectionManager; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.core.Direction; | ||
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; | ||
|
||
import static org.spongepowered.asm.mixin.injection.At.Shift.AFTER; | ||
|
||
@Mixin(RenderSectionManager.class) | ||
public class Sodiummixin | ||
{ | ||
@Shadow(remap = false) | ||
private float cameraX; | ||
|
||
@Shadow(remap = false) | ||
private float cameraY; | ||
|
||
@Shadow(remap = false) | ||
private float cameraZ; | ||
|
||
@Inject(method = "addVisible", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/graph/ChunkGraphIterationQueue;add(Lme/jellysquid/mods/sodium/client/render/chunk/RenderSection;Lnet/minecraft/core/Direction;)V", remap = false, shift = AFTER), remap = false, cancellable = true) | ||
private void isWithinRenderDistance(final RenderSection render, final Direction flow, final CallbackInfo ci) | ||
{ | ||
if (distSqr(render.getOriginX(), render.getOriginY(), render.getOriginZ(), cameraX, cameraY, cameraZ) > (Minecraft.getInstance().options.renderDistance * 16) * ( | ||
Minecraft.getInstance().options.renderDistance * 16)) | ||
{ | ||
ci.cancel(); | ||
} | ||
} | ||
|
||
private double distSqr(float fromX, float fromY, float fromZ, float toX, float toY, float toZ) | ||
{ | ||
double d0 = fromX - toX; | ||
double d1 = fromY - toY; | ||
double d2 = fromZ - toZ; | ||
return d0 * d0 + ConfigurationCache.stretch * (d1 * d1) + d2 * d2; | ||
} | ||
} |
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