Jump to content

[1.7.10] When running on dedicated server I get no such method error


Recommended Posts

Posted

When I test my mod on a dedicated server and when I trigger the method that transforms the player into his party member I get a no such method error (this doesnt happen in LAN or when in singleplayer)

 

I have a getMob function, this function gets the entity that the player spawned from his party list by comparing the uuids the player knows with the uuids of entities from the world

//this function gives me a no such method error when I run the server and when player morphs
public static Entity getMob(World world, EntityPlayer player) {
	PlayerParty ppp = PlayerParty.get(player);
	for (Object object : world.getLoadedEntityList()) {
		if (object instanceof EntityPartyMember) {
			EntityPartyMember entity = (EntityPartyMember) object;
			long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost");
			long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast");
			if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) {
			return entity;
			}
		}
	}
	System.out.println("DID NOT FIND ENTITY: Entity is Null");
	return null;
}

 

I have a morph function, this function swaps positions with the entity the player is transforming into and triggers a model/texture switch and will in the future switch their stats and all of that The way it works is as follows

 

  Reveal hidden contents

 

For some reason the helper method gives me a no such method exception when I run dedicated server and test. This method is located inside my BattlePlayerProperties class which is a IEEP class that adds additional stuff to the player

public void morph(boolean shouldBeMorphed){
	if(shouldBeMorphed){
	System.out.println("Morphing");
	} else{
	System.out.println("Returning");
	}
	EntityPartyMember morphPartyMember = (EntityPartyMember) WorldHelper.getMob(player.worldObj, player); //this line gives me a no such method error when I run the           server and test Im not sure why This is happening
	morphPartyMember.setMorphedIntoPlayer(shouldBeMorphed);
	double preMorphPosX = this.player.posX;
	double preMorphPosY = this.player.posY;
	double preMorphPosZ = this.player.posZ;
	this.player.setPositionAndUpdate(morphPartyMember.posX, morphPartyMember.posY, morphPartyMember.posZ);
	this.player.prevPosX = morphPartyMember.posX;
	this.player.prevPosY = morphPartyMember.posY;
	this.player.prevPosZ = morphPartyMember.posZ;
	morphPartyMember.setPosition(preMorphPosX, preMorphPosY, preMorphPosZ);
	morphPartyMember.prevPosX = preMorphPosX;
	morphPartyMember.prevPosY = preMorphPosY;
	morphPartyMember.prevPosZ = preMorphPosZ;

}

 

The consol error log (Please let me know if I have provided enough code/info about this error)

 

  Reveal hidden contents

 

Posted

Now I understand that my getMob function is taxing, I havent been able to find a way around using it which sucks. If anyone has any ideas as to how to achieve that I would gladly appreciate any input.

 

As Always Thanks for reading the post :)

Posted

World#getLoadedEntityList() is for client side only, and you're trying to call it on server side.

I'm not the best person with determining Sided things, but I do know that client only means it cannot be run on a dedicated server. You should use your proxy to make sure that it is the client side, and not the server. I've had to do that with several things.

With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver

Posted

I changed it by adding the following to client proxy

public static List getLoadedEntityList(World world){
	return world.getLoadedEntityList();
}

 

and then

 

public static Entity getMob(World world, EntityPlayer player) {
	PlayerParty ppp = PlayerParty.get(player);
	for (Object object : ClientProxy.getLoadedEntityList()) {
		if (object instanceof EntityPartyMember) {
			EntityPartyMember entity = (EntityPartyMember) object;
			long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost");
			long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast");
			if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) {
			return entity;
			}
		}
	}
	System.out.println("DID NOT FIND ENTITY: Entity is Null");
	return null;
}

 

but I still get a crash this time it is a java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP but this is from the server thread nothing is printed to consol.

at custommod.battle.helper.WorldHelper.getMob(WorldHelper.java:145) ~[WorldHelper.class:?]

Posted
  On 5/31/2015 at 3:01 AM, Thornack said:

Does anyone know of a better way to get an entity by its UUID when you are on the server?

Oh, if that's what you're doing, the function already exists.

Use World.getPlayerEntityByUUID(); It's not restricted to either side. That way, you don't have to loop through all the entities.

With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver

Posted

Im not looking to get the Player by UUID I want a spawned entity for which the player has a UUID. My Player has a list of party members all of which he knows UUID's for all the time. I want to get the entity from the UUID the player knows when the entity is in the world. I want this done on server side Also World.getPlayerEntityByUUID() isnt a method in 1.7.10 I dont think (I only found World # getPlayerEntityByName())

