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

I’m trying to add support for the “GregTech 6” ore to the “Astrominer” code from the “Galacticraft 3” mod, but I’m not familiar with Java and the Forge api.

At the moment, I have made “Astrominer” mine blocks of ore, but he loses information about them (NBT).
Extracts for example ore 2214:9213 (#2214/9213),
Brings - 2214 (#2214/0).



Uh I do not think it is possible to fix that one, unless you can rewrite GC3s Code.


That’s exactly what I’m trying to do. I took the source files from here: GitHub - micdoodle8/Galacticraft at MC1.7
I have already set up the workspace and am trying to fix some of the code for compatibility.
At the moment I don’t know how to properly force save NBT.

The “Astrominer” code is here: Galacticraft/ at MC1.7 · micdoodle8/Galacticraft · GitHub

Unfortunately, I have not yet been able to find information on how the NBT works.
Can you help?


In order for “Astrominer” to start recognizing GT6 ore, I made the following changes:


    public static void checkForCompatibleMods()
        if (Loader.isModLoaded("gregtech") || Loader.isModLoaded("GregTech_Addon") || Loader.isModLoaded("GregTech") )
            CompatibilityManager.modGTLoaded = true;
            try {
                Class<?> clazz = Class.forName("gregtech.common.blocks.GT_Block_Ores");    //delete
            	Class<?> clazz = Class.forName("gregapi.block.prefixblock.PrefixBlock");   //add
            	if (clazz != null)
            		classGTOre = clazz;
            catch (Exception e) { e.printStackTrace(); } - Variation 1:

        ItemStack drops = gtFlag ? getGTDrops(x, y, z, b) : getPickBlock(this.worldObj, x, y, z, b);    //delete
        ItemStack drops = gtFlag ? getGTBlocks(x, y, z, b) : getPickBlock(this.worldObj, x, y, z, b);   //add
-//- -//- -//-
    // add
    private ItemStack getGTBlocks(int x, int y, int z, Block b)
        int meta = this.worldObj.getBlockMetadata(x, y, z);
        if (b.hasTileEntity(meta))
            return new ItemStack(b, 1, meta);
        return null;
    } - Variation 2:

        ItemStack drops = gtFlag ? getGTDrops(x, y, z, b) : getPickBlock(this.worldObj, x, y, z, b);    //delete
        ItemStack drops = getPickBlock(this.worldObj, x, y, z, b);   //add

These options work, but information about the ore is lost.


getPickBlock only creates an ItemStack out of the block type and the placed metadata which doesn’t necessarily match the block’s item meta - I recommend never relying on that. IIRC GT stores block subtypes in a tile entity because it allows more variants than the standard limit of 16, so the placed meta will never match the item meta anyway.

The old code you removed already looks like it has some GT compat, which at least from a glance looks like it should work (getGTDrops uses block.getDrops which is position-aware and should therefore create the right ItemStacks). The only error I see is that the getDrops call always passes the placed block meta 0 instead of the actual meta, depending on how the method is implemented this could lead to incorrect results.


You’re right. The old “getGTDrops” code works (it was written for “GregTech 5”), but it mines the ore by destroying the block. Like if I used a hammer.
I’m trying to make it mine a block of ore, like with a silk touch pickaxe.


Assuming that all relevant GT blocks extend, calling the block’s (not the astro miner’s) getPickBlock method should yield the correct stack. I’m not sure how the underlying bits work, you might want to ask Greg beforehand whether that’s a safe way to do it.


@TheBobcat getPickBlock is clientside only as far as I remember, you should never ever use it for Serverside Stuff.

And the getDrops Function mines it as if you used a regular Pickaxe, not like a Hammer. A Hammer will crush the Ore even further.

Also there is absolutely no NBT in my Prefix Items and Blocks, so asking how something works that does not exist, kindof wont help you, will it?

Doesnt getDrops have a Player Parameter for whoever harvests it? Maybe put a FakePlayer there and give it a Silk Touch Tool. That is the ONLY vanilla way to actually get Silk Touch drops out properly regardless of Mod. In fact getDrops() should ALWAYS be called by GC3, why the fuck does it have a special case for doing the CORRECT thing to GregTech but not to LITERALLY EVERY OTHER MOD?!


It does not mine “TileEntity” blocks by default. The “TileEntity” check has been added for GTOres only.

You have given me some ideas. As a small example, I can look at the “AdvancedMiner” code from “IndustrialCraft 2 Experimental”


Once upon a time, I addressed the issue that GT6 ores are not generated on Asteroids, although it seems like they should. No matter how hard I tried, the miracle never happened.
Now this is not critical, since I have an alternative option.

Interested, maybe there is a table with the parameters for generating ores on Asteroids:
Chance, density and other standard parameters…

I think this table will work for me:


Once upon a time for “GregTech 5” I registered ore in OreDict like this:

GT_OreDictUnificator.registerOre(OrePrefixes.oreBlackgranite.get(Materials.Aluminium), new ItemStack(Block_GTOA.oreBlocks1, 1, 0));

I can’t figure out how it’s done in GT6


Uhm what are you trying to achieve? I am asking this because this one thing you’re trying to use as an example is actually even blacklisted because “Aluminium Ore” is not allowed to exist.

And you might want something like

OM.reg(OP.ore, MT.Al, ST.make(YourBlock, 1, YourMetaData));


This is just an example from 2016)
You can take another:

GT_OreDictUnificator.registerOre(OrePrefixes.oreBlackgranite.get(Materials.Diamond), new ItemStack(Block_GTOA.oreBlocks1, 1, 8));

This is how I assigned the ore properties from GregTech to my blocks without making them a TileEntity

In 2016, I wrote a mod for Galacticraft with certain ore blocks (like in vanilla) and replaced the standard Galacticraft ores that were used to generate Asteroids with them.
This is my solution with the generation of the ore I need on Asteroids :slightly_smiling_face:

UPD: Thanks!


One more question:
I couldn’t figure out how to register “oreSmall” and “oreSpace”.
With ordinary ore, everything is fine

OM.reg(OP.oreSpace, MT.CertusQuartz, ST.make(Blocks_GCAOE.ores1, 1, 0));

But how to specify the desired stone for small ores?

OM.reg(OP.oreSmall, MT.CertusQuartz, ST.make(Blocks_GCAOE.smallores1, 1, 0));

Small Ores never drop themselves, that’s why their OreDict is not really useful.

And you did not explain what was wrong with oreSpace.

1 Like

I apologize if I misled you.
With “oreSpace” there are no problems, everything works as it should.

I thought “oreSmall” could also be given GTOres properties.

When I started setting up the generation parameters based on the wiki table, I realized that it was not complete.
I searched a bit and came across “Loader_Worldgen” where I found all the parameters.

PS: Google translate))


Yeah Small Ores do not have any Processing assigned to them, they are just Blocks that drop crushed Ore, or Gems, or Dust, depending on what is available. The Blocks themselves arent really registered to anything useful either.


Thank you!
So I’ll assign them items to drop.


Without the proper generation of ores on asteroids, they are a little useless.
Even if the ores from GregTech were successfully generated on asteroids, this would not be entirely correct due to the peculiarity of their generation and the “Astronomical Miner” invented for their extraction.

When an asteroid is generated, the coordinates of this asteroid are recorded and, based on these coordinates, the “Astronomical Miner” digs out the middle (core) of the asteroid according to a certain algorithm.

So I’m trying to “finish” the original idea of ​​the author a little. If I can figure out how to make 4 types of ore be generated in one asteroid without breaking the existing world generation and add a chunk loader to the “Astronomical Miner” I will be happy :slightly_smiling_face:


Try making your Ores normal Blocks, dont use any PrefixBlocks from GregTech, then you can generate up to 16 Ores per used Block ID if you do the MetaData thing most Mods do. This should make it easier for you to perform your task. :wink: