Jump to content

TheThorneCorporation

Members
  • Posts

    65
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheThorneCorporation's Achievements

Stone Miner

Stone Miner (3/8)

2

Reputation

  1. Yes. Yes, it is. I feel kind of silly now...
  2. RESOLVED by importing using the Gradle wizard. Maybe that should be mentioned in the docs... Hello, After opening a fresh MDK and running genEclipseRuns, I open the project in Eclipse only to find that the decompiled Minecraft code is missing. Is there something I have to do?
  3. Is this how it feels to work in computer science?
  4. You were supposed to do that? Edit: And it still doesn't work.
  5. I did that, but it still doesn't work, giving the same error.
  6. Here you go. (I should probably get to cleaning up the files – I changed the minimum amount required from the defaults to make the mod work.) The mod class: package com.thornecorporation.elementalmagic; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod(ElementalMagic.MOD_ID) public class ElementalMagic { // Directly reference a log4j logger. public static final String MOD_ID = "elementalmagic"; private static final Logger LOGGER = LogManager.getLogger(); public static final ItemGroup ITEM_GROUP = new ElementalMagicItemGroup("elemental_magic_group"); public ElementalMagic() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("elementalmagic", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onNewRegistry(final RegistryEvent.NewRegistry event) { } } public static class ElementalMagicItemGroup extends ItemGroup { public ElementalMagicItemGroup(String name) { super(name); } @Override public ItemStack createIcon() { return new ItemStack(Items.COOKED_COD); } } } The mods.toml file at src/main/resources: # This is an example mods.toml file. It contains the data relating to the loading mods. # There are several mandatory fields (#mandatory), and many more that are optional (#optional). # The overall format is standard TOML format, v0.5.0. # Note that there are a couple of TOML lists in this file. # Find more information on toml format here: https://github.com/toml-lang/toml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # A URL to refer people to when problems occur with this mod issueTrackerURL="http://my.issue.tracker/" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod modId="elementalmagic" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory # A URL to query for updates for this mod. See the JSON update specification <here> updateJSONURL="http://myurl.me/" #optional # A URL for the "homepage" for this mod, displayed in the mod UI displayURL="http://example.com/" #optional # A file name (in the root of the mod JAR) containing a logo for display logoFile="examplemod.png" #optional # A text field displayed in the mod UI credits="Thanks for this example mod goes to Java" #optional # A text field displayed in the mod UI authors="Love, Cheese and small house plants" #optional # The description text for the mod (multi line!) (#mandatory) description=''' This is a long form description of the mod. You can write whatever you want here Have some lorem ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.examplemod]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency versionRange="[31,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" # Here's another dependency [[dependencies.examplemod]] modId="minecraft" mandatory=true versionRange="[1.15.2]" ordering="NONE" side="BOTH" Hey, wait a minute. I forgot to change an appearance of "examplemod" in the toml files! Maybe that's it? EDIT: Nope, that's not it. I fixed the mistake and it still gives me the same problem. I attached the latest.log for the mod, but here's the most relevant section (the first FATAL thing logged): [28Jul2020 20:40:10.728] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev [28Jul2020 20:40:26.227] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.2.1 build 12 [28Jul2020 20:40:29.655] [Render thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: File /Users/neoskater/Desktop/ComputerScience/Java/MinecraftModding/1.15.2/ElementalMagic/bin/main constructed 0 mods: [], but had 1 mods specified: [elementalmagic] [28Jul2020 20:40:29.655] [Render thread/FATAL] [net.minecraftforge.fml.ModLoader/CORE]: Failed to initialize mod containers net.minecraftforge.fml.ModLoadingException: The Mod File /Users/neoskater/Desktop/ComputerScience/Java/MinecraftModding/1.15.2/ElementalMagic/bin/main has mods that were not found and the new and improved mods.toml: modLoader="javafml" #mandatory loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. issueTrackerURL="http://my.issue.tracker/" #optional [[mods]] #mandatory modId="elementalmagic" #mandatory version="${file.jarVersion}" #mandatory displayName="Elemental Magic" #mandatory updateJSONURL="http://myurl.me/" #optional displayURL="http://example.com/" #optional logoFile="examplemod.png" #optional credits="Damian Thorne - the mod maker" #optional authors="Damian Thorne, CEO of the Thorne Corporation" #optional description='''A way to utilize the power of fire, water, air, earth, and ether in Minecraft.''' [[dependencies.elementalmagic]] #optional modId="forge" #mandatory mandatory=true #mandatory versionRange="[31,)" #mandatory ordering="NONE" side="BOTH" [[dependencies.elementalmagic]] modId="minecraft" mandatory=true versionRange="[1.15.2]" ordering="NONE" side="BOTH" latest.log
  7. Whenever I try to run runClient, I get past the Minecraft loading screen, only to be met by this error message: "Users/neoskater/Desktop/ComputerScience/Java/MinecraftModding/1.15.2/ElementalMagic/bin/main has mods that were not found." I went into the mods.toml file in main and it does appear to be set up correctly with the correct modid, but nothing is loading. Any idea what's going on? (Note: For some reason the bin/main in this mod only contains a pack.mcmeta and a META-INF folder containing only mods.toml, while the one for the only mod I have successfully tested contains a full copy of the code. Maybe that has something to do with it?)
  8. Hello, I'm creating an elemental magic mod, and am creating a class Element to represent the elements. I want each instance of Element to be associated with a color. Text relating to this element will show up in this color. However, I don't know what class I should use to represent this color. Does anyone have any suggestions on this matter? Also, I'm creating a registry for Elements using RegistryBuilder. What methods should I call on it, in what order, and with what parameters?
  9. Hey guys, So I have a biome, and I want it to be of type forest. However, I also want the grass and leaves in the biome to be orange, which is not the default for forest biomes. is there any way I can override the natural grass color of a biome type? In addition, I have written this method for class DrillItem that will allow it to perform a function similar to stripping wood for ores, that also spawns an item at the player using the block: protected static final Map<Block, Block> ORE_DEPLETION_MAP = (new Builder<Block, Block>()) .put(Blocks.COAL_ORE, BlockList.DEPLETED_COAL_ORE.get()) .put(BlockList.DEPLETED_COAL_ORE.get(), BlockList.TWICE_DEPLETED_COAL_ORE.get()) .put(BlockList.TWICE_DEPLETED_COAL_ORE.get(), BlockList.THRICE_DEPLETED_COAL_ORE.get()) .put(BlockList.THRICE_DEPLETED_COAL_ORE.get(), Blocks.STONE) .put(Blocks.IRON_ORE, BlockList.DEPLETED_IRON_ORE.get()) .put(BlockList.DEPLETED_IRON_ORE.get(), BlockList.TWICE_DEPLETED_IRON_ORE.get()) .put(BlockList.TWICE_DEPLETED_IRON_ORE.get(), BlockList.THRICE_DEPLETED_IRON_ORE.get()) .put(BlockList.THRICE_DEPLETED_IRON_ORE.get(), Blocks.STONE) .put(Blocks.GOLD_ORE, BlockList.DEPLETED_GOLD_ORE.get()) .put(BlockList.DEPLETED_GOLD_ORE.get(), BlockList.TWICE_DEPLETED_GOLD_ORE.get()) .put(BlockList.TWICE_DEPLETED_GOLD_ORE.get(), BlockList.THRICE_DEPLETED_GOLD_ORE.get()) .put(BlockList.THRICE_DEPLETED_GOLD_ORE.get(), Blocks.STONE) .put(Blocks.LAPIS_ORE, BlockList.DEPLETED_LAPIS_ORE.get()) .put(BlockList.DEPLETED_LAPIS_ORE.get(), BlockList.TWICE_DEPLETED_LAPIS_ORE.get()) .put(BlockList.TWICE_DEPLETED_LAPIS_ORE.get(), BlockList.THRICE_DEPLETED_LAPIS_ORE.get()) .put(BlockList.THRICE_DEPLETED_LAPIS_ORE.get(), Blocks.STONE) .put(Blocks.REDSTONE_ORE, BlockList.DEPLETED_REDSTONE_ORE.get()) .put(BlockList.DEPLETED_REDSTONE_ORE.get(), BlockList.TWICE_DEPLETED_REDSTONE_ORE.get()) .put(BlockList.TWICE_DEPLETED_REDSTONE_ORE.get(), BlockList.THRICE_DEPLETED_REDSTONE_ORE.get()) .put(BlockList.THRICE_DEPLETED_REDSTONE_ORE.get(), Blocks.STONE) .put(Blocks.EMERALD_ORE, BlockList.DEPLETED_EMERALD_ORE.get()) .put(BlockList.DEPLETED_EMERALD_ORE.get(), BlockList.TWICE_DEPLETED_EMERALD_ORE.get()) .put(BlockList.TWICE_DEPLETED_EMERALD_ORE.get(), BlockList.THRICE_DEPLETED_EMERALD_ORE.get()) .put(BlockList.THRICE_DEPLETED_EMERALD_ORE.get(), Blocks.STONE) .put(Blocks.DIAMOND_ORE, BlockList.DEPLETED_DIAMOND_ORE.get()) .put(BlockList.DEPLETED_DIAMOND_ORE.get(), BlockList.TWICE_DEPLETED_DIAMOND_ORE.get()) .put(BlockList.TWICE_DEPLETED_DIAMOND_ORE.get(), BlockList.THRICE_DEPLETED_DIAMOND_ORE.get()) .put(BlockList.THRICE_DEPLETED_DIAMOND_ORE.get(), Blocks.STONE) .put(BlockList.MOD_GEM_ORE.get(), BlockList.DEPLETED_MOD_GEM_ORE.get()) .put(BlockList.DEPLETED_MOD_GEM_ORE.get(), Blocks.STONE) .build(); protected static final Random rng = new Random(); protected static final Map<Block, Supplier<ItemStack>> DEPLETION_DROPS_MAP = (new Builder<Block, Supplier<ItemStack>>()) .put(Blocks.COAL_ORE, () -> new ItemStack(Items.COAL, 1)) .put(BlockList.DEPLETED_COAL_ORE.get(), () -> new ItemStack(Items.COAL, 1)) .put(BlockList.TWICE_DEPLETED_COAL_ORE.get(), () -> new ItemStack(Items.COAL, 1)) .put(BlockList.THRICE_DEPLETED_COAL_ORE.get(), () -> new ItemStack(Items.COAL, 1)) .put(Blocks.IRON_ORE, () -> new ItemStack(ItemList.IRON_SLAG.get(), 1)) .put(BlockList.DEPLETED_IRON_ORE.get(), () -> new ItemStack(ItemList.IRON_SLAG.get(), 1)) .put(BlockList.TWICE_DEPLETED_IRON_ORE.get(), () -> new ItemStack(ItemList.IRON_SLAG.get(), 1)) .put(BlockList.THRICE_DEPLETED_IRON_ORE.get(), () -> new ItemStack(ItemList.IRON_SLAG.get(), 1)) .put(Blocks.GOLD_ORE, () -> new ItemStack(ItemList.GOLD_SLAG.get(), 1)) .put(BlockList.DEPLETED_GOLD_ORE.get(), () -> new ItemStack(ItemList.GOLD_SLAG.get(), 1)) .put(BlockList.TWICE_DEPLETED_GOLD_ORE.get(), () -> new ItemStack(ItemList.GOLD_SLAG.get(), 1)) .put(BlockList.THRICE_DEPLETED_GOLD_ORE.get(), () -> new ItemStack(ItemList.GOLD_SLAG.get(), 1)) .put(Blocks.LAPIS_ORE, () -> new ItemStack(Items.LAPIS_LAZULI, MathHelper.nextInt(rng, 4, 9))) .put(BlockList.DEPLETED_LAPIS_ORE.get(), () -> new ItemStack(Items.LAPIS_LAZULI, MathHelper.nextInt(rng, 4, 9))) .put(BlockList.TWICE_DEPLETED_LAPIS_ORE.get(), () -> new ItemStack(Items.LAPIS_LAZULI, MathHelper.nextInt(rng, 4, 9))) .put(BlockList.THRICE_DEPLETED_LAPIS_ORE.get(), () -> new ItemStack(Items.LAPIS_LAZULI, MathHelper.nextInt(rng, 4, 9))) .put(Blocks.EMERALD_ORE, () -> new ItemStack(Items.EMERALD, 1)) .put(BlockList.DEPLETED_EMERALD_ORE.get(), () -> new ItemStack(Items.EMERALD, 1)) .put(BlockList.TWICE_DEPLETED_EMERALD_ORE.get(), () -> new ItemStack(Items.EMERALD, 1)) .put(BlockList.THRICE_DEPLETED_EMERALD_ORE.get(), () -> new ItemStack(Items.EMERALD, 1)) .put(Blocks.DIAMOND_ORE, () -> new ItemStack(Items.DIAMOND, 1)) .put(BlockList.DEPLETED_DIAMOND_ORE.get(), () -> new ItemStack(Items.DIAMOND, 1)) .put(BlockList.TWICE_DEPLETED_DIAMOND_ORE.get(), () -> new ItemStack(Items.DIAMOND, 1)) .put(BlockList.THRICE_DEPLETED_DIAMOND_ORE.get(), () -> new ItemStack(Items.DIAMOND, 1)) .put(Blocks.REDSTONE_ORE, () -> new ItemStack(Items.REDSTONE, MathHelper.nextInt(rng, 4, 5))) .put(BlockList.DEPLETED_REDSTONE_ORE.get(), () -> new ItemStack(Items.REDSTONE, MathHelper.nextInt(rng, 4, 5))) .put(BlockList.TWICE_DEPLETED_REDSTONE_ORE.get(), () -> new ItemStack(Items.REDSTONE, MathHelper.nextInt(rng, 4, 5))) .put(BlockList.THRICE_DEPLETED_REDSTONE_ORE.get(), () -> new ItemStack(Items.REDSTONE, MathHelper.nextInt(rng, 4, 5))) .put(BlockList.MOD_GEM_ORE.get(), () -> new ItemStack(ItemList.MOD_GEM.get(), 1)) .put(BlockList.DEPLETED_MOD_GEM_ORE.get(), () -> new ItemStack(ItemList.MOD_GEM.get(), 1)) .build(); . . . public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); BlockPos blockpos = context.getPos(); BlockState blockstate = world.getBlockState(blockpos); Block block = ORE_DEPLETION_MAP.get(blockstate.getBlock()); if (block != null && this.canHarvestBlock(blockstate)) { PlayerEntity playerentity = context.getPlayer(); world.playSound(playerentity, blockpos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); if (!world.isRemote) { world.setBlockState(blockpos, block.getDefaultState().with(RotatedPillarBlock.AXIS, blockstate.get(RotatedPillarBlock.AXIS)), 11); if (playerentity != null) { if(DEPLETION_DROPS_MAP.get(blockstate.getBlock()) != null) { Supplier<ItemStack> sup = DEPLETION_DROPS_MAP.get(blockstate.getBlock()); world.addEntity(new ItemEntity(world, playerentity.getPosition().getX(), playerentity.getPosition().getY(), playerentity.getPosition().getZ(), sup.get())); } context.getItem().damageItem(1, playerentity, (player) -> { player.sendBreakAnimation(context.getHand()); }); } } return ActionResultType.SUCCESS; } else { return ActionResultType.PASS; } } Unfortunately, when I tested the method in the world it did not work, The block was not changed to the value it is mapped to in ORE_DEPLETION_MAP, nor did an ItemStack spawn. What am I doing wrong?
  10. Hey, So I'm overriding onRightClick in a custom item class called DrillItem to spawn a certain ItemStack at the using player's head whenever certain particular blocks are right-clicked. However, I don't know how to spawn an ItemStack entity in the world, much less at the player's head. Could someone please give me some pointers?
  11. Heya, So, I have a class of tool called DrillItem, and I want to add a feature called "ore depletion." It's like stripping wood, except it's for ores. Depleting an ore spawns that ore's specific ItemStack at the player and replaces the ore with the next less depleted form. For example, if I right-clicked with a Diamond Drill on Coal Ore, it would turn into Depleted Coal Ore and give me 1 coal. If I right-clicked on the Depleted Coal Ore, it would turn to Twice Depleted Coal Ore and give me 1 more coal. If I right-clicked on the Twice Depleted Coal Ore, it would turn to Thrice Depleted Coal Ore and give me 1 more coal. If I right-clicked on the Thrice Depleted Coal Ore one final time, it would turn to stone and give me 1 more coal. I want to use an implementation of Map<Block, Block> to control what each ore turns into when depleted, and a Map<Block, Supplier<ItemStack>> to determine what ItemStack comes out. I copied code from the AxeItem class's stripping map to create these maps. However, I am adding a static method registerDepletableOre that would allow other modders to add their ores to the system, and I want the maps to be mutable to that end. The Builder method of creating the map, which I am using now, doesn't do the trick for me. What other mutable implementations of Map should I use to make my map mutable?
  12. Overriding a vanilla block class...? Most vanilla blocks are instances of Block, and those with special functionality use a subclass of Block with the required methods. Do you mean changing the functionality of a vanilla block? I know nothing about this. Maybe the "reflection" I've been hearing so much about may be useful to you.
  13. Heya, So, I'm adding "depleted," "twice depleted," and "thrice depleted" counterparts to all the vanilla ores, for my own reasons. I want to decrease the amount each ore is affected by increasing levels of Fortune. For example, for depleted lapis ore mining it with a Fortune III pickaxe is the same as mining it with a Fortune II pickaxe, and Fortune II is equivalent to Fortune I, and you might as well not waste your Fortune I pickaxe. For twice depleted lapis ore, mining it with a Fortune II pickaxe gets the same results as a Fortune I pickaxe, and thrice depleted lapis just isn't affected by Fortune at all. Problem is, I'm not sure how to go about this in the json files. I'm thinking of creating a new formula for applying Fortune bonuses and using that, but I'm not sure how to start. Could someone please give me pointers?
  14. Your next line is, "1.10.2 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support"!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.