Jump to content

Recommended Posts

Posted

Hello,

 

I have a small problem with my generated ore stacking after i break it with a pickaxe.

If i spawn in both ores with Creative, and drop them with the Q button they dont stack. any advice ?

 

Thx in advance.

 

Block MetaData ores

package NexanSv6.MechanicalCraft.Blocks;

import java.util.List;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;


public class BlockMetadataOres extends Block
{
public BlockMetadataOres(int ID)
{
	super(ID , Material.rock);
	setHardness(5F);
	setResistance(10F);
	setCreativeTab(CreativeTabs.tabBlock);

}


public String getTextureFile()
{
	return "/gfx/MeCOre.png";
}


public int getBlockTextureFromSideAndMetadata(int i,int l)
{
	switch(l)
	{
	case 0:return 0;
	case 1:return 1;
	default: return 0;
	}
}


public void getSubBlocks(int i,CreativeTabs tab, List list)
{
	list.add(new ItemStack(i,1,0));
	list.add(new ItemStack(i,1,1));
}

}

 

Item Metadata Ores

package NexanSv6.MechanicalCraft.Blocks;

import net.minecraft.src.ItemBlock;
import java.util.List;

import NexanSv6.MechanicalCraft.MechanicalCraft;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;

public class ItemMetadataOre extends ItemBlock
{
public ItemMetadataOre(int par1)
{
	super(par1);
	setMaxDamage(0);
	setHasSubtypes(true);
}

public String getItemNameIS(ItemStack i)
{
	switch(i.getItemDamage())
	{
	case 0: return "Rutile Ore";
	case 1: return "Bauxite Ore";
	default: return"";
	}
}

public int getMetadata(int par1)
{
	return par1;
}

@SideOnly(Side.CLIENT)
public int getIconFromDamage(int par1)
{
	return MechanicalCraft.metaOre.getBlockTextureFromSideAndMetadata(2, par1);
}
}

 

Bauxite World Generator

 

package NexanSv6.MechanicalCraft.WorldGeneration;

import java.util.Random;

import NexanSv6.MechanicalCraft.MechanicalCraft;

import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.WorldGenMinable;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.World;
import cpw.mods.fml.common.IWorldGenerator;


public class BauxiteWorldGenerator implements IWorldGenerator
{
@Override
public void generate(Random random, int chunkX, int chunkZ,World world, IChunkProvider chunkGenerator,IChunkProvider chunkProvider)
{
	switch(world.provider.worldType)
	{
	case 0 :generateSurface(world,random,chunkX*16,chunkZ*16);
	}
}
public void generateSurface(World world, Random random, int blockX, int blockZ)
{
	int XCoord = blockX + random.nextInt(16);
	int YCoord = random.nextInt(60);
	int ZCoord = blockZ + random.nextInt(16);
(new WorldGenMinable(MechanicalCraft.metaOre.blockID,1,12)).generate(world, random, XCoord, YCoord, ZCoord);	
}

}

 

Rutile World Generator

package NexanSv6.MechanicalCraft.WorldGeneration;

import java.util.Random;

import NexanSv6.MechanicalCraft.MechanicalCraft;

import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.WorldGenMinable;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.World;
import cpw.mods.fml.common.IWorldGenerator;


public class RutileWorldGenerator implements IWorldGenerator
{
@Override
public void generate(Random random, int chunkX, int chunkZ,World world, IChunkProvider chunkGenerator,IChunkProvider chunkProvider)
{
	switch(world.provider.worldType)
	{
	case 0 :generateSurface(world,random,chunkX*16,chunkZ*16);
	}
}
public void generateSurface(World world, Random random, int blockX, int blockZ)
{
	int XCoord = blockX + random.nextInt(16);
	int YCoord = random.nextInt(60);
	int ZCoord = blockZ + random.nextInt(16);
(new WorldGenMinable(MechanicalCraft.metaOre.blockID,0,6)).generate(world, random, XCoord, YCoord, ZCoord);	
}

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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