Skip to content

Commit

Permalink
feat(day 16): Witchery nature & "Super Secret Settings"
Browse files Browse the repository at this point in the history
  • Loading branch information
sylv256 committed Nov 4, 2024
1 parent 4d943d0 commit a296a14
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 69 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod_name=Legacy Landscape
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=EUPL-1.2
# The mod version. See https://semver.org/
mod_version=0.4.1+1.21.1
mod_version=0.5.0+1.21.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/gay/sylv/legacy_landscape/ClientConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package gay.sylv.legacy_landscape;

import gay.sylv.legacy_landscape.client.SuperSecretSetting;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.neoforge.common.ModConfigSpec;

@EventBusSubscriber(modid = LegacyLandscape.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
public class ClientConfig {
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();

private static final ModConfigSpec.IntValue SUPER_SECRET_SETTINGS = BUILDER
.comment("Super secret settings to enhance your experience.")
.comment("Do not use this setting if you have photosensitive epilepsy or are otherwise sensitive to flashing lights.")
.defineInRange("superSecretSettings", 0, 0, SuperSecretSetting.values().length - 1);

static final ModConfigSpec SPEC = BUILDER.build();

public static SuperSecretSetting superSecretSettings;

@SubscribeEvent
static void onLoad(final ModConfigEvent event)
{
superSecretSettings = SuperSecretSetting.values()[SUPER_SECRET_SETTINGS.get()];
}
}
63 changes: 0 additions & 63 deletions src/main/java/gay/sylv/legacy_landscape/Config.java

This file was deleted.

8 changes: 5 additions & 3 deletions src/main/java/gay/sylv/legacy_landscape/LegacyLandscape.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;

Expand All @@ -35,6 +37,9 @@ public final class LegacyLandscape {
// The constructor for the mod class is the first code that is run when your mod is loaded.
// FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
public LegacyLandscape(IEventBus modBus, ModContainer modContainer) {
modContainer.registerConfig(ModConfig.Type.CLIENT, ClientConfig.SPEC);
modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);

LegacySounds.SOUNDS.register(modBus);
LegacyComponents.DATA_COMPONENTS.register(modBus);
LegacyEffects.MOB_EFFECTS.register(modBus);
Expand All @@ -47,9 +52,6 @@ public LegacyLandscape(IEventBus modBus, ModContainer modContainer) {
LegacyRecipes.TYPES.register(modBus);
LegacyRecipes.SERIALIZERS.register(modBus);
modBus.addListener(this::commonSetup);

// Register our mod's ModConfigSpec so that FML can create and load the config file for us
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
}

public static ResourceLocation id(String path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package gay.sylv.legacy_landscape.client;

public enum SuperSecretSetting {
NONE,
BLUR
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package gay.sylv.legacy_landscape.client.util;

import gay.sylv.legacy_landscape.ClientConfig;
import gay.sylv.legacy_landscape.client.HackedRenderSystem;
import gay.sylv.legacy_landscape.client.SuperSecretSetting;
import gay.sylv.legacy_landscape.mixin.client.Accessor_CompositeRenderType;
import gay.sylv.legacy_landscape.mixin.client.Accessor_CompositeState;
import gay.sylv.legacy_landscape.mixin.client.Accessor_TextureStateShard;
Expand Down Expand Up @@ -54,7 +56,8 @@ public static void setLegacyTextures(RenderType renderType) {
assert compositeState != null;
Accessor_TextureStateShard textureState = (Accessor_TextureStateShard) (compositeState.getTextureState());
if (textureState.getTexture().isPresent()) {
HackedRenderSystem.setShaderTexture(0, textureState.getTexture().get(), textureState.isBlur(), textureState.isMipmap());
boolean blurSetting = ClientConfig.superSecretSettings == SuperSecretSetting.BLUR;
HackedRenderSystem.setShaderTexture(0, textureState.getTexture().get(), textureState.isBlur() || blurSetting, textureState.isMipmap());
}
}
}
7 changes: 6 additions & 1 deletion src/main/resources/assets/legacy_landscape/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@
"commands.legacy_landscape.vanish.cannot_be_applied": "Cannot apply Evanescence to entity.",
"commands.legacy_landscape.vanish.cannot_be_removed": "Cannot remove Evanescence from entity.",
"commands.legacy_landscape.vanish.applied": "vanish: Applied Evanescence effect to entity.",
"commands.legacy_landscape.vanish.removed": "vanish: Removed Evanescence effect from entity."
"commands.legacy_landscape.vanish.removed": "vanish: Removed Evanescence effect from entity.",
"legacy_landscape.configuration.superSecretSettings": "Super Secret Settings",
"legacy_landscape.configuration.section.legacy.landscape.client.toml": "legacy_landscape-client.toml",
"legacy_landscape.configuration.section.legacy.landscape.client.toml.title": "Legacy Landscape Client TOML",
"legacy_landscape.configuration.title": "Legacy Landscape",
"legacy_landscape.configuration.superSecretSettings.tooltip": "Super secret settings to enhance your experience.\nDo not use this setting if you have photosensitive epilepsy or are otherwise sensitive to flashing lights."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "witchery"
}
],
"block": "#legacy_landscape:ephemeral_fabric_of_reality",
"power": 1,
"limit": 800
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "witchery"
}
],
"block": "#legacy_landscape:fabric_of_reality",
"power": 8,
"limit": 800
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "witchery"
}
],
"block": "#legacy_landscape:flowing_reality",
"power": 32,
"limit": 800
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "witchery"
}
],
"block": "#legacy_landscape:intertwined_reality",
"power": 12,
"limit": 800
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "witchery"
}
],
"block": "#legacy_landscape:patched_fabric_of_reality",
"power": 16,
"limit": 800
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"legacy_landscape:ephemeral_fabric_of_reality",
"legacy_landscape:inverted_ephemeral_fabric_of_reality"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"legacy_landscape:fabric_of_reality",
"legacy_landscape:inverted_fabric_of_reality"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"legacy_landscape:flowing_reality",
"legacy_landscape:inverted_flowing_reality"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"legacy_landscape:intertwined_reality",
"legacy_landscape:inverted_intertwined_reality"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"legacy_landscape:patched_fabric_of_reality",
"legacy_landscape:inverted_patched_fabric_of_reality"
]
}

0 comments on commit a296a14

Please sign in to comment.