modularized portal block configuration

This commit is contained in:
alterNERDtive 2023-07-26 11:15:19 +02:00
parent 30ae345c6a
commit da06973b36
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1
3 changed files with 18 additions and 6 deletions

View file

@ -1,6 +1,7 @@
# devel # devel
* Balance changes are now disabled by default, bug fixes enabled. Will not affect exsting worlds/configs. * Balance changes are now disabled by default, bug fixes enabled. Will not affect exsting worlds/configs.
* Modularized Portal block configuration; you can now define your own blocks to build Vault Portals out of.
# 3.11.1.0 (2023-07-25) # 3.11.1.0 (2023-07-25)

View file

@ -18,12 +18,15 @@
package tv.alterNERD.VaultModTweaks; package tv.alterNERD.VaultModTweaks;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;
import net.minecraftforge.common.ForgeConfigSpec.IntValue; import net.minecraftforge.common.ForgeConfigSpec.IntValue;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.common.ForgeConfigSpec.Builder; import net.minecraftforge.common.ForgeConfigSpec.Builder;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
@ -51,7 +54,8 @@ public class Configuration {
public static BooleanValue VAULTAR_ENABLED; public static BooleanValue VAULTAR_ENABLED;
public static IntValue VAULTAR_INFUSION_TIME; public static IntValue VAULTAR_INFUSION_TIME;
public static BooleanValue PORTAL_TEMPLATE_ENABLED; public static BooleanValue PORTAL_BLOCKS_ENABLED;
public static ConfigValue<List<? extends String>> PORTAL_BLOCKS;
public static BooleanValue FAKE_PLAYER_FIX; public static BooleanValue FAKE_PLAYER_FIX;
public static BooleanValue ROUTER_VAULTAR_FIX; public static BooleanValue ROUTER_VAULTAR_FIX;
@ -149,9 +153,14 @@ public class Configuration {
// Vault Portal // Vault Portal
builder.push("VaultPortal"); builder.push("VaultPortal");
PORTAL_TEMPLATE_ENABLED = builder PORTAL_BLOCKS_ENABLED = builder
.comment("Allow Template Frame Blocks extruded by Modular Routers Extruder Mk2 module as Vault Portal Frame blocks") .comment("Add additional blocks as valid Portal frame blocks")
.define("allowTemplateFrames", false); .define("extendValidPortalBlocks", false);
PORTAL_BLOCKS = builder
.comment("List of additional blocks")
.defineList("additionalPortalBlocks", new ArrayList<String>(), entry -> {
return ForgeRegistries.BLOCKS.containsKey(new ResourceLocation((String)entry));
});
builder.pop(); builder.pop();
// Bug fixes // Bug fixes

View file

@ -51,9 +51,11 @@ public abstract class MixinVaultPortalConfig extends Config {
@Override @Override
protected void onLoad(Config oldConfigInstance) { protected void onLoad(Config oldConfigInstance) {
super.onLoad(oldConfigInstance); super.onLoad(oldConfigInstance);
if (Configuration.PORTAL_TEMPLATE_ENABLED.get()) { if (Configuration.PORTAL_BLOCKS_ENABLED.get()) {
ArrayList<String> list = new ArrayList<String>(Arrays.asList(VALID_BLOCKS)); ArrayList<String> list = new ArrayList<String>(Arrays.asList(VALID_BLOCKS));
list.add("modularrouters:template_frame"); for (String block : Configuration.PORTAL_BLOCKS.get()) {
list.add(block);
}
VALID_BLOCKS = list.toArray(VALID_BLOCKS); VALID_BLOCKS = list.toArray(VALID_BLOCKS);
} }
} }