-
Posts
304 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Alpvax
-
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++; }
-
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.
-
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.
-
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.
-
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).
-
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.
-
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.
-
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.
-
[1.14.4] How to change block bounds? (Update, Problem with BlockStates)
Alpvax replied to Cerandior's topic in Modder Support
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 -
[1.14.4] How to change block bounds? (Update, Problem with BlockStates)
Alpvax replied to Cerandior's topic in Modder Support
The voxelshapes method takes values between 0 and 1, the model takes 0-16. You need to divide all your voxelshapes by 16. -
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.
-
Copy one of the mappings from here: http://export.mcpbot.bspk.rs/ Into your build gradle (copy the existing format, just update the numbers).
-
You need to look into tile entity rendering (look at chests and shulker boxes opening animations
-
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.
-
How do i register my own BlockStateProvider?
Alpvax replied to Drachenbauer's topic in Modder Support
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! -
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?
-
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.
-
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).