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

I made a quiver which can be put into chest and legs armor slots, but it has no texture it both. So how I add different textures when it's on chest or legs?

I don't think you can do that.

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
5 minutes ago, Draco18s said:

I don't think you can do that.

When I asked about quiver I've head same reply, some said I can do it only with custom bow, but I found a way, so.. Don't do such statements if you not sure

I didn't say "you can't do that" I said "I don't think you can."

As in, I do not know of a way to make the texture dependent on which slot it is in: that information is not available to the Item or ItemStack classes.

 

But sure, if you've accomplished it, good job. I'd be interested to know how.

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
Just now, Draco18s said:

I didn't say "you can't do that" I said "I don't think you can."

As in, I do not know of a way to make the texture dependent on which slot it is in: that information is not available to the Item or ItemStack classes.

 

But sure, if you've accomplished it, good job. I'd be interested to know how.

I you really interested check github ItemQuiver and ItemQuiverWithArrows, code is not perfect, a lot of conditional spaghetti, but I have to check for a lot of stuff so..

The only thing I see you doing is changing from one item to another based on whether or not there are arrows (or not).

Your code for CHEST and LEGS are exactly the same except for a 1 or a 2 (the slot number) and could be replaced with a function call containing said slot number.

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
18 minutes ago, Draco18s said:

The only thing I see you doing is changing from one item to another based on whether or not there are arrows (or not).

Your code for CHEST and LEGS are exactly the same except for a 1 or a 2 (the slot number) and could be replaced with a function call containing said slot number.

take a look at extends parts of both items

Also what's function to replace it better?

Edited by LavX64

7 minutes ago, LavX64 said:

take a look at extends parts of both items

Item vs. ItemArrow.

That has nothing to do with the texture.

7 minutes ago, LavX64 said:

Also what's function to replace it better?

private void checkEquipSlots(int slotIndex) {
	if (((EntityPlayer) entityIn).inventory.armorItemInSlot(slotIndex).getItem() instanceof ItemArrow) {
		ItemStack newStack = ((EntityPlayer) entityIn).inventory.armorItemInSlot(slotIndex);
		// Set it to normal Quiver if it has no tag, or arrow tag, or arrow <= 0
		if (newStack.hasTagCompound()) {
			NBTTagCompound nbt = newStack.getTagCompound();
			if (nbt.hasKey("Arrows")) {
				if (nbt.getInteger("Arrows") <= 0) {
					((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
					return;
				}
			} else {
				((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
				return;
			}
		} else {
			((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
			return;
		}
	}
}

Then the chunk under // armor slot 2(chest) check gets replaced with checkEquipSlots(2) and // slot 1(legs) gets replaced with checkEquipSlots(1).

Now you have no duplicate code.

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
2 minutes ago, Draco18s said:

Item vs. ItemArrow.

That has nothing to do with the texture.


private void checkEquipSlots(int slotIndex) {
	if (((EntityPlayer) entityIn).inventory.armorItemInSlot(slotIndex).getItem() instanceof ItemArrow) {
		ItemStack newStack = ((EntityPlayer) entityIn).inventory.armorItemInSlot(slotIndex);
		// Set it to normal Quiver if it has no tag, or arrow tag, or arrow <= 0
		if (newStack.hasTagCompound()) {
			NBTTagCompound nbt = newStack.getTagCompound();
			if (nbt.hasKey("Arrows")) {
				if (nbt.getInteger("Arrows") <= 0) {
					((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
					return;
				}
			} else {
				((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
				return;
			}
		} else {
			((EntityPlayer) entityIn).inventory.armorInventory.set(slotIndex, new ItemStack(ItemInit.QUIVER));
			return;
		}
	}
}

Then the chunk under // armor slot 2(chest) check gets replaced with checkEquipSlots(2) and // slot 1(legs) gets replaced with checkEquipSlots(1).

Now you have no duplicate code.

Yeah, i knew i had to do that, ty.

So u asked how I did my quiver, and told bow to use it, so that's how, my quiver with arrows is ItemArrow with function isInfinite, so bow calls this func everytime it shoots

1 hour ago, LavX64 said:

So how I add different textures when it's on chest or legs?

 

55 minutes ago, Draco18s said:

I don't think you can do that.

 

49 minutes ago, LavX64 said:

I found a way

 

3 minutes ago, LavX64 said:

So u asked how I did my quiver, and told bow to use it, so that's how

No, no I did not. This thread was about textures for the different slots, I said "I don't think I can do that" you said "I found a way." I asked how and you said "see, extends ItemArrow."

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
54 minutes ago, LavX64 said:

When I asked about quiver I've head same reply, some said I can do it only with custom bow, but I found a way, so.. 

 

52 minutes ago, Draco18s said:

But sure, if you've accomplished it, good job. I'd be interested to know how.

So you meant textures right? Sorry

Edited by LavX64

18 minutes ago, LavX64 said:

So you meant textures right? Sorry

Yes, I had. If I misread something as well, I apologize.

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.

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.