-
Override vanilla advancements? (1.14)
I have a block that is functionally similar to a vanilla block that has an associated INVENTORY_CHANGED advancement. Of course, the advancement only triggers for the vanilla block, but I would like it to also accept my block as completing the advancement. Is there a way to override vanilla advancements and replace some with my own? Currently I've found that the AdvancementList inside the AdvancementManager is my best bet. Unfortunately, the remove() method of the AdvancementList is client only, and I'm not sure whether calling loadAdvancements() after the vanilla advancements are loaded would work. In addition, accessing the AdvancementList would require passing through multiple private variables with reflection, which is possible, but unfavorable. I'd appreciate either some more insight on this approach or a new approach I hadn't considered. Edit: as it turns out the only AdvancementManager instance is final. So the above approach won't work. I also don't think that creating an advancement named the same would work because it is by modid - there is no way for me to replace the "minecraft:" advancement without having it under the minecraft modid. Are there any ideas to how something like this could be implemented? Thanks for the help.
-
In-Code Json Creation
This seems more like what I am looking for, however, could you explain the process?
-
In-Code Json Creation
Okay, hopefully this will help: for(i=0;i<50;i++){ String json = "blah blah mymod:blocks/dummyblock1 blah blah"; //text for the jsons, the file names for the textures, models and blocknames are incremented //add code for adding json } If you're asking why, as in why would I want this feature in my mod, it's supposed to be more of a utility mod for mapmakers. If you're asking why, as in it would make no difference whether you put it in there or not, although I might be new to programming Minecraft mods, you do need a JSON and only a JSON to specify the attributes of how the block or item is rendered, correct? So if I want all of the attributes of my 50 blocks to be the same, except for the texture, I would either have to have tons of variants of that single block or add three separate JSON files for each block, correct? So therefore I would just need to loop over a line of code that adds the JSON files for every single block on bootup as an alternative to typing out the code for all 50 of the blocks. If this doesn't make sense, I'm really sorry, but I'm trying to explain this the best I can. Hopefully you'll understand now.
-
In-Code Json Creation
I don't really understand why a resource pack would come into play here. Let me explain thoroughly: My mod is something that adds a set amount of blocks (50 as default) that are exactly identical to each other except the texture they use. When the game first boots up, these blocks are generated and added into the game using a for loop. What I want to do is create the model files for these blocks inside the code in that same for loop, so that the user can use a texture pack to retexture them as they please. Basically I want to code something that goes into the for loop of my code and generates the JSON files at the same time as the blocks. All I need is the piece of code specifying where the file needs to be written to.
-
In-Code Json Creation
Ok then, thanks. Sorry I've been a bit stubborn, but just to make sure: Could you loop over something in one of your classes that will create all of the variants in the JSON file without typing all of that in? I'm not really looking for compact code, although that would be nice, but I'm looking for something that will create that code right there on startup.
-
In-Code Json Creation
Right, but is there a more efficient way of typing in the code for 50 blocks in the JSON file?
-
In-Code Json Creation
Thank you! Now I don't have to have 150 separate JSON files for each of my 50 blocks. One more question though, and that's about how I would add the JSON file from my for loop in my java class? Thank you, ComputerCraze
-
In-Code Json Creation
In my mod that I am currently working on, I have a numerous amount of identical blocks which you can texture using a texture pack. However hard coding all of these would be painful at best so I was thinking of looping over a piece of code that would create all of the jsons. How would I go about it?
-
Run Code the First Time the Mod is Run
I am trying to make a simple mod where there is fifty "dummy blocks" that you can assign textures to through a texture pack, perfect for a mapmaking scenario. However, I need the json files to be created when the mod is first run. I don't want to write all of the files manually (cut down on file size) so I want to create all of them by code, probably during the preInit cycle, before the actual blocks are initiated. Is there a way to run a specific section of code only when it is the first time running the mod? Thanks in advance, ComputerCraze
-
[1.8] [SOLVED] onNeighborBlockChange see if neighborBlock is a certain block
I was going to do that, but I need help checking if the block below it is a fence. What would I put in on the other side of the double-equals to make sure it is a fence?
-
[1.8] [SOLVED] onNeighborBlockChange see if neighborBlock is a certain block
This is probably a really easy question but I haven't gotten the grips around Minecraft Mod Coding yet. I saw this method in the Diode class and decided to give it a try, because it would be easy to use for my 2-block multiblock structure. The code in question is here: public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState blockstate, Block neighborBlock){ if (neighborBlock == ) } As you can see I have my if statement incomplete because I have no idea what format neighborBlock is in. If you are wondering the block that I am looking for is below the one referenced in the code, and is a fence post. Thanks, ComputerCraze
-
Liquids in Forge 1.8?
Thank you Choonster! Your mod code was very helpful. I have a few questions, though: 1. What is the difference between a Fluid and a BlockFluidClassic? Is the BlockFluidClassic a source block, or is it something completely different? 2. What does the RegisterTank function do? 3. I have never worked with models, so the ModModelManager is completely new to me. How do I register the fluid models? Thanks, CC
-
Liquids in Forge 1.8?
I want to create a fluid (similar to water) in my mod. I checked in the source for Minecraft and I was not able to find a class for water. I also have checked online, and I found one person who released the code for it, but he used a lot of algorithms to determine the water's height and position, and I couldn't fully understand the code. Is there a class in Forge that does those calculations for you? I feel like there is, as it was mentioned a little online, but I don't know what the class is or how it works. If there is a class like that, can you give me a tutorial or some example code so I can see how it works? Thanks, CC
-
[SOLVED]Modify Vanilla Items?
Have you considered just using a different texture for your own item or changing its design to be something other than an egg? Wow I can't believe I hadn't though of that. I sometimes really do think too hard Thanks so much!
-
[SOLVED]Modify Vanilla Items?
ASM is a library that allows you to manipulate the bytecode of classes at runtime. There aren't many tutorials on using it in coremods, since you should avoid using it unless you have a solid understanding of the bytecode format and you absolutely need to use it. Replacing the vanilla item with your own won't be easy and may not be possible. You can remove it from the creative menu, but players will still be able to obtain it through NEI or the /give command. Ah. Thanks, you've really helped me. But just in case I'm missing something, is there possibly another alternative to adding the shine effect? Also, I only want to make the vanilla spawn eggs different from the new kind of spawn eggs I am adding.
IPS spam blocked by CleanTalk.