GeoDoX Posted October 28, 2012 Posted October 28, 2012 Hello Modders! I was wondering if there was a way to override (and not edit base classes) what Vanilla ore's drop? I've done hours of googleing and nothing came to results, so please dont tell me to google it or something related. If so could you point me in the direction of how to do that? Thanks in Advance! Quote
SCC Posted October 29, 2012 Posted October 29, 2012 You make a ore Block like normal (no generation or the like but), can probably just super-class the original ore block to make it quicker, but change the drop method(s) to do what you need, then when assigning ID's just use the ID of the ore you want to replace Quote
GeoDoX Posted October 29, 2012 Author Posted October 29, 2012 You make a ore Block like normal (no generation or the like but), can probably just super-class the original ore block to make it quicker, but change the drop method(s) to do what you need, then when assigning ID's just use the ID of the ore you want to replace That's actually bad programming, very bad programming. Not to mention, it also wouldn't work. The vanilla ore would still generate, and mine would gen too. So I thank you for the reply, but I respectively decline. Your free to come back if you find the answer though! Anyone else? Quote
keepcalm Posted October 29, 2012 Posted October 29, 2012 You could try adding an event listener for EntityJoinWorld, check if the entity is instanceof EntityItem and then get the ID, comapre it to that of the ore block, and then spawn items there if its appropriate? I can see a few holes there (could result in item duplication), but that's the only thing I can think of Or, you could use a coremod and override that class - you might want to look at NotEnoughItems and CodeChickenCore - chickenbones overrides a class in NEI, so you could learn from him... Quote Protip: try and find answers yourself before asking on the forum. It's pretty likely that there is an answer. Was I helpful? Give me a thank you! http://bit.ly/HZ03zy[/img] Tired of waiting for mods to port to bukkit? use BukkitForge! (now with a working version of WorldEdit!)
SCC Posted October 30, 2012 Posted October 30, 2012 That's actually bad programming, very bad programming. Not to mention, it also wouldn't work. The vanilla ore would still generate, and mine would gen too. So I thank you for the reply, but I respectively decline. Your free to come back if you find the answer though! Debating as to weather or not something is a bad programing or not is beyond the scope of these boards As to weather or not it works? How do you think Eloraam gets spreading mossy cobblestone? Take a look inside Redpower World and you'll see a file called BlockCobbleMossifier.class, it's a new mossy cobblestone block, when ID's are assigned she simply has Forge assign this block the normal mossy cobblestone ID. The reason this works is that when Minecraft does terrain generation it works on ID's, not actual objects Quote
LordFokas Posted October 30, 2012 Posted October 30, 2012 Actually SCC's answer is not that bad... And it does work... although I don't know if you can succeed to assign a block an ID that is already being used... probably Eloraam has a way to go around it, given she's one of the Forge main devs (or was at least), and her skill levels are above those of the average modder. At this moment, the core mod option sounds the best, or you can waste some hours looking at the code, searching for something that allows you to override a block the way Elo does with the Mossy cobble. Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
SCC Posted October 30, 2012 Posted October 30, 2012 The why Eloraam assigns the block ID is the same way everybody else assigns block ID's, Forge doesn't throw a hissy fit if you try and use a vanilla ID, only ones already used by mods Quote
LordFokas Posted October 30, 2012 Posted October 30, 2012 Oh, I didn't it ignored vanilla ID's. Nice. So yeah, overriding the block by ID is pretty easy to do, and should be clean. I'd do it... Quote Did I help? Hitting 'Thank You' would be appreciated. Soon, the lost city will rise from the bottom of the ocean, and spread it's technology across Minecraft.
Recommended Posts
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.