Jump to content

Recommended Posts

Posted

I know i can do it by myself (and I already did) but it would be better if gradle creates an eclipse workspace with the decopiled vanilla source code instead of the classes, just to easilly edit the: "private" to "public" and access some codes

 

may i be wrong, but aren't some (if not all) private changed to public in the game client?

Actually i don't know what to write in this signature soooo.... anyway

Posted

that means i can't anymore access to GuiAchievements.currentPage ?

 

so how am i supposed to add a custom GUI for achievements?

I used this code

 

Minecraft minecraft = Minecraft.getMinecraft();

 

GuiScreen var15 = minecraft.currentScreen;

 

int var14;

 

if (var15 != null)

{

if (var15 instanceof GuiAchievements)

{

var14 = ((GuiAchievements)var15).currentPage;

 

if (AchievementPage.getTitle(var14).equals("Glacia"))

{

minecraft.thePlayer.openGui(mod_Glacia.instance, GlaciaCommonProxy.GUI_ID_ACHIEVEMENTS, minecraft.theWorld, var14, 0, 0);

}

}

 

if (var15 instanceof GuiAchievementsGlacia)

{

var14 = ((GuiAchievementsGlacia)var15).currentPage;

 

if (!AchievementPage.getTitle(var14).equals("Glacia"))

{

GuiAchievements var16 = new GuiAchievements(var15, minecraft.thePlayer.getStatFileWriter());

var16.currentPage = var14;

FMLClientHandler.instance().displayGuiScreen(minecraft.thePlayer, var16);

}

}

}

Actually i don't know what to write in this signature soooo.... anyway

Posted

is this gonna work?

 

 

GuiScreen var15 = minecraft.currentScreen;

 

GuiAchievements GuiAchievements = new GuiAchievements(var15, minecraft.thePlayer.getStatFileWriter());

Field achPageCurrent = GuiAchievements.class.getDeclaredField("currentPage");

achPageCurrent.setAccessible(true);

int achCurrentPage = Integer.parseInt((String) achPageCurrent.get(GuiAchievements));

Actually i don't know what to write in this signature soooo.... anyway

Posted

wait the problem is i have also to modify the int, i don't just have to get it, so this won't work anyway

Actually i don't know what to write in this signature soooo.... anyway

Posted

also as i am reading, access transformer modifies access to public only on forge, but in the game client accesses are still private or am i wrong?

Actually i don't know what to write in this signature soooo.... anyway

Posted

i am getting confused so can you please help me just with this?

 

the value i want to get, and then set is currentPage in GuiAchievements.class, what are the codes to get and then set it

 

PLEEEASE (SAD FACE)

 

 

PS: forum buttons aren't working

Actually i don't know what to write in this signature soooo.... anyway

Posted

I understand but... Oh wait like this?

 

 

GuiScreen var15 = minecraft.currentScreen;

 

GuiAchievements GuiAchievements = new GuiAchievements(var15, minecraft.thePlayer.getStatFileWriter());

Field achPageCurrent = GuiAchievements.class.getDeclaredField("currentPage");

achPageCurrent.setAccessible(true);

int achCurrentPage = achPageCurrent.getInt(GuiAchievements);

 

and then

 

achPageCurrent.setInt(GuiAchievements, 0);

Actually i don't know what to write in this signature soooo.... anyway

Posted

okay but will setInt really set the protected int currentpage in GuiAchievement to another value?

Actually i don't know what to write in this signature soooo.... anyway

Posted

nope mo probs:

 

i'm setting the int on the new GuiAchievements i created, while i need to set the int on the already existent GuiAchievements, and so var15 casted to GuiAchievements, so (GuiAchievements)var15

 

 

.....

Actually i don't know what to write in this signature soooo.... anyway

Posted

Yeah i was getting confused, anyway for anyone looking for the final code to add your custom GUI to your achievement pages (In your TickEvent Event), here it is:

 

 

 

 

    public static class TickHandlerClient

    {

//private GuiScreen lastGuiOpen;

 

@SubscribeEvent

public void onTick(TickEvent.ClientTickEvent event)

{

//CLIENT TICK END

if (event.phase == TickEvent.Phase.END)

{

Minecraft minecraft = Minecraft.getMinecraft();

 

GuiScreen CurrentGUI = minecraft.currentScreen;

 

int PageToDisplay;

 

if (CurrentGUI != null)

{

//GETTING THE PRIVATE CURRENTPAGE INT

GuiAchievements AchievementGui = new GuiAchievements(CurrentGUI, minecraft.thePlayer.getStatFileWriter());

Field achPageCurrent = GuiAchievements.class.getDeclaredField("currentPage");

achPageCurrent.setAccessible(true);

 

if (CurrentGUI instanceof GuiAchievements)

{

//PageToDisplay = ((GuiAchievements)CurrentGUI).currentPage;

PageToDisplay = achPageCurrent.getInt((GuiAchievements)CurrentGUI);

 

if (AchievementPage.getTitle(PageToDisplay).equals("Glacia"))

{

minecraft.thePlayer.openGui(mod_Glacia.instance, GlaciaCommonProxy.GUI_ID_ACHIEVEMENTS, minecraft.theWorld, PageToDisplay, 0, 0);

}

}

 

if (CurrentGUI instanceof GuiAchievementsGlacia)

{

PageToDisplay = ((GuiAchievementsGlacia)CurrentGUI).currentPage;

 

if (!AchievementPage.getTitle(PageToDisplay).equals("Glacia"))

{

GuiAchievements OldPageGUI = new GuiAchievements(CurrentGUI, minecraft.thePlayer.getStatFileWriter());

 

//var16.currentPage = PageToDisplay;

achPageCurrent.setInt(OldPageGUI, PageToDisplay);

 

FMLClientHandler.instance().displayGuiScreen(minecraft.thePlayer, OldPageGUI);

}

}

}

}

}

    }

