Jump to content

Recommended Posts

Posted

How exactly do I do that? I can't register that in the NBTTagCompounds. Also, like I said earlier, the getter for the owners are vanilla methods and part of the EntityTameable class

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

Posted
  On 5/9/2015 at 1:56 PM, NovaViper said:

How exactly do I do that? I can't register that in the NBTTagCompounds. Also, like I said earlier, the getter for the owners are vanilla methods and part of the EntityTameable class

Ah I see. then make independent getter/setter method or field for the nickname of the owner.

Also you should sync the nickname field when the owner(player with UUID) logs in.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

So, basically override the vanilla methods with my own right?

 

Something like this?

	public UUID getOwnerNickname(){
	return this.getOwner().getUniqueID();	
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

No, make your own field representing the nickname of the owner.

And sync the field when the owner(player with UUID) logs in.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Sorry if I'm asking really noob questions.. but how do I sync the field? I made the field like this:

 

	protected EntityPlayer owner;

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

You shouldn't be storing the player, store their UUID, like so:

 

protected UUID m_ownerID;

 

Save it to NBT by writing it to a string, then load it from string and use UUID.fromString(string) to get it back.

Posted
  On 5/9/2015 at 2:53 PM, NovaViper said:

Sorry if I'm asking really noob questions.. but how do I sync the field? I made the field like this:

 

	protected EntityPlayer owner;

No, do not sync THAT field.

I said: make field representing 'nickname of the owner'.

and sync the field(nickname) when the owner logs in!

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Did you at least try searching for how to synchronize fields in an Entity before asking? Chances are that whatever question you have has already been asked and answered.

 

Anyway, three main methods:

1. DataWatcher (google it - there is a good tutorial on the Forge wiki) - you'll probably want to use this one

2. IEntityAdditionalSpawnData - useful for unchanging fields; not suitable for your situation

3. Custom packet - very flexible and something you should learn about if you don't know already; tutorials abound

Posted
  On 5/10/2015 at 6:47 PM, NovaViper said:

I'm trying to use the datawatcher, but it says it has to be a string

Okay, this kind of reply where you state a problem but do not show the code you tried that resulted in the problem is part of the reason this thread is so long.

 

Whenever you have an issue with your code, SHOW the code right away when you describe the problem, even if you think it is redundant, rather than waiting for someone to ask for it.

 

All I can tell you without seeing the code is exactly what the error message says: if you are using DataWatcher to store a String, then you have to store a String, not anything else. If you have a UUID, you need to convert it to a String, which you would see if you looked at EntityTameable (always look at the vanilla code for examples when you are doing something that has already been done).

Posted

I'm sorry, it's not the client thats saying that, it's eclipse that's saying the field needs to be a string

 

	@Override
public void writeEntityToNBT(NBTTagCompound tagCompound) {
	super.writeEntityToNBT(tagCompound);
	tagCompound.setBoolean("Angry", this.isAngry());
	tagCompound.setByte("CollarColor", (byte) this.getCollarColor().getDyeDamage());
	tagCompound.setBoolean("Saddle", this.isSaddled());
	tagCompound.setBoolean("Evolve", this.hasEvolved());
	tagCompound.setString("Owner", ownerID); <<<< underlined red and says The method setString(String, String) in the type NBTTagCompound is not applicable for the arguments (String, UUID)
	tagCompound.setString("version", Constants.version);
	tagCompound.setString("dogName", this.getZertumName());
	tagCompound.setInteger("dogHunger", this.getDogHunger());
	tagCompound.setBoolean("willObey", this.willObeyOthers());
	tagCompound.setBoolean("dogBeg", this.isBegging());

	this.talents.writeTalentsToNBT(tagCompound);
	this.levels.writeTalentsToNBT(tagCompound);
	this.mode.writeToNBT(tagCompound);
	this.coords.writeToNBT(tagCompound);
	TalentHelper.writeToNBT(this, tagCompound);
}

 

My field

	protected UUID ownerID;

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/10/2015 at 6:55 PM, NovaViper said:

I'm sorry, it's not the client thats saying that, it's eclipse that's saying the field needs to be a string

tagCompound.setString("Owner", ownerID); <<<< underlined red and says The method setString(String, String) in the type NBTTagCompound is not applicable for the arguments (String, UUID)

I know it's not a crash. Read my reply again. ownerID is a UUID, which you cannot store as a DataWatcher element - you must convert it to a String.

 

Please READ the EntityTameable code. It shows you exactly how to do what you are trying to do. Better yet, just extend EntityTameable and you don't have to do anything for the owner to work correctly. Then you just have to worry about storing the nickname, which is exactly the same as storing the other String.

Posted

I am extending to the EntityTameable code, I said that at the beginning I was. So.. do I store the nickname by typing

 

		tagCompound.setString("Owner", this.getOwnerId());

or

		tagCompound.setString("Owner", this.getOwner().getName());

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/10/2015 at 7:24 PM, NovaViper said:

Eclipse says it's a IChatComponent, not a string

You can safely cast that to a
ChatComponentText

and use

ChatComponentText#getChatComponentText_TextValue()

to get the display name.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

That method doesn't exist, would something like this work?

 

		tagCompound.setString("Owner", this.getOwner().getDisplayName().toString());

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted
  On 5/10/2015 at 7:33 PM, NovaViper said:

That method doesn't exist

Yes it does, it is a method of EntityPlayer. Unless your entity will be tameable by other types of mobs, then the only type of owner you will have is an EntityPlayer. Check the instance type and cast to EntityPlayer if you can, otherwise store getCustomNameTag() or whatever else you feel like.

Posted
  On 5/10/2015 at 7:57 PM, NovaViper said:

getOwner is an entity, not a EntityPlayer

.. That's what I just said... but you have a custom field, 'this.owner', which IS NOT the same as what is returned by EntityTameable#getOwner, and that is what I was asking about.

 

Anyway, it should be clear by now what you need to do; if not, I highly suggest you take some time to properly learn Java so that simple things like incorrect type parameters to a method (e.g. UUID instead of String) are no longer cause for concern.

Posted

I know about the UUID, I was asking what to do with it since it clearly won't work for String.  But wouldn't using a differenent player conflinct since its not saving the actual owner?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I've tried the java version you linked to and got a new exit code of 127 Here is the new console log I also tried making sure that I had Java 8 selected with the version of Java 8 I already had installed and got the same exit code Here is the console log with that installation in case it has any differences I do notice both say 'Java checker returned some invalid data we don't understand:' followed by 'Minecraft might not start properly.' which could be some issues.  
    • Looking for unbeatable savings on Temu in 2025? Our exclusive Temu code [ald244107] is your key to unlocking a $100 OFF discount, plus much more! This verified promo code works for both new and existing customers, giving you up to 50% off your next order and even bigger savings on clearance items. With Temu coupon code [ald244107], you'll get a flat $100 discount on top of existing sales. First-time users can enjoy an extra 100% off select items, while returning shoppers automatically qualify for the $100 OFF when applying the code at checkout. Imagine saving up to 90% on your favorite products across the USA, Canada, UK, and many other countries! 🔥 Temu Coupon Highlights with Code [ald244107]:  * Temu New User Offer: Use ald244107 for 50% off your first order + $100 OFF.  * Temu Existing Customer Promo: Apply ald244107 to get an instant $100 OFF.  * Global Reach: Valid in the USA, UK, Canada, Germany, France, Japan, Chile, Colombia, Malaysia, Mexico, South Korea, Philippines, Saudi Arabia, Qatar, Pakistan, and more.  * Top 2025 Deal: Secure $200 OFF plus 100% bonus discounts with ald244107. Maximize Your Savings: Top Temu Deals for 2025 (Code: ald244107)  * ✅ Temu Memorial Day Sale: Save $100 with ald244107  * ✅ Temu First Order Special: Use ald244107 for 50% + $100 OFF  * ✅ Temu USA Exclusive: Get $100 off instantly with ald244107  * ✅ International Temu Codes: ald244107 works in Japan, Germany, Chile, and many others.  * ✅ Temu Reddit Discount: Enjoy $100 OFF for both new and old users.  * ✅ Temu Coupon Bundle 2025: Combine $100 OFF with up to 50% slash deals.  * ✅ 100% OFF Free Gift Code: Use ald244107 – no invitation needed!  * ✅ Temu Sign-Up Bonus: Instantly get a welcome $100 OFF.  * ✅ Free Temu Code for New Users: Apply ald244107 – no referral required.  * ✅ Temu Clearance Codes 2025: Use ald244107 for 85–100% discounts. This Temu code [ald244107] is more than just a discount; it's your ticket to free shipping, exclusive first-order deals, and stackable coupon bundles across electronics, fashion, home goods, and beauty products. You can truly unlock up to 90% OFF plus an additional $100 OFF on qualified orders. 💡 Pro Tip: Don't forget to apply ald244107 during checkout on the Temu app or website to activate your instant $100 discount, even if you’re a returning customer! Temu $100 OFF Code by Country (All Use ald244107):  * 🇺🇸 Temu USA – ald244107  * 🇯🇵 Temu Japan – ald244107  * 🇲🇽 Temu Mexico – ald244107  * 🇨🇱 Temu Chile – ald244107  * 🇨🇴 Temu Colombia – ald244107  * 🇲🇾 Temu Malaysia – ald244107  * 🇵🇭 Temu Philippines – ald244107  * 🇰🇷 Temu Korea – ald244107  * 🇵🇰 Temu Pakistan – ald244107  * 🇫🇮 Temu Finland – ald244107  * 🇸🇦 Temu Saudi Arabia – ald244107  * 🇶🇦 Temu Qatar – ald244107  * 🇫🇷 Temu France – ald244107  * 🇩🇪 Temu Germany – ald244107 Real Shoppers, Real Savings: User Reviews We love hearing about your experiences! Here’s what some happy shoppers are saying about using the Temu code [ald244107]:  * Alice W., USA ⭐️⭐️⭐️⭐️⭐️ (5/5) "Great experience! Temu's promo code {ald244107} saved me a lot on my first order. Highly recommend this offer!"  * James T., UK ⭐️⭐️⭐️⭐️ (4/5) "Very happy with the quality and prices on Temu. The $100 credits offer was a nice bonus using {ald244107}. Will shop again."  * Sara M., Canada ⭐️⭐️⭐️ (3/5) "Got some decent deals with the {ald244107} code, though shipping took a bit longer than expected. Overall satisfied with the credits."
    • Thank you so much! I didnt see it in the log😭😭  
    • So im completely new to modding in general, i have some experience in Behavior packs in minecraft bedrock and i would like to modify entities stats and attributes like in a behavior pack (health, damage, speed, xp drop...). The problem is that i cant find any information online on how to do that, and I have no clue on what to do and where to start. I am currently modding in 1.20.4 with IntelliJ if that helps. My final objective is to buff mobs health and damage (double it for exemple), but since there is no entity file anywhere i don't know how to change it... 😢
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
  • Topics

×
×
  • Create New...

Important Information

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