Jump to content

[1.10] IIcon replacement?


rojo8399

Recommended Posts

  • 1 month later...

I have the same problem.

 

I'm using in 1.7.10 IICon to have one item that is multiple items depending on the metadata.

this saved me time because the items all have the same function. only a different name and texture

 


private int itemCount = Ref.CRAFTITEMS.length;

@SideOnly
(Side.CLIENT)
private IIcon[] icons;

public CraftItem() {
	super();
	setCreativeTab(PurpleStuffMod.purpleStuffTab);
	setHasSubtypes(true);
	setMaxDamage(0);
}

@Override
public String getUnlocalizedName(ItemStack stack) {
	int i = MathHelper.clamp_int(stack.getItemDamage(), 0, itemCount);
	return Ref.CRAFTITEMS[i];
}

@Override
@SideOnly
(Side.CLIENT)
public void registerIcons(IIconRegister register) {
	icons = new IIcon[itemCount];

	for (int i = 0; i < icons.length; i++) {
		icons[i] = register.registerIcon(Ref.Texture_Path + Ref.CRAFTITEMS[i]);
	}
}

@Override
@SideOnly
(Side.CLIENT)
public IIcon getIconFromDamage(int dmg) {
	return icons[dmg];
}

@Override
@SideOnly
(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
	for (int i = 0; i < itemCount; i++) {
		list.add(new ItemStack(this, 1, i));
	}
}

 

 

Link to comment
Share on other sites

You have to create different items, but you can just use the same class for them

 

This is wrong.

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/OresBase.java#L108

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

IIcon has been replaced with the ResourceLocation class (at least that's where my strings went). Usage differs depending on whether you have an item or a block. You also need to learn all about block states and the JSON files. There has been much written over the last two years, please Google the Forge + keywords and look for forum posts from mc 1.8 forward.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I guess I didn't say it well. For block texturing, just read about blockstates and go from there.

 

For items, ignore tutorials about the "mesher". Set a custom resource location instead (see the ModelLoader class). You should Google this forum for past discussion.

 

In either case, you'll need to write json files (maybe many of them). Use a json validator tool such as json lint. (I wonder if there's a way for me to add one to Eclipse).

 

Much of the discussion on upgrading from IIcon is now more than a year old. Do a Google search of this forum and then narrow your search using a custom date range (and continue to ignore the mesher).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I can remember i used the resourceLocation in the past.

 

And has anybody tried to let gson create the json files for the items and blocks?

Offcourse with a check if they don't exist.

 

i just want a simple and easy way to add simple generic items,

so that i have more time to work on the more complicated stuff.

Link to comment
Share on other sites

I can remember i used the resourceLocation in the past.

 

And has anybody tried to let gson create the json files for the items and blocks?

Offcourse with a check if they don't exist.

 

i just want a simple and easy way to add simple generic items,

so that i have more time to work on the more complicated stuff.

That would be very simple just do it before the game actually starts loading and by that i mean before it starts loading the resources.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

That would be very simple just do it before the game actually starts loading and by that i mean before it starts loading the resources.

 

So i guess in the preInit i need to create an arraylist with all the items/blocks and then check if the json exists. and when thats done create and register the items and the create json files.

 

and in the init method tell the proxy to use the desired json file.

 

Is this the way to it? because it kinda sounds too simple to work out of the box :P

Link to comment
Share on other sites

If you really want to not write any JSON by hand then write yourself a small program to generate them beforehand instead of messing around with the game's internals.

 

First i wrote them by hand, but it was tedious work, then i searched the internet and i found the program made by wuppy and this was great but i could not copy and paste so i had to type everything and this was again a lot of work.

 

So i wrote a java program that asks for the mod root directory and then compares the names of the textures with the names of the model/json files and it creates the model/json file when there was a texture but no model/json file for it and it also adds an generic entry in the language file for the item/block.

 

But this program does basic stuff and if i make more complicated block i still have to edit the json file.

 

and i know i'm just lazy.  i was just wondering if it was possible to do it this way.

 

one of the things i want to avoid is looking for hours at my code why something is not working and then find out i forgot a column or a komma in my json file ;)

Link to comment
Share on other sites

For a "complicated block" you have to write special logic anyways. If you write that in JSON or in code does not make much difference, except that JSON is cleaner here.

 

Yes i know there are always exceptions :)

 

Thank you for your feedback i really appreciated it.

 

you have helped me a lot just by helping other people on this forum.

Link to comment
Share on other sites

