Jump to content

Recommended Posts

Posted

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?

Posted

Post your code and crash.

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.

 

 

Posted
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?

Posted

Post your code then.

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.

 

 

Posted
2 hours ago, DavidM said:

Post your code

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.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)

Posted

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.

 

 

  • Thanks 1
Posted
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

Posted (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 by Draco18s

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.

Posted

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. 

 

Posted
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

Posted (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 by DavidM

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.

 

 

Posted

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.

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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