Everything posted by SilentThief
-
[1.6.4] Ore generation not working fully [solved]
There's a much easier way to do what you're looking to do. You have 3 separate classes for each world, which isn't needed. Here is my EventManager class: package betterblocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class EventManager implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId){ case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); } } private void generateEnd(World world, Random random, int x, int z) { } private void generateSurface(World world, Random random, int x, int z) { this.addOreSpawn(BBCore.magicOre, world, random, x, z, 16, 16, 3+random.nextInt(3), 20, 10, 50); } private void generateNether(World world, Random random, int x, int z) { } /** * Adds an Ore Spawn to Minecraft. Simply register all Ores to spawn with this method in your Generation method in your IWorldGeneration extending Class * * @param The Block to spawn * @param The World to spawn in * @param A Random object for retrieving random positions within the world to spawn the Block * @param An int for passing the X-Coordinate for the Generation method * @param An int for passing the Z-Coordinate for the Generation method * @param An int for setting the maximum X-Coordinate values for spawning on the X-Axis on a Per-Chunk basis * @param An int for setting the maximum Z-Coordinate values for spawning on the Z-Axis on a Per-Chunk basis * @param An int for setting the maximum size of a vein * @param An int for the Number of chances available for the Block to spawn per-chunk * @param An int for the minimum Y-Coordinate height at which this block may spawn * @param An int for the maximum Y-Coordinate height at which this block may spawn **/ public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { int maxPossY = minY + (maxY - 1); assert maxY > minY: "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16"; assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0"; assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0"; assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16"; int diffBtwnMinMaxY = maxY - minY; for(int x = 0; x < chancesToSpawn; x++) { int posX = blockXPos + random.nextInt(maxX); int posY = minY + random.nextInt(diffBtwnMinMaxY); int posZ = blockZPos + random.nextInt(maxZ); (new WorldGenMinable(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ); } } } Under: private void generateSurface(World world, Random random, int x, int z) { Put your ore (for spawning in the overworld, aka surface). Make sure you make the EventManager class, for the end and nether, you need to make separate classes. Here's a tutorial on ore generation:
-
Testing an ore genereator?
In your event manager, where you set your ore to spawn: this.addOreSpawn(block, world, random, blockXPos, blockZPos, maxX, maxZ, maxVeinSize, chancesToSpawn, minY, maxY); Increase "chancesToSpawn" and MaxY (to find easier). (set minY to 10)
-
[1.6.4]Ore Item Drops
Thank you for the replies! Sorry I wasn't clear enough: I have one ore, if I break the ore, it drops one of the items specified, if I break the same ore a second time, it drops another ore that is specified. But the item it drops is random each time. Roymond, and AndyLun, thank you for supplying sufficient explanations. I will reply with the product of what I come up with. Edit: package betterblocks.ores; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import betterblocks.items.YellowDust; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class MagicOre extends Block { public MagicOre(int id, Material material) { super(id, material); setHardness(3.0F); setStepSound(Block.soundStoneFootstep); setUnlocalizedName("magicOre"); setCreativeTab(CreativeTabs.tabBlock); setTextureName("betterblocks:magicore"); setLightValue(0.5F); } public int idDropped(int metadata, Random random, int fortune){ int drop = random.nextInt(4); if (drop == 0){ return betterblocks.BBCore.whiteDust.itemID; }else if (drop == 1); return betterblocks.BBCore.yellowDustBB.itemID; } @SideOnly(Side.CLIENT) protected boolean canSilkHarvest(){ return true; } } Roymond's suggestion did work, drops the two items randomly, I will be adding more to the ore, thank you very much, also AndyLun, thank you very much for pointing me towards the Random class, I will get to learning that.
-
[1.6.4]Ore Item Drops
Hello everyone, I am kind of new at modding and having a little trouble finding out how to make a ore drop different items each time you break the ore. Detailed Explanation: For instance, if I were to break my ore, and it drops for say, yellow dust, and then I break the second ore, it drops red dust, and so on, what would be the way to go about doing that. Note: I am still in the progress of learning modding and java. You don't have to give me the code, but an explanation would be helpful.
-
[1.6.4]getLightValue making my textures really bright
Light values shouldn't make your texture bright, it must be something wrong with the texture. Try re-creating the texture.
IPS spam blocked by CleanTalk.