Posted
  On 5/31/2015 at 3:18 AM, Thornack said:

Im not looking to get the Player by UUID I want a spawned entity for which the player has a UUID. My Player has a list of party members all of which he knows UUID's for all the time. I want to get the entity from the UUID the player knows when the entity is in the world. I want this done on server side

That function will still work for that. It is not limited to the client entity player, it searches through every single instance of an EntityPlayer in the world, by using the list World.playerEntities. This means that if you are on a server, it checks every single player that is currently logged into that world, and returns them if they match the UUID.

 

Edit: I just noticed you said that the function does not exist in 1.7.10. Does the field World.entityPlayers exist?

With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver

Posted
  On 5/31/2015 at 3:28 AM, Thornack said:

Im not looking for Players though. I am looking for EntityCustomMob not EntityPlayer.

Is this what you are looking for?

http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2136028-get-entity-by-uuid?comment=6

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted
  On 5/31/2015 at 3:28 AM, Thornack said:

Im not looking for Players though. I am looking for EntityCustomMob not EntityPlayer.

It seems just the accessor method is client only. Have you tried using World.loadedEntityList directly?

 

i.e.:

 

public static Entity getMob(World world, EntityPlayer player) {
	PlayerParty ppp = PlayerParty.get(player);
	for (Object object : world.loadedEntityList) {
		if (object instanceof EntityPartyMember) {
			EntityPartyMember entity = (EntityPartyMember) object;
			long uuidMost = ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDMost");
			long uuidLeast =ppp.getEntityPartyMemberNBTFromSlot(ppp.getSpawnedSlot()).getLong("UUIDLeast");
			if (entity.getUniqueID().getMostSignificantBits() == uuidMost && entity.getUniqueID().getLeastSignificantBits() == uuidLeast) {
			return entity;
			}
		}
	}
	System.out.println("DID NOT FIND ENTITY: Entity is Null");
	return null;

That may work, I'm not 100% sure if loadedEntityList is set to public in 1.7.10

With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver

Posted

 
/** A list of all Entities in all currently-loaded chunks */
    public List loadedEntityList = new ArrayList();

Ya it is public I think ill try that and letcha know if it works. I do want to eventually figure out a better way of getting my entity while on server side

 

EDIT: Yes that worked thanks alot!

Posted
  On 5/31/2015 at 3:30 AM, The_Fireplace said:

  Quote

Im not looking for Players though. I am looking for EntityCustomMob not EntityPlayer.

Is this what you are looking for?

http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2136028-get-entity-by-uuid?comment=6

 

That is exactly what I am doing currently and it now works on dedicated server and on single player too. However I want a more efficient way of getting my entity since using that method you are scanning through all entities and if there is 5000+ on a server this is taxing. very inefficient.

Posted
  On 5/31/2015 at 3:44 AM, Thornack said:

That is exactly what I am doing currently and it now works on dedicated server and on single player too. However I want a more efficient way of getting my entity since using that method you are scanning through all entities and if there is 5000+ on a server this is taxing. very inefficient.

Since they are not actually players, have you tried just using World.getEntityById()? Every time an entity is created, it is assigned an id that stays the same until it dies. You might could use that. Instead of saving the UUID, you can just save the regular ID. I'm not sure if entity IDs persist over world saves, though. I never really tested that.

 

Edit:

Looking at the code, I don't think they are saved. So, logging out and logging back in would reload all entities with new IDs. If you want them to be remembered over world saves, just keep using what you were.

With all due respect, sir: I do, what I do, the way I do it. ~ MacGyver

Posted
  On 5/31/2015 at 3:56 AM, Himself12794 said:

  Quote

That is exactly what I am doing currently and it now works on dedicated server and on single player too. However I want a more efficient way of getting my entity since using that method you are scanning through all entities and if there is 5000+ on a server this is taxing. very inefficient.

Since they are not actually players, have you tried just using World.getEntityById()? Every time an entity is created, it is assigned an id that stays the same until it dies. You might could use that. Instead of saving the UUID, you can just save the regular ID. I'm not sure if entity IDs persist over world saves, though. I never really tested that.

 

Edit:

Looking at the code, I don't think they are saved. So, logging out and logging back in would reload all entities with new IDs. If you want them to be remembered over world saves, just keep using what you were.

 

Ya it is unfortunate that they dont persist otherwise I would use that. Ill be thinking of ways to improve this cause it isnt good atm scanning all Entities in all loaded chunks is a bad idea I think. Even though my method is called once in forever pretty much even if the player spams the morph/unmorph buttons, I still want a more efficient way of getting the entity cause if 5000 players decide to spam then there may be issues. Its just inefficient and Ill bet there is a better way. For now unless I get any ideas ill be working on other stuff. Again if anyone comes up with a better solution please post, I see this get entity by UUID issue alot in the forums and it seems no one's found anything thats really good and efficient I dont think.

Posted

Thorny - I alredy told you, comparing even 10000 UUIDs is NOTHING if done per-call.

 

Computers are capable of computing shitload of data, don't worry about something like this.

 

As to better solutions - I've also alredy told you - only way to do it faster is to make smart caching of direct entity references.

Again there is no point.

Best thing to do is simpl cut down everything irrelevant. Pseudo:

 

optional: check smart cache - one I mentioned, first see if you can grab entity on instant, if not, go further.

for loop on world.entities

if (entity instanceof YourEntity) // checking instanceof is like x+y, cmon man!

now you compare UUIDs

  Quote

1.7.10 is no longer supported by forge, you are on your own.

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

    • In France, we deeply value financial security and independence. After my divorce, my life took a chaotic turn, and amidst all the turmoil, I misplaced the backup phrase for my Bitcoin wallet, which held a significant amount, $220,000. I was already grappling with emotional challenges, and the thought of losing my Bitcoin felt like the final blow. In moments like these, I couldn't help but think of the French saying, “Il ne faut jamais dire jamais,” which means “Never say never.” Little did I know that this would become a mantra for my recovery journey. I spent days searching for that elusive phrase, going through old documents and turning my apartment upside down, but it was as if the universe had conspired against me—the backup was simply gone. Feeling desperate and overwhelmed, I confided in a friend who works in the cryptocurrency space. He recommended Hack Buster Recovery, mentioning that they had helped many French investors in similar situations. Skeptical but out of options, I decided to reach out. From the moment I contacted Hack Buster Recovery, I was struck by their understanding of my situation. They were professional and compassionate, reassuring me that I wasn’t alone in this struggle. Their team quickly got to work, explaining the recovery process in a way that put my mind at ease. It was clear they had dealt with cases like mine before, WEBSITE: hackbusters.online
    • (LEEULTIMATEHACKER @ A O L . C O M)  telegram: LEEULTIMATE With LEE ULTIMATE HACKER, a team which specializes in recovering a wide range of digital assets including, Bitcoin, Etherium, stablecoins, non -fungible tokens (NFTs), and other various cryptocurrencies, In the ever evolving crypto world the need for effective recovery solutions is very critical. Their services are specifically tailored to assist clients dealing with fraud, LEE ULTIMATE HACKER's strength lies in its team of industry pioneers who have contributed to shaping the legal and regulatory frameworks around crypto assets, They also work closely with trusted insolvency practitioners, crypto custodians leading exchanges, and Insurance providers, LEE ULTIMATE HACKER and team works with a robust network allows them to delivery seamless end-to-end recovery service capable of handling even the most complex cases, services that are specifically tailored to assist clients dealing with fraud, Bitcoin scams and digital assets that are deliberately concealed or Misappropriated. LEE ULTIMATE HACKER strength lies in its team of industry pioneers who have contributed to shaping the legal and regulatory framework around crypto assets, from the moment assets go missing LEE ULTIMATE HACKER is dedicated to guiding clients through every step of the recovery process, they understand the urgency and emotional weight of such situations and leverage their expertise to maximize the chances of successful outcome, whether facing fraud, scams, or other crypto -related challenges, LEE ULTIMATE HACKER stands ready to help clients reclaim what is rightfully theirs.
    • I deleted wildbackport and now i get this https://mclo.gs/1Q7mHD1
    • Add the full crash-report or latest.log (logs-folder) with sites like https://mclo.gs/ and paste the link to it here
    • Not all Create addons are compatible with Create 6 Remove creatingspace   Then some dependencies are missing, or some mods are not up-to-date: k_turrets requires satako 7.0.31 or above, and below 8.0.0 Downgrade amplified_nether to a 1.20.1 build - the current build is for 1.21.x lootintegrations requires cupboard 1.20.1-1.5 or above minecolonies requires structurize 1.20.1-1.0.768-snapshot or above - Currently, structurize is 1.20.1-1.0.742-RELEASE cullleaves requires midnightlib 1.0.0 or above minecolonies requires blockui 1.20.1-1.0.190-snapshot or above - Currently, blockui is 1.20.1-1.0.156-RELEASE taczjs requires kubejs 2001.6.4-build.95 or above midnight requires lucent 1.5 or above
  • Topics

×
×
  • Create New...

Important Information

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