Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED][1.10.2]Sign doesn't update

Featured Replies

Posted

I made a sign that will act as a leaderboard, so the text in it should be set automatically. If i set the text when placing down the sign everyhting works correctly, however, if i do in the "update" method of the tile entity nothing is displayed on the sign. This is the TileEntity i'm using

	package com.cf.entities;
	import java.util.ArrayList;
	import com.cf.guild.Guild;
import com.cf.utils.GuildUtils;
	import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
	public class TileEntityLeaderboardSign extends TileEntitySign implements ITickable {
	    @Override
    public void update() {
        if (!this.worldObj.isRemote) {
            ArrayList<Guild> guilds = GuildUtils.getGuildsOrderedByBank();
            if (!guilds.isEmpty()) {
                this.signText[0] = new TextComponentTranslation("guild.leaderboard.top", new Object[0]);
                this.signText[1] = new TextComponentString("#1");
                this.signText[2] = new TextComponentString(guilds.get(0).getName());
                this.signText[3] = new TextComponentString(
                        new TextComponentTranslation("guild.leaderboard.golds", new Object[0]) + " "
                                + String.valueOf(guilds.get(0).getBank().getGold()));
            } else
                this.signText[0] = new TextComponentTranslation("guild.leaderboard.noguilds", new Object[0]);
        }
    }
}
	



So i just extend the TileEntitySign and implement the ITickable interface to make the TileEntity update. But as i said on the sign no text is displayed at all. What should i do to solve this issue? :)

EDIT: I solved this by using 2 messages. The first is sent to the server from the tile entity like this

if (this.worldObj.isRemote) {
            CoreGuild.NETWORK.sendToServer(new LeaderboardServerMessage(this.pos.getX(), this.pos.getY(), this.pos.getZ()));
        }



In wich i do this

TileEntity te = CoreGuild.PROXY.getPlayer(ctx).worldObj.getTileEntity(message.pos);
                    if(te != null && te instanceof TileEntityLeaderboardSign) {
                        TileEntityLeaderboardSign sign = (TileEntityLeaderboardSign)te;
                        ArrayList<Guild> guilds = GuildUtils.getGuildsOrderedByBank();
                        String text = "No guilds";
                        if (!guilds.isEmpty()) {
                            text = guilds.get(0).getName();
                        }
                        CoreGuild.NETWORK.sendTo(new LeaderboardClientMessage(text, message.pos.getX(), message.pos.getY(), message.pos.getZ()), (EntityPlayerMP) CoreGuild.PROXY.getPlayer(ctx));
                    }



So i send a message to the client with what i want to display. Then on the client i set the texts :)

TileEntity te = CoreGuild.PROXY.getPlayer(ctx).worldObj.getTileEntity(message.pos);
                    if(te != null && te instanceof TileEntityLeaderboardSign) {
                        TileEntityLeaderboardSign sign = (TileEntityLeaderboardSign)te;
                        sign.signText[0] = new TextComponentString(message.name);
                    }

Edited by JimiIT92

Don't blame me if i always ask for your help. I just want to learn to be better :)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.