Java Code Examples for net.minecraft.block.Block#getLocalizedName()

The following examples show how to use net.minecraft.block.Block#getLocalizedName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuestFarm.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private String cropName(Integer i) {
	if (i == null) {
		return "Crop";
	}
	Block crop = CROP_TYPES[i];
	if (crop == null) {
		System.out.println("invalid crop ID [" + i + "]");
		return "Crop";
	}
	return crop.getLocalizedName();
}
 
Example 2
Source File: CarvableHelper.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta)
{
    if(variations.size() >= 16)
        return;

    if(blockName == null && block != null)
        blockName = block.getLocalizedName();
    else if(blockName == null && description != null)
        blockName = description;

    CarvableVariation variation = new CarvableVariation();
    variation.description = description;
    variation.metadata = metadata;
    variation.blockName = blockName;

    if(texture != null)
    {
        variation.texture = texture;

        String path = "/assets/" + modName + "/textures/blocks/" + variation.texture;

        boolean any = Chisel.class.getResource(path + ".png") != null;
        boolean ctm3 = Chisel.class.getResource(path + "-ctm1.png") != null && Chisel.class.getResource(path + "-ctm2.png") != null && Chisel.class.getResource(path + "-ctm3.png") != null;
        boolean ctmv = Chisel.class.getResource(path + "-ctmv.png") != null;
        boolean ctmh = Chisel.class.getResource(path + "-ctmh.png") != null;
        boolean side = Chisel.class.getResource(path + "-side.png") != null;
        boolean top = Chisel.class.getResource(path + "-top.png") != null;
        boolean bot = Chisel.class.getResource(path + "-bottom.png") != null;
        boolean v9 = Chisel.class.getResource(path + "-v9.png") != null;
        boolean v4 = Chisel.class.getResource(path + "-v4.png") != null;
        boolean ctmx = Chisel.class.getResource(path + "-ctm.png") != null;

        if(ctm3)
        {
            variation.kind = 3;
        } else if(ctmh && top)
        {
            variation.kind = 5;
        } else if(ctmv && top)
        {
            variation.kind = CTMV;
        } else if(bot && top && side)
        {
            variation.kind = 2;
        } else if(top && side)
        {
            variation.kind = 1;
        } else if(v9)
        {
            variation.kind = V9;
        } else if(v4)
        {
            variation.kind = V4;
        } else if(any && ctmx && !Configurations.disableCTM)
        {
            variation.kind = CTMX;
        } else if(any)
        {
            variation.kind = 0;
        } else
        {
            throw new RuntimeException("No valid textures found for chisel block variation '" + description + "' (" + variation.texture + ")");
        }
    } else
    {
        variation.block = block;
        variation.kind = 2;
        variation.blockMeta = blockMeta;
    }

    variations.add(variation);
    map[metadata] = variation;
}