Moved PR config to client config.

This commit is contained in:
Flanks255 2024-11-07 14:54:40 -06:00
parent 5e616297ee
commit 9c6859cdd3
5 changed files with 29 additions and 13 deletions

View file

@ -1,5 +1,6 @@
# 1.3.10+mc1.21.1
* Fixed Fluid placer not being harvestable.
* PR #1438, Added config to disable energy overlay.
* The following machines will now retain energy when broken:
* Coal Generator
* Oil Generator

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.config.ClientConfig;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
@ -75,6 +76,8 @@ public class ActuallyAdditions {
public ActuallyAdditions(IEventBus eventBus, ModContainer container, Dist dist) {
container.registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
if (dist.isClient())
container.registerConfig(ModConfig.Type.CLIENT, ClientConfig.CLIENT_CONFIG);
ActuallyBlocks.init(eventBus);
ActuallyItems.init(eventBus);
@ -135,10 +138,12 @@ public class ActuallyAdditions {
}
private void onConfigReload(ModConfigEvent event) {
Item item1 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.RELAYCONFIGURATOR.get()));
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
if (event.getConfig().getType() == ModConfig.Type.COMMON) {
Item item1 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.RELAYCONFIGURATOR.get()));
CommonConfig.Other.redstoneConfigureItem = item1 != null ? item1 : Items.AIR;
CommonConfig.Other.relayConfigureItem = item2 != null ? item2 : Items.AIR;
}
}
public void serverStarted(ServerStartedEvent event) {

View file

@ -0,0 +1,17 @@
package de.ellpeck.actuallyadditions.mod.config;
import net.neoforged.neoforge.common.ModConfigSpec;
public class ClientConfig {
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
public static ModConfigSpec CLIENT_CONFIG;
public static ModConfigSpec.BooleanValue HIDE_ENERGY_OVERLAY;
static {
HIDE_ENERGY_OVERLAY = BUILDER.comment("If true, when looking at blocks the Energy Overlay will be hidden.")
.define("hideEnergyOverlay", false);
CLIENT_CONFIG = BUILDER.build();
}
}

View file

@ -89,13 +89,11 @@ public class CommonConfig {
}
public static class Other {
public static ModConfigSpec.BooleanValue HIDE_ENERGY_OVERLAY;
public static ModConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;
public static ModConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
public static ModConfigSpec.BooleanValue DO_CAT_DROPS;
public static ModConfigSpec.BooleanValue DO_BAT_DROPS;
public static ModConfigSpec.IntValue FUR_CHANCE;
public static ModConfigSpec.BooleanValue WORMS;
public static ModConfigSpec.IntValue WORMS_DIE_TIME;
public static ModConfigSpec.BooleanValue CTRL_EXTRA_INFO;
@ -117,9 +115,6 @@ public class CommonConfig {
BUILDER.comment("Everything else").push("other");
HIDE_ENERGY_OVERLAY = BUILDER.comment("If true, when looking at blocks the Energy Overlay will be hidden.")
.define("hideEnergyOverlay", false);
SOLID_XP_ALWAYS_ORBS = BUILDER.comment("If true, Solidified Experience will always spawn orbs, even for regular players.")
.define("solidXPOrbs", false);
@ -135,9 +130,6 @@ public class CommonConfig {
DO_BAT_DROPS = BUILDER.comment("Should Bat wings drop from Bats?")
.define("doBatDrops", true);
FUR_CHANCE = BUILDER.comment("The 1/n drop chance, per tick, for a fur ball to be dropped.")
.defineInRange("furDropChance", 5000, 1, Integer.MAX_VALUE);
WORMS = BUILDER.comment("If true, worms will drop from tilling the soil.")
.define("tillingWorms", true);

View file

@ -15,6 +15,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import de.ellpeck.actuallyadditions.api.misc.IGoggles;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.config.ClientConfig;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
@ -264,7 +265,7 @@ public class ClientEvents {
}
}
if (tileHit instanceof IEnergyDisplay display && !CommonConfig.Other.HIDE_ENERGY_OVERLAY.get()) {
if (tileHit instanceof IEnergyDisplay display && !ClientConfig.HIDE_ENERGY_OVERLAY.get()) {
if (!display.needsHoldShift() || player.isShiftKeyDown()) {
if (energyDisplay == null) {
energyDisplay = new EnergyDisplay(0, 0, null);