Jump to content

Syric

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by Syric

  1. Understood. I guess I'll just brush up on events in general. Thanks again!
  2. That helps, thank you! Where can I go to learn more about FMLCommonSetupEvent, and how to use it? (Edit: in addition to the readthedocs.io, I'm already there)
  3. I'm working on a system for brewing various items in cauldrons. As part of this, I have created the 'Substance' class, referring to various things one might put in a cauldron, and during initial modloading (immediately after calling the deferred registries to register my items, blocks, etc.) I am filling out a list of possible Substances. One such substance, 'crash_pad', is equivalent to a modded block, also called 'crash_pad'. When defining it as a Substance, I reference its item format, like so: (The problem line, #16, is marked with an asterisk.) public class SubstanceList { public static ArrayList<Substance> list = new ArrayList<Substance>(); public static Substance water = new Substance("water", new Ingredient[]{}, false, null); * public static Substance crash_pad = new Substance("crash_pad", new Ingredient[]{}, true, registerBlocks.CRASH_PAD.get().asItem()); //Substance constructor takes in (String, Ingredient[], boolean, Item). public SubstanceList() { initialize(); } public static void initialize() { list.add(water); list.add(crash_pad); } //For getting ingredients private static Ingredient get(Item item) { return IngredientsDict.get(item); } } When I try to launch the game, I get an error saying that the crash_pad registry object was not present. The full crash report is available here, the most relevant part (in my estimation) is quoted here: I'm not sure why the game is having trouble finding the registered item, given that I run the registers prior to calling SubstanceList.initialize(). This is the constructor from my main mod file: (The asterisked line is line 38, where the issue was thrown in the crash log above.) public AlchemyPlus() { registry.register(); IngredientsDict.initialize(); * SubstanceList.initialize(); RecipeList.initialize(); ... } I suspect the issue has something to do with me misunderstanding registries, because I'm still pretty iffy on the details of how they work. What exactly is going wrong? If more information or code is needed, don't hesitate to ask- I'm not confident enough to say that I've definitely provided all relevant code! Thanks for the help!
  4. What are you trying to do? Are you trying to make a mod? If so, what program are you using to write it?
  5. Understood, and I'll go check that out. Thank you so much!
  6. Okay, thanks for the help! A few questions. BLOCKS and ITEMS are in the same class as each other- it's called 'registry'. (forgot to capitalize, oops- I'll fix that momentarily.) What exactly shouldn't be in separate classes? Are you saying that my actual RegistryObjects (the individual blocks, items, etc.) should all be in the same class? Or that the DeferredRegisters should all be in the same class? Or that all the RegistryObject<Block>s should be in the same class as the DeferredRegister<Block>, and the RegistryObject<Item>s should be in the same class as the DeferredRegister<Item>, but those two classes don't necessarily have to be the same? What is @ObjectHolder, what does it do, and where can I go to learn more? (That is, assuming it's a Forge thing. If it's a Java thing I don't know, say so and I'll go research it elsewhere- I understand and respect that this forum isn't a place to look for Java help.)
  7. From my understanding, all of my blocks, items, and whatnot should be registered like this: public static final RegistryObject<Block> CRASH_PAD = registry.BLOCKS.register("crash_pad", () -> new CrashPadBlock(AbstractBlock.Properties.of(Material.CLAY, MaterialColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion())); public static final RegistryObject<Item> ALCHEMICAL_FLASK = registry.ITEMS.register("alchemical_flask", () -> new Item(new Item.Properties().tab(ItemGroup.TAB_MATERIALS))); If I then wished to refer to the crash_pad Block, or the alchemical_flask Item, do I have to refer to them as 'registry.CRASH_PAD.get()' and 'registry.ALCHEMICAL_FLASK.get()'? This seems a bit roundabout. Can I define the blocks as Blocks and the items as Items before creating and registering RegistryObject<T>s from them, or do I have to always get the blocks and items from their RegistryObjects?
  8. createBlockStateDefinition seems to have done the trick, at least for now- the game does not crash on startup! I'll have to investigate more to make sure things are actually working (and, y'know, actually do something with the blockstates) but I'm leaving that to tomorrow. Thank you all for the help!
  9. Every implementation of blockstates I've been able to find (including the one you just linked) does something along the lines of: this.setDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); but setDefaultState shows up red and IntelliJ claims it can't resolve the symbol. I assume the method's been renamed. Where can I find it? If it's registerDefaultState then I'm already using that, so that's not the solution (oh well). As for your suggestion of what is needed, adding that method did not change the outcome- in fact, it threw an error because it didn't actually override anything. My bad, you said you didn't know the Mojang mapping. Never mind. If anyone else has suggestions, my original problem is still present.
  10. Apologies for the repeat, then. Do you have any advice relating to my main problem?
  11. I'm currently trying to make a new cauldron-type block, and I'm having difficulty implementing blockstates. Here's the relevant part of the alchemical cauldron's code: public class AlchemicalCauldronBlock extends Block { public static final IntegerProperty LEVEL = IntegerProperty.create("level", 1, 3); private static final VoxelShape INSIDE = box(2.0D, 4.0D, 2.0D, 14.0D, 16.0D, 14.0D); protected static final VoxelShape SHAPE = VoxelShapes.join(VoxelShapes.block(), VoxelShapes.or(box(0.0D, 0.0D, 4.0D, 16.0D, 3.0D, 12.0D), box(4.0D, 0.0D, 0.0D, 12.0D, 3.0D, 16.0D), box(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), INSIDE), IBooleanFunction.ONLY_FIRST); public AlchemicalCauldronBlock() { super(Properties.of(Material.METAL).sound(SoundType.METAL).harvestLevel(3).strength(2F,2F)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 0)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); } ... When I try to run this with either of the two attempts at registerDefaultState uncommented, I get this error: https://pastebin.com/vPf3UryC. For convenience, I believe this part is most relevant: How can I avoid this? My registry classes look like this, if it helps: public class registry { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AlchemyPlus.MODID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AlchemyPlus.MODID); public static void register() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(modEventBus); ITEMS.register(modEventBus); registerItems.register(); registerBlocks.register(); } } public class registerBlocks { public static final RegistryObject<Block> ALCHEMICAL_CAULDRON = register("alchemical_cauldron", AlchemicalCauldronBlock::new); static void register() {} private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> block) { return registry.BLOCKS.register(name, block); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) { RegistryObject<T> ret = registerNoItem(name, block); registry.ITEMS.register(name, () -> new BlockItem(ret.get(), new Item.Properties().tab(ItemGroup.TAB_BREWING))); return ret; } } Full GitHub repository available here. (Other minor problem(?): I copied the methods getShape and getInteractionShape from net.minecraft.block.CauldronBlock and I'm getting these weird warnings. What's up with that? Do I need to worry about it?)
  12. Sounds good. Jury-rigged constructor nonsense it is.
  13. In the mod I'm working on, I want to have several items which have the same function (searching for entities and making noise when they are found) but with different parameters (search radius, which entity to look for, what noise to make, etc.). In Forge, what is the best way to handle this? My first attempt simply involved copying the code over to each item, but the hassle of changing all of them every time I want to edit the code has grown enough that I'm looking for a more complicated way of approaching the problem. Should I make a 'SeekerGeneric' class containing all the relevant code and then have various specific items extend that class, each with different parameters? Or is there another way to do things?
  14. I'm very new to Minecraft modding, and one thing that's still causing me some confusion is the client/server dichotomy. From what I understand (via reading the Forge documentation), they're separate and it's very bad to do things on the wrong side. My questions are: How do I know which side to do something on? How do I know when it matters? Does every single statement need to be prefaced with something like if (world.isRemote()) {}? How can I check that I've done things correctly? There's a 'runServer' thing in IntelliJ, but it says I need to agree to the EULA somehow and I don't know how to do that. Where can I go to learn more? (I've already read the Forge documentation.)
  15. Thank you for the help! I got it to work... in theory, at least. One of the two mods I need to import works fine. The other crashes, for some reason, despite the fact that I've a) played with that version of the mod just fine and b) imported it as a dependency just fine. Here's the build.gradle for another mod, where I successfully imported citadel and ice-and-fire-dragons. Here's my current build.gradle. Citadel works, but as soon as I add Ice & Fire, the game crashes with this log. It says it's a problem within Ice & Fire, but since it works in those other contexts I'm somewhat doubtful. Any idea how to fix or work around this?
  16. Update: as soon as I change 'https://files.minecraftforge.net/maven' to "https://www.cursemaven.com", as cursemaven.com suggests I should, refreshing gradle produces this error: I think this means I need to change this line in my build.gradle: dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true } but I'm not sure how I'd go about doing that. (If you need any more information, please ask for it- I'm quite a bit out of my depth here.)
  17. Forge isn't a mod. Don't put it in your mods folder. siodemkacavebiomes isn't a Forge mod. You can't use it with Forge. I don't know what's wrong with Biomes O'Plenty, but removing it should fix whatever problem it's having.
  18. I'm starting a new mod from scratch. I have very little experience, so let me know if you need any more information, and please be patient with me. In past mods, such as this one (build.gradle) I've been able to add dependencies so that runClient would load mods that mine depended on. It looked something like this: dependencies { minecraft 'net.minecraftforge:forge:1.16.4-35.1.28' compile fg.deobf("curse.maven:mgui:3104239") compile fg.deobf("curse.maven:tetra:3232294") compile fg.deobf("curse.maven:citadel:3198842") compile fg.deobf("curse.maven:ice-and-fire-dragons:3217622") } However, this method does not work with my new mod (GitHub, build.gradle). When I try running runClient, it produces this error message: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find curse.maven:citadel:3198842_mapped_official_1.16.5. Searched in the following locations: - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/citadel/3198842_mapped_official_1.16.5/citadel-3198842_mapped_official_1.16.5.pom - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/citadel/3198842_mapped_official_1.16.5/citadel-3198842_mapped_official_1.16.5.jar Required by: project : > Could not find curse.maven:ice-and-fire-dragons:3217622_mapped_official_1.16.5. Searched in the following locations: - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/ice-and-fire-dragons/3217622_mapped_official_1.16.5/ice-and-fire-dragons-3217622_mapped_official_1.16.5.pom - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/ice-and-fire-dragons/3217622_mapped_official_1.16.5/ice-and-fire-dragons-3217622_mapped_official_1.16.5.jar Required by: project : Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html I have tried copying over the buildscript {} section at the top of the build.gradle file from Tetranomicon (which works) to the new mod (which doesn't), but that doesn't help. I thought it might because it seems to declare repositories, as the error message suggests. The main difference between the two projects that I can see is that the new one uses ForgeGradle 4.1+ while the old one uses ForgeGradle 3+. (I get error messages about gradle versions if I try changing from one to the other.) Did the format for declaring and importing dependencies change with the update? Thank you for the help!
  19. That's a shame. I'll provide a datapack on the mod's page.
  20. I am aware that it can be overridden by a data pack. I would like to allow my users to modify or remove the data in ways more accessible than creating and applying their own data packs. Can I do this with a .txt configuration file?
  21. How is the system designed to do what I need? I'm trying to provide a quick and easy way for my mod's users to modify which data files the mod uses, one more accessible than writing their own datapacks to override my mod's data. Ideally, they'd be able to change a 'false' to a 'true' in a .txt and have my mod load different data files. Has anyone written a way to change loot tables or crafting recipes with a config file? Those solutions might have some applicability to my situation. Edit: to clarify, the data is inside my mod's .jar, so it's not easily accessed and modified by the user.
  22. Is there a way to let someone use a .txt file to toggle whether or not certain datapacks are loaded?
  23. I have a mod that pretty much only loads a data folder. I'd like to introduce a config file that will allow me to load different versions of some of the data files, or not load some at all. Is this possible? How would I go about doing it?
×
×
  • Create New...

Important Information

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