Skip to content

Commit

Permalink
Set render distance for mob inside mod spawner to 16 blocks (#761)
Browse files Browse the repository at this point in the history
* set render distance for mob inside mod spawner to 16 blocks

* add config in angelica

* add slider in video setting menu
  • Loading branch information
Alexdoru authored Dec 3, 2024
1 parent d66b557 commit 70d15f2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,9 @@ public class AngelicaConfig {
@Config.RangeInt(min = 64, max = 1024)
public static int itemRendererDisplayListCacheSize;

@Config.Comment("Render distance for the spinning mob inside mod spawners")
@Config.DefaultDouble(16D)
@Config.RangeDouble(min = 16D, max = 64D)
public static double mobSpawnerRenderDistance;

}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public enum Mixins {
,"sodium.MixinRenderGlobal"
,"sodium.MixinWorldClient"
,"sodium.MixinTileEntity"
,"sodium.MixinTileEntityMobSpawner"
,"sodium.MixinEffectRenderer"
,"sodium.MixinTileEntityRendererDispatcher"
,"sodium.MixinLongHashMap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ else if(Minecraft.getMinecraft().currentScreen instanceof SodiumOptionsGUI oldGu
.setImpact(OptionImpact.MEDIUM)
.build()
)
.add(
OptionImpl.createBuilder(int.class, angelicaOpts)
.setName(I18n.format("options.angelica.mobSpawnerRenderDistance"))
.setTooltip(I18n.format("options.angelica.mobSpawnerRenderDistance.tooltip"))
.setControl(option -> new SliderControl(option, 16, 64, 1, ControlValueFormatter.number()))
.setBinding((options, value) -> AngelicaConfig.mobSpawnerRenderDistance = value, options -> (int) AngelicaConfig.mobSpawnerRenderDistance)
.setImpact(OptionImpact.MEDIUM)
.build()
)
.build());

return new OptionPage(I18n.format("stat.generalButton"), ImmutableList.copyOf(groups));
Expand All @@ -178,8 +187,10 @@ public static OptionPage quality() {
.setTooltip(I18n.format("sodium.options.graphics_quality.tooltip"))
.setControl(option -> new CyclingControl<>(option, GraphicsMode.class))
.setBinding(
(opts, value) -> { opts.fancyGraphics = value.isFancy();
SettingsManager.graphicsUpdated(); },
(opts, value) -> {
opts.fancyGraphics = value.isFancy();
SettingsManager.graphicsUpdated();
},
opts -> GraphicsMode.fromBoolean(opts.fancyGraphics))
.setImpact(OptionImpact.HIGH)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/angelica/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ options.dynamic_lights_shader_force=Dynamic Lights - Forced With Shaders
options.dynamic_lights_shader_force.tooltip=Enabled - Dynamic Lights are shown even when a shader is active, Disabled - Dynamic Lights are disabled when a shader is active.
options.angelica.droppedItemLimit=Dropped Item Render Limit
options.angelica.droppedItemLimit.tooltip=The maximum number of dropped items that will be rendered. Lower values can improve performance.
options.angelica.mobSpawnerRenderDistance=Mod spawner render distance
options.angelica.mobSpawnerRenderDistance.tooltip=Render distance for the spinning mob inside mod spawners
options.angelica.itemdisplaylistcount=Item Renderer Display List Cache Size
options.angelica.itemdisplaylistcount.tooltip=The maximum number of display lists to cache in the optimized item renderer. Higher values will increase performance but increase VRAM usage.
pack.iris.select.title=Select
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;

import com.gtnewhorizons.angelica.config.AngelicaConfig;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(TileEntityMobSpawner.class)
public class MixinTileEntityMobSpawner extends TileEntity {

@Override
public double getMaxRenderDistanceSquared() {
final double d = AngelicaConfig.mobSpawnerRenderDistance;
return d * d;
}

}

0 comments on commit 70d15f2

Please sign in to comment.