GraphicsPreset.java

net.minecraft.client.GraphicsPreset

信息

  • 全限定名:net.minecraft.client.GraphicsPreset
  • 类型:public enum
  • 包:net.minecraft.client
  • 源码路径:src/main/java/net/minecraft/client/GraphicsPreset.java
  • 起始行号:L16
  • 实现:StringRepresentable
  • 职责:

    TODO

字段/常量

  • FAST, FANCY, FABULOUS, CUSTOM

    • 类型: GraphicsPreset
    • 修饰符: package-private
    • 源码定位: L17
    • 说明:

      TODO

  • serializedName

    • 类型: String
    • 修饰符: private final
    • 源码定位: L22
    • 说明:

      TODO

  • key

    • 类型: String
    • 修饰符: private final
    • 源码定位: L23
    • 说明:

      TODO

  • CODEC

    • 类型: Codec<GraphicsPreset>
    • 修饰符: public static final
    • 源码定位: L24
    • 说明:

      TODO

内部类/嵌套类型

构造器

private GraphicsPreset(String serializedName, String key) @ L26

  • 构造器名:GraphicsPreset
  • 源码定位:L26
  • 修饰符:private

参数:

  • serializedName: String
  • key: String

说明:

TODO

方法

下面的方法块按源码顺序生成。

public String getSerializedName() @ L31

  • 方法名:getSerializedName
  • 源码定位:L31
  • 返回类型:String
  • 修饰符:public

参数:

说明:

TODO

public String getKey() @ L36

  • 方法名:getKey
  • 源码定位:L36
  • 返回类型:String
  • 修饰符:public

参数:

说明:

TODO

public void apply(Minecraft minecraft) @ L40

  • 方法名:apply
  • 源码定位:L40
  • 返回类型:void
  • 修饰符:public

参数:

  • minecraft: Minecraft

说明:

TODO

<T> void set(OptionsSubScreen screen, OptionInstance<T> option, T value) @ L113

  • 方法名:set
  • 源码定位:L113
  • 返回类型: void
  • 修饰符:package-private

