Posted April 16, 201312 yr Hi. I hope I'm not asking something obvious, but I haven't been able to find the answer anywhere. Is it possible to get a block object and/or ID by the block's text name, for mod-generated blocks? It seems to me that, from a programming point of view, this would be the best way of allowing mods to interact with each other, without worrying about internal IDs. I'd like to write a mod that makes use of custom blocks that exist in another mod, but that mod uses undocumented ID/meta values. (Specifically, I want to use some of the blocks from the Condensed Blocks mod in recipes.) I've tried using the ID Resolver mod to find out more info about the blocks in question, but it just hangs my Minecraft during loading. The mod does use a config file for the base IDs of the blocks, but the few blocks I'm looking for, specifically, don't have any mention in the config. Anyone have any ideas? Thanks.
April 16, 201312 yr Author Hi. I hope I'm not asking something obvious, but I haven't been able to find the answer anywhere. Is it possible to get a block object and/or ID by the block's text name, for mod-generated blocks? It seems to me that, from a programming point of view, this would be the best way of allowing mods to interact with each other, without worrying about internal IDs. I'd like to write a mod that makes use of custom blocks that exist in another mod, but that mod uses undocumented ID/meta values. (Specifically, I want to use some of the blocks from the Condensed Blocks mod in recipes.) I've tried using the ID Resolver mod to find out more info about the blocks in question, but it just hangs my Minecraft during loading. The mod does use a config file for the base IDs of the blocks, but the few blocks I'm looking for, specifically, don't have any mention in the config. Anyone have any ideas? Thanks.
April 16, 201312 yr Try using GameRegistry.findBlock(string modId, String name); You can then just access its blockId through that. http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img] I make games, minecraft mods/plugins, and some graphic art. Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.
April 16, 201312 yr Try using GameRegistry.findBlock(string modId, String name); You can then just access its blockId through that. http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img] I make games, minecraft mods/plugins, and some graphic art. Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.
April 17, 201312 yr Author Or... maybe not. Looks like that function was added in the last couple of revisions. I need to wait for all my favorite mods to update to 1.5.1 first. :-( I'm still on 1.4.7, and that function doesn't exist yet. Oh, well. Patience...
April 17, 201312 yr Author Or... maybe not. Looks like that function was added in the last couple of revisions. I need to wait for all my favorite mods to update to 1.5.1 first. :-( I'm still on 1.4.7, and that function doesn't exist yet. Oh, well. Patience...
April 17, 201312 yr foreach Block block inn BlockList if (block.name == name) return block If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr foreach Block block inn BlockList if (block.name == name) return block If you guys dont get it.. then well ya.. try harder...
April 17, 201312 yr it should be in the mod owners mcmod info file, or in the main mod class under modid = "MODID", alternatively if you do not have access to either of these you would have to ask thr mod creator. Use examples, i have aspergers. Examples make sense to me.
April 17, 201312 yr it should be in the mod owners mcmod info file, or in the main mod class under modid = "MODID", alternatively if you do not have access to either of these you would have to ask thr mod creator. Use examples, i have aspergers. Examples make sense to me.
April 19, 201312 yr foreach Block block inn BlockList if (block.name == name) return block minecraft is coded in java not in c# c# foreach(Block b in Block.blocksList){ if(b.name.Equals(name)) return block; } java for(Block b : Block.blocksList){ if(b.name.equals(name) return block; }
April 19, 201312 yr foreach Block block inn BlockList if (block.name == name) return block minecraft is coded in java not in c# c# foreach(Block b in Block.blocksList){ if(b.name.Equals(name)) return block; } java for(Block b : Block.blocksList){ if(b.name.equals(name) return block; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.