trollworkout Posted November 12, 2016 Posted November 12, 2016 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? Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 Yes you need to register the ItemBlock. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 Hey thank you for your help. I did that and it seems to appear twice. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 3:07 AM, trollworkout said: Hey thank you for your help. I did that and it seems to appear twice. Oops I meant to say substitute it, though I don't know if that will work? (Never done any substituting, at least while the system is working). Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 3:29 AM, trollworkout said: 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. Did you set the model location with ModelLoader? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 ModelLoader.setCustomModelResourceLocation(ModItems.CAULDRON, 0, new ModelResourceLocation(ModBlocks.CAULDRON.getRegistryName(), "variants")); like that Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 3:49 AM, trollworkout said: ModelLoader.setCustomModelResourceLocation(ModItems.CAULDRON, 0, new ModelResourceLocation(ModBlocks.CAULDRON.getRegistryName(), "variants")); like that Could you post all relevant code or better yet github link? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 Okay Ill upload to github is is broken atm Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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 Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 OK so an alias substitution is like registering it so it won't work if I register then alias it. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 I think the substitution alias thing is still broken since long time ago. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 4:45 AM, trollworkout said: I think the substitution alias thing is still broken since long time ago. No, CPW, and Lex have both said that it works. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 Yeah I dunno keeps giving me null pointer to Item.getItemFromBlock(replacement_block) AFTER I set both up with addSubstituteAlias Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 Try moving your blockstate file. To a folder called minecraft (where your modid would be), but in your project. IE assets.minecraft.blockstates, but inside your project. Instead of assets.modid.blockstates. Item.getItemFromBlock doesn't respect substitution aliasing. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 On 11/12/2016 at 5:41 AM, Animefan8888 said: Try moving your blockstate file. To a folder called minecraft (where your modid would be), but in your project. IE assets.minecraft.blockstates, but inside your project. Instead of assets.modid.blockstates. Item.getItemFromBlock doesn't respect substitution aliasing. Gotcha Im gonna try that. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 Seems the reason is failing is this .setRegistryName("cauldron") and this Item.getItemFromBlock Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 5:47 AM, trollworkout said: Seems the reason is failing is this .setRegistryName("cauldron") and this Item.getItemFromBlock The setRegistryName should be fine, but Item.getItemFromBlock doesn't respect aliasing it only accesses the registry data and not the aliasing data. My testing code... Block block = null; Item item = null; try { block = new BlockCauldron().setRegistryName(new ResourceLocation("wr", "cauldron")); item = new ItemBlockSpecial(block).setRegistryName(new ResourceLocation("wr", "cauldron")); GameRegistry.addSubstitutionAlias("minecraft:cauldron", Type.BLOCK, block); GameRegistry.addSubstitutionAlias("minecraft:cauldron", Type.ITEM, item); } catch (ExistingSubstitutionException e) { e.printStackTrace(); } ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(new ResourceLocation(ModReference.MODID, "cauldron"), "inventory")); Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
Animefan8888 Posted November 12, 2016 Posted November 12, 2016 On 11/12/2016 at 5:55 AM, trollworkout said: 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. Use your public static final variables instead of my in method variables and note "wr" is the modid, and the meta of 1 is incorrect use 0. You should really try the... Quote Try moving your blockstate file. To a folder called minecraft (where your modid would be), but in your project. IE assets.minecraft.blockstates, but inside your project. Instead of assets.modid.blockstates. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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 Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 On 11/12/2016 at 5:41 AM, Animefan8888 said: Try moving your blockstate file. To a folder called minecraft (where your modid would be), but in your project. IE assets.minecraft.blockstates, but inside your project. Instead of assets.modid.blockstates. Item.getItemFromBlock doesn't respect substitution aliasing. 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) Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
trollworkout Posted November 12, 2016 Author Posted November 12, 2016 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. Quote Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
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.