Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/19/20 in all areas

  1. https://github.com/SaturninUfolud/PGC/blob/master/java/saturnin_ufolud/pgc/block/PgcBlocks.java#L40 Problematic Code #14 You have a block registry event handler, use it. Or delete that one because you have two. You can't do this here either. Do not, under any circumstances, create a registry entry in any place other than the registry event for that registry object type.
    1 point
  2. 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.
    1 point
  3. If you looked at the BowItem code, you would see that it looks for items within the ARROWS tag. So yes, you would need to add your item to the arrow tag. Adding an item to a vanilla tag is just as simple as navigating to data.minecraft.tags.items.tagname.json and creating a json file which holds the registry name of your item. Just make sure you have the replace value set as false since you do not want to override anything. Also, for future reference, if you don't know how to do something related to json files in Minecraft, you can google it. There is documentation all over the internet about how to do it. Some good examples is the Forge Documentation and the Minecraft Wiki which tells you literally how to create a json file for tags. If you need a visual reference, the data folder in Minecraft holds all the tags (which in your workspace should be under client-extra.jar) so you can just open one of those json files and just copy it replacing its items with yours.
    1 point
  4. No. They already tried this. It doesn't work. Because the game scales any texture you give it down to fit into a space meant to be occupied by a 16x16 texture.
    1 point
  5. Nope. Which is why I don't bother replying to his threads any more.
    1 point
  6. ...You do know that there's a game rule that already covers this, right? If you don't have the recipe in your recipe book, you can't craft it when the rule is enabled.
    1 point
×
×
  • Create New...

Important Information

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