Schleim_time Posted May 15, 2019 Posted May 15, 2019 My game crashes by using shift click in my custom container, is there a way to fix that? i readed about @Override the transferStackinslot but i cant fint that anymore, maybe its gotten removed or got an other name? Quote
DavidM Posted May 15, 2019 Posted May 15, 2019 Post your code and crash. Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 9 hours ago, DavidM said: and Funny thing is there is no crash and are nor errors, its seems to do an infinity loop or something but idk why, i heard you need to override transferstack or something but i have no plan how to use that. Can you see the minecraft workbench transferstack? Quote
DavidM Posted May 16, 2019 Posted May 16, 2019 Post your code then. Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 14 hours ago, DavidM said: Its only a construktor with containers and a gui Quote
Cadiboo Posted May 16, 2019 Posted May 16, 2019 2 hours ago, DavidM said: Post your code Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
V0idWa1k3r Posted May 16, 2019 Posted May 16, 2019 If you just extend Container then you need to override Container#transferStackInSlot, as you've said yourself. 17 hours ago, Schleim_time said: i cant fint that anymore It's still very much there on my end, so I don't know what your issue here is. Afaik the method didn't get renamed. 1 Quote
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 2 hours ago, V0idWa1k3r said: as Ok i found out how to use that, i have to use that in the container bit o dont understand the syntax of that because its returning an itemstack, why will it still crash on return null instead of doing nothing on shift? Shift isnt important for me, so is it easy to only make that it return nothing? Or what can i do in there? Return an itemstack is weird i also tried return air but it still crashes instead of replacing the slot with air Quote
Draco18s Posted May 16, 2019 Posted May 16, 2019 (edited) 1 hour ago, Schleim_time said: Ok i found out how to use that, i have to use that in the container bit o dont understand the syntax of that because its returning an itemstack, why will it still crash on return null instead of doing nothing on shift? ItemStacks cannot be null. They cannot be null because a stack of size zero is empty and should be treated as a non-existent stack. Quote Shift isnt important for me, so is it easy to only make that it return nothing? Or what can i do in there? Return an itemstack is weird i also tried return air but it still crashes instead of replacing the slot with air This is why ItemStack.EMPTY exists. Edited May 16, 2019 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 I did empty, return null stoops server and crash and return empty do crash without error 1 hour ago, Draco18s said: ItemStacks cannot be null. They cannot be null because a stack of size zero is empty and should be treated as a non-existent stack. This is why ItemStack.EMPTY exists. Quote
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 1 hour ago, Draco18s said: ItemStacks cannot be null. They cannot be null because a stack of size zero is empty and should be treated as a non-existent stack. This is why ItemStack.EMPTY exists. So im only tring to do that shift will not crash, shift dont need a function but i have no plan how to do this, im not understanding the method Quote
DavidM Posted May 16, 2019 Posted May 16, 2019 (edited) You still haven't post your code... 4 hours ago, Schleim_time said: im not understanding the method IIRC the method takes in a player and an index indicating who clicked on the slot and which slot he/she clicked on. The method also handles the inventory manipulation during the shift-click process. The ItemStack the method returns is the ItemStack that should remain in the slot after the shift-click operation. Edited May 16, 2019 by DavidM Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
Schleim_time Posted May 16, 2019 Author Posted May 16, 2019 Thank you david, i will try my best but as first i copied the crafting table one because i also want to do something like that 52 minutes ago, DavidM said: You still haven't post your code... IIRC the method takes in a player and an index indicating who clicked on the slot and which slot he/she clicked on. The method also handles the inventory manipulation during the shift-click process. The ItemStack the method returns is the ItemStack that should remain in the slot after the shift-click operation. Quote
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.