Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello!  ;D

 

So if you all remember from my last thread, you all helped me make an item where on right click, it would bring up a chest-like Gui.

 

Now, I realized I need to make the item not be able to be put in itself... Anyone know how to do that?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

You have a custom slot class, yeah?

Make that slot not accept your bag item.

 

Done.

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.

  • Author

You have a custom slot class, yeah?

Make that slot not accept your bag item.

 

Done.

 

What would I be overriding here? canTakeStack? or what else?

 

 

 

EDIT: NEVERMIND xD I found isItemValid. Now, how do I say "test_bag is a no-no"? if(__ = test_bag) return false?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

You have a custom slot class, yeah?

Make that slot not accept your bag item.

 

Done.

 

What would I be overriding here? canTakeStack? or what else?

 

 

 

EDIT: NEVERMIND xD I found isItemValid. Now, how do I say "test_bag is a no-no"? if(__ = test_bag) return false?

Quick question, how much Java do you know, how much Minecraft/Forge do you know?

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.

  • Author

You have a custom slot class, yeah?

Make that slot not accept your bag item.

 

Done.

 

What would I be overriding here? canTakeStack? or what else?

 

 

 

EDIT: NEVERMIND xD I found isItemValid. Now, how do I say "test_bag is a no-no"? if(__ = test_bag) return false?

Quick question, how much Java do you know, how much Minecraft/Forge do you know?

 

I am not too experienced with Java, and I try to learn as much Minecraft/Forge as I can. Everything I have coded I understand (I go back and ask everything to understand it) and I understand some other stuff.

 

Keep in mind, I am only 14, still in 8th grade. I like coding so that's why I am here.

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

  • Author

Ok just asking, you know what an ItemStack is, right? And do you know what an instanceof check is?

 

Yes I do. Now that you say this, let me see if I can piece together this with new ideas.

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

You don't even need InstanceOf here at all.

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.

You don't even need InstanceOf here at all.

Just in case he wants to make more Bags than just one. This way you can't put any bag inside a bag.

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.

  • Author

You don't even need InstanceOf here at all.

 

What can/should/do I use here then? (I was just experimenting with instanceof and no good, so that's why I ask)

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

You don't even need InstanceOf here at all.

 

What can/should/do I use here then? (I was just experimenting with instanceof and no good, so that's why I ask)

How did you use instanceof and you could also use stack.getItem() != bagItemField.

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.

  • Author

I was using something like

 

		instanceof(stack.isItemEqual(ModItems.test_bag)){
	return false;
	}

 

yes, I think this isn't correct (I know test_bag isn't an itemstack, i am trying to figure out what to do there...)

 

Anyway, with that instanceof stuff I think I got it to work with "while"...

 

		while(stack.getItem() != ModItems.test_bag){
	return false;

	}

	return true;

}

 

Is while ok here?

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

No,

while

is for a loop to run repeatedly. You just need an

if

. You've got the actual comparison right, though.

instanceof(stack.isItemEqual(ModItems.test_bag))

 

ok, for one, that's not even valid java. and two, even if it was, an ItemStack and an Item will never ever not in a billion years be equal.

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.

  • Author

Ok, so I have

	@Override
public boolean isItemValid(ItemStack stack) {

	if(stack.getItem() != ModItems.test_bag){
	return false;

	}

	return true;

}

 

And this does not work. I can still put my item in there.

 

WAIT!

*Cheeks code once more, sees !=, slams head into desk* Wow I am stupid.

 

Solved

I Love To Help People. Unless They Are The Kind Of People Who Just Doesn't Know Anything. Those People Need Some Serious Help. This Could Help But......

https://www.youtube.com/watch?v=6t0GlXWx_PY

 

ThingsMod Git: https://github.com/EscapeMC/Things-Mod-1.10.2

 

TeamMadness Mod Git: https://github.com/EscapeMC/TeamMadness-Mod-1.10.2

 

If I somehow help you, please click the "Thank You" button. If I am a total waste of time, please click the "Applaud" button.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.