-
Posts
297 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Alpvax
-
Vanilla has this feature: /gamerule doLimitedCrafting See http://minecraft.gamepedia.com/Recipe_book#Obtaining
-
Forge *needs* to save textures after stitching them
Alpvax replied to tuskiomi's topic in Suggestions
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. -
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.
-
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).
-
Forge *needs* to save textures after stitching them
Alpvax replied to tuskiomi's topic in Suggestions
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... -
What exactly are you trying to do? I use that method to conditionally highlight sub segments of my block (by returning a different voxelshape).
-
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).
-
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.
-
[1.15] How to Grant and Check on Advancements
Alpvax replied to Kristopher_RAS's topic in Modder Support
So you have an instance of the player (the one using the table). Use that player to get the server: player.world.getServer(); -
[1.15] How to Grant and Check on Advancements
Alpvax replied to Kristopher_RAS's topic in Modder Support
Your way will crash on a server. Where are you calling this from? What are you trying to achieve? -
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); }
-
I think you need to leave the default implementation of canStickTo, just override isStickyBlock
-
[1.15.2] How to add a camera zoom like vanilla bow on aim?
Alpvax replied to Torq's topic in Modder Support
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. -
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.
-
[1.15.2] How to add a camera zoom like vanilla bow on aim?
Alpvax replied to Torq's topic in Modder Support
Just checked, you're listening to the wrong event bus. You want the Forge bus, not the Mod one. (bus = Mod.EventBusSubscriber.Bus.FORGE) -
[1.15.2] How to add a camera zoom like vanilla bow on aim?
Alpvax replied to Torq's topic in Modder Support
If you are subscribing the events to the class, the methods have to be static (there is no instance to access the methods on). -
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.
-
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.
-
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.