Jump to content

Gradle decompiled vanilla source instead of classes


Alesimula

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried to play a mod for forge 1.20.2 and the mod didn't work, fix this please.
    • EntityRenders requires an EntityRenderProvider. This is what I have: @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public static class ClientModEvents { @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { EntityRenderers.register(HOSE.get(), new HoseEntityRenderFactory()); } private static class HoseEntityRenderFactory implements EntityRendererProvider<HoseEntity> { @Override public EntityRenderer<HoseEntity> create(Context context) { return new HoseEntityRenderer<>(context); } } } Replace HoseEntity with your own entity. If you're doing multiple try doing generics (though untested).
    • First off, I know should probably be able to debug this on my own, but this is my first mod, and I couldn't figure it out for multiple days now. What I'm trying to do, is to modify the default minecart by replacing it with a slightly different version, but I'm stuck 1 step before that, that being "cloning" the minecart as a separate Entity/Item. Here you can see a GitHub gist of all relevant files: https://gist.github.com/Kipama/cd39127e8891715a3006fa990ca7ff14 If there are files missing or access isn't working as intended, please let me know! In the Gist you can find the following files: -CustomMinecartEntity.java:        This file extends AbstractMinecart and is a clone of the vanilla minecart entity. I know I should override the minecart entity directly, but as this should work rn, I didn't change it yet. -CustomMinecartRenderer.java:  Basically vanilla MinecartRenderer with a Custom slapped on it, extends MinecraftRenderer. -ModEntities.java:                         This is where the new Entity gets added to the deferred register ENTITY_TYPES. -ModernMinecarts.java:               The main mod file. Relevant part is at the bottom, where I try to use onClientSetup to register the new Entity using EntityRenderers.register(). That last part is where my problem begins. When I try to register the new entity using EntityRenderers.register(ModEntities.CUSTOM_MINECART_ENTITY.get(), CustomMinecartRenderer::new); I get a syntax Error saying the provided and required types don't match. These are the required and provided types: ModEntities.CUSTOM_MINECART_ENTITY.get(): Required: EntityType<? extends T> Provided:EntityType<CustomMinecartEntity> CustomMinecartRenderer::new: Required: EntityRendererProvider<T> Provided:<method reference   So far I looked at 2 different Git repositories implementing custom entities, but haven't been able to figure out what I'm doing wrong. Any answers, suggestions and ridicules appreciated.
    • Yes, it is. I found out how to do it. (for Forge 1.20.1) Add this to main class constructor: // ... MinecraftForge.EVENT_BUS.<PlayerInteractEvent.EntityInteract>addListener(e -> { Player playerWhoUsed = e.getEntity(); ItemStack usedItemStack = e.getItemStack(); Entity entityThatWasClicked = e.getTarget(); if (usedItemStack.getItem() instanceof YourItem item) { // your code... e.setCancelled(true); // you can remove this if you want to continue interaction } } // ...
    • Hi there, I'm hoping to create a block that renders a fake skybox, blocking anything behind it. There are a couple of mods that already do this, but they are very outdated. One example: https://github.com/Elix-x/Skyblocks/ https://www.curseforge.com/minecraft/mc-mods/skyblocks I'm not familiar enough with rendering to be able to port it. Is there anyone who can point me in the right direction? Any help would be appreciated.
  • Topics

×
×
  • Create New...

Important Information

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