Jump to content

[1.12.2] Having a problem with attaching capabilities...


SapphireSky

Recommended Posts

I have two capabilities.

One gives the player a number of different stats.

The other allows living entities to store a list of all players that attacked it.

 

The player one works perfectly fine.

However, the attack list one is continuously causing never-ending console spam saying it's attaching a new capability.

It prints the "Attaching capability" printout literally over a thousand times a second (one timestamp fills the entire Eclipse console).

Why is it doing this and how can I make it stop?

 

Attach event:

	@SubscribeEvent
	public void attachCapability(AttachCapabilitiesEvent<Entity> event)
	{
    		// Works perfectly fine
    		// (I assume; haven't tried on it in a world with more than one player)
		if (event.getObject() instanceof EntityPlayer)
		{
			System.out.println("[" + Main.MODID.toUpperCase() + "] ATTACHING STATS CAPABILITY.");
			event.addCapability(Main.STATS, new StatsManager());
		}
      
    		// Seems to work, but for some reason infinitely
    		// spams the console with the following println command.
        	// Tested in a superflat world with maybe 30 entities tops...
		if (event.getObject() instanceof EntityLivingBase)
		{
			System.out.println("[" + Main.MODID.toUpperCase() + "] ATTACHING ATTACK TRACKER CAPABILITY.");
			event.addCapability(Main.ATTACKERS, new AttackersManager());
		}
	}

 

Console spam:

Spoiler

[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
[19:11:26] [Server thread/INFO] [STDOUT]: [ww.souls.CapabilityEvents:attachCapability:100]: [SOULS] ATTACHING ATTACK TRACKER CAPABILITY.
............etc

 

Link to comment
Share on other sites

On 11/16/2019 at 8:56 AM, diesieben07 said:

Something is creating that many entities. Use the debugger.

But how do I figure out WHAT is creating that many entities?

It's just a random assortment of all kinds of mobs, testing on a basic superflat world.

I've only added a GUI and capabilities so far, not anything would affect or create mob spawns.

It's not like there's a getWhyThisEntityWasCreated() method...

And it's not like LivingSpawnEvent or EntityConstructing offer any source of creation either.

Link to comment
Share on other sites

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.