Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [UNSOLVED] Adding a new method to a base class, without changing it?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
HydroBane

[UNSOLVED] Adding a new method to a base class, without changing it?

By HydroBane, June 22, 2013 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

HydroBane    0

HydroBane

HydroBane    0

  • Stone Miner
  • HydroBane
  • Members
  • 0
  • 69 posts
Posted June 22, 2013

It sounds quite confusing, and I assume the answer isn't simple, but I would like to know if there is a way I can add a method to Block.class without actually changing the class itself?

 

Can I add said method to Block.class via one of my classes I've added?

 

Thanks in advance

~Hydro

  • Quote

Share this post


Link to post
Share on other sites

EnergyPulse    1

EnergyPulse

EnergyPulse    1

  • Tree Puncher
  • EnergyPulse
  • Members
  • 1
  • 25 posts
Posted June 22, 2013

Just add the method to the block(s) you need it on :)

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14008 posts
Posted June 23, 2013

Just add the method to the block(s) you need it on :)

 

I think the idea is that he wants the function on vanilla blocks as well.

  • Quote

Share this post


Link to post
Share on other sites

Kore    23

Kore

Kore    23

  • Creeper Killer
  • Kore
  • Forge Modder
  • 23
  • 239 posts
Posted June 23, 2013

The best thing to do would be to file in to lex or overmind to ask for new methods, OR you could make a mod for the base code(A.K.A make a new class with the same name as other and change methods then recompile) then, rename that new class to the name of the class it is replacing, (for example, 3letters.class = blocks.java) then make sure you have that as your dependencies in your mod(in the @Mod area)

 

Hope this helps!

  • Quote

Share this post


Link to post
Share on other sites

HydroBane    0

HydroBane

HydroBane    0

  • Stone Miner
  • HydroBane
  • Members
  • 0
  • 69 posts
Posted June 23, 2013

I've solved it!

I didn't need to add it to Block.class afterall, I was just using the wrong type of method...

 

*facepalm*

 

Thanks for your replies anyway!

 

EDIT:

 

I haven't fixed it.

 

My method, in case you need it:

public static void setTextureType(Block block, String name) {
setTextureType(block, name);
}

 

And I've called it in my main class:

TextureTypes type = new TextureTypes();
type.setTextureType(BlockAzurite, "azurite");

  • Quote

Share this post


Link to post
Share on other sites

Kore    23

Kore

Kore    23

  • Creeper Killer
  • Kore
  • Forge Modder
  • 23
  • 239 posts
Posted June 23, 2013

If you are trying to make a modular texture pack, heres the code:

 

In clientside file(any of them)

public static String azurite = "ModName:.png file name(no .png on end)";

place the texture in your src for MCP

/src/mods/ModName/textures/file name.png

then when exporting mod, put the /mods folder into the minecraft.jar to give textures

 

In your block file:

public void registerIcons(IconRegister iconRegister)
{
	blockIcon = iconRegister.registerIcon(ClientsideFile.azurite);
}

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Rohman
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman · Posted 35 minutes ago

      Here you go. Thanks for having a look. debug(1).log
    • diesieben07
      Server Cannot Start

      By diesieben07 · Posted 56 minutes ago

      You installed a client-only mod (Controllable) on the server. Mods have the ability to indicate their client-only-ness to Forge and it will not load the mod on a server. This mod has not done so, please report this bug to the mod author.
    • diesieben07
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By diesieben07 · Posted 1 hour ago

      Why would you replace them?! This is a simple method override and you are calling super. There is no need to replace anything. Again: Please learn Java basics before making a mod.
    • diesieben07
      [1.12.2 Build 2847] Server Crash on startup

      By diesieben07 · Posted 1 hour ago

      Post the debug.log file.
    • diesieben07
      Need your help pls

      By diesieben07 · Posted 1 hour ago

      1.8.9 is no longer supported on this forum due to it's age. Update to a modern version of Minecraft to receive support.
  • Topics

    • Rohman
      2
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman
      Started 2 hours ago

    • The_Unkown675
      1
      Server Cannot Start

      By The_Unkown675
      Started 4 hours ago

    • J0WAY
      17
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started Thursday at 09:10 PM

    • _jiriik_
      1
      Need your help pls

      By _jiriik_
      Started 3 hours ago

    • Kuaka
      0
      My Forge 1.12 and 1.12.2 Keep Crashing when i start it up

      By Kuaka
      Started 1 hour ago

  • Who's Online (See full list)

    • Simon_kungen
    • Choonster
    • Ugdhar
    • Gnaux
    • plugsmustard
    • vaartis
    • HussNuss
    • AkosM
    • Ollie_Bear
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [UNSOLVED] Adding a new method to a base class, without changing it?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community