-
[1.12.2] ItemBlock model not being applied
I'm working on a small mod that revolves around a specific block, and I've more or less got the functionality down. The issue I'm having is with the models - I've managed to get the model to apply when the block is placed in the world, but I can't get the item to be modeled in the player's inventory. It just shows up as the default flat black/magenta checkerboard in its slot, and as an overlarge block of the same texture when held. I wouldn't normally ask for help with something so mundane, but I'm legitimately stumped what I'm doing wrong. I've tried just about everything I can think of, including converting the blockstate JSON to Forge's format, changing paths, everything. The registry code is clearly working at least in part, since the block model works when it's placed, but the item just refuses to work. ClientRegistry.kt @SideOnly(Side.CLIENT) @Mod.EventBusSubscriber(Side.CLIENT) object ClientRegistry { @SubscribeEvent fun registerModels(e: ModelRegistryEvent) { ModelLoader.setCustomModelResourceLocation( Registry.itemBlockAutocrafter, 0, ModelResourceLocation(Registry.blockAutocrafter.registryName!!, "inventory")) } } blockstates/autocrafter.json { "variants": { "normal": { "model": "autocrafter:autocrafter" }, "inventory": { "model": "autocrafter:autocrafter" } } } models/block/autocrafter.json (copied wholesale from the Crafting Table, going to edit more later) { "parent": "block/cube", "textures": { "particle": "blocks/crafting_table_front", "down": "blocks/planks_oak", "up": "blocks/crafting_table_top", "north": "blocks/crafting_table_front", "east": "blocks/crafting_table_side", "south": "blocks/crafting_table_side", "west": "blocks/crafting_table_front" } } models/item/autocrafter.json (again copied/modified from the Crafting Table) { "parent": "autocrafter:block/autocrafter" } The item being rendered The block when placed (currently looks the same as a Crafting Table, but it's not)
-
[1.11/1.12] @Config annotation with Scala code
Ah, ok. Glad to hear that it's being worked on! I'll continue using the Java code as a workaround for the time being.
-
[1.11/1.12] @Config annotation with Scala code
As my previous posts probably suggest, I generally prefer modding in Scala to modding in Java. However, I've run up against an issue where I can't get the @Config annotation to work with Scala code. My solution thus far has been to stick it on Java code instead and simply link the two, but it'd be nice to have some of Scala's conciseness when defining the config. Is there any way to get these two to play nice?
-
[1.10.2] Change block model location?
Thanks for the advice, I've started on the process but it's slow going. Guess they really wanted to make this complicated, huh? Still, thanks! I probably wouldn't have figured that out alone...
-
Block color like item color
Glad you got it working!
-
[1.11.2] [SOLVED] Some Questions Regarding Minecraft::getMinecraft
My bad, I guess I'm just a bit too used to Scala where I can just if(world.isRemote) { import net.minecraft.client.Minecraft // do stuff } Please disregard my previous comments as to how to use Minecraft#getMinecraft safely, it appears I am either an idiot or really rusty when it comes to Java.
-
[1.10.2] Change block model location?
What would really be ideal is to be able to load the assets from a folder within the .minecraft folder, where I'm already loading the blocks themselves from. I'm aiming to make these "block packs" as easy as possible to install, which means that the models and textures need to be in roughly the same location as everything else so they come down to a simple drag and drop install.
-
Block color like item color
@LousyLynx Sorry, not much I can do right now... If you still need help later, I can take a look. Wish I could be of more use.
-
Block color like item color
@LousyLynx Hmm... I remember having issues with this myself. Luckily, I just remembered how to fix it, I think! It's definitely true that this is an unusually painful process for blocks, and there's little to no documentation. In your block class, override this method: getBlockLayer() It should return BlockRenderLayer.CUTOUT and then the model should work, if I remember right from when I last did this. If it doesn't, let me know - I still have source code laying around, so I can dig though it a bit and see what else is relevant (it's been a month or two since I worked with this, so I don't remember off the top of my head).
-
Block color like item color
@LousyLynx You'll want to look into the "tintindex" parameter in the block model JSON, it defines what tint index (the int in the method signature) the block should be tinted on. Here's a link to the spec for that file: http://minecraft.gamepedia.com/Model#Block_models
-
[1.11.2] [SOLVED] Some Questions Regarding Minecraft::getMinecraft
Glad I could help! That is one of the most common uses of it that's actually legitimately needed, yes. Just be careful to check world.isRemote to make sure you're on the client side before you try to use Minecraft#getMinecraft, and you should be fine =)
-
[1.11.2] [SOLVED] Some Questions Regarding Minecraft::getMinecraft
Each instance of Minecraft initializes the mod separately, so they won't overlap ever. I can't answer to whether saving it statically is safe, but I'd assume so. However, you should only ever use Minecraft#getMinecraft() if you absolutely have to - there are almost always better and safer ways to get the information you want. The player can only be gotten from a Minecraft instance on the client side, not on the server, so be very careful where you do this. If you can avoid using Minecraft#player at all, do. The relevant player will usually be passed along with events and method calls. I can't answer to this for sure, but again, Minecraft#getMinecraft() is usually unnecessary and the same effects can be achieved in a different and safer way. Hope that helps!
-
Block color like item color
I'd assume you're using the IItemColor interface to color your items, correct? If so, there is a corresponding IBlockColor interface that works essentially exactly the same. The main differences are that the method you need to implement is colorMultiplier(IBlockState, IBlockAccess, BlockPos, Int) rather than getColor(ItemStack, Int) and instead of registering with Minecraft.getMinecraft.getItemColors.registerItemColorHandler you register with Minecraft.getMinecraft.getBlockColors.registerBlockColorHandler Hope that helps!
-
[1.10.2] Change block model location?
I'm attempting to make a mod that essentially lets you add blocks and items to the game via JSON (yes, I know some already exist, but 1. this is mostly just to see if I can and 2. they all have some drawback or another). What I'm wondering is, is it possible to change the location that Minecraft looks for block and item models at? For example, would it be possible to add my own directory as an additional directory to search for domains in (i.e. it would search for assets both in assets/<domain> as usual and in my own moddirectory/<domain>)? The one other thought I've had at the moment is to copy the model files into the built-in folder at runtime, but that would really not be ideal if it can be avoided.
-
[1.11.2][Scala] Can't register GUI Handler
Thank you, that seems to have fixed it ^-^ I guess I haven't broken out of my Java habits as nicely as I'd have hoped.
IPS spam blocked by CleanTalk.