Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Alpvax

  1. Vanilla has this feature: /gamerule doLimitedCrafting See http://minecraft.gamepedia.com/Recipe_book#Obtaining
  2. You still haven't taken into account user resource packs (i.e. those which are not in a mod jar). You would have to re-hash every time someone changed a resource pack, including in-game.
  3. I seem to remember one of the mdk versions shipping with the vanilla code (and all the blocks) but the newer versions have that all stripped. What remains is helper functions to create standard blocks, fences, stairs etc. It is easy to strip from your mod if you really want to, as it is all called by events. Just exclude that class file from the build task, but how much space does a single class file take up (for me, including all my blockstates, models, recipes, tags etc., it's < 40kb uncompressed, and I've got a load of junk in mine that I was experimenting with)? For example, it is far easier to create a new fence model by creating the "fence_post" and "fence_side" models (just binding a texture to the parent models, can be done easily with a function call each) and calling a single method, passing those ResourceLocations in, than it is to manually create the multipart model file.
  4. It was added by Mojang for their use, and has been extended to be usable by forge mods. It means that you don't have to manually create json files for all your basic blocks which are identical apart from texture. No, you can leave it there. During normal running, the event isn't fired, so the code isn't used (and probably isn't even loaded if it is in a separate file).
  5. Hmmm... I wonder what would happen if someone wanted to change the textures with a resource pack? Which can be done in-game, and now instead of just loading and stitching the textures, it has to hash and save. And then the player decides they didn't like that resource pack after all...
  6. What exactly are you trying to do? I use that method to conditionally highlight sub segments of my block (by returning a different voxelshape).
  7. Unfortunately, so much has changed since 1.7 that you're better off rewriting the mod from scratch (create a new workspace so you can copy the old functionality).
  8. Oh, re-reading the code, I think you need to override canStickTo to only return true if the other block is itself or non sticky. To be honest, I'm surprised that slime doesn't push your block.
  9. So you have an instance of the player (the one using the table). Use that player to get the server: player.world.getServer();
  10. Your way will crash on a server. Where are you calling this from? What are you trying to achieve?
  11. If it's your own block, you can override Block#getShape: @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { if(context instanceof EntitySelectionContext) { Entity e = context.getEntity(); if (e != null) { // Perform your logic } } return super.getShape(state, worldIn, pos, context); }
  12. I think you need to leave the default implementation of canStickTo, just override isStickyBlock
  13. Registry events (and lifecycle events, config events etc.) are fired on the mod bus (anything to do with your mod). Game events (player interaction, damage, crafting etc.) are fired on the forge bus. If you aren't sure, it usually tells you which bus to use in the javadoc for the event.
  14. Look at https://minecraft.gamepedia.com/Model#Block_states. Specifically the "multipart: Used instead of variants to combine models based on block state attributes" part. It allows you to declare individual states and models for each. Fences show how it is used.
  15. Just checked, you're listening to the wrong event bus. You want the Forge bus, not the Mod one. (bus = Mod.EventBusSubscriber.Bus.FORGE)
  16. If you are subscribing the events to the class, the methods have to be static (there is no instance to access the methods on).
  17. For starters this: .setRegistryName("[NAMESPACE HERE]","steve_head") won't work, everything has to be lowercase (and the namespace should be your modid). Secondly, What is the error? Show us your log file.
  18. Look at the blue banner at the top of the page: "New LTS System, 1.14 and moving forward" 1.12 is no longer supported on this forum. Update to a newer version.
  19. 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).
  20. Please create a github repository, it is very hard to debug when we only have tiny snapshots of your code.
  21. What's the exception? With stacktrace preferably. Is your code on github? It would be easier for me to see if it was.
  22. 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++; }
  23. 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.
  24. 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.
  25. 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.
  • Create New...

Important Information

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