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



×
×
  • Create New...

Important Information

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