Jump to content

trollworkout

Members
  • Posts

    300
  • Joined

Everything posted by trollworkout

  1. the way you're supposed to name your files is based on how you set up the model generally i do it like this ingot copper looks like this definition: public static final Item INGOT_COPPER = new Item().setUnlocalizedName("ingot_copper").setRegistryName("ingot_copper").setCreativeTab(ModData.CREATIVE_TAB); // ingots model ModelLoader.setCustomModelResourceLocation(INGOT_COPPER, 0, new ModelResourceLocation(INGOT_COPPER.getRegistryName(), "inventory")); ModItems.INGOT_COPPER.getRegistryName() actually returns technorcery:ingot_copper (it adds modid automatically) This tells forge to look in my local folder under src/main/resources/assets/ in a folder called technorcery then grab the item model which would be under it's proper folder the src/main/resources/assets/technorcery/models/item and the name of the json would be same as registry name in this case ingot_copper and add .json to it to get the file so the model json is in /src/main/resources/assets/technorcery/models/item/ingot_copper.json /src/main/resources/assets/technorcery/textures/items/ingot_copper.png <this one is referenced from json file notice how all my underlined bits and pieces match up. this makes my life easy. I understand not everyone wants this. ALSO notice how my registry name and unlocalized name is the same apparently this is NOT something everyone here supports so don't do that if you don't want to. I do it to make things easier for myself.
  2. This is just an addition to what Draco said above Any item with "inventory" model works fine out of the box if you are using the vanilla MC models as parent. For ex this will work fine { "parent": "item/generated", "textures": { "layer0": "technorcery:items/fennel" } } This is because the inventory is already set up in that item/generated.json model In fact if you set a parent to a block that has parent a mc vanilla block it will also work when displaying block in inventory. You need to define inventory, offhand, 3rd person etc only if you use a custom json that does not extend anything form vanilla mc as parent. Have a look at say item/generated model or block/cube_all to understand how to set up a json file from scratch to be displayed properly in the game/inventory/world.
  3. Have a look at my project I created a couple of fully functional seeds and crops for ex my model registry (blocks top items bottom) FENNEL is an ItemSeedFood type item. https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/client/ModelsHandler.java For the seed eithr ItemSeed or ItemSeedFood is just like a regular item and you register it normally via ModelLoader For ex my fennel is like a carrot ItemSeedFood is both a food and a seed and is registered like so for texture ModelLoader.setCustomModelResourceLocation(ModItems.FENNEL, 0, new ModelResourceLocation(ModItems.FENNEL.getRegistryName(), "inventory")); and defined like so public static final Item FENNEL = new ItemSeedFood(1, 0.3F, ModBlocks.CROP_FENNEL, Blocks.FARMLAND).setUnlocalizedName("fennel").setRegistryName("fennel").setCreativeTab(ModData.CREATIVE_TAB); As you can see I use the vanilla MC itemSeedFood works fine. Also have a look at my json model for the item . My bet is you're doing something wrong either with model loader registry or your json is wrong. my json for item https://github.com/trollworkout/technorcery/blob/master/src/main/resources/assets/technorcery/models/item/fennel.json
  4. You wanna look at BlockCrops class updateTick (every random tick..is not fixed but can be like 5 10 seconds maybe) this function uses getGrowthChance to calculate a chance if chance is good and less than certain percentage then grow getBonemealAgeIncrease this function sets the age increase per bonemeal use getGrowthChance this function seems to check for nearby blocks if they can sustain plant life and calculates a chance grow this function physically changes the look of the crop when the plant has jus grown i don't fully understand the chances you need to study them on paper to understand but i think mc wiki will probably explain better the growing chances
  5. Im by no means an expert but I noticed the way plants grow is they have random ticking enabled and every random tick they calculate a growth chance and if growth chance is favourable they grow to next stage. Bonemeal works similarly except it calculates a growth chance every time you use it. Check the crop block to see how bonemeal or crops grow. Easiest way to simulate something like a watering can is to apply a bonemeal effect on the crops you are aiming at with the watering can at a certain regular interval as long as the watering can is being used ie hold right click and slowly damage the watering can (ie remove water from it)
  6. FIGURED IT OUT Is so easyyy SO you INDEED need to replace BOTH the block and it's associated Item!! I assume this is because model bakery or whatever gets the model behind the scenes uses the block's item to find the json models and blockstates. I don't know how that happens but maybe it uses the registry name of the item as the path. Next you need to register and set unlocalized name like normal then you register a block just the same way you normally do it. Then you need to substitute both . The only problem is item will show up twice.
  7. OK so the block gets replaced properly . I just tested it and is indeed a fully working cauldron alternative block however , the block shows up as a full default checker texture block so that means it's model is missing. I m still working on that bit. EDIT: I think you may be right about /minecraft folder in my own mod folder. I am trying that now. Maybe the way you change the model is not by registering a new model but rather by simply mod pack style replacing the blockstate and model
  8. OK so I kinda figured this out but I am still trying to figure out how to set the model however I am VERY close. I noticed nobody sets the registry name on a block that you wanna use as a substitute so I did the same. I removed setRegistryName Once I did that I could see right away that all blocks of that type got changed to my block (although still no texture). So this does not just replace new blocks but ALL instances of the block or item including anything pre-placed.
  9. OK sorry for the spam. SO I went back to my original idea of replacing block only and this time it worked! Of course already existing preplaced Cauldrons are vanilla but any new ones I manually place change to my block. See no need to replace item. So the function IS working is just I don't know how to use it. The problem now is my block does not have any model and I think that may be due to cauldron having extra properties which need to be ignored.
  10. This means the block DID NOT get replaced with my block. Since what you are doing her eis replacing the vanilla block's model. This is a method done in a resource pack. My block sohuld have my own model refs and blockstate and the alias method should (based on description) completely replace a vanilla block for my block including my own model, lang , blockstate etc. So this should not be necessary if it actually did work. I'm probably doing it badly or is broken (again)
  11. OK so from my test there seems to be no direct way to change a block. You can only change the block item and the block associated with it but the block itself is not changeable. So if I wanna replace all vanilla Cauldrons that are to be pre-placed in the game I cannot. I can only replace the item you craft and the block associated with it. For ex I made the cauldron places a steam boiler (custom block i made) but I cannot make already existing Cauldron automatically become Seam boilers. According to the description it says it replaces all references of one block/item with another. I was wondering WHY you want me to replace both item and block?? I just need to change the block only. Maybe the function works differently than it says. it does not replace one block reference with the other but in fact it simply replaces the output on the item on the crafting table thus replacing the block associated with it.
  12. SO I confirm that the item replacement seems to work somewhat (shows up twice still) but the block replacement does not. Also an odd thing if I set no creative tab or a creative tab and no unlocalized it won't show up. But if i set both creative and unlocalized i shows up twice. it seems addSubsititutionAlias("cauldorn" or addSubsititutionAlias("minecraft:cauldorn" is same thing
  13. Oh man I'm gonna go to sleep I been up since this morning and last few hours been trying to figure this out with no hope. Im gonna try your code idea first thing in the morning. Thank you so far. All I need is to get this working once.
  14. Seems the reason is failing is this .setRegistryName("cauldron") and this Item.getItemFromBlock
  15. Yeah I dunno keeps giving me null pointer to Item.getItemFromBlock(replacement_block) AFTER I set both up with addSubstituteAlias
  16. I think the substitution alias thing is still broken since long time ago.
  17. OK so an alias substitution is like registering it so it won't work if I register then alias it.
  18. Here is my project https://github.com/trollworkout/technorcery/tree/master/src/main/java/com/technorcery my blocks are in ModBlocks https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/common/ModBlocks.java items here https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/common/ModItems.java my models are here https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/client/ModelsHandler.java Essentially I'm doing this in my blocks define my custom cauldron public static final Block CAULDRON = new Cauldron().setUnlocalizedName("cauldron").setRegistryName("cauldron"); then in preInit i register it like this try { GameRegistry.addSubstitutionAlias("cauldron", GameRegistry.Type.BLOCK, CAULDRON); } catch (ExistingSubstitutionException e) { e.printStackTrace(); throw new RuntimeException(e); } then in models later in pre init() i register like so ModelLoader.setCustomModelResourceLocation(ModItems.CAULDRON, 0, new ModelResourceLocation(ModBlocks.CAULDRON.getRegistryName(), "variants")); This should replace the block with my block with my own custom model and everything. But it doesn't! Maybe because I still need to GameRegistry.register(CAULDRON) ? Not sure
  19. ModelLoader.setCustomModelResourceLocation(ModItems.CAULDRON, 0, new ModelResourceLocation(ModBlocks.CAULDRON.getRegistryName(), "variants")); like that
  20. I'm pretty sure you are right because it seems block and item are tied in. You can't just replace one without the other. I just now need to figure out why it appears twice and why is using vanilla blockstate and model instead of my own.
  21. Hey thank you for your help. I did that and it seems to appear twice.
  22. I tried creating my own block then addSubstitutionAlias but it keeps telling me null pointer exception whenever I try to register the model. Maybe the model does not require registering?? Seems like if I copy and paste all the blockstate and model json files over from MC to my game then simply set unlocalized name and registry name same as minecraft it works. Im confused if this is actually working or just trolling me. DO I need to register BOTH block and it's itemblock?
  23. Have a look at my project I got all this working. https://github.com/trollworkout/technorcery/tree/master/src/main/java/com/technorcery/common/blocks common/blocks all generic blocks common all generic mod data including ModBlocks (where i define register blocks) ModItems (where i define and register items) .. models are registered in client. You probably want to have a look at SlabDoubleWood SlabWood and SlabBlock (this one removes the VARIANT and sub block meta stuff and auto registers things).
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.