Jump to content

[1.7.10] onNeighbourBlock + oreDict?


jordsta95

Recommended Posts

Hey there, I was wondering if it is possible for onNeighbourBlock to detect the oreDict of whatever is next to it?

For example:

 public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
	 if (world.getBlock(posX, posY + 1, posZ) == Blocks.iron_ore){

but I wanted it to be the ore dictionary for iron ore, because that would make some amount of sense for what this does would it be possible to do that?

Why bother?

Link to comment
Share on other sites

Sure. First, get the oreID for ironOre, or whatever you want to check for. Then do Ints.containts(OreDicitionary.getOreIDs(<stack>), <ironOreID>).

When you say stack? Do you mean it'd be something like:

Ints.containts(OreDicitionary.getOreIDs(1), ore:oreIron)

to do 1 iron ore?

Why bother?

Link to comment
Share on other sites

Wat.

 

1) OreDicitionary.getOreIDs(...) requires an ItemStack passed to it.  1 is an integer.

2) ore:oreIron, even if you declared that as a string (which you didn't, so it'll just throw all kinds of errors), that's not the oreDict string for iron ore.

3) Even if it was the correct string, it's not an integer!

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

Wat.

 

1) OreDicitionary.getOreIDs(...) requires an ItemStack passed to it.  1 is an integer.

2) ore:oreIron, even if you declared that as a string (which you didn't, so it'll just throw all kinds of errors), that's not the oreDict string for iron ore.

3) Even if it was the correct string, it's not an integer!

 

