Jump to content

Alpvax

Members
  • Posts

    304
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Alpvax

  1. I looked at Lex's mod CobbleForDays to get mine working. Tropicraft's 1.14 branch was useful to start with as well (I used that until I found Lex's).
  2. Please create a github repository, it is very hard to debug when we only have tiny snapshots of your code.
  3. What's the exception? With stacktrace preferably. Is your code on github? It would be easier for me to see if it was.
  4. I'm not quite sure what you mean by this. I would use this as your loop. You have no use for the ..._SUPPLIERS variables, as RegistryObjects ARE Suppliers. And again, the ArrayList<FlowerPotBlock> is useless, because the blocks do not exist yet, so there is nothing to fill the list with. i = 0; for(String color : COLORS) { EMPTY_FLOWER_POT_REGISTRIES.add(BLOCKS.register(color + "_flower_pot", () -> new FlowerPotBlock(null, AIR_SUPPLIER, Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0f).notSolid()))); j = 0; for(Supplier<Block> plant_supplier : PLANT_SUPPLIERS) { String plant = plant_supplier.getId().getPath(); FULL_FLOWER_POT_REGISTRIES.add(BLOCKS.register(color + "_potted_" + plant, () -> new FlowerPotBlock(EMPTY_FLOWER_POT_SUPPLIERS.get(i), plant_supplier, Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0f).notSolid()))); j++; } i++; }
  5. I'm pretty sure I played a 1.15.2 modpack the other day which had more than 2 pages, so I don't think that is accurate.
  6. Again, you CANNOT access the blocks until after the event has fired. They simply don't exist. Use the ID, or the RegistryObject itself, it is an instance of Supplier<T>. I use the following 3 methods to register my blocks: /** * Register a block and a default ItemBlock with the Item group set to my Item group. */ private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> block) { return register(name, block, (b) -> () -> new BlockItem(b.get(), new Item.Properties().group(AAItems.ITEM_GROUP))); } /** * Register a block and an Item using a custom Item supplier. * @param itemCreator type is (block) -> Supplier<Item>. (block passed in so you could use the same function to define multiple block items). */ private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> block, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) { RegistryObject<T> ret = registerBlockOnly(name, block); ITEMS.register(name, itemCreator.apply(ret)); return ret; } /** * Register a block with no item (could be used for door/bed halves etc.). */ private static <T extends Block> RegistryObject<T> registerBlockOnly(String name, Supplier<? extends T> sup) { return BLOCKS.register(name, sup); } The reason why you have to pass in suppliers to the DeferredRegister#register methods is so that they can call them in the registry events, i.e. at the correct time. Note that using the block/item objects .get() in suppliers ONLY WORKS FOR GETTING BLOCKS AND ITEMS. This is because those 2 registry events are fired in that order, before any others, and until the event has fired, the object doesn't exist, so cannot be used in other events. (The order of other registries is random, so it might work sometimes and not others.) If you need to access other registry objects, you need to use a supplier (as in pass the actual RegistryObject into the constructor) and get the object when it is needed.
  7. The whole point of registry objects is that they are initialised in the correct event (The DeferredRegister does that too). Until the registry events have run, the registry objects will be "not present". As all you are after is the id, use RegistryObject#getId() instead of trying to get the object first.
  8. .minecraft/logs Or wherever your gameDir is
  9. Be careful when doing that, chunks are unloaded for a reason (reduce memory usage by not keeping all chunks in memory at once). Make sure you unload/unforce the chunk again when you're done. Otherwise your mod will have performance issues on worlds which have been played for a while.
  10. Use a multipart model/blockstate is the easiest way to do it: https://minecraft.gamepedia.com/Model#Block_states Look at how the fence blockstate is defined (client-extra.jar) for an example, and just rotate about the other axis for up/down. That way you only need a couple of models for all permutations, and don't need a custom baked model. See mine (wire, has multiple states for each side so is somewhat complicated, but you can just look at the basic structure): Blockstate file: https://github.com/Alpvax/AdvancedAutocrafting/blob/1.15/src/generated/resources/assets/advancedautocrafting/blockstates/wire.json One of the model files (wire_arm is currently just base_wire_arm, but with a texture): https://github.com/Alpvax/AdvancedAutocrafting/blob/1.15/src/generated/resources/assets/advancedautocrafting/models/block/part/base_wire_arm.json For reference, my wire blockstate has an enum property for each direction (NONE, CONNECTED, INTERFACE, DISABLED) and each state shows something different ("arm"s are visible for both connected and interface, hence the | in the "when" json value. I would not recommend actually looking at my WireBlock code, it is overly complicated due to some experimentation I was doing with data generation and general messing around). Attached image for end result (before disabled got its own model).
  11. There is always a log. As your code looks correct, I would say there's probably a line in your log file telling you what is wrong.
  12. Code? Logs? We aren't magic (well, most of us, anyway ? ).
  13. You will have to make a new blockstate file for each block (unless they have custom tile renderers, which I haven't looked into). You can use the same model for all of those files I believe. Also, look into data generators, it will help you generate all the files from code, saving you a lot of time.
  14. Imagine if everyone used 2 character mod IDs. That means there would be a lot of conflicts, as there are only 26² possible combinations, but some would be more popular than others.
  15. Actually yes. But only if the player uses the vanilla "recipes need to be unlocked before they can be used" mechanic. I believe you can relock the recipes, although I've never tried. Alternatively, make your own IRecipe implementation which checks whether or not it should be unlocked for the player creating it.
  16. In your model JSON, set the "particle" texture to "#texture" (or whatever you want it to be). I went with the vanilla approach of having base models (in /part/) and then my textured models, which the blockstate references. I'm not sure if there is a better way, as I don't think you can pass in texture overrides from the blockstate file. My models are here: https://github.com/Alpvax/AdvancedAutocrafting/tree/1.15/src/generated/resources/assets/advancedautocrafting/models/block
  17. The voxelshapes method takes values between 0 and 1, the model takes 0-16. You need to divide all your voxelshapes by 16.
  18. Please keep this forum in English! Learn Java first, before you start modding. For your issue, look into resource packs, the vanilla format can support 3d models from JSON.
  19. Copy one of the mappings from here: http://export.mcpbot.bspk.rs/ Into your build gradle (copy the existing format, just update the numbers).
  20. You need to look into tile entity rendering (look at chests and shulker boxes opening animations
  21. No, it would appear that I'm getting a 404 when using curl. I'm afraid I'm not sure what your issue is. I have just noticed that your mappings are for 1.14, but you're missing for 1.15. try updating your mappings.
  22. This is the third thread I have come across from you now, all asking the same thing! Please stop spamming the forums and give people a chance to actually answer!
  23. Are you on the school network. At least when I used to be at school the games sites were blocked. Can you actually access the site listed in the link?
  24. One case I can think of would be to have a folder of optional mods (renamed with .disabled after the extension to prevent loading). When modpacks get large it can become more difficult to find the ones you are looking for, and I don't see how more organisation can hurt. You can search if you know what mod you are looking for but you can't search for "optional mods". Duplicates/different versions would get flagged up on launch. It could be put behind a config option.
  25. Look through the vanilla code (tracing up the call path if necessary). Find a mod which does something similar to what you want and look through it's code (most mods are on GitHub somewhere). Ask specific questions on here, telling people what you want to achieve (for the user).
×
×
  • Create New...

Important Information

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