Jump to content

Modifying tooltips not working server sided


61352151511

Recommended Posts

I'm trying to make it so tools you look at always show the durability when you mouse over them, (You don't need F3+H/Advanced tooltips to see them in this case) This is working fine client sided however when it comes to the server it doesn't work at all. Here are the 3 Proxies I have

 

Common Proxy:

package com.sixonethree.home.proxy;

import com.sixonethree.home.utility.WarpPoint;

public abstract class CommonProxy {
public void init() {
	WarpPoint.loadAll();
}

public void exit() {
	WarpPoint.saveAll();
}
}

 

ServerProxy:

package com.sixonethree.home.proxy;


public class ServerProxy extends CommonProxy {
}

 

ClientProxy:

package com.sixonethree.home.proxy;

import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class ClientProxy extends CommonProxy {
@Override
public void init() {
	super.init();
	MinecraftForge.EVENT_BUS.register(this);
}

@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent event) {
	if (!event.showAdvancedItemTooltips) {
		if (event.itemStack != null) {
			ItemStack is = event.itemStack;
			if (is.isItemDamaged()) {
				event.toolTip.add(EnumChatFormatting.GRAY + "Durability: " + (is.getMaxDamage() - is.getItemDamage() + " / " + is.getMaxDamage()));
			}
		}
	}
}
}

 

I've got no idea why it doesn't work when it comes to the server side, any help is appreciated

Link to comment
Share on other sites

ServerProxy?  That is a new one. 

 

Are you sure you meant to have the ! in "if (!event.showAdvancedItemTooltips) {"

 

I would recommend putting some print statements in your event and find out where it is failing. 

Long time Bukkit & Forge Programmer

Happy to try and help

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.