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.

Featured Replies

Posted

So basically I'd like to get a players username and change it to something else, basically I'll be making a friendlist or whatever and I'd like the name to change appropriately.

 

I have no idea if I am doing this right as I am very new to forge and there does not seem to be many tutorials for 1.7. I also do have some basic java knowledge but I still haven't been able to figure this out.

 

This is my code so far, (ignore the name, the mod was going to edit item frames first but I was just too lazy to change it, I'll do that later.

 

I also heard I'll need a proxy to do that in Multiplayer but I really don't know how it works, most tutorials just show you how to make one. Now how to use one.

 

The EventHandler class

package com.czaarek99.FrameMod;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.event.entity.player.PlayerEvent;


/**
* Created by Czarek on 2014-08-09.
*/
public class EventHandler {
    @SubscribeEvent
    public String loginEvent(PlayerEvent.NameFormat event){
        if(event.username.equals("someone sexy")){
            String userName = event.username;
            return userName;
        }
        else{
            return null;
        }
    }
}



 

The main mod class (FrameMod)

package com.czaarek99.FrameMod;

/**
* Created by Czarek on 2014-08-09.
*/
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraftforge.common.MinecraftForge;


import java.lang.String;




@Mod(modid = FrameMod.modid, version = FrameMod.version)
public class FrameMod {

    public static final String modid = "FrameMod";
    public static final String version = "1.0 ALPHA";


    EventHandler events = new EventHandler();


    @SidedProxy(clientSide = "com.czaarek99.FrameMod.ClientProxy",serverSide = "com.czaarek99.FrameMod.ServerProxy")
    public static ServerProxy proxy;



    @Mod.EventHandler
    public void PreLoad(FMLPreInitializationEvent event){
        proxy.registerRenderThings();
        FMLCommonHandler.instance().bus().register(events);
        MinecraftForge.EVENT_BUS.register(events);

    }
    }


 

ClientProxy

package com.czaarek99.FrameMod;

/**
* Created by Czarek on 2014-08-09.
*/
public class ClientProxy  {

    public void registerRenderThings() {

    }

}

 

 

ServerProxy

package com.czaarek99.FrameMod;

/**
* Created by Czarek on 2014-08-09.
*/
public class ServerProxy {

    public void registerRenderThings() {

    }

}

@SubscribeEvent
    public void getName(PlayerEvent.NameFormat event) {
        if(event.username.equals("MultiMote")) event.displayname="Spy";
    }

  • Author

That works.

 

But how can I make it work in Multiplayer? I guess it has something to do with the proxy?

Guest
This topic is now closed to further replies.

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.