diff --git a/.gitignore b/.gitignore index a2efcad..4d41377 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,4 @@ bin/ run/ -# custom - -darkness/ -schema.tic +/.apt_generated/ diff --git a/README.md b/README.md index f6e27d2..df8366d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ [![build](https://github.com/lever1209/pandora-core/actions/workflows/build.yml/badge.svg?branch=development-1.19.x)](https://github.com/lever1209/pandora-core/actions/workflows/build.yml) Imagine a world where you are at the bottom of the food chain. -The only thing you know about them is they dont like being seen. \ No newline at end of file +The only thing you know about them is they dont like being seen. diff --git a/build.gradle b/build.gradle index c41fdc6..cea1cfd 100644 --- a/build.gradle +++ b/build.gradle @@ -29,17 +29,20 @@ dependencies { // fapi modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation ("com.terraformersmc:modmenu:${modmenu_version}") { + modImplementation ("com.terraformersmc:modmenu:${project.modmenu_version}") { exclude(group: "net.fabricmc.fabric-api") } - include modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") { // one or the other, most likely spruce + include modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { // one or the other, most likely spruce exclude(group: "net.fabricmc.fabric-api") } include modApi("dev.lambdaurora:spruceui:${project.spruceui_version}") - include modApi("com.github.LlamaLad7:MixinExtras:0.1.0-rc5") - annotationProcessor "com.github.LlamaLad7:MixinExtras:0.1.0-rc5" + // apparently this is bundled in fabric loader 15+? check how to use that version instead + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${project.mixinextras_versions}"))) + + // include modApi("com.github.LlamaLad7:MixinExtras:0.1.0-rc5") + // annotationProcessor "com.github.LlamaLad7:MixinExtras:0.1.0-rc5" // implementation 'me.nullicorn:Nedit:2.2.0' // temporary unless proven useful include modApi("org.snakeyaml:snakeyaml-engine:${snakeyaml_engine_version}") diff --git a/gradle.properties b/gradle.properties index afe0071..4f82a88 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # https://fabricmc.net/develop minecraft_version=1.19 yarn_mappings=1.19+build.4 -loader_version=0.14.9 +loader_version=0.15.6 fabric_version=0.58.0+1.19 # Mod Properties @@ -17,4 +17,5 @@ slf4j_simple_version=1.7.9 # will crash if updated snakeyaml_engine_version=2.4 cloth_config_version=8.2.88 spruceui_version=3.3.3+1.18 -architectury_version=5.12.44 \ No newline at end of file +architectury_version=5.12.44 +mixinextras_versions=0.3.5 diff --git a/src/main/java/pkg/deepCurse/pandora/core/CustomDamageSources.java b/src/main/java/pkg/deepCurse/pandora/core/CustomDamageSources.java index 4bdc993..b2e8f5a 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/CustomDamageSources.java +++ b/src/main/java/pkg/deepCurse/pandora/core/CustomDamageSources.java @@ -4,8 +4,7 @@ public class CustomDamageSources extends DamageSource { protected boolean fire; - public static final DamageSource GRUE = new CustomDamageSources( - "pandora.darkness"); + public static final DamageSource GRUE = new CustomDamageSources("pandora.darkness"); protected CustomDamageSources(String name) { super(name); diff --git a/src/main/java/pkg/deepCurse/pandora/core/Pandora.java b/src/main/java/pkg/deepCurse/pandora/core/Pandora.java index 2182cc6..7cb6082 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/Pandora.java +++ b/src/main/java/pkg/deepCurse/pandora/core/Pandora.java @@ -16,33 +16,43 @@ import pkg.deepCurse.pandora.core.util.tools.*; public class Pandora implements ModInitializer, PreLaunchEntrypoint { - + private static Logger log = LoggerFactory.getLogger(Pandora.class); - // TODO hip lantern + // TODO hip lantern? - // TODO light enchantment + // TODO light enchantment? glowstone ash and ghast tear paste to become an armor trim instead? - // TODO torches burn out and can only be relit twice, after that they turn to ash + // TODO torches burn out and can only be relit twice, after that they turn to + // ash // TODO refil lanterns with phantom membrane, and have 3x slower burn rate - // TODO glowstone paste of some kind to augment equipment with light, vanishes on repair and grindstone + // TODO glowstone paste of some kind to augment equipment with light, vanishes + // on repair and grindstone - /* TODO "tutorial" message - * first time player gets "Its pitch black, you are likely to be eaten by a grue." - * then cooldown, and 50% every time you enter darkness, until you get it, then cooldown - * then chance reduces to 15%, until message has appeared 10 times, then disable message + /* + * TODO "tutorial" message first time player gets + * "Its pitch black, you are likely to be eaten by a grue." then cooldown, and + * 50% every time you enter darkness, until you get it, then cooldown then + * chance reduces to 15%, until message has appeared 10 times, then disable + * message */ - - // TODO setup gamerules for select config options - - // TODO fade light level - - // TODO fix readme, that last line is kinda cringe - - // TODO add button on worlds menu to recalculate all blocks lighting, potentially dangerous with non vanilla, so throw up a warning, this "solves" the lighting artifacts when changing lighting values without needing too much cpu power in game, should only be used when editing these values or when converting world to pandora - + + // TODO setup gamerules for select config options + + // TODO fade light level + + // TODO fix readme, that last line is kinda cringe + + // TODO add button on worlds menu to recalculate all blocks lighting, + // potentially dangerous with non vanilla, so throw up a warning, this "solves" + // the lighting artifacts when changing lighting values without needing too much + // cpu power in game, should only be used when editing these values or when + // converting world to pandora since all lighting values are cached + + // TODO spawn a light generating whisp when respawning, it lasts 2 minutes and + // follows the player, or until the player enters the light @Override public void onPreLaunch() { log.info("[Pandora] Running pre launch initializers. . ."); @@ -63,7 +73,7 @@ public void onInitialize() { log.info("[Pandora] Loaded and applied config."); registerHooks(); - + log.info("[Pandora] Finished initializing mod."); } @@ -79,5 +89,5 @@ public static void registerHooks() { PandoraTools.overrideLuminance(id, block); }); } - + } \ No newline at end of file diff --git a/src/main/java/pkg/deepCurse/pandora/core/PandoraConfig.java b/src/main/java/pkg/deepCurse/pandora/core/PandoraConfig.java index 4296bc4..bf8f0d7 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/PandoraConfig.java +++ b/src/main/java/pkg/deepCurse/pandora/core/PandoraConfig.java @@ -1,288 +1,289 @@ package pkg.deepCurse.pandora.core; -import java.io.*; -import java.util.*; -import java.util.function.*; - -import org.slf4j.*; -import org.snakeyaml.engine.v2.api.*; - -import net.fabricmc.loader.api.*; -import net.minecraft.block.*; -import net.minecraft.nbt.*; -import net.minecraft.state.property.*; -import net.minecraft.util.*; -import net.minecraft.util.registry.*; -import pkg.deepCurse.pandora.core.util.exceptions.*; -import pkg.deepCurse.pandora.core.util.tools.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.function.ToIntFunction; +import java.util.stream.Collectors; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.snakeyaml.engine.v2.api.Load; +import org.snakeyaml.engine.v2.api.LoadSettings; + +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.client.particle.BlockLeakParticle; +import net.minecraft.state.property.Property; +import net.minecraft.util.Identifier; +import net.minecraft.util.Pair; +import net.minecraft.util.math.Vec3d; +import pkg.deepCurse.pandora.core.PandoraConfig.General.BlockLightLevelSettings; +import pkg.deepCurse.pandora.core.mixins.shared.StateMixin; +import pkg.deepCurse.pandora.core.util.exceptions.PandoraConfigParseException; +import pkg.deepCurse.pandora.core.util.interfaces.ConditionalToIntFunction; +import pkg.deepCurse.pandora.core.util.interfaces.PropertyMapPrinterAccess; +import pkg.deepCurse.pandora.core.util.tools.CalculateFogFunction; public class PandoraConfig { - private static Logger log = LoggerFactory.getLogger(PandoraConfig.class); + public static class General { + public static class Enabled { + public static boolean EnablePandora = true; + public static boolean EnableCustomFog = true; + public static boolean EnableCustomAI = true; + public static boolean EnableCustomLightmap = true; + public static boolean EnableGrueWards = true; + } - public static File getConfigFile() { - return new File(FabricLoader.getInstance().getConfigDir().toFile(), - "pandora.yaml"); - } + public static boolean IgnoreSkyLight = false; + public static boolean IgnoreMoonPhase = false; - public static boolean IGNORE_SKY_LIGHT = false; - public static boolean IGNORE_MOON_PHASE = false; - public static int MINIMUM_SAFE_LIGHT_LEVEL = 5; - public static int MINIMUM_FADE_LIGHT_LEVEL = 3; - public static boolean HARDCORE_AFFECTS_OTHER_MOBS = false; - public static boolean RESET_GAMMA = true; - public static double GAMMA_VALUE = 1.0F; - public static boolean GRUES_ATTACK_IN_WATER = false; - public static boolean GRUES_EAT_ITEMS = true; - - public static boolean ENABLE_PANDORA = true; - public static boolean ENABLE_CUSTOM_FOG = true; - public static boolean ENABLE_PANDORA_AI = true; - public static boolean ENABLE_LIGHT_MODIFICATION = true; - public static boolean ENABLE_GRUE_WARDS = true; - - public static HashMap> BLOCK_LIGHT_LEVEL_FUNCTIONS = new HashMap<>(); - public static HashMap DIMENSION_SETTINGS = new HashMap<>(); - - public static ArrayList, Double>> GRUE_WARDS = new ArrayList<>(); - - public static ArrayList ANIMALS = null; - public static ArrayList BOSS_MOBS = null; - public static ArrayList VILLAGERS = null; - public static ArrayList HOSTILE_MOBS = null; - public static ArrayList MISC_MOBS = null; - - public static boolean GRUES_ATTACK_ANIMALS = false; - public static boolean GRUES_ATTACK_BOSS_MOBS = false; - public static boolean GRUES_ATTACK_VILLAGERS = true; - public static boolean GRUES_ATTACK_HOSTILE_MOBS = false; - public static boolean GRUES_ATTACK_MISC_MOBS = true; - public static boolean GRUES_ATTACK_PLAYERS = true; // players dont have ids or ai, so they are present only here - - public static boolean ANIMALS_FEAR_DARKNESS = false; - public static boolean BOSS_MOBS_FEAR_DARKNESS = false; - public static boolean VILLAGERS_FEAR_DARKNESS = true; - public static boolean HOSTILE_MOBS_FEAR_DARKNESS = false; - public static boolean MISC_MOBS_FEAR_DARKNESS = true; - - // TODO add support for configs that do not get added, or at least shuffled to the bottom - public static double FLAME_LIGHT_SOURCE_DECAY_RATE = 1.0F; - public static boolean FORCE_GRUES_ALWAYS_ATTACK = false; + public static int MinimumSafeLightLevel = 5; + public static int MinimumFadeLightLevel = 3; - private static LoadSettings settings = LoadSettings.builder().setLabel("Config Reader Settings").build(); + public static boolean HardcoreAffectsOtherMobs = true; - public static void loadConfig() { // TODO test every cast + public static boolean ResetGamma = true; + public static double GammaValue = 1.0f; - log.info("start"); + public static boolean GruesAttackInWater = false; + public static boolean GruesEatItems = true; - GRUE_WARDS.clear(); + public static HashMap BlockLightLevelSettings = null; - DIMENSION_SETTINGS.clear(); - BLOCK_LIGHT_LEVEL_FUNCTIONS.clear(); + public static class BlockLightLevelSettings { - Load load = new Load(settings); - LinkedHashMap yamlLinkedHashMap = null; + public BlockLightLevelSettings(ConditionalToIntFunction level) { + this.LightLevel = level; + } - try { + public ConditionalToIntFunction LightLevel; + } - yamlLinkedHashMap = (LinkedHashMap) load - .loadFromInputStream(new FileInputStream(getConfigFile())); + public static HashMap DimensionSettings = null; - } catch (FileNotFoundException e) { - try { - log.info("[Pandora] Config not found, extracting sample config. . ."); - unpackageConfig(); - log.info("[Pandora] Example config extracted."); - - loadConfig(); - return; + public static class DimensionSettings { - } catch (IOException e2) { - log.error("[Pandora] Failed to extract example config."); - e2.printStackTrace(); - log.error( - "[Pandora] using internal defaults for now, please look into this issue using the above stack trace."); - yamlLinkedHashMap = (LinkedHashMap) load.loadFromInputStream(PandoraConfig.class - .getResourceAsStream("/assets/pandora/pandora.yaml")); + public DimensionSettings(CalculateFogFunction fog, boolean infested) { + this.FogLevel = fog; + this.Infested = infested; } - } - LinkedHashMap general; - try { - general = (LinkedHashMap) yamlLinkedHashMap.get("general"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for general in config file."); - throw new PandoraConfigParseException("Incorrect data type for general in config file", e); + public CalculateFogFunction FogLevel; + public boolean Infested; } - LinkedHashMap enabled; - try { - enabled = (LinkedHashMap) general.get("enabled"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for enabled in config file."); - throw new PandoraConfigParseException("Incorrect data type for enabled in config file", e); - } + public static HashMap GrueWards = null; - ArrayList blockLightSettings; - try { - blockLightSettings = (ArrayList) general.get("block light settings"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for block light settings in config file."); - throw new PandoraConfigParseException("Incorrect data type for block light settings in config file", e); - } + public static class GrueWardSettings { + public double Potency; - ArrayList dimensionSettings; - try { - dimensionSettings = (ArrayList) general.get("dimension settings"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for dimension settings in config file."); - throw new PandoraConfigParseException("Incorrect data type for dimension settings in config file", e); + public GrueWardSettings(double potency) { + this.Potency = potency; + } } - ArrayList grueWards; - try { - grueWards = (ArrayList) general.get("grue wards"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for grue wards in config file."); - throw new PandoraConfigParseException("Incorrect data type for grue wards in config file", e); - } + public static HashMap MobSettings = null; - LinkedHashMap mobGroup; - try { - mobGroup = (LinkedHashMap) general.get("mob group settings"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for mob group in config file."); - throw new PandoraConfigParseException("Incorrect data type for mob group in config file", e); - } + public static class MobSettings { + public double DamageMultiplier; + public boolean FearDarkness; // TODO look into making this a float for the ai weight? - LinkedHashMap debug; - try { - debug = (LinkedHashMap) yamlLinkedHashMap.get("debug settings"); - } catch (ClassCastException e) { - log.error("[Pandora Help] Incorrect data type for debug in config file."); - throw new PandoraConfigParseException("Incorrect data type for debug in config file", e); + public MobSettings(double damageMultiplier, boolean fearsDarkness) { + this.DamageMultiplier = damageMultiplier; + this.FearDarkness = fearsDarkness; + } } + } - IGNORE_SKY_LIGHT = (boolean) general.get("ignore sky light"); - IGNORE_MOON_PHASE = (boolean) general.get("ignore moon phase"); + public class Debug { + // TODO add support for configs that do not get added, or at least shuffled to + // the bottom + public static double FlameLightSourceDecayRate = 1.0f; + public static boolean ForceGruesAlwaysAttack = false; + public static int GrueAttackInterval = 1; // TODO finish this + } - MINIMUM_SAFE_LIGHT_LEVEL = (int) general.get("minimum safe light level"); - MINIMUM_FADE_LIGHT_LEVEL = (int) general.get("minimum fade light level"); + private static Logger log = LoggerFactory.getLogger(PandoraConfig.class); - HARDCORE_AFFECTS_OTHER_MOBS = (boolean) general.get("hardcore affects other mobs"); + public static File getConfigFile() { + return new File(FabricLoader.getInstance().getConfigDir().toFile(), "pandora.yaml"); + } - RESET_GAMMA = (boolean) general.get("reset gamma"); - GAMMA_VALUE = (double) general.get("gamma value"); + private static LoadSettings settings = LoadSettings.builder().setLabel("Config Reader Settings").build(); - GRUES_ATTACK_IN_WATER = (boolean) general.get("grues attack in water"); - GRUES_EAT_ITEMS = (boolean) general.get("grues eat items"); + public static void loadConfig() { // TODO write yaml parser to get spans and line numbers, and to add more user + // friendly errors - ENABLE_PANDORA = (boolean) enabled.get("enable pandora"); - ENABLE_CUSTOM_FOG = (boolean) enabled.get("enable custom fog"); - ENABLE_PANDORA_AI = (boolean) enabled.get("enable pandora ai"); + log.info("start"); - for (LinkedHashMap i : (ArrayList>) blockLightSettings) { + General.DimensionSettings = new HashMap<>(); + General.MobSettings = new HashMap<>(); + General.BlockLightLevelSettings = new HashMap<>(); + General.GrueWards = new HashMap<>(); - final Identifier id; - int lightLevel; - ToIntFunction tif; + Load load = new Load(settings); + HashMap yamlHashMap; + + try { + yamlHashMap = (HashMap) load.loadFromInputStream(new FileInputStream(getConfigFile())); + } catch (FileNotFoundException e) { + try { + log.info("[Pandora] Config not found, extracting sample config. . ."); + unpackageConfig(); + log.info("[Pandora] Example config extracted."); + loadConfig(); + return; + } catch (IOException e2) { + log.error("[Pandora] Failed to extract example config."); + e2.printStackTrace(); + log.error( + "[Pandora] using internal defaults for now, please look into this issue using the above stack trace."); + yamlHashMap = (HashMap) load + .loadFromInputStream(PandoraConfig.class.getResourceAsStream("/assets/pandora/pandora.yaml")); + } + } + + HashMap general = (HashMap) yamlHashMap.get("general"); + HashMap enabled = (HashMap) general.get("enabled"); + ArrayList blockLightSettings = (ArrayList) general.get("block light settings"); + ArrayList dimensionSettings = (ArrayList) general.get("dimension settings"); + ArrayList grueWards = (ArrayList) general.get("grue wards"); + ArrayList mobGroups = (ArrayList) general.get("mob group settings"); + HashMap debug = (HashMap) yamlHashMap.get("debug settings"); + + General.Enabled.EnablePandora = (boolean) enabled.get("enable pandora"); + General.Enabled.EnableCustomFog = (boolean) enabled.get("enable custom fog"); + General.Enabled.EnableCustomAI = (boolean) enabled.get("enable pandora ai"); + General.Enabled.EnableCustomLightmap = (boolean) enabled.get("enable light modifications"); + General.Enabled.EnableGrueWards = (boolean) enabled.get("enable grue wards"); + + General.IgnoreSkyLight = (boolean) general.get("ignore sky light"); + General.IgnoreMoonPhase = (boolean) general.get("ignore moon phase"); + General.MinimumSafeLightLevel = (int) general.get("minimum safe light level"); + General.MinimumFadeLightLevel = (int) general.get("minimum fade light level"); + General.HardcoreAffectsOtherMobs = (boolean) general.get("hardcore affects other mobs"); + General.ResetGamma = (boolean) general.get("reset gamma"); + General.GammaValue = (double) general.get("gamma value"); + General.GruesAttackInWater = (boolean) general.get("grues attack in water"); + General.GruesEatItems = (boolean) general.get("grues eat items"); + + General.BlockLightLevelSettings = new HashMap<>(); + for (HashMap i : (ArrayList>) blockLightSettings) { if (!i.containsKey("light level")) { throw new PandoraConfigParseException( "Value for required key \"light level\" not found or invalid. type required: int, example key value pair: \"light level: 7\""); } - lightLevel = (int) i.get("light level"); - - if (i.containsKey("id") && !i.containsKey("state")) { - id = new Identifier((String) i.get("id")); - tif = (state) -> { - return lightLevel; - }; + Identifier id = new Identifier((String) i.get("id")); + int lightLevel = (int) i.get("light level"); + ConditionalToIntFunction conditional_to_int_function; - if (BLOCK_LIGHT_LEVEL_FUNCTIONS.containsKey(id)) { - throw new PandoraConfigParseException("block light settings already contains key " + id); - } - - BLOCK_LIGHT_LEVEL_FUNCTIONS.put(id, tif); - - } else if (i.containsKey("state") && !i.containsKey("id")) { - final LinkedHashMap state = (LinkedHashMap) i.get("state"); - final LinkedHashMap properties = (LinkedHashMap) state.get("properties"); - id = new Identifier((String) state.get("name")); - - tif = (blockstate) -> { - - for (Property prop : blockstate.getProperties()) { - if (!prop.getName().equals(id.getPath())) { - + LinkedHashMap configPropertyHashMap = (LinkedHashMap) i.get("properties"); + conditional_to_int_function = (argBlockstate, oldValue) -> { + if (!argBlockstate.getEntries().isEmpty() && configPropertyHashMap != null) { + var translatedBlockState = new HashMap(); + for (var ij : argBlockstate.getEntries().entrySet()) { + translatedBlockState.put(ij.getKey().getName(), ij.getValue().toString()); + } + for (var config_property : configPropertyHashMap.entrySet()) { + if (!translatedBlockState.get(config_property.getKey()) + .contentEquals(config_property.getValue().toString())) { + return oldValue; } } - - return 0; - }; - - } else if (i.containsKey("state") && i.containsKey("id")) { - throw new PandoraConfigParseException( - "Element contains two identifier keys, please remove either \"state\" or \"id\" from the element. (" - + i + ")"); - } else if (!i.containsKey("state") && !i.containsKey("id")) - throw new PandoraConfigParseException( - "Element contains no identifier keys, please add either \"state\" or \"id\" to the element. (" - + i + ")"); - } + } + return lightLevel; + }; - log.info("block level light settings: {}", BLOCK_LIGHT_LEVEL_FUNCTIONS); - - for (LinkedHashMap i : (ArrayList>) dimensionSettings) { - - - + General.BlockLightLevelSettings.put(id, new BlockLightLevelSettings(conditional_to_int_function)); } - - for (LinkedHashMap i : (ArrayList>) grueWards) { - - // String dep = (String) (i.get("depends") == null ? "minecraft" : i.get("depends")); // introduces questionable pairity for network sessions - // if (FabricLoader.getInstance().isModLoaded(dep)) { + for (HashMap dim : (ArrayList>) dimensionSettings) { - ArrayList items = new ArrayList<>(); + var fogFactor = (double) dim.get("fog factor"); + var identifiers = (ArrayList) dim.get("ids"); + var infested = (boolean) dim.get("infested"); - for (String id : (ArrayList) i.get("items")) - items.add(new Identifier(id)); - GRUE_WARDS.add(new Pair(items, i.get("potency"))); - // } +// if (fogFactor == null) { +// throw new PandoraConfigParseException( +// "Element does not contain required key \"fog factor\", please add it to the element. (" + dim +// + ")"); +// } + if (identifiers == null) { + throw new PandoraConfigParseException( + "Element does not contain required key \"ids\", please add it to the element. (" + dim + ")"); + } +// if (infested == null) { +// throw new PandoraConfigParseException( +// "Element does not contain required key \"infested\", please add it to the element. (" + dim +// + ")"); +// } + for (var id : identifiers) { + General.DimensionSettings.put(new Identifier(id), new General.DimensionSettings( + (owner, color, sun_angle, oldValue, world, biome_access, sun_height, i, j, k) -> { + final double MIN = 0; + Vec3d result = oldValue; + result = new Vec3d(Math.max(MIN, result.x * fogFactor), Math.max(MIN, result.y * fogFactor), + Math.max(MIN, result.z * fogFactor)); + return result; + }, infested)); + } } - log.info("wards:"); - - for (Pair, Double> i : GRUE_WARDS) { - log.info("id[]: {}, double: {}", i.getLeft(), i.getRight()); +// General.DimensionSettings.put(new Identifier("minecraft:overworld"), new General.DimensionSettings( +// (owner, color, sun_angle, oldValue, world, biome_access, sun_height, i, j, k) -> { +// final double factor = 0.7d; +// final double MIN = 0; +// +// { +// Vec3d result = oldValue; +// result = new Vec3d(Math.max(MIN, result.x * factor), Math.max(MIN, result.y * factor), +// Math.max(MIN, result.z * factor)); +// +// return result; +// } +// }, true)); + + for (HashMap i : (ArrayList>) grueWards) { + var potency = (double) i.get("potency"); + var ids = (ArrayList) i.get("ids"); + for (var id : ids) { + General.GrueWards.put(new Identifier(id), new General.GrueWardSettings(potency)); + } } - ANIMALS = (ArrayList) mobGroup.get("animals"); - BOSS_MOBS = (ArrayList) mobGroup.get("boss mobs"); - VILLAGERS = (ArrayList) mobGroup.get("villagers"); - HOSTILE_MOBS = (ArrayList) mobGroup.get("hostile mobs"); - MISC_MOBS = (ArrayList) mobGroup.get("misc"); + for (HashMap i : (ArrayList>) mobGroups) { + var ids = (ArrayList) i.get("ids"); + var damageMultiplier = (double) i.get("damage multiplier"); + var fearsDarkness = (boolean) i.get("fears darkness"); - GRUES_ATTACK_ANIMALS = (boolean) mobGroup.get("grues attack animals"); - GRUES_ATTACK_BOSS_MOBS = (boolean) mobGroup.get("grues attack boss mobs"); - GRUES_ATTACK_VILLAGERS = (boolean) mobGroup.get("grues attack villagers"); - GRUES_ATTACK_HOSTILE_MOBS = (boolean) mobGroup.get("grues attack hostile mobs"); - GRUES_ATTACK_MISC_MOBS = (boolean) mobGroup.get("grues attack misc mobs"); - GRUES_ATTACK_PLAYERS = (boolean) mobGroup.get("grues attack players"); - - ANIMALS_FEAR_DARKNESS = (boolean) mobGroup.get("animals fear darkness"); - BOSS_MOBS_FEAR_DARKNESS = (boolean) mobGroup.get("boss mobs fear darkness"); - VILLAGERS_FEAR_DARKNESS = (boolean) mobGroup.get("villagers fear darkness"); - HOSTILE_MOBS_FEAR_DARKNESS = (boolean) mobGroup.get("hostile mobs fear darkness"); - MISC_MOBS_FEAR_DARKNESS = (boolean) mobGroup.get("misc mobs fear darkness"); + for (var id : ids) { + // log.info("{} {} {}", id, damageMultiplier, fearsDarkness); + General.MobSettings.put(new Identifier(id), new General.MobSettings(damageMultiplier, fearsDarkness)); + } + } - FLAME_LIGHT_SOURCE_DECAY_RATE = (double) debug.get("flameLightSourceDecayRate"); - FORCE_GRUES_ALWAYS_ATTACK = (boolean) debug.get("forceGruesAlwaysAttack"); + Debug.FlameLightSourceDecayRate = (double) debug.get("flameLightSourceDecayRate"); + Debug.ForceGruesAlwaysAttack = (boolean) debug.get("forceGruesAlwaysAttack"); - log.info("end"); // TODO remove later +// log.info("CONFIG:\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}", +// General.Enabled.EnablePandora, General.Enabled.EnableCustomFog, General.Enabled.EnableCustomAI, +// General.Enabled.EnableCustomLightmap, General.Enabled.EnableGrueWards, General.IgnoreSkyLight, +// General.IgnoreMoonPhase, General.MinimumSafeLightLevel, General.MinimumFadeLightLevel, +// General.HardcoreAffectsOtherMobs, General.ResetGamma, General.GammaValue, General.GruesAttackInWater, +// General.GruesEatItems, General.BlockLightLevelSettings, General.DimensionSettings, General.GrueWards, +// General.MobSettings, Debug.FlameLightSourceDecayRate, Debug.ForceGruesAlwaysAttack); } @@ -294,8 +295,7 @@ public static void unpackageConfig() throws IOException { FileWriter writer = new FileWriter(getConfigFile()); BufferedReader reader = new BufferedReader( - new InputStreamReader(PandoraConfig.class - .getResourceAsStream("/assets/pandora/pandora.yaml"))); + new InputStreamReader(PandoraConfig.class.getResourceAsStream("/assets/pandora/pandora.yaml"))); for (int t; (t = reader.read()) != -1;) { writer.write(t); @@ -309,106 +309,130 @@ public static void deleteConfig() { getConfigFile().delete(); } - public static boolean moblistContains(Identifier identifier) { - return ANIMALS.contains(identifier) || BOSS_MOBS.contains(identifier) || VILLAGERS.contains(identifier) - || HOSTILE_MOBS.contains(identifier) || MISC_MOBS.contains(identifier); - } + // public static boolean moblistContains(Identifier identifier) { + // return ANIMALS.contains(identifier) || VILLAGERS.contains(identifier) + // || HOSTILE_MOBS.contains(identifier) || BOSS_MOBS.contains(identifier) + // || MISC_MOBS.contains(identifier); + // } + + // HashMap load_linked_hashmap_from_config() { + + // } + } // public enum PandoraConfigEnum { -// animalsFearDarkness(false, "Should animals avoid staying in the dark too long"), -// blockLightOnly(false, -// "Should the calculation for whether you are in darkness or not only use block light, ignoring sky light"), -// bossMobsFearDarkness(false, "Should boss mobs avoid staying in the dark too long"), -// defaultGammaResetValue(1.0F, -// "The value pandora will reset your gamma to on boot, resetting your gamma can be disabled too"), - -// -// dimensionFogFactors(0, "What fog factor should a dimension use"), -// effectiveDimensions(0, "What dimensions should be afflicted by grues"), -// lightLevelBlockPairs(0, -// "What blocks should have what light levels, supports block states (API NOTE: an api is available for this value)"), - -// flameLightSourceDecayRate(1.0F, -// "The decay rate of torches and similar, 1.0 is 1x the decay rate, 2.0 is 2x, 0.5 is half the decay rate, any value can be entered"), -// gruesAttackAnimals(false, "Should grues eat animals"), -// gruesAttackBossMobs(false, "Should grues eat boss monsters"), -// gruesAttackInWater(false, "Should grues eat mobs in dark water"), -// gruesAttackPlayers(true, "Should grues eat players"), -// gruesAttackVillagers(true, "Should grues eat villagers"), -// gruesCanAttackHostileMobs(false, "Should grues attack hostile mobs"), -// gruesEatItems(true, "Should grues eat items (since items do not have health, the grue can eat it in one go)"), -// hardcoreAffectsOtherMobs(false, -// "Does being in hardcore mode affect other mobs, in hardcore mode grues will 1 hit ko"), -// hostileMobsFearDarkness(false, "Should hostile mobs avoid staying in the dark too long"), -// ignoreMoonPhase(false, -// "Should the calculation for whether you are in darkness or not use the moon phases, full moon you are safe under the moonlight"), -// isEnabled(true, "Is the whole mod enabled"), -// minimumSafeLightLevel(3, "The minimum light level you need to be in to stay safe from grues"), -// resetGammaOnLaunch(true, "Should pandora reset your gamma value at launch"), -// villagersFearDarkness(true, "Should villagers avoid staying in the dark too long"), -// grueWardsEnabled(true, "Should grue wards be enabled (items you can hold to be mostly immune to grues)"), -// isDarknessEnabled(true, "Should the world darken significantly (client side only)"), - -// // Debug options ahead, will not be stored in config, but will always be available in config - -// forceGruesAlwaysAttack(false, false); - -// public Object object; -// public String comment; -// public boolean canPutInConfig = true; - -// PandoraConfigEnum(Object defaultValue, boolean canPutInConfig) { -// this.object = defaultValue; -// this.canPutInConfig = canPutInConfig; -// } - -// PandoraConfigEnum(Object defaultValue, String comment) { -// this.object = defaultValue; -// this.comment = comment; -// } +// animalsFearDarkness(false, "Should animals avoid staying in the dark too +// long"), +// blockLightOnly(false, +// "Should the calculation for whether you are in darkness or not only use block +// light, ignoring sky light"), +// bossMobsFearDarkness(false, "Should boss mobs avoid staying in the dark too +// long"), +// defaultGammaResetValue(1.0F, +// "The value pandora will reset your gamma to on boot, resetting your gamma can +// be disabled too"), + +// +// dimensionFogFactors(0, "What fog factor should a dimension use"), +// effectiveDimensions(0, "What dimensions should be afflicted by grues"), +// lightLevelBlockPairs(0, +// "What blocks should have what light levels, supports block states (API NOTE: +// an api is available for this value)"), + +// flameLightSourceDecayRate(1.0F, +// "The decay rate of torches and similar, 1.0 is 1x the decay rate, 2.0 is 2x, +// 0.5 is half the decay rate, any value can be entered"), +// gruesAttackAnimals(false, "Should grues eat animals"), +// gruesAttackBossMobs(false, "Should grues eat boss monsters"), +// gruesAttackInWater(false, "Should grues eat mobs in dark water"), +// gruesAttackPlayers(true, "Should grues eat players"), +// gruesAttackVillagers(true, "Should grues eat villagers"), +// gruesCanAttackHostileMobs(false, "Should grues attack hostile mobs"), +// gruesEatItems(true, "Should grues eat items (since items do not have health, +// the grue can eat it in one go)"), +// hardcoreAffectsOtherMobs(false, +// "Does being in hardcore mode affect other mobs, in hardcore mode grues will 1 +// hit ko"), +// hostileMobsFearDarkness(false, "Should hostile mobs avoid staying in the dark +// too long"), +// ignoreMoonPhase(false, +// "Should the calculation for whether you are in darkness or not use the moon +// phases, full moon you are safe under the moonlight"), +// isEnabled(true, "Is the whole mod enabled"), +// minimumSafeLightLevel(3, "The minimum light level you need to be in to stay +// safe from grues"), +// resetGammaOnLaunch(true, "Should pandora reset your gamma value at launch"), +// villagersFearDarkness(true, "Should villagers avoid staying in the dark too +// long"), +// grueWardsEnabled(true, "Should grue wards be enabled (items you can hold to +// be mostly immune to grues)"), +// isDarknessEnabled(true, "Should the world darken significantly (client side +// only)"), + +// // Debug options ahead, will not be stored in config, but will always be +// available in config + +// forceGruesAlwaysAttack(false, false); + +// public Object object; +// public String comment; +// public boolean canPutInConfig = true; + +// PandoraConfigEnum(Object defaultValue, boolean canPutInConfig) { +// this.object = defaultValue; +// this.canPutInConfig = canPutInConfig; +// } + +// PandoraConfigEnum(Object defaultValue, String comment) { +// this.object = defaultValue; +// this.comment = comment; +// } // } // public static ArrayList blacklistedEntityType = new ArrayList<>(); // public static ArrayList grueWards = new ArrayList<>(); -// public static HashMap effectiveDimensions = new HashMap<>(); -// public static HashMap dimensionFogFactors = new HashMap<>(); -// public static HashMap> lightLevelBlockPairs = new HashMap<>(); +// public static HashMap effectiveDimensions = +// new HashMap<>(); +// public static HashMap dimensionFogFactors = new +// HashMap<>(); +// public static HashMap> +// lightLevelBlockPairs = new HashMap<>(); // static { // data values i have yet to figure out how to serialize -/* dimensionFogFactors.put(new Identifier("minecraft:overworld"), 1.0F); - dimensionFogFactors.put(new Identifier("minecraft:the_nether"), 0.5F); - dimensionFogFactors.put(new Identifier("minecraft:the_end"), 0.0F); - - double MIN = 0.029999999329447746D; // minimum brightness in grondags darkness - - effectiveDimensions.putIfAbsent(new Identifier("minecraft:overworld"), - (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { - float factor = dimensionFogFactors.getOrDefault(new Identifier("minecraft:overworld"), 1.0F); - return new Vec3d(Math.max(MIN, oldValue.x * factor), - Math.max(MIN, oldValue.y * factor), - Math.max(MIN, oldValue.z * factor)); - }); - - effectiveDimensions.putIfAbsent(new Identifier("minecraft:the_nether"), - (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { - float factor = dimensionFogFactors.getOrDefault(new Identifier("minecraft:the_nether"), 0.5F); - return new Vec3d(Math.max(MIN, oldValue.x * factor), - Math.max(MIN, oldValue.y * factor), - Math.max(MIN, oldValue.z * factor)); - }); - - effectiveDimensions.putIfAbsent(new Identifier("minecraft:the_end"), - (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { - float factor = dimensionFogFactors.getOrDefault(new Identifier("minecraft:the_end"), 0.0F); - return new Vec3d(Math.max(MIN, oldValue.x * factor), - Math.max(MIN, oldValue.y * factor), - Math.max(MIN, oldValue.z * factor)); - }); */ +/* + * dimensionFogFactors.put(new Identifier("minecraft:overworld"), 1.0F); + * dimensionFogFactors.put(new Identifier("minecraft:the_nether"), 0.5F); + * dimensionFogFactors.put(new Identifier("minecraft:the_end"), 0.0F); + * + * double MIN = 0.029999999329447746D; // minimum brightness in grondags + * darkness + * + * effectiveDimensions.putIfAbsent(new Identifier("minecraft:overworld"), + * (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { float + * factor = dimensionFogFactors.getOrDefault(new + * Identifier("minecraft:overworld"), 1.0F); return new Vec3d(Math.max(MIN, + * oldValue.x * factor), Math.max(MIN, oldValue.y * factor), Math.max(MIN, + * oldValue.z * factor)); }); + * + * effectiveDimensions.putIfAbsent(new Identifier("minecraft:the_nether"), + * (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { float + * factor = dimensionFogFactors.getOrDefault(new + * Identifier("minecraft:the_nether"), 0.5F); return new Vec3d(Math.max(MIN, + * oldValue.x * factor), Math.max(MIN, oldValue.y * factor), Math.max(MIN, + * oldValue.z * factor)); }); + * + * effectiveDimensions.putIfAbsent(new Identifier("minecraft:the_end"), + * (effects, color, f, oldValue, world, access, sunHeight, i, j, k) -> { float + * factor = dimensionFogFactors.getOrDefault(new + * Identifier("minecraft:the_end"), 0.0F); return new Vec3d(Math.max(MIN, + * oldValue.x * factor), Math.max(MIN, oldValue.y * factor), Math.max(MIN, + * oldValue.z * factor)); }); + */ // } // public static void saveConfigs() { @@ -416,9 +440,9 @@ public static boolean moblistContains(Identifier identifier) { // config.commentMap().clear(); // for (PandoraConfigEnum i : PandoraConfigEnum.values()) { -// if (i.canPutInConfig) { -// config.setComment(i.name(), i.comment); -// } +// if (i.canPutInConfig) { +// config.setComment(i.name(), i.comment); +// } // } // config.save(); diff --git a/src/main/java/pkg/deepCurse/pandora/core/PandoraRegistry.java b/src/main/java/pkg/deepCurse/pandora/core/PandoraRegistry.java index 57545be..24a7e92 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/PandoraRegistry.java +++ b/src/main/java/pkg/deepCurse/pandora/core/PandoraRegistry.java @@ -20,9 +20,10 @@ public class PandoraRegistry { private static boolean hasInitialized = false; private static Logger log = LoggerFactory.getLogger(PandoraRegistry.class); - public static final ItemGroup PANDORA_ITEM_GROUP = FabricItemGroupBuilder.create( - new Identifier("pandora", "pandora.item.group.default")) - .icon(() -> new ItemStack(Items.REINFORCED_DEEPSLATE)) // TODO figure out how to set this to the revenant flint + public static final ItemGroup PANDORA_ITEM_GROUP = FabricItemGroupBuilder + .create(new Identifier("pandora", "pandora.item.group.default")) + .icon(() -> new ItemStack(Items.REINFORCED_DEEPSLATE)) // TODO figure out how to set this to the revenant + // flint .build(); public static final Item REVENANT_FLINT_AND_STEEL = new RevenantFlintAndSteelItem( @@ -41,7 +42,8 @@ public static void init() { Registry.register(Registry.ITEM, new Identifier("pandora", "revenant_flint_and_steel"), REVENANT_FLINT_AND_STEEL); Registry.register(Registry.ITEM, new Identifier("pandora", "debug_stick"), DEBUG_STICK); - // Registry.register(Registry.BLOCK, new Identifier("pandora", "soul_fire"), SOUL_FIRE); + // Registry.register(Registry.BLOCK, new Identifier("pandora", "soul_fire"), + // SOUL_FIRE); hasInitialized = true; diff --git a/src/main/java/pkg/deepCurse/pandora/core/items/PandoraDebugStickItem.java b/src/main/java/pkg/deepCurse/pandora/core/items/PandoraDebugStickItem.java index 0750bf3..e2e20d1 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/items/PandoraDebugStickItem.java +++ b/src/main/java/pkg/deepCurse/pandora/core/items/PandoraDebugStickItem.java @@ -59,34 +59,37 @@ private boolean use(PlayerEntity player, BlockState state, WorldAccess world, Bl } NbtCompound nbtState = NbtHelper.fromBlockState(state); - - log.info("{}, {}", nbtState, ((NbtCompound) nbtState.get("Properties"))); - + + // log.info("{}, {}", nbtState, ((NbtCompound) nbtState.get("Properties"))); + try { NbtCompound compound = NbtHelper.fromNbtProviderString(nbtState.asString()); log.info("Compound: {}", compound); - + } catch (CommandSyntaxException e) { throw new PandoraConfigParseException("Failed to parse config.", e); } Collection> props = state.getProperties(); log.info("props:\n{}", props); - + for (Property prop : props) { - log.info("{}",prop.getName()); + log.info("{}", prop.getName()); } - - + return true; } - // private static > BlockState cycle(BlockState state, Property property, boolean inverse) { - // return (BlockState) state.with(property, - // PandoraDebugStickItem.cycle(property.getValues(), state.get(property), inverse)); + // private static > BlockState cycle(BlockState state, + // Property property, boolean inverse) { + // return (BlockState) state.with(property, + // PandoraDebugStickItem.cycle(property.getValues(), state.get(property), + // inverse)); // } - // private static T cycle(Iterable elements, @Nullable T current, boolean inverse) { - // return inverse ? Util.previous(elements, current) : Util.next(elements, current); + // private static T cycle(Iterable elements, @Nullable T current, boolean + // inverse) { + // return inverse ? Util.previous(elements, current) : Util.next(elements, + // current); // } private void deserialize(BlockState state) { @@ -95,9 +98,6 @@ private void deserialize(BlockState state) { for (Property i : state.getProperties()) { log.info("Properties iteration:\n\tName: {}\n\tValue: {}", i.getName(), state.get(i)); } - - - } diff --git a/src/main/java/pkg/deepCurse/pandora/core/items/RevenantFlintAndSteelItem.java b/src/main/java/pkg/deepCurse/pandora/core/items/RevenantFlintAndSteelItem.java index 398220c..8d840e2 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/items/RevenantFlintAndSteelItem.java +++ b/src/main/java/pkg/deepCurse/pandora/core/items/RevenantFlintAndSteelItem.java @@ -21,8 +21,7 @@ import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; -public class RevenantFlintAndSteelItem - extends Item { +public class RevenantFlintAndSteelItem extends Item { public RevenantFlintAndSteelItem(Item.Settings settings) { super(settings); } @@ -41,14 +40,12 @@ public ActionResult useOnBlock(ItemUsageContext context) { Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD); world.emitGameEvent((Entity) playerEntity, GameEvent.BLOCK_CHANGE, blockPos); if (playerEntity != null) { - context.getStack().damage(1, playerEntity, - p -> p.sendToolBreakStatus(context.getHand())); + context.getStack().damage(1, playerEntity, p -> p.sendToolBreakStatus(context.getHand())); } return ActionResult.success(world.isClient()); } BlockPos blockPos2 = blockPos.offset(context.getSide()); - if (AbstractFireBlock.canPlaceAt(world, blockPos2, - context.getPlayerFacing())) { + if (AbstractFireBlock.canPlaceAt(world, blockPos2, context.getPlayerFacing())) { world.playSound(playerEntity, blockPos2, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0f, world.getRandom().nextFloat() * 0.4f + 0.8f); BlockState blockState2 = AbstractFireBlock.getState(world, blockPos2); diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/BackgroundRendererMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/BackgroundRendererMixin.java index 89b83a2..502c220 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/BackgroundRendererMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/BackgroundRendererMixin.java @@ -1,7 +1,7 @@ package pkg.deepCurse.pandora.core.mixins.client; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +// import org.slf4j.Logger; +// import org.slf4j.LoggerFactory; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -18,17 +18,24 @@ @Mixin(BackgroundRenderer.class) public class BackgroundRendererMixin { - @SuppressWarnings("unused") - private static Logger log = LoggerFactory.getLogger(BackgroundRendererMixin.class); + // private static Logger log = + // LoggerFactory.getLogger(BackgroundRendererMixin.class); + // method_28112, method_24873, render method_3210 + + // custom FOG, just the background FOG overlay @WrapOperation(method = "method_24873", at = @At(value = "INVOKE", target = "net/minecraft/client/render/DimensionEffects.adjustFogColor(Lnet/minecraft/util/math/Vec3d;F)Lnet/minecraft/util/math/Vec3d;")) private static Vec3d overrideFog(DimensionEffects effects, Vec3d color, float f, Operation operation, - ClientWorld world, BiomeAccess access, - float sunHeight, int i, int j, int k) { + ClientWorld world, BiomeAccess access, float sunHeight, int i, int j, int k) { + + var settings = PandoraConfig.General.DimensionSettings.get(world.getDimensionKey().getValue()); + + var result = operation.call(effects, color, f); + + if (settings != null) { + return settings.FogLevel.calculate(effects, color, f, result, world, access, sunHeight, i, j, k); + } - return PandoraConfig.DIMENSION_SETTINGS - .getOrDefault(world.getDimensionKey().getValue(), (e, c, f2, o, w, a, s, i2, j2, k2) -> o) - .calculate(effects, color, f, operation.call(effects, color, f), world, access, sunHeight, i, j, k); - + return result; } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/GameRendererMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/GameRendererMixin.java index 8c65bfd..ee8e7fd 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/GameRendererMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/GameRendererMixin.java @@ -22,10 +22,10 @@ @Mixin(GameRenderer.class) public class GameRendererMixin { - + @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(GameRendererMixin.class); - + @Shadow private MinecraftClient client; @Shadow diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/LightmapTextureManagerMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/LightmapTextureManagerMixin.java index 52dc236..c247fda 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/LightmapTextureManagerMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/LightmapTextureManagerMixin.java @@ -22,10 +22,10 @@ @Mixin(LightmapTextureManager.class) public class LightmapTextureManagerMixin implements LightmapAccess { - + @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(LightmapTextureManagerMixin.class); - + @Shadow private NativeImageBackedTexture texture; @Shadow @@ -47,4 +47,4 @@ public float darkness_prevFlicker() { public boolean darkness_isDirty() { return dirty; } -} \ No newline at end of file +} diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/NativeImageBackedTextureMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/NativeImageBackedTextureMixin.java index 60d5ed4..8832f49 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/client/NativeImageBackedTextureMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/client/NativeImageBackedTextureMixin.java @@ -11,16 +11,15 @@ import org.spongepowered.asm.mixin.injection.callback.*; import net.minecraft.client.texture.*; -import pkg.deepCurse.pandora.core.*; import pkg.deepCurse.pandora.core.util.interfaces.*; import pkg.deepCurse.pandora.core.util.tools.*; @Mixin(NativeImageBackedTexture.class) public class NativeImageBackedTextureMixin implements TextureAccess { - + @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(NativeImageBackedTextureMixin.class); - + @Shadow NativeImage image; @@ -28,7 +27,7 @@ public class NativeImageBackedTextureMixin implements TextureAccess { @Inject(method = "upload", at = @At(value = "HEAD")) private void onUpload(CallbackInfo ci) { - if (enableHook && PandoraConfig.ENABLE_CUSTOM_FOG && image != null) { + if (enableHook && DarknessTools.ENABLE_WORKSPACE_DARKNESS && image != null) { final NativeImage img = image; for (int b = 0; b < 16; b++) { diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/MobEntityMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/MobEntityMixin.java index c94c15b..e0ff13e 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/MobEntityMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/MobEntityMixin.java @@ -1,18 +1,24 @@ package pkg.deepCurse.pandora.core.mixins.shared; -import org.slf4j.*; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.*; -import org.spongepowered.asm.mixin.injection.callback.*; - -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.mob.*; -import net.minecraft.util.math.*; -import pkg.deepCurse.pandora.core.*; -import pkg.deepCurse.pandora.core.util.ai.goals.*; -import pkg.deepCurse.pandora.core.util.tools.*; - -@Mixin(MobEntity.class) // TODO change to PathAwareEntity? +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.ai.goal.GoalSelector; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; +import net.minecraft.world.World; +import pkg.deepCurse.pandora.core.PandoraConfig; +import pkg.deepCurse.pandora.core.util.ai.goals.EscapeGrueGoal; + +@Mixin(MobEntity.class) // TODO modify all wander goals to prioritize light over dark, but not to make it a requirement public class MobEntityMixin { @SuppressWarnings("unused") @@ -24,23 +30,37 @@ public class MobEntityMixin { @Shadow private BlockPos positionTarget; - @Inject(method = "initGoals()V", at = @At(value = "RETURN")) - private void appendGoals(CallbackInfo ci) { + @Inject(method = "*", at = @At(value = "RETURN")) // TODO fix this, using the constructor does not guarantee the goal will stay if a custom entity clears its goals + private void pandora_constructorReturn(EntityType entityType, World world, CallbackInfo ci) { // portal to SheepEntity and VillagerEntity MobEntity self = (MobEntity) (Object) this; - if (self instanceof PathAwareEntity && PandoraTools.shouldFearDarkness(self)) { - goalSelector.add(0, new EscapeGrueGoal(self, 1.2D, - PandoraConfig.MINIMUM_SAFE_LIGHT_LEVEL)); // TODO add support for prioritizing safe over fade, but allow fade + // TODO give a slight regen effect when near light? + var type = self.getType(); + var identifier = Registry.ENTITY_TYPE.getId(type); + var mobSettings = PandoraConfig.General.MobSettings.get(identifier); + +// log.info("initGoals: {} {} {}", type, identifier, mobSettings); + + // TODO add support for prioritizing safe over fade, but allow fade + // self instanceof PathAwareEntity && + if (mobSettings != null && mobSettings.FearDarkness) { + goalSelector.add(0, new EscapeGrueGoal(self, 1D/* TODO patch this speed value to load from config? */, + PandoraConfig.General.MinimumSafeLightLevel)); } } - // This method was supposed to prevent entities from walking into the darkness unless absolutely necissary + // This method was supposed to prevent entities from walking into the darkness + // unless absolutely necissary // FIXME bug where entities spin in place after moving one block - // @Inject(method = "getPathfindingPenalty(Lnet/minecraft/entity/ai/pathing/PathNodeType;)F", at = @At(value = "RETURN")) - // private float getPathFindingPenaltyOverride(PathNodeType nodeType, CallbackInfoReturnable cir) { - - // if (PandoraTools.isNearLight(((Entity) (Object) this).world, positionTarget)) { - // return cir.getReturnValueF(); - // } - // return 16F; + // @Inject(method = + // "getPathfindingPenalty(Lnet/minecraft/entity/ai/pathing/PathNodeType;)F", at + // = @At(value = "RETURN")) + // private float getPathFindingPenaltyOverride(PathNodeType nodeType, + // CallbackInfoReturnable cir) { + + // if (PandoraTools.isNearLight(((Entity) (Object) this).world, positionTarget)) + // { + // return cir.getReturnValueF(); + // } + // return 16F; // } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/SoulFireBlockMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/SoulFireBlockMixin.java index 06bf2c3..13b80aa 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/SoulFireBlockMixin.java +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/SoulFireBlockMixin.java @@ -14,7 +14,8 @@ public class SoulFireBlockMixin { @Inject(method = "canPlaceAt", at = @At(value = "RETURN"), cancellable = true) - private void canPlaceAtOverride(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable cir) { + private void canPlaceAtOverride(BlockState state, WorldView world, BlockPos pos, + CallbackInfoReturnable cir) { } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/StateMixin.java b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/StateMixin.java new file mode 100644 index 0000000..092e2d3 --- /dev/null +++ b/src/main/java/pkg/deepCurse/pandora/core/mixins/shared/StateMixin.java @@ -0,0 +1,25 @@ +package pkg.deepCurse.pandora.core.mixins.shared; + +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Function; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import net.minecraft.state.State; +import net.minecraft.state.property.Property; +import pkg.deepCurse.pandora.core.util.interfaces.PropertyMapPrinterAccess; + +@Mixin(State.class) +public class StateMixin implements PropertyMapPrinterAccess { + + @Shadow + public static Function, Comparable>, String> PROPERTY_MAP_PRINTER; + + @Override + public Function, Comparable>, String> pandora_getPropertyMapPrinter() { + return PROPERTY_MAP_PRINTER; + } + +} diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/ai/goals/EscapeGrueGoal.java b/src/main/java/pkg/deepCurse/pandora/core/util/ai/goals/EscapeGrueGoal.java index 5735c4a..01e451b 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/ai/goals/EscapeGrueGoal.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/ai/goals/EscapeGrueGoal.java @@ -16,17 +16,19 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.random.Random; +import net.minecraft.util.registry.Registry; import net.minecraft.world.World; +import pkg.deepCurse.pandora.core.PandoraConfig; import pkg.deepCurse.pandora.core.util.tools.PandoraTools; /** * recovered from old pandora, 2021/10/21 */ public class EscapeGrueGoal extends Goal /* MoveToTargetPosGoal? */ { - + @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(EscapeGrueGoal.class); - + protected final MobEntity mob; private double targetX; @@ -50,19 +52,23 @@ public EscapeGrueGoal(MobEntity mob, double speed, int minimumLightLevel) { } public boolean canStart() { - if (!(this.mob instanceof HostileEntity) && !(this.mob instanceof AnimalEntity) - && !(this.mob instanceof VillagerEntity)) { + if (!PandoraConfig.General.MobSettings.get(Registry.ENTITY_TYPE.getId(this.mob.getType())).FearDarkness) { +// log.info("MobSettings {}", this.mob); return false; } if (this.mob.getTarget() != null) { +// log.info("hasTarget {}", this.mob); return false; } if (PandoraTools.isNearLight(this.world, this.mob.getBlockPos(), this.minimumLightLevel)) { +// log.info("isNearLight {}", this.mob); return false; } if (targetLightPos()) { +// log.info("noValidPos {}", this.mob); return false; } +// log.info("validPos {}", this.mob); return true; } @@ -93,7 +99,8 @@ protected Vec3d locateBrightPos() { BlockPos blockPos2 = blockPos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10); if (PandoraTools.isNearLight(this.world, blockPos2, this.minimumLightLevel)) { if (this.mob instanceof PathAwareEntity) { - if (((PathAwareEntity) this.mob).getPathfindingFavor(blockPos2) < 0.0F); + if (((PathAwareEntity) this.mob).getPathfindingFavor(blockPos2) < 0.0F) + ; return Vec3d.ofBottomCenter((Vec3i) blockPos2); } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/callbacks/EndServerTickCallback.java b/src/main/java/pkg/deepCurse/pandora/core/util/callbacks/EndServerTickCallback.java index ba59eab..d7a05fb 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/callbacks/EndServerTickCallback.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/callbacks/EndServerTickCallback.java @@ -9,39 +9,40 @@ import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.server.world.*; -import net.minecraft.util.*; import net.minecraft.util.math.*; -import net.minecraft.util.registry.*; +import net.minecraft.util.registry.Registry; import pkg.deepCurse.pandora.core.*; +import pkg.deepCurse.pandora.core.PandoraConfig.General; import pkg.deepCurse.pandora.core.util.managers.*; import pkg.deepCurse.pandora.core.util.tools.*; public class EndServerTickCallback { - @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(EndServerTickCallback.class); private static EntityCooldownManager cooldownManager = new EntityCooldownManager(); public static void run(ServerWorld world) { - - cooldownManager.update(); - Iterator entities = world.iterateEntities().iterator(); while (entities.hasNext()) { Entity entity = entities.next(); - + + // log.info("{} {}", Registry.ENTITY_TYPE.getId(entity.getType()), cooldownManager.getCooldownProgress(entity, 0)); + if (!cooldownManager.isCoolingDown(entity)) { doDarknessDamage(entity, 0.0F, world); - cooldownManager.set(entity, - world.getRandom().nextInt(60) + 30); + cooldownManager.set(entity, world.getRandom().nextInt(100) + 40); } + + cooldownManager.update(); // ASAP COOLDOWN MANAGER BROKEY } } - private static void doDarknessDamage(Entity entity, float damageAmount, - ServerWorld world) { // TODO optimize a bit more at some point - // FIXME re test all values here because i heavily messed with some variables and changed logic + private static void doDarknessDamage(Entity entity, float damageAmount, ServerWorld world) { // TODO optimize a bit + // more at some + // point + // FIXME re test all values here because i heavily messed with some variables + // and changed logic if (!(entity instanceof LivingEntity)) { return; @@ -50,101 +51,99 @@ private static void doDarknessDamage(Entity entity, float damageAmount, Double wardPotency = 0D; float nonPlayerAttackChance = world.getRandom().nextFloat(); - if (PandoraConfig.ENABLE_GRUE_WARDS) { + if (PandoraConfig.General.Enabled.EnableGrueWards) { Iterator itemStack = entity.getItemsEquipped().iterator(); while (itemStack.hasNext()) { - for (Pair, Double> i : PandoraConfig.GRUE_WARDS) { - for (Identifier j : i.getLeft()) { - if (itemStack.next().getRegistryEntry().matchesId(j)) { - wardPotency = i.getRight(); - } + for (var i : PandoraConfig.General.GrueWards.entrySet()) { // + if (itemStack.next().getRegistryEntry().matchesId(i.getKey())) { + wardPotency = i.getValue().Potency; } } } } - if (PandoraConfig.FORCE_GRUES_ALWAYS_ATTACK) { + if (PandoraConfig.Debug.ForceGruesAlwaysAttack) { nonPlayerAttackChance = 1; wardPotency = 0D; } - + + if (!General.DimensionSettings.get(world.getRegistryKey().getValue()).Infested) { + return; + } + BlockPos entityLocation = entity.getBlockPos(); - if (PandoraTools.isNearLight(world, entityLocation)) + if (PandoraTools.isNearLight(world, entityLocation, PandoraConfig.General.MinimumSafeLightLevel)) + return; + if (PandoraTools.isNearLight(world, entityLocation, PandoraConfig.General.MinimumFadeLightLevel) + && world.random.nextFloat() > 0.85f) { // TODO use cooldown manager here return; + } if (damageAmount <= 0.0F) { switch (world.getDifficulty()) { - case HARD: - damageAmount = 8.0F; - break; - case NORMAL: - damageAmount = 4.0F; - break; - case EASY: - damageAmount = 2.0F; - break; - case PEACEFUL: - damageAmount = 1.0F; + case HARD: + damageAmount = 8.0F; + break; + case NORMAL: + damageAmount = 4.0F; + break; + case EASY: + damageAmount = 2.0F; + break; + case PEACEFUL: + damageAmount = 1.0F; } } - if (!world.getBlockState(entityLocation).isAir()) { + if (!world.getBlockState(entityLocation).isAir()) { // TODO prevent villagers from walking into the darkness + // willingly, optimize their pathfinding for light entityLocation = entityLocation.up(); - } // patch for soul sand + } // patch for soul sand since the poll location is the center of the feet, which + // sinks into the soul sand, meaning if you stand on soul sand you are always in + // 0 light + + // TODO bottle o ghast tears if (entity instanceof PlayerEntity) { - if (((PlayerEntity) entity).isCreative()) { + if (((PlayerEntity) entity).isCreative()) return; - } } else { - if (PandoraConfig.ANIMALS.contains(Registry.ENTITY_TYPE.getId(entity.getType())) && !PandoraConfig.GRUES_ATTACK_HOSTILE_MOBS) { - damageAmount /= 2.0F; - return; - } - - if (PandoraConfig.ANIMALS.contains(Registry.ENTITY_TYPE.getId(entity.getType())) && !PandoraConfig.GRUES_ATTACK_VILLAGERS) { - return; - } - - if (PandoraConfig.ANIMALS.contains(Registry.ENTITY_TYPE.getId(entity.getType())) && !PandoraConfig.GRUES_ATTACK_ANIMALS) { - return; - } - if (entity.getType() == EntityType.ITEM) { if (nonPlayerAttackChance <= 0.003D // 0.3% chance - && PandoraConfig.GRUES_EAT_ITEMS) { + && PandoraConfig.General.GruesEatItems) { entity.kill(); return; } - return; - } + } else { + var mob_settings = PandoraConfig.General.MobSettings.get(Registry.ENTITY_TYPE.getId(entity.getType())); + + if (mob_settings == null) + return; + + damageAmount *= mob_settings.DamageMultiplier; + + } + if (nonPlayerAttackChance < 0.90D) { // 90% chance return; } } - if (((LivingEntity) entity).getActiveStatusEffects() - .containsKey(StatusEffects.NIGHT_VISION)) + if (((LivingEntity) entity).getActiveStatusEffects().containsKey(StatusEffects.NIGHT_VISION)) // TODO make this + // configurable return; - if (entity.isSubmergedInWater() && !PandoraConfig.GRUES_ATTACK_IN_WATER) - return; - - if (!PandoraConfig.moblistContains(Registry.ENTITY_TYPE.getId(entity.getType()))) + if (entity.isSubmergedInWater() && !PandoraConfig.General.GruesAttackInWater) return; if (world.getServer().isHardcore() - && (PandoraConfig.HARDCORE_AFFECTS_OTHER_MOBS - || entity instanceof PlayerEntity)) { + && (PandoraConfig.General.HardcoreAffectsOtherMobs || entity instanceof PlayerEntity)) damageAmount = Float.MAX_VALUE; - } - - if (wardPotency == 0 || (world.random.nextFloat() > wardPotency)) { - entity.damage(CustomDamageSources.GRUE, - damageAmount); + if (world.random.nextFloat() > wardPotency && damageAmount != 0f) { + entity.damage(CustomDamageSources.GRUE, damageAmount); // TODO glow squids } } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/exceptions/PandoraConfigParseException.java b/src/main/java/pkg/deepCurse/pandora/core/util/exceptions/PandoraConfigParseException.java index 81a7201..47e6c39 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/exceptions/PandoraConfigParseException.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/exceptions/PandoraConfigParseException.java @@ -1,6 +1,6 @@ package pkg.deepCurse.pandora.core.util.exceptions; -public class PandoraConfigParseException extends RuntimeException { // TODO add extra trace functionality, and an automatic error handler that opens a client screen +public class PandoraConfigParseException extends RuntimeException { // ASAP get rid of this garbage public PandoraConfigParseException() { super(); @@ -18,8 +18,7 @@ public PandoraConfigParseException(Throwable cause) { super(cause); } - protected PandoraConfigParseException(String message, Throwable cause, - boolean enableSuppression, + protected PandoraConfigParseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/integrations/ModMenuIntegration.java b/src/main/java/pkg/deepCurse/pandora/core/util/integrations/ModMenuIntegration.java index 9505b03..a5dae03 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/integrations/ModMenuIntegration.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/integrations/ModMenuIntegration.java @@ -13,7 +13,7 @@ public class ModMenuIntegration implements ModMenuApi { @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(ModMenuIntegration.class); - + @Override public ConfigScreenFactory getModConfigScreenFactory() { return screen -> createNewConfigScreen(screen); diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/ConditionalToIntFunction.java b/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/ConditionalToIntFunction.java new file mode 100644 index 0000000..002e545 --- /dev/null +++ b/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/ConditionalToIntFunction.java @@ -0,0 +1,6 @@ +package pkg.deepCurse.pandora.core.util.interfaces; + +@FunctionalInterface +public interface ConditionalToIntFunction { + int applyAsInt(T value, int oldValue); +} diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/PropertyMapPrinterAccess.java b/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/PropertyMapPrinterAccess.java new file mode 100644 index 0000000..e4ff8bc --- /dev/null +++ b/src/main/java/pkg/deepCurse/pandora/core/util/interfaces/PropertyMapPrinterAccess.java @@ -0,0 +1,10 @@ +package pkg.deepCurse.pandora.core.util.interfaces; + +import java.util.Map; +import java.util.function.Function; + +import net.minecraft.state.property.Property; + +public interface PropertyMapPrinterAccess { + Function, Comparable>, String> pandora_getPropertyMapPrinter(); +} diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/managers/EntityCooldownManager.java b/src/main/java/pkg/deepCurse/pandora/core/util/managers/EntityCooldownManager.java index d95f3f6..56e0f96 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/managers/EntityCooldownManager.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/managers/EntityCooldownManager.java @@ -13,12 +13,12 @@ // stolen from mojang with <3 public class EntityCooldownManager { - + @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(EntityCooldownManager.class); - + private final Map entries = Maps.newHashMap(); - private int tick; + private long tick; public boolean isCoolingDown(Entity entity) { return this.getCooldownProgress(entity, 0.0f) > 0.0f; @@ -37,20 +37,22 @@ public float getCooldownProgress(Entity entity, float f) { public void update() { ++this.tick; if (!this.entries.isEmpty()) { - Iterator> iterator = this.entries - .entrySet().iterator(); + Iterator> iterator = this.entries.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); - if (entry.getValue().endTick > this.tick) +// log.info("entry: {}", entry.getKey()); + if (entry.getValue().endTick > this.tick) { continue; + } iterator.remove(); + this.remove(entry.getKey()); this.onCooldownUpdate(entry.getKey()); } } } - public void set(Entity entity, int i) { - this.entries.put(entity, new Entry(this.tick, this.tick + i)); + public void set(Entity entity, long i) { + this.entries.putIfAbsent(entity, new Entry(this.tick, this.tick + i)); this.onCooldownUpdate(entity, i); } @@ -59,17 +61,17 @@ public void remove(Entity entity) { this.onCooldownUpdate(entity); } - protected void onCooldownUpdate(Entity entity, int i) { + protected void onCooldownUpdate(Entity entity, long i) { } protected void onCooldownUpdate(Entity entity) { } private static class Entry { - final int startTick; - final int endTick; + final long startTick; + final long endTick; - Entry(int i, int j) { + Entry(long i, long j) { this.startTick = i; this.endTick = j; } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/screens/DebugScreen.java b/src/main/java/pkg/deepCurse/pandora/core/util/screens/DebugScreen.java index fa6658e..82065d5 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/screens/DebugScreen.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/screens/DebugScreen.java @@ -28,17 +28,15 @@ public DebugScreen(Screen parent) { @Override public void init() { - this.addDrawableChild(new ButtonWidget(0, 0, 49, 10, - Text.translatable("pandora.menu.return"), (buttonWidget) -> { + this.addDrawableChild( + new ButtonWidget(0, 0, 49, 10, Text.translatable("pandora.menu.return"), (buttonWidget) -> { this.client.setScreen(this.parent); })); - this.addDrawableChild(new ButtonWidget(0, 10, 79, 10, - Text.translatable("pandora.menu.debug.save.config"), - (buttonWidget) -> { + this.addDrawableChild( + new ButtonWidget(0, 10, 79, 10, Text.translatable("pandora.menu.debug.save.config"), (buttonWidget) -> { PandoraConfig.saveConfigs(); })); - this.addDrawableChild(new ButtonWidget(0, 20, 59, 10, - Text.translatable("pandora.menu.debug.reload.config"), + this.addDrawableChild(new ButtonWidget(0, 20, 59, 10, Text.translatable("pandora.menu.debug.reload.config"), (buttonWidget) -> { try { PandoraConfig.loadConfig(); @@ -46,8 +44,7 @@ public void init() { e.printStackTrace(); } })); - this.addDrawableChild(new ButtonWidget(60, 20, 59, 10, - Text.translatable("pandora.menu.debug.register.hooks"), + this.addDrawableChild(new ButtonWidget(60, 20, 59, 10, Text.translatable("pandora.menu.debug.register.hooks"), (buttonWidget) -> { try { Pandora.registerHooks(); @@ -57,17 +54,15 @@ public void init() { })); // this.addDrawableChild(new ButtonWidget(60, 20, 59, 10, - // Text.translatable("pandora.menu.debug.new.config"), - // (buttonWidget) -> { - // PandoraConfig.newConfig(); - // })); LEGACY unset method - this.addDrawableChild(new ButtonWidget(0, 30, 69, 10, - Text.translatable("pandora.menu.debug.delete.config"), + // Text.translatable("pandora.menu.debug.new.config"), + // (buttonWidget) -> { + // PandoraConfig.newConfig(); + // })); LEGACY unset method + this.addDrawableChild(new ButtonWidget(0, 30, 69, 10, Text.translatable("pandora.menu.debug.delete.config"), (buttonWidget) -> { PandoraConfig.deleteConfig(); })); - this.addDrawableChild(new ButtonWidget(0, 40, 79, 10, - Text.translatable("pandora.menu.debug.unpack.config"), + this.addDrawableChild(new ButtonWidget(0, 40, 79, 10, Text.translatable("pandora.menu.debug.unpack.config"), (buttonWidget) -> { try { PandoraConfig.unpackageConfig(); @@ -75,11 +70,10 @@ public void init() { e.printStackTrace(); } })); - this.addDrawableChild(new ButtonWidget(101, 100, 20, 10, - Text.translatable("print modified block lights"), - (buttonWidget) -> { - log.info("{}\n{}", PandoraConfig.BLOCK_LIGHT_LEVEL_FUNCTIONS.entrySet(), - PandoraConfig.BLOCK_LIGHT_LEVEL_FUNCTIONS.values()); + this.addDrawableChild( + new ButtonWidget(101, 100, 20, 10, Text.translatable("print modified block lights"), (buttonWidget) -> { + log.info("{}\n{}", PandoraConfig.General.BlockLightLevelSettings.entrySet(), + PandoraConfig.General.BlockLightLevelSettings.values()); })); this.addDrawableChild(new SliderWidget(0, 80, 100, 20, Text.literal("fog factor: " + factor), 1.0D) { @@ -116,33 +110,25 @@ protected void applyValue() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, - float delta) { + public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { MatrixStack mats = new MatrixStack(); int vOffset = 0; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.setShaderTexture(0, - new Identifier("minecraft", "textures/block/deepslate.png")); + RenderSystem.setShaderTexture(0, new Identifier("minecraft", "textures/block/deepslate.png")); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); - bufferBuilder.begin(DrawMode.QUADS, - VertexFormats.POSITION_TEXTURE_COLOR); + bufferBuilder.begin(DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); bufferBuilder.vertex(0.0D, (double) this.height, 0.0D) - .texture(0.0F, (float) this.height / 32.0F + (float) vOffset) - .color(64, 64, 64, 255).next(); + .texture(0.0F, (float) this.height / 32.0F + (float) vOffset).color(64, 64, 64, 255).next(); bufferBuilder.vertex((double) this.width, (double) this.height, 0.0D) - .texture((float) this.width / 32.0F, - (float) this.height / 32.0F + (float) vOffset) - .color(64, 64, 64, 255).next(); - bufferBuilder.vertex((double) this.width, 0.0D, 0.0D) - .texture((float) this.width / 32.0F, (float) vOffset) + .texture((float) this.width / 32.0F, (float) this.height / 32.0F + (float) vOffset) .color(64, 64, 64, 255).next(); - bufferBuilder.vertex(0.0D, 0.0D, 0.0D).texture(0.0F, (float) vOffset) + bufferBuilder.vertex((double) this.width, 0.0D, 0.0D).texture((float) this.width / 32.0F, (float) vOffset) .color(64, 64, 64, 255).next(); + bufferBuilder.vertex(0.0D, 0.0D, 0.0D).texture(0.0F, (float) vOffset).color(64, 64, 64, 255).next(); tessellator.draw(); - drawCenteredText(mats, this.textRenderer, this.title, this.width / 2, - 15, 16777215); + drawCenteredText(mats, this.textRenderer, this.title, this.width / 2, 15, 16777215); super.render(mats, mouseX, mouseY, delta); } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/tools/CalculateFogFunction.java b/src/main/java/pkg/deepCurse/pandora/core/util/tools/CalculateFogFunction.java index 83eb415..70ee1ef 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/tools/CalculateFogFunction.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/tools/CalculateFogFunction.java @@ -8,8 +8,7 @@ @FunctionalInterface public interface CalculateFogFunction { // interface for darkness api? will be used internally - Vec3d calculate(DimensionEffects effects, Vec3d color, float f, Vec3d oldValue, - ClientWorld world, BiomeAccess access, - float sunHeight, int i, int j, int k); + Vec3d calculate(DimensionEffects owner, Vec3d color, float sun_angle, Vec3d oldValue, ClientWorld world, + BiomeAccess access, float sunHeight, int i, int j, int k); } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/tools/DarknessTools.java b/src/main/java/pkg/deepCurse/pandora/core/util/tools/DarknessTools.java index 5a46460..1b297f4 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/tools/DarknessTools.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/tools/DarknessTools.java @@ -60,28 +60,30 @@ public class DarknessTools { // } private static boolean isDark(World world) { - return PandoraConfig.DIMENSION_SETTINGS.containsKey(world.getRegistryKey().getValue()); + return PandoraConfig.General.DimensionSettings.containsKey(world.getRegistryKey().getValue()); } private static float skyFactor(World world) { - if (!PandoraConfig.IGNORE_SKY_LIGHT && isDark(world)) { - if (world.getDimension().hasSkyLight()) { - final float angle = world.getSkyAngle(0); - - if (angle > 0.25f && angle < 0.75f) { - final float oldWeight = Math.max(0, (Math.abs(angle - 0.5f) - 0.2f)) * 20; - final float moon = PandoraConfig.IGNORE_MOON_PHASE ? 0 - : world.getMoonSize(); - return MathHelper.lerp(oldWeight * oldWeight * oldWeight, moon * moon, 1f); - } else { - return 1; - } - } else { - return 0; - } - } else { + +// var dimSettings = PandoraConfig.General.DimensionSettings.get(world.getRegistryKey().getValue()); + +// if (dimSettings.FogLevel!=1D) { +// +// } + + if (world.getDimension().hasSkyLight() && PandoraConfig.General.IgnoreSkyLight) { return 1; } + + final float angle = world.getSkyAngle(0); + + if (angle > 0.25f && angle < 0.75f) { // TODO fine tune these angles + final float oldWeight = Math.max(0, (Math.abs(angle - 0.5f) - 0.2f)) * 20; + final float moon = PandoraConfig.General.IgnoreMoonPhase ? 0 : world.getMoonSize(); + return MathHelper.lerp(oldWeight * oldWeight * oldWeight, moon * moon, 1f); + } + + return 1; } private static final float[][] LUMINANCE = new float[16][16]; @@ -103,8 +105,10 @@ public static float luminance(float r, float g, float b) { return r * 0.2126f + g * 0.7152f + b * 0.0722f; } - public static void updateLuminance(float tickDelta, MinecraftClient client, - GameRenderer worldRenderer, float prevFlicker) { + public static boolean ENABLE_WORKSPACE_DARKNESS = true; + + public static void updateLuminance(float tickDelta, MinecraftClient client, GameRenderer worldRenderer, + float prevFlicker) { final ClientWorld world = client.world; if (world != null) { @@ -112,16 +116,16 @@ public static void updateLuminance(float tickDelta, MinecraftClient client, || (client.player.hasStatusEffect(StatusEffects.CONDUIT_POWER) && client.player.getUnderwaterVisibility() > 0) || world.getLightningTicksLeft() > 0) { - PandoraConfig.ENABLE_CUSTOM_FOG = false; + ENABLE_WORKSPACE_DARKNESS = false; return; } else { - PandoraConfig.ENABLE_CUSTOM_FOG = true; + ENABLE_WORKSPACE_DARKNESS = true; } final float dimSkyFactor = skyFactor(world); final float ambient = world.getStarBrightness(1.0F); final DimensionType dim = world.getDimension(); - final boolean blockAmbient = !isDark(world); + final boolean darkWorld = isDark(world); for (int skyIndex = 0; skyIndex < 16; ++skyIndex) { float skyFactor = 1f - skyIndex / 15f; @@ -148,7 +152,7 @@ public static void updateLuminance(float tickDelta, MinecraftClient client, for (int blockIndex = 0; blockIndex < 16; ++blockIndex) { float blockFactor = 1f; - if (!blockAmbient) { + if (darkWorld) { blockFactor = 1f - blockIndex / 15f; blockFactor = 1 - blockFactor * blockFactor * blockFactor * blockFactor; } @@ -169,11 +173,11 @@ public static void updateLuminance(float tickDelta, MinecraftClient client, green = green * (0.99F - min) + min; blue = blue * (0.99F - min) + min; - if (world.getRegistryKey() == World.END) { - red = skyFactor * 0.22F + blockBase * 0.75f; - green = skyFactor * 0.28F + blockGreen * 0.75f; - blue = skyFactor * 0.25F + blockBlue * 0.75f; - } +// if (world.getRegistryKey() == World.END) { +// red = skyFactor * 0.22F + blockBase * 0.75f; +// green = skyFactor * 0.28F + blockGreen * 0.75f; +// blue = skyFactor * 0.25F + blockBlue * 0.75f; +// } if (red > 1.0F) { red = 1.0F; @@ -202,32 +206,33 @@ public static void updateLuminance(float tickDelta, MinecraftClient client, red = red * (0.99F - min) + min; green = green * (0.99F - min) + min; blue = blue * (0.99F - min) + min; - - if (red > 1.0F) { - red = 1.0F; - } - - if (green > 1.0F) { - green = 1.0F; - } - - if (blue > 1.0F) { - blue = 1.0F; - } - - if (red < 0.0F) { - red = 0.0F; - } - - if (green < 0.0F) { - green = 0.0F; - } - - if (blue < 0.0F) { - blue = 0.0F; - } - - LUMINANCE[blockIndex][skyIndex] = luminance(red, green, blue); + +// if (red > 1.0F) { +// red = 1.0F; +// } +// +// if (green > 1.0F) { +// green = 1.0F; +// } +// +// if (blue > 1.0F) { +// blue = 1.0F; +// } +// +// if (red < 0.0F) { +// red = 0.0F; +// } +// +// if (green < 0.0F) { +// green = 0.0F; +// } +// +// if (blue < 0.0F) { +// blue = 0.0F; +// } + + LUMINANCE[blockIndex][skyIndex] = luminance(Math.max(0f, Math.min(1f, red)), Math.max(0f, Math.min(1f, green)), Math.max(0f, Math.min(1f, blue))); +// LUMINANCE[blockIndex][skyIndex] = luminance(red, green, blue); } } } diff --git a/src/main/java/pkg/deepCurse/pandora/core/util/tools/PandoraTools.java b/src/main/java/pkg/deepCurse/pandora/core/util/tools/PandoraTools.java index c3358c1..ddd0cfb 100644 --- a/src/main/java/pkg/deepCurse/pandora/core/util/tools/PandoraTools.java +++ b/src/main/java/pkg/deepCurse/pandora/core/util/tools/PandoraTools.java @@ -12,24 +12,16 @@ public class PandoraTools { - @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(PandoraTools.class); - public static boolean isNearLight(World world, BlockPos pos) { - return isNearLight(world, pos, PandoraConfig.MINIMUM_SAFE_LIGHT_LEVEL); // TODO fade support - } - - public static boolean isNearLight(World world, BlockPos pos, - int minimumSafeLightLevel) { + public static boolean isNearLight(World world, BlockPos pos, int minimumSafeLightLevel) { int blockLightLevel = world.getLightLevel(LightType.BLOCK, pos); int skyLightLevel = world.getLightLevel(LightType.SKY, pos); if (blockLightLevel >= minimumSafeLightLevel) { return true; } else { - if (world.getDimension().hasSkyLight() - && skyLightLevel >= minimumSafeLightLevel) { - float angle = world.getDimension() - .getSkyAngle(world.getLunarTime()); + if (world.getDimension().hasSkyLight() && skyLightLevel >= minimumSafeLightLevel) { + float angle = world.getDimension().getSkyAngle(world.getLunarTime()); if (angle < 0.26F || angle > 0.73F) { return true; } @@ -44,19 +36,16 @@ public static boolean isNearLight(World world, BlockPos pos, } public static void overrideLuminance(Identifier identifier, Block block) { - if (PandoraConfig.BLOCK_LIGHT_LEVEL_FUNCTIONS.containsKey(identifier)) { - // log.info("[Pandora] Changing luminance of {} from {} to {}", identifier, - // block.getDefaultState().getLuminance(), - // PandoraConfig.lightLevelBlockPairs.get(identifier).applyAsInt( - // block.getDefaultState())); + if (PandoraConfig.General.BlockLightLevelSettings.containsKey(identifier)) { +// log.info("[Pandora] Changing luminance of {} from {} to {}", identifier, +// block.getDefaultState().getLuminance(), +// PandoraConfig.General.BlockLightLevelSettings.get(identifier).LightLevel); for (BlockState state : block.getStateManager().getStates()) { ((LuminanceOverride) state) - .setLuminance(PandoraConfig.BLOCK_LIGHT_LEVEL_FUNCTIONS.get(identifier).applyAsInt(state)); + .setLuminance(PandoraConfig.General.BlockLightLevelSettings.get(identifier).LightLevel + .applyAsInt(state, state.getLuminance())); } - } + } // Blocks } - public static boolean shouldFearDarkness(MobEntity self) { - return true; // TODO fix - } } \ No newline at end of file diff --git a/src/main/resources/assets/pandora/pandora.yaml b/src/main/resources/assets/pandora/pandora.yaml index bec4cd3..2cc7a92 100644 --- a/src/main/resources/assets/pandora/pandora.yaml +++ b/src/main/resources/assets/pandora/pandora.yaml @@ -1,4 +1,4 @@ -# To restore this config to its original values, simply delete this file +# To restore this config to its original values, simply delete this file and start the mod again # This config is very specific with what it needs for each key # But dont worry, the mod will tell you if something goes wrong while loading it # And the mod will even tell you what is wrong and how to fix it @@ -6,12 +6,24 @@ # You can hit F and notepad to find it for you # If you have any questions feel free to join my discord (https://discord.gg/T4kjkyZUw2) general: - + # Should certain sections of this mod be enabled + enabled: + # The entire mod + enable pandora: true + # custom dimension fog, the fog that cuts off the edge of the render distance + enable custom fog: true + # Allows entities to run towards light and stay within the light, as well as use grue wards + enable pandora ai: true # TODO + # Change block brightness depending on the darkness level of the world + enable light modifications: true # TODO + # Should certian glowing items scare away grues + enable grue wards: true # TODO + # Should pandora ignore all skylight (only torches or light blocks count) ignore sky light: false # Should pandora ignore what moon phase the moon is ignore moon phase: false - + # If the current light level is greater or equal to this value, grues will not attack minimum safe light level: 5 # If the current light level is greater or equal to this value and less than the above value, grues may still have interest @@ -23,80 +35,244 @@ general: # should your gamma be reset, and what value it should be reset to reset gamma: true gamma value: 1.0 - + # In testing this was revealed to be very unfair for the player, so it is left on false grues attack in water: false - + # Should grues be able to eat items grues eat items: true - - # Should certain sections of this mod be enabled - enabled: - enable pandora: true - enable custom fog: true - enable pandora ai: true - enable light modifications: true # TODO - enable grue wards: true # TODO - - block light settings: +# TODO ash + block light settings: # TODO glowing armor trim + # Fire based lights + - id: "minecraft:lava" + light level: 15 + - id: "minecraft:lava_cauldron" + light level: 12 # lava - 3 + - id: "minecraft:fire" + light level: 10 - id: "minecraft:torch" - # light level, from 0 to 15 + light level: 10 + - id: "minecraft:wall_torch" + light level: 10 + - id: "minecraft:furnace" + light level: 4 + properties: + lit: true + - id: "minecraft:candle" light level: 7 - - - state: - name: "minecraft:sea_pickle" - properties: - pickles: 4 - waterlogged: true + properties: + lit: true + - id: "minecraft:candle_cake" + light level: 7 + properties: + lit: true + - id: "minecraft:campfire" + light level: 10 + properties: + lit: true + - id: "minecraft:lantern" + light level: 7 + - id: "minecraft:magma" + light level: 5 + - id: "minecraft:smoker" + light level: 4 + - id: "minecraft:blast_furnace" + light level: 4 + + # Soul based lights + - id: "minecraft:soul_torch" + light level: 7 + - id: "minecraft:soul_wall_torch" + light level: 7 + - id: "minecraft:soul_campfire" + light level: 7 + - id: "minecraft:soul_lantern" + light level: 7 + + # Redstone + - id: "minecraft:redstone_torch" + light level: 5 + properties: + lit: true + - id: "minecraft:redstone_wall_torch" + light level: 5 + properties: + lit: true + - id: "minecraft:redstone_lamp" + light level: 7 + properties: + lit: true + - id: "minecraft:redstone_ore" + light level: 5 + properties: + lit: true + + # Low grade magic + - id: "minecraft:glowstone" + light level: 8 + - id: "minecraft:nether_portal" + light level: 6 + - id: "minecraft:brewing_stand" + light level: 2 + - id: "minecraft:sea_lantern" + light level: 8 + - id: "minecraft:crying_obsidian" + light level: 2 + - id: "minecraft:ender_chest" + light level: 5 + - id: "minecraft:conduit" + light level: 5 + - id: "minecraft:respawn_anchor" + light level: 7 + - id: "minecraft:amethyst_cluster" + light level: 7 + - id: "minecraft:large_amethyst_bud" + light level: 5 + - id: "minecraft:medium_amethyst_bud" + light level: 3 + - id: "minecraft:small_amethyst_bud" + light level: 1 + - id: "minecraft:ochre_froglight" + light level: 8 + - id: "minecraft:verdant_froglight" + light level: 8 + - id: "minecraft:pearlescent_froglight" + light level: 8 + + # High grade magic + - id: "minecraft:enchanting_table" + light level: 7 + - id: "minecraft:end_portal" + light level: 12 + - id: "minecraft:end_portal_frame" + light level: 6 + properties: + eye: true + - id: "minecraft:end_rod" + light level: 15 + - id: "minecraft:end_gateway" + light level: 15 + - id: "minecraft:dragon_egg" + light level: 15 +# - id: "minecraft:light" +# light level: 15 + - id: "minecraft:beacon" + light level: 15 + properties: + lit: true + + # Glowing plants + - id: "minecraft:glow_lichen" + light level: 5 + - id: "minecraft:cave_vines" + light level: 12 + properties: + berries: true + - id: "minecraft:cave_vines_plant" + light level: 12 + properties: + berries: true + - id: "minecraft:sea_pickle" + properties: + pickles: 1 + waterlogged: true + light level: 4 + - id: "minecraft:sea_pickle" + properties: + pickles: 2 + waterlogged: true + light level: 6 + - id: "minecraft:sea_pickle" + properties: + pickles: 3 + waterlogged: true + light level: 8 + - id: "minecraft:sea_pickle" + properties: + pickles: 4 + waterlogged: true + light level: 10 + - id: "minecraft:shroomlight" + light level: 8 + - id: "minecraft:jack_o_lantern" light level: 7 - + - id: "minecraft:brown_mushroom" + light level: 2 + - id: "minecraft:sculk_sensor" + light level: 9 + properties: + sculk_sensor_phase: "active" + - id: "minecraft:sculk_shrieker" + light level: 15 + properties: + shrieking: true + - id: "minecraft:sculk_catalyst" + light level: 9 + properties: + bloom: true + - id: "minecraft:sculk_vein" + light level: 3 + - id: "minecraft:sculk" + light level: 5 + dimension settings: # fog factor is the multiplier for the dimension, lower the number, darker the fog # infested is if grues should be present in the dimension # (modded dimensions like the aether are bright so much i figured grues wouldnt like it) + + # if fog factor is 1, the fog is unchanged, if it is 0, it is solid black - fog factor: 0.5 - id: "minecraft:the_nether" + ids: ["minecraft:the_nether"] infested: true - - fog factor: 1.0 - id: "minecraft:overworld" + - fog factor: 0.7 + ids: ["minecraft:overworld"] infested: true - fog factor: 0.0 - id: "minecraft:the_end" + ids: ["minecraft:the_end"] infested: true - + grue wards: # potency is how strong the grue wards are (0 is off, 1.0 is most powerful) # calculated as: if (random number between 0 and 1 > ward potency) do damage # items is an array of ids, Example: ["minecraft:torch", "minecraft:glowstone"] # supports armor as well - potency: 0.4 - items: ["minecraft:glowstone_dust"] - - - potency: 0.8 - items: ["minecraft:torch", "minecraft:glowstone"] - + ids: ["minecraft:glowstone_dust"] + + - potency: 1.0 + ids: ["minecraft:torch", "minecraft:glowstone"] + + # if a mob id is not included, the mod simply ignores that mob mob group settings: - # Example: ["minecraft:sheep", "minecraft:cow"] - animals: ["minecraft:sheep"] - boss mobs: ["minecraft:ender_dragon", "minecraft:wither"] - villagers: ["minecraft:villager"] - hostile mobs: ["minecraft:creeper"] - misc: [] # used for mobs that cannot be categorized like above - - grues attack animals: false - grues attack boss mobs: false - grues attack villagers: true - grues attack hostile mobs: false - grues attack misc mobs: true - grues attack players: true # players dont have ids or ai, so they are present only here - - animals fear darkness: false - boss mobs fear darkness: false - villagers fear darkness: true - hostile mobs fear darkness: false - misc mobs fear darkness: true + # passive types + - ids: ["minecraft:axolotl", "minecraft:bat", "minecraft:bee", "minecraft:cat","minecraft:chicken", "minecraft:cod","minecraft:cow","minecraft:dolphin", "minecraft:donkey", "minecraft:fox", "minecraft:frog", "minecraft:glow_squid", "minecraft:goat", "minecraft:horse", "minecraft:llama", "minecraft:mooshroom", "minecraft:mule", "minecraft:ocelot", "minecraft:panda", "minecraft:parrot", "minecraft:pig", "minecraft:polar_bear", "minecraft:pufferfish", "minecraft:rabbit", "minecraft:salmon", "minecraft:sheep","minecraft:skeleton_horse", "minecraft:squid", "minecraft:strider", "minecraft:tadpole", "minecraft:trader_llama", "minecraft:tropical_fish", "minecraft:turtle", "minecraft:zombie_horse"] + damage multiplier: 0.0 + fears darkness: false + # golom types + - ids: ["minecraft:iron_golem", "minecraft:snow_golem", "minecraft:wolf"] + damage multiplier: 0.0 + fears darkness: false + # boss mob types + - ids: ["minecraft:elder_guardian", "minecraft:ender_dragon", "minecraft:wither", "minecraft:warden"] + damage multiplier: 0.0 + fears darkness: false + # villager types + - ids: ["minecraft:villager", "minecraft:wandering_trader"] + damage multiplier: 0.6 + fears darkness: true + # hostile mob types + - ids: ["minecraft:blaze", "minecraft:cave_spider","minecraft:creeper", "minecraft:drowned", "minecraft:enderman", "minecraft:endermite", "minecraft:ghast", "minecraft:giant", "minecraft:guardian", "minecraft:hoglin", "minecraft:husk", "minecraft:magma_cube", "minecraft:phantom", "minecraft:piglin", "minecraft:piglin_brute", "minecraft:ravager", "minecraft:shulker", "minecraft:silverfish", "minecraft:skeleton", "minecraft:slime", "minecraft:spider", "minecraft:stray", "minecraft:vex", "minecraft:witch", "minecraft:wither_skeleton", "minecraft:zoglin", "minecraft:zombie", "minecraft:zombie_villager", "minecraft:zombified_piglin"] + damage multiplier: 0.0 + fears darkness: false + - ids: ["minecraft:evoker", "minecraft:illusioner", "minecraft:pillager", "minecraft:vindicator"] + damage multiplier: 0.0 + fears darkness: false + # whatever else, just add another category for each different set of settings + - ids: [] + damage multiplier: 1.0 + fears darkness: true # Debug values should be left alone as they can either make the game unstable or unfair debug settings: flameLightSourceDecayRate: 1.0 - forceGruesAlwaysAttack: false \ No newline at end of file + forceGruesAlwaysAttack: false diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index df72f64..86b5b35 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,10 +29,10 @@ "pandora.mixins.json" ], "depends": { - "fabricloader": ">=0.13.3", + "fabricloader": ">=0.15.0", "fabric": "*", "minecraft": "1.19.x", - "java": ">=16" + "java": "=17" }, "suggests": { "modmenu": "*", diff --git a/src/main/resources/pandora.mixins.json b/src/main/resources/pandora.mixins.json index 19e1c0b..cbd335c 100644 --- a/src/main/resources/pandora.mixins.json +++ b/src/main/resources/pandora.mixins.json @@ -2,9 +2,10 @@ "required": true, "minVersion": "0.8", "package": "pkg.deepCurse.pandora.core.mixins", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "mixins": [ "shared.accessors.LuminanceOverride", + "shared.StateMixin", "shared.MobEntityMixin", "shared.SoulFireBlockMixin" ],