Actually i don't know what to write in this signature soooo.... anyway

Posted

and so where do i have to put getdeclaredfield? and also will this work if getdeclaredfield is called once and currentPage int changes?

Actually i don't know what to write in this signature soooo.... anyway

Posted

so you mean before calling tickevent, so

 

 

 

 

    public static class TickHandlerClient

    {

 

Field achPageCurrent = GuiAchievements.class.getDeclaredField("currentPage");

                achPageCurrent.setAccessible(true);

 

@SubscribeEvent

public void onTick(TickEvent.ClientTickEvent event)

{

                ................

Actually i don't know what to write in this signature soooo.... anyway

Posted

THIS is why we don't give you access to edit base classes. Morons like you who don't know the basics of java or how to solve your own problem think the proper solution is to edit minecraft's base classes directly. NO STOP THIS.

Anyways, this is not the place for this, closing.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I deleted delightful and all farmers delight addon (just in case) and still i have the error :'(, i need to check mod by mod?
    • I'm developing a Forge mod for Minecraft 1.16.5 to run on CatServer (version 1.16.5-1d8d6313, Forge 36.2.39). My mod needs to get the player's UUID from a ServerPlayerEntity object within a Forge ServerChatEvent handler. When I use serverPlayerEntity.getUUID(), my mod compiles fine, but I get a java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at runtime. I cannot use serverPlayerEntity.getUniqueID() as it causes a compile error (cannot find symbol). Is there a known issue with this on CatServer, or a recommended way for a Forge mod to reliably get a player's UUID from ServerPlayerEntity in this environment? My goal is to pass this UUID to the LuckPerms API (which is running as a Bukkit plugin and successfully connected via ServicesManager). erorr ChatMod: FMLServerStartedEvent received. Attempting to initialize LuckPerms connection... [22:45:20] [Server thread/INFO]: ⚙️ Початок ініціалізації LuckPerms API через Bukkit Services Manager... [22:45:20] [Server thread/INFO]: ✅ Bukkit ServicesManager успішно отримано. [22:45:20] [Server thread/INFO]: ✅ Реєстрацію сервісу LuckPerms знайдено. [22:45:20] [Server thread/INFO]: ✅ API LuckPerms успішно отримано від Bukkit plugin! [22:45:20] [Server thread/INFO]: Використовується реалізація: me.lucko.luckperms.common.api.LuckPermsApiProvider [22:45:20] [Server thread/INFO]: ✅ LuckPerms API схоже що успішно ініціалізовано через Bukkit Services Manager. [22:45:24] [User Authenticator #1/INFO]: UUID of player Hiklee is 92cd7721-2652-3867-896b-2ceba5b99306 [22:45:25] [Server thread/INFO]: Using new advancement loading for net.minecraft.advancements.PlayerAdvancements@24cb7a68 [22:45:26] [Server thread/INFO]: Hiklee[/127.0.0.1:41122] logged in with entity id 210 at (92.23203876864889, 95.6183020148442, 68.24087802017877) [22:45:28] [Async Chat Thread - #0/INFO]: ✅ Скасовано стандартне відправлення чату! [22:45:28] [Async Chat Thread - #0/ERROR]: Exception caught during firing event: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; Index: 1 Listeners: 0: NORMAL 1: ASM: class com.example.chatmod.ChatEventHandler onPlayerChat(Lnet/minecraftforge/event/ServerChatEvent;)V java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at com.example.chatmod.ChatPacketHandler.getPlayerPrefix(ChatPacketHandler.java:46) at com.example.chatmod.ChatEventHandler.onPlayerChat(ChatEventHandler.java:32) at net.minecraftforge.eventbus.ASMEventHandler_1_ChatEventHandler_onPlayerChat_ServerChatEvent.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:303) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at net.minecraftforge.common.ForgeHooks.onServerChatEvent(ForgeHooks.java:493) at net.minecraft.network.play.ServerPlayNetHandler.chat(ServerPlayNetHandler.java:1717) at net.minecraft.network.play.ServerPlayNetHandler.func_244548_c(ServerPlayNetHandler.java:1666) at net.minecraft.network.play.ServerPlayNetHandler.func_147354_a(ServerPlayNetHandler.java:1605) at net.minecraft.network.play.client.CChatMessagePacket.lambda$handle$0(CChatMessagePacket.java:34) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750
    • Thank you so much for your help, I'll try it as soon as I can. I have a genuine question because I'm not familiar with the matter: Can a recipe error cause something as serious as the AMD error?
    • When i try to launch my modpack, the instance crashes and this is sent to the logs: Time: 2025-05-27 23:07:18 Description: Rendering overlay Below is the full log: https://mclo.gs/jP5G2EH
    • Make a test without delightful
  • Topics

×
×
  • Create New...

Important Information

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