参数:

  • screen: OptionsSubScreen
  • option: OptionInstance
  • value: T

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public enum GraphicsPreset implements StringRepresentable {
    FAST("fast", "options.graphics.fast"),
    FANCY("fancy", "options.graphics.fancy"),
    FABULOUS("fabulous", "options.graphics.fabulous"),
    CUSTOM("custom", "options.graphics.custom");
 
    private final String serializedName;
    private final String key;
    public static final Codec<GraphicsPreset> CODEC = StringRepresentable.fromEnum(GraphicsPreset::values);
 
    private GraphicsPreset(String serializedName, String key) {
        this.serializedName = serializedName;
        this.key = key;
    }
 
    @Override
    public String getSerializedName() {
        return this.serializedName;
    }
 
    public String getKey() {
        return this.key;
    }
 
    public void apply(Minecraft minecraft) {
        OptionsSubScreen screen = minecraft.screen instanceof OptionsSubScreen ? (OptionsSubScreen)minecraft.screen : null;
        GpuDevice device = RenderSystem.getDevice();
        switch (this) {
            case FAST: {
                int viewDistance = 8;
                this.set(screen, minecraft.options.biomeBlendRadius(), 1);
                this.set(screen, minecraft.options.renderDistance(), 8);
                this.set(screen, minecraft.options.prioritizeChunkUpdates(), PrioritizeChunkUpdates.NONE);
                this.set(screen, minecraft.options.simulationDistance(), 6);
                this.set(screen, minecraft.options.ambientOcclusion(), false);
                this.set(screen, minecraft.options.cloudStatus(), CloudStatus.FAST);
                this.set(screen, minecraft.options.particles(), ParticleStatus.DECREASED);
                this.set(screen, minecraft.options.mipmapLevels(), 2);
                this.set(screen, minecraft.options.entityShadows(), false);
                this.set(screen, minecraft.options.entityDistanceScaling(), 0.75);
                this.set(screen, minecraft.options.menuBackgroundBlurriness(), 2);
                this.set(screen, minecraft.options.cloudRange(), 32);
                this.set(screen, minecraft.options.cutoutLeaves(), false);
                this.set(screen, minecraft.options.improvedTransparency(), false);
                this.set(screen, minecraft.options.weatherRadius(), 5);
                this.set(screen, minecraft.options.maxAnisotropyBit(), 1);
                this.set(screen, minecraft.options.textureFiltering(), TextureFilteringMethod.NONE);
                break;
            }
            case FANCY: {
                int viewDistance = 16;
                this.set(screen, minecraft.options.biomeBlendRadius(), 2);
                this.set(screen, minecraft.options.renderDistance(), 16);
                this.set(screen, minecraft.options.prioritizeChunkUpdates(), PrioritizeChunkUpdates.PLAYER_AFFECTED);
                this.set(screen, minecraft.options.simulationDistance(), 12);
                this.set(screen, minecraft.options.ambientOcclusion(), true);
                this.set(screen, minecraft.options.cloudStatus(), CloudStatus.FANCY);
                this.set(screen, minecraft.options.particles(), ParticleStatus.ALL);
                this.set(screen, minecraft.options.mipmapLevels(), 4);
                this.set(screen, minecraft.options.entityShadows(), true);
                this.set(screen, minecraft.options.entityDistanceScaling(), 1.0);
                this.set(screen, minecraft.options.menuBackgroundBlurriness(), 5);
                this.set(screen, minecraft.options.cloudRange(), 64);
                this.set(screen, minecraft.options.cutoutLeaves(), true);
                this.set(screen, minecraft.options.improvedTransparency(), false);
                this.set(screen, minecraft.options.weatherRadius(), 10);
                this.set(screen, minecraft.options.maxAnisotropyBit(), 1);
                this.set(screen, minecraft.options.textureFiltering(), TextureFilteringMethod.RGSS);
                break;
            }
            case FABULOUS: {
                int viewDistance = 32;
                this.set(screen, minecraft.options.biomeBlendRadius(), 2);
                this.set(screen, minecraft.options.renderDistance(), 32);
                this.set(screen, minecraft.options.prioritizeChunkUpdates(), PrioritizeChunkUpdates.PLAYER_AFFECTED);
                this.set(screen, minecraft.options.simulationDistance(), 12);
                this.set(screen, minecraft.options.ambientOcclusion(), true);
                this.set(screen, minecraft.options.cloudStatus(), CloudStatus.FANCY);
                this.set(screen, minecraft.options.particles(), ParticleStatus.ALL);
                this.set(screen, minecraft.options.mipmapLevels(), 4);
                this.set(screen, minecraft.options.entityShadows(), true);
                this.set(screen, minecraft.options.entityDistanceScaling(), 1.25);
                this.set(screen, minecraft.options.menuBackgroundBlurriness(), 5);
                this.set(screen, minecraft.options.cloudRange(), 128);
                this.set(screen, minecraft.options.cutoutLeaves(), true);
                this.set(screen, minecraft.options.improvedTransparency(), Util.getPlatform() != Util.OS.OSX);
                this.set(screen, minecraft.options.weatherRadius(), 10);
                this.set(screen, minecraft.options.maxAnisotropyBit(), 2);
                if (GraphicsWorkarounds.get(device).isAmd()) {
                    this.set(screen, minecraft.options.textureFiltering(), TextureFilteringMethod.RGSS);
                } else {
                    this.set(screen, minecraft.options.textureFiltering(), TextureFilteringMethod.ANISOTROPIC);
                }
            }
        }
    }
 
    <T> void set(@Nullable OptionsSubScreen screen, OptionInstance<T> option, T value) {
        if (option.get() != value) {
            option.set(value);
            if (screen != null) {
                screen.resetOption(option);
            }
        }
    }
}

引用的其他类