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).
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.
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;
}
EntityAstroMiner.java - 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 PrefixBlock.java, 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?!
@Gregorius
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…
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.
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
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.
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.
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
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.