diff --git a/.gitignore b/.gitignore index 0137555..877a226 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ run # Files from Forge MDK forge*changelog.txt .DS_Store + +logs \ No newline at end of file diff --git a/MODIFIERS.md b/MODIFIERS.md new file mode 100644 index 0000000..b951b69 --- /dev/null +++ b/MODIFIERS.md @@ -0,0 +1,50 @@ +# Modifiers +This is a full list of modifiers in the game and a description of what they do. +## Breakers +These effects are applied when breaking blocks. +### Veiny +Breaking any block will cause all blocks of the same type adjacent to it to break up to 5 in each direction. +### Magnetic +Upon breaking a block (allowed by tool type), all items at that block's position will teleport to you. +### Learning +After breaking 10 blocks as allowed by this tool, gain 3 experience points. +## Holders +These effects are applied when holding the tool. +### Rainy +While holding the tool in the rain, mine faster! +### Hasty +While holding the tool, get the Haste effect. +### Detecting +While holding the tool, ores around you will glow. +### Appley +While holding the tool, get the absorption effect. +### Tomb Raider +While holding the spawners around you will glow. +### Filling +While holding the tool, get the saturation effect. +## Users +These effects are applied when right clicking. +### Heartha's Grace +Right clicking on the top of a block with the tool in hand will place a dirt block and use 1 durability points. +### Spelunking +Right clicking on the top of a block with the tool in hand will place a torch and use 10 durability points. +### Fire Starter +Right clicking on the top of a block while crouching with the tool in hand will start a fire and use 2 durability points. +## Hurters +These effects are applied when hurting enemies. +### Poisonous +When attacking with tool, apply the poison effect to the target. +### Charged +After 7 seconds, hitting and enemy will summon a lightning bolt and empty the charge meter. +### Necrotic +Heals 10% of damage dealt to target. +### Critical +Always critically strikes enemy. +### Withering +When attacking with tool, apply the wither effect to the target. +### Blinding +When attacking with tool, apply the blindness effect to the target. +### Flaming +Sets enemy on fire for 2 seconds. +### Dexterous +Hitting enemies within 2 seconds after hitting them deals an extra 25% damage. diff --git a/README.md b/README.md index ddd1b70..b797c2a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ Holding Shift while hovering over tools will give you an expanded view on detail Holding Control (command on a mac) while hovering over tools will give you a description of every trait currently applied to the tool. ![tools with control information](https://raw.githubusercontent.com/TheMarstonConnell/randomloot/main/.github/assets/expanded_info.png) +#### Tool Modifiers +For a complete list of modifiers check out the [modifier list](https://github.com/TheMarstonConnell/randomloot/blob/main/MODIFIERS.md). + ## Another Rewrite? The jump from 1.12 to 1.16 was one of the biggest changes to Forge & the Minecraft codebase making a complete rewrite of the mod very welcome. However, the 1.16 to 1.20 is again, a massive change and I'm overall dissatisfied with the 1.16 version of the mods codebase and sloppy planning. As such, 1.20 is a complete rewrite of Random Loot to make the mod feel more cohesive and less janky. diff --git a/src/main/java/dev/marston/randomloot/GenWiki.java b/src/main/java/dev/marston/randomloot/GenWiki.java new file mode 100644 index 0000000..756fb78 --- /dev/null +++ b/src/main/java/dev/marston/randomloot/GenWiki.java @@ -0,0 +1,75 @@ +package dev.marston.randomloot; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Iterator; +import java.util.Set; + +import dev.marston.randomloot.loot.modifiers.Modifier; +import dev.marston.randomloot.loot.modifiers.ModifierRegistry; + +public class GenWiki { + + private static void write(String s, FileWriter f) throws IOException { + f.write(s + "\n"); + } + + private static void writeMod(Modifier m, FileWriter f) throws IOException { + write("### " + m.name(), f); + + write(m.description(),f ); + } + + private static void writeMods(Set mods, FileWriter f) throws IOException { + for (Iterator iterator = mods.iterator(); iterator.hasNext();) { + Modifier modifier = iterator.next(); + writeMod(modifier, f); + } + } + + private static void writeModifiers(FileWriter f) throws IOException { + + write("# Modifiers", f); + write("This is a full list of modifiers in the game and a description of what they do.", f); + + write("## Breakers", f); + write("These effects are applied when breaking blocks.", f); + writeMods(ModifierRegistry.BREAKERS, f); + + write("## Holders", f); + write("These effects are applied when holding the tool.", f); + writeMods(ModifierRegistry.HOLDERS, f); + + write("## Users", f); + write("These effects are applied when right clicking.", f); + writeMods(ModifierRegistry.USERS, f); + + write("## Hurters", f); + write("These effects are applied when hurting enemies.", f); + writeMods(ModifierRegistry.HURTERS, f); + + } + + public static void genWiki() { + + String isProd = System.getenv("RL_PROD").strip(); + RandomLootMod.LOGGER.info("RL_PROD: " + isProd); + + if (isProd.contains("false")) { + RandomLootMod.LOGGER.info("Creating wiki..."); + + try { + FileWriter wikiWriter = new FileWriter("../MODIFIERS.md"); + writeModifiers(wikiWriter); + wikiWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + + } + +} diff --git a/src/main/java/dev/marston/randomloot/Globals.java b/src/main/java/dev/marston/randomloot/Globals.java new file mode 100644 index 0000000..d54fb03 --- /dev/null +++ b/src/main/java/dev/marston/randomloot/Globals.java @@ -0,0 +1,6 @@ +package dev.marston.randomloot; + +public class Globals { + public static long Seed = 0; + +} diff --git a/src/main/java/dev/marston/randomloot/RandomLootMod.java b/src/main/java/dev/marston/randomloot/RandomLootMod.java index 628fe93..ab790b7 100644 --- a/src/main/java/dev/marston/randomloot/RandomLootMod.java +++ b/src/main/java/dev/marston/randomloot/RandomLootMod.java @@ -38,8 +38,6 @@ public class RandomLootMod { public static final Logger LOGGER = LogUtils.getLogger(); public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - public static long Seed = 0; - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister .create(Registries.CREATIVE_MODE_TAB, MODID); @@ -47,31 +45,32 @@ public RandomLootMod() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::commonSetup); - modEventBus.addListener(this::addCreative); + modEventBus.addListener(this::addCreative); ModLootModifiers.register(modEventBus); MinecraftForge.EVENT_BUS.register(this); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); + + GenWiki.genWiki(); } private void commonSetup(final FMLCommonSetupEvent event) { LOGGER.info("RandomLoot Common Setup"); } - - private void addCreative(BuildCreativeModeTabContentsEvent event) - { - if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) - event.accept(LootRegistry.CaseItem); - } + + private void addCreative(BuildCreativeModeTabContentsEvent event) { + if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) + event.accept(LootRegistry.CaseItem); + } @SubscribeEvent public void onServerStarting(ServerStartingEvent event) { LOGGER.info("Starting server with RandomLoot installed!"); - Seed = event.getServer().getWorldData().worldGenOptions().seed(); + Globals.Seed = event.getServer().getWorldData().worldGenOptions().seed(); } @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) diff --git a/src/main/java/dev/marston/randomloot/loot/NameGenerator.java b/src/main/java/dev/marston/randomloot/loot/NameGenerator.java index fad0a9d..f8ada57 100644 --- a/src/main/java/dev/marston/randomloot/loot/NameGenerator.java +++ b/src/main/java/dev/marston/randomloot/loot/NameGenerator.java @@ -2,6 +2,7 @@ import java.util.Random; +import dev.marston.randomloot.Globals; import dev.marston.randomloot.RandomLootMod; public class NameGenerator { @@ -181,7 +182,7 @@ public static String generateForger(float temp) { list = HotNames; } - Random generator = new Random(RandomLootMod.Seed); + Random generator = new Random(Globals.Seed); String adj = list[generator.nextInt(list.length)]; return adj;