You also want to learn how the Forge alternate blockstates format works. It spares us some of the Cartesian product hell that Mojang gave us in 1.8.0.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • OLO4D adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Bukopin. Berikut adalah beberapa alasan mengapa Anda harus memilih OLO4D: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Bukopin Kami menyediakan layanan transaksi mudah melalui Bank Bukopin untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Pasti Jackpot OLO4D memberikan jaminan bahwa setiap pemain pasti mendapatkan jackpot. Dengan peluang kemenangan yang tinggi, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar.  
    • Balon168: Gampang Banjir Scatter Hitam Malam Ini Balon168 telah menjadi sorotan dalam dunia perjudian online, dan ada alasan kuat mengapa pemain semakin tertarik. Salah satu permainan unggulannya, yang dikenal dengan tingkat kemenangan yang tinggi, adalah varian "Gampang Banjir Scatter Hitam Malam Ini". Mari kita selami lebih dalam mengenai fenomena ini. Balon168: Destinasi Utama bagi Pecinta Slot     DAFTAR SEKARANG LINK VIP MAXWIN  
    • BALON168🎈: Situs Slot Gacor Terbaik, Termewah, dan Tergacor 2024 dengan RTP 99,99% Mudah Maxwin Jika Anda pencinta judi online, mencari situs yang dapat diandalkan dan memberikan pengalaman bermain yang memuaskan tentu menjadi prioritas. Salah satu opsi terbaik yang patut dipertimbangkan adalah BALON168🎈. Situs ini tidak hanya menawarkan berbagai permainan slot yang menarik, tetapi juga mempersembahkan keunggulan dan kenyamanan bagi para pemainnya. Keunggulan BALON168🎈 BALON168🎈 tidak hanya sekadar situs slot online biasa. Dengan reputasi yang solid dan terpercaya, BALON168🎈 telah menjadi destinasi favorit bagi para penggemar judi online di tahun 2024. Keunggulan yang ditawarkan mencakup: 1. RTP Tinggi 99,99% Salah satu hal yang membuat BALON168🎈 menonjol adalah tingkat pengembalian (RTP) yang luar biasa tinggi, mencapai 99,99%. Ini berarti pemain memiliki peluang besar untuk memenangkan hadiah besar setiap kali mereka memutar gulungan di slot BALON168🎈. 2. Permainan Slot Gacor BALON168🎈 dikenal sebagai situs slot gacor terbaik di tahun 2024. "Gacor" adalah istilah yang digunakan untuk mesin slot yang sering memberikan kemenangan kepada pemainnya. Dengan koleksi permainan slot yang beragam dan sering memberikan jackpot besar, BALON168🎈 memastikan pengalaman bermain yang memuaskan bagi para pengunjungnya. 3. Maxwin yang Mudah Di BALON168🎈, peluang maxwin tidak hanya menjadi impian belaka. Dengan fitur yang mudah dimengerti dan diakses, pemain memiliki kesempatan yang besar untuk meraih kemenangan maksimum dalam setiap permainan yang mereka mainkan. Keamanan dan Kepuasan Pemain BALON168🎈 mengutamakan keamanan dan kepuasan para pemainnya. Dengan sistem keamanan terkini dan perlindungan data yang canggih, para pemain dapat bermain dengan tenang tanpa khawatir tentang privasi dan keamanan mereka. Layanan pelanggan yang responsif dan ramah juga selalu siap membantu para pemain dalam setiap masalah atau pertanyaan yang mereka miliki.       ❱❱❱❱❱ DAFTAR DI SINI ❰❰❰❰❰ ❱❱❱❱❱ DAFTAR AKUN PRO ❰❰❰❰❰ ❱❱❱❱❱ DAFTAR AKUN VIP ❰❰❰❰❰            
    • LadangToto2 adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Mestika. Berikut adalah beberapa alasan mengapa Anda harus memilih LadangToto2: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Mestika Kami menyediakan layanan transaksi mudah melalui Bank Mestika untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Hadiah Hingga 100 Juta LadangToto2 memberikan kesempatan untuk meraih hadiah hingga 100 juta dalam kemenangan. Dengan jackpot dan hadiah-hadiah besar yang ditawarkan, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar.  
    • Mengapa Memilih LadangToto? LadangToto adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor WD Maxwin dengan transaksi mudah menggunakan Bank BNI. Berikut adalah beberapa alasan mengapa Anda harus memilih LadangToto: Slot Gacor WD Maxwin Terbaik Kami menyajikan koleksi slot gacor WD Maxwin terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank BNI Kami menyediakan layanan transaksi mudah melalui Bank BNI untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan.  
  • Topics

×
×
  • Create New...

Important Information

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