Jump to content

Recommended Posts

Posted

I am sorry, just recently i dont get much responce.. for like days sometimes. it is understanding after a day when i figure it out just its true i am impatient and i like input thats all

Posted (edited)
9 minutes ago, clowcadia said:

As thus comparing with unlocalized names, what are other ways of comparing?

Compare the Item directly. Items are singletons so can be compared just using the == operator.

Edited by Jay Avery
Posted
19 minutes ago, clowcadia said:
                if(nbt==null) nbt = new NBTTagCompound();
                if(nbt.hasKey("targetX")){

When you create a brand new tag compound, it's never going to already have a given key - perhaps you meant to check if it doesn't have that key?

 

In gameplay terms, how do you want the ItemStack's target information to be given to the entity? Do you put the stack in the entity's inventory? Is the information sent to the entity as soon as the target is clicked?

Posted

i am seriously tried alot of different methods, and the most succestful once only return success one time, where the targetItem is vaible one use, iwant it multiple uses

Posted

Be more specific: are you unable to use the item a second time? Does it not save the co-ordinates a second time? Does the entity's AI target not change when the item is changed?

Posted

What this mod is supposed to do is allow the user to have a Target Item that is used by right clicking on a block/block position where the item internal nbt records the block position xyz. An entity that has a container with the gui where the player can then insert the Target item after a location in the Target item has been set to pass the location to the entity to go to. Once the entity reaches the target item target position the player then can take the target item back reset to a new target location to the items nbt and again insert to the entity s gui/container to pass another location to have the entity move to( this is where my mod is not functioning, the reset values of my target item are not passing to entity ai like they have the first time), this can be repeated unlimited times

Posted

Then how do i read the items nbt from the task ai, everything i tried this far bring null on the calling of the nbt

i tried ItemStack.getItem().getSharedNBTTag().getInteger("targetX")

ItemStack.getNBTCompoundTag().getInteger("targetX")

top of my head examples of what i tried

Posted (edited)
7 minutes ago, diesieben07 said:
  • Why are you calling getNBTShareTag? I don't think you know what it does...
  • In onItemUse you check if the stack already has an NBT tag. If it doesn't, you create a new NBT tag, put data into it and then just forget about it.

ShareTag i was using ealrier it work for the first time , and yes no idea what exactly it does, i do have the other option getNBTTagCompount as well though and it also returns null

 

and what do u mean forget about it, what else is supposed to be done?

 

https://github.com/Clowcadia/MinecraftForge/blob/master/1.11/NPCTesting/src/main/java/com/clowcadia/test/entities/living/ai/AIGoto.java#L36

Edited by clowcadia

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.