My bad, I saw stack as a "how many you would want" (I was replying while on my way home from work, so I didn't know what it needed...

So let me correct that now...

So I have:

if (world.getBlock(posX, posY + 1, posZ) == OreDictionary.getOreIDs(, "ore:oreIron")
[code]
But I don't actually understand what it wants in the brackets, it suggests null (when you add unimplemented methods) but that breaks everything... I really don't know what to put in there  (Sorry for the newbie questions, but I have never used oreDict, and the code
[code]
    public static int[] getOreIDs(ItemStack stack)
    {
        if (stack == null || stack.getItem() == null) return new int[0];

        Set<Integer> set = new HashSet<Integer>();

        int id = Item.getIdFromItem(stack.getItem());
        List<Integer> ids = stackToId.get(id);
        if (ids != null) set.addAll(ids);
        ids = stackToId.get(id | ((stack.getItemDamage() + 1) << 16));
        if (ids != null) set.addAll(ids);

        Integer[] tmp = set.toArray(new Integer[set.size()]);
        int[] ret = new int[tmp.length];
        for (int x = 0; x < tmp.length; x++)
            ret[x] = tmp[x];
        return ret;
    }

doesn't really make sense :/

 

 

 

 

And i didn't do 

Ints.containts(OreDicitionary.getOreIDs(<stack>), <ironOreID>)

because the

Ints.containts

didn't exist (dunno if that is needed or not)

Why bother?

Link to comment
Share on other sites

That is not even close. If anything, you got FATHER away. Now your trying to compare a Block with an int[]

 

Oh, and "ore:oreIron" is still wrong.

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

That is not even close. If anything, you got FATHER away. Now your trying to compare a Block with an int[]

 

Oh, and "ore:oreIron" is still wrong.

From ore dictionary class... do I just need to do oreIron?

            registerOre("oreIron",    Blocks.iron_ore);

 

So this?

Ints.contains(OreDictionary.getOreIDs(null), "oreIron")

Which still shows errors, I don't know what that Ints is supposed to be, and the null? I don't understand what it should be...

Why bother?

Link to comment
Share on other sites

Seriously?

 

/**

    * Gets all the integer ID for the ores that the specified item stakc is registered to.

    * If the item stack is not linked to any ore, this will return an empty array and no new entry will be created.

    *

    * @param stack The item stack of the ore.

    * @return An array of ids that this ore is registerd as.

    */

 

And "oreIron" is still not an integer.  You need

getOreID(String name)

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

Seriously?

 

/**

    * Gets all the integer ID for the ores that the specified item stakc is registered to.

    * If the item stack is not linked to any ore, this will return an empty array and no new entry will be created.

    *

    * @param stack The item stack of the ore.

    * @return An array of ids that this ore is registerd as.

    */

 

And "oreIron" is still not an integer.  You need

getOreID(String name)

 

Yes, call me an idiot all you like, but I don't know what that means!

Getting somewhere though through my idiocy and I apologize for this:

 public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
	 if (world.getBlock(posX, posY + 1, posZ) == Ints.contains(OreDictionary.getOreIDs((neighbourBlock),getOreID("oreIron"))

now the only issue is the getOreID... well... it doesn't work?

Why bother?

Link to comment
Share on other sites

You don't know what an ItemStack is or how to use it? o..O

 

now the only issue is the getOreID

 

OreDictionary.getOreID(...)

 

I thought that was pretty obvious.

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

You don't know what an ItemStack is or how to use it? o..O

 

now the only issue is the getOreID

 

OreDictionary.getOreID(...)

 

I thought that was pretty obvious.

 

public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){

if (world.getBlock(posX, posY + 1, posZ) == Ints.contains(OreDictionary.getOreID("oreIron"){

 

Still getting issues though...

Ints is erroring, but I don't know what to do with it, as importing the only option doesn't fix anything :/

Why bother?

Link to comment
Share on other sites

And then you dropped

OreDictionary.getOreIDs(neighbourBlock)

for no apparent reason.

 

And you're comparing a Block to a boolean.

 

And

Ints

is not an object or a class.

 

And you're missing a )

 

It's like you're doing stuff without thinking about what that stuff you're doing means.  You're back to a point where you don't even have "code that makes sense, but contains syntax errors."

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

And then you dropped

OreDictionary.getOreIDs(neighbourBlock)

for no apparent reason.

 

And you're comparing a Block to a boolean.

 

And

Ints

is not an object or a class.

 

And you're missing a )

 

It's like you're doing stuff without thinking about what that stuff you're doing means.  You're back to a point where you don't even have "code that makes sense, but contains syntax errors."

I dropped it because this didn't work:

public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){

if (world.getBlock(posX, posY + 1, posZ) == contains(OreDictionary.getOreIDs((neighbourBlock),OreDictionary.getOreID("oreIron")))){

 

And I thought you meant use the other... the issue is "getOreIDs" it says it's not applicable for Block, int

Why bother?

Link to comment
Share on other sites

it says it's not applicable for Block, int

If you don't know what this means then you need to go do some tutorials about basic Java.

I know what it means. But I don't understand why, I was told to do that, but then find out it doesn't work...

Why bother?

Link to comment
Share on other sites

I know what it means. But I don't understand why, I was told to do that, but then find out it doesn't work...

 

Because you're not doing it right and no one is just going to write your code for you.

 

You need to understand the functions involved and put the puzzle pieces together yourself.

 

I'm done helping you.

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

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello! My friends and I were attempting to add a few extra mods to the Create Chronicles modpack, and all was well until people started crashing when they opened their inventories. Any help finding the culprit would be MUCH appreciated, I've been scratching my head for the past few days on what went wrong. https://paste.ee/p/8pajP
    • >>>KLIK LOGIN DISINI SAYANG<<< >>>KLIK DAFTAR DISINI SAYANG<<< Pendahuluan Dalam dunia perjudian online, slot menjadi salah satu permainan yang paling diminati. Dengan munculnya berbagai platform, Togel2Win hadir sebagai salah satu pilihan menarik, terutama dengan fitur anti rungkad yang dijanjikan. Artikel ini akan membahas tentang Togel2Win, keunggulan slot terbaru, dan bagaimana server Thailand berperan dalam meningkatkan pengalaman bermain. Apa Itu Togel2Win? Togel2Win adalah platform permainan yang menawarkan berbagai jenis permainan, termasuk slot dan togel. Dengan antarmuka yang ramah pengguna dan beragam pilihan permainan, situs ini bertujuan untuk memberikan pengalaman bermain yang menyenangkan dan menguntungkan bagi para pemain. Keunggulan Slot Togel2Win Fitur Anti Rungkad: Salah satu keunggulan utama dari Togel2Win adalah fitur anti rungkad yang dirancang untuk mengurangi kemungkinan gangguan saat bermain. Ini memastikan bahwa pemain dapat menikmati permainan tanpa gangguan teknis, meningkatkan kenyamanan dan fokus. Beragam Pilihan Slot: Togel2Win menawarkan berbagai jenis slot, dari yang klasik hingga yang modern dengan grafis menawan dan tema yang menarik. Ini memberikan variasi yang cukup bagi pemain untuk menemukan permainan yang sesuai dengan preferensi mereka. Server Thailand yang Stabil: Server yang berlokasi di Thailand memberikan koneksi yang cepat dan stabil. Ini sangat penting untuk pengalaman bermain yang lancar, terutama saat bermain slot yang memerlukan respons cepat. Bonus dan Promosi Menarik: Togel2Win sering menawarkan bonus dan promosi yang menarik untuk menarik pemain baru dan mempertahankan loyalitas pemain yang sudah ada. Ini bisa berupa bonus deposit, putaran gratis, atau program loyalitas. Tips untuk Pemain Slot di Togel2Win Pilih Slot dengan RTP Tinggi: Sebelum memulai permainan, pastikan untuk memilih slot dengan tingkat pengembalian pemain (RTP) yang tinggi untuk meningkatkan peluang menang. Kelola Anggaran: Tentukan batasan anggaran sebelum bermain dan patuhi itu. Ini membantu mencegah kerugian besar dan menjaga pengalaman bermain tetap menyenangkan. Manfaatkan Bonus: Jangan ragu untuk memanfaatkan bonus dan promosi yang ditawarkan. Ini bisa memberikan tambahan modal untuk bermain lebih lama. Kesimpulan Togel2Win merupakan pilihan menarik bagi para penggemar slot, terutama dengan fitur anti rungkad dan server yang stabil. Dengan berbagai pilihan permainan dan bonus yang menggiurkan, Togel2Win siap memberikan pengalaman bermain yang tak terlupakan. Jika Anda mencari platform slot yang andal dan menyenangkan, Togel2Win bisa menjadi solusi yang tepat.
    • I'm trying to make my own modpack, but sometimes, in certain areas of the world, the game just says "server closed". Minecraft doesn't close, it just returns to the menu. When I tried to figure it out on my own and understand the logs, I didn't understand anything (English is not my native language, so it's difficult for me). I've been trying to solve the problem for the third month. So I ask if anyone is good at this and it's not difficult for you, to help me with this. If you need details, ask. I'll describe everything. What it looks like Logs
  • Topics

×
×
  • Create New...

Important Information

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