Compatibility of "GTOres" and "Astrominer" from "Galacticraft 3". Need help with NBT

That’s exactly what I did :slightly_smiling_face:
OreDict allows you to not set up recipes for processing, it assigns recipes to GT.

Maybe there is a list or table where the parameters of items falling out during the extraction of small ores are indicated?
Or something else that will make it easier to set up small ores?
If I remember correctly, for example, different elements can fall out of small diamond ore …

2 Likes

Yeah there is a Drops_Small_Ores.java somewhere in my Code, cant properly look it up atm, but it starts with the word “Drops” so it should be easy to find.

2 Likes

I found: “gregapi.block.behaviors”.
Not what I expected, but I think even better :slightly_smiling_face:

It remains to understand how it is correct and whether I can use something like this:

Blocks_GCAOE.smallores2 = new Drops_SmallOre(MT.Diamond);

Since my knowledge of the Java language is rather poor and I am guided by IDE hints, logic, intuition and articles on the Internet, I need a lot of time to figure out how it should work.

2 Likes

I think you dont wanna pass Diamond as parameter there, unless you want the background stone to be Diamond. XD

1 Like

I’m trying to figure out how it works by trial and error.
It’s hard to figure out how your code works.

2 Likes

I think I will already dream of small ores… I just don’t understand in which direction to move :pensive:
I would be very grateful if you tell me in which direction to move. Link to my code on GitHub if anyone wants to help:
GitHub

2 Likes

Look up where there is a getDrops or so Function that returns a “List” inside the Block.java of vanilla Minecraft, you will need that to drop the ItemStacks there.

2 Likes

I had to postpone work…
I think I found what you were talking about:

net.minecraft.block.Block.java
    /**
     * This returns a complete list of items dropped from this block.
     *
     * @param world The current world
     * @param x X Position
     * @param y Y Position
     * @param z Z Position
     * @param metadata Current metadata
     * @param fortune Breakers fortune level
     * @return A ArrayList containing all items this block drops
     */
    public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
        ArrayList<ItemStack> ret = new ArrayList<ItemStack>();

        int count = quantityDropped(metadata, fortune, world.rand);
        for (int i = 0; i < count; i++) {
            Item item = getItemDropped(metadata, world.rand, fortune);
            if (item != null) {
                ret.add(new ItemStack(item, 1, damageDropped(metadata)));
            }
        }
        return ret;
    }

Unfortunately, without examples (even approximate ones), it is still difficult for me to figure out how to apply this.

While trying to find examples with explanations or manuals))

2 Likes

Correct Function, remove everything but the ArrayList<ItemStack> ret = new ArrayList<> and the return ret;

Then just call ret.add(YOUR_DROPPED_ITEMSTACKS_HERE); and it will just work. :wink:

2 Likes

I took a closer look at your “Drops_SmallOre” code…
I also found the standard ore drop code:

minecraft.block.BlockOre.java
    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
        return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
    }

I also haven’t found how you’ve built in experience drops on mining (maybe I shouldn’t bother with that).
I also think the question will arise how can I assign the dropout of a certain material for each block using metadata.

P.S.: I should probably make my code more correct…

2 Likes

ItemStacks, literally ItemStacks. You should use them. The original Code in vanilla is very stupid, dont try to use that garbage. Please use “getDrops” to drop your ItemStacks and NOTHING ELSE.

Also there is a function in the BlockOre.java that returns a “Number” of Experience Orbs, which is independent of the Drops.

2 Likes

Thank you!
I seem to understand how it should be.
I’m not sure yet how to properly register materials for each ore, but I hope I’ll figure it out in the process.

2 Likes

I refactored the code a little and thought to make a drop drop similar to yours, but I got confused.
I can’t figure out how to correctly set the drop of GT6 materials from the corresponding ore block to one “getDrops” function.
Unfortunately, I only partially understand the dependencies in GT6 and Minecraft code.

I’ve made a small sketch so far:

Summary
package by.lucelarius.gcaoe.common.util;

import gregapi.data.MT;
import gregapi.data.OP;
import gregapi.oredict.OreDictMaterial;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import java.util.ArrayList;

public class EOreSmall_Drops {

    private final OreDictMaterial rockDrop;

    public EOreSmall_Drops() {
        this.rockDrop = MT.STONES.SpaceRock;
    }

    public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
    {
        ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
        ret.add(new ItemStack(OP.dust.mat(this.rockDrop, 1).getItem()));
        ret.add(new ItemStack(Items.diamond, 2));

        return ret;
    }
}

All code on GitHub

2 Likes

Uh why the heck do you do it this way? you do NOT need to do “new ItemStack” on this Line, in fact that is what fucks you over. You want this:
ret.add(OP.dust.mat(this.rockDrop, 1));

2 Likes

This code is just a sketch and is not used yet.
I don’t know much about the Java language, so I can make stupid mistakes. I am learning in the process.
While trying to figure out how to make getDrops common to all ore blocks.
While in development and not sure if I need this:

Summary
package by.lucelarius.gcaoe.common.util;

import gregapi.oredict.OreDictMaterial;

public class GT6_Drops_SmallOre {

    public void setMaterail(OreDictMaterial soMaterial, int metadata) {

        ? = soMaterial;
        ? = metadata;

    }
}
2 Likes

I uhh, dont know how to give you hints that you wont misunderstand, sooooo, I will refrain from answering anything that is not a question in the first place, in order to not confuse you.

2 Likes

I have 2 classes of small ores where metadata is used:
EOreSmall1.java (9 ores)
EOreSmall2.java (11 ores)
I’m thinking of making a separate class for getDrops.
I don’t know how to correctly specify the drop of certain items for each ore.

2 Likes

You mean the same way you already do with the Icons? Its that simple with the Array.

2 Likes

I would like to use the drop logic you have in “Drops_SmallOre”.

2 Likes