Minecraft Modding - 彼此具有相同名称的块

时间:2013-05-20 04:14:34

标签: java module minecraft

Hello stackoverflow社区。我遇到了一个我正在为我的世界制造的模型的问题,并且出于某种原因,模块正在采用彼此的名字。

涉及块的主要mod类代码:

public static final Block bloodStone = new BlockBloodStone(160, 0).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep).getIndirectPowerOutput("bloodStone");
/* Conflict 1: */ public static final Block darkStone = new BlockDarkStone(161, 0).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep);
/* Conflict 1: */public static final Block darkStoneBrick = new BlockDarkStoneBrick(162, 0).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep);
/* Conflict 1: */ public static final Block darkGlowstone = new BlockDarkGlowstone(163, 0).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep).setLightValue(0.8F);
/* Conflict 1: */ public static final Block darkStonePillar = new BlockDarkStonePillar(164).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep);
/* Conflict 1: */ public static final Block darkStoneSmooth = new Block(165, Block.stone.blockMaterial).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep).getIndirectPowerOutput("darkStoneTop");
/* Conflict 1: */ public static final Block darkLog = new BlockDarkLog(166).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep);
public static final Block darkWood = new Block(167, Block.wood.blockMaterial).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep).getIndirectPowerOutput("darkWood");
/* Conflict 1: */ public static final Block darkWoodFence = new BlockFence(168, "darkWood", Block.fence.blockMaterial).setCreativeTab(CreativeTabs.tabDecorations);
/* Conflict 2: */ public static final Block darkGrass = new BlockDarkGrass(169, 0).setCreativeTab(CreativeTabs.tabBlock).setHardness(1F).setResistance(2F).setStepSound(Block.soundGrassFootstep).getIndirectPowerOutput("darkStoneTop");
public static final Block darkDirt = new Block(170, Block.dirt.blockMaterial).setCreativeTab(CreativeTabs.tabBlock).setHardness(1F).setResistance(2F).setStepSound(Block.soundGrassFootstep).getIndirectPowerOutput("darkDirt");

ModLoader.addName(bloodStone, "\u00a74Bloodstone");
/* Conflict 1 */ ModLoader.addName(darkStone, "\u00a78Darkstone");
/* Conflict 1 */ ModLoader.addName(darkStoneBrick, "\u00a78Dark StoneBrick");
/* Conflict 1 */ ModLoader.addName(darkGlowstone, "\u00a78Dark Glowbrick");
ModLoader.addName(darkStoneChunk, "\u00a78Darkstone Chunk");
ModLoader.addName(darkStoneIngot, "\u00a78Darkstone Brick");
/* Conflict 1 */ ModLoader.addName(darkStonePillar, "\u00a78Darkstone Pillar");
/* Conflict 2 */ ModLoader.addName(darkStoneSmooth, "\u00a78Smooth Darkstone");
/* Conflict 1 */ ModLoader.addName(darkLog, "\u00a78Smooth Dark Log");
ModLoader.addName(darkWood, "\u00a78Darkwood");
/* Conflict 1 */ ModLoader.addName(darkWoodFence, "\u00a78Darkwood Fence");
/* Conflict 2 */ ModLoader.addName(darkGrass, "\u00a78Dark Grass");
ModLoader.addName(darkDirt, "\u00a78Dark Dirt");

ModLoader.registerBlock(bloodStone);
/* Conflict 1 */ ModLoader.registerBlock(darkStone);
/* Conflict 1 */ ModLoader.registerBlock(darkStoneBrick);
/* Conflict 1 */ ModLoader.registerBlock(darkGlowstone);
/* Conflict 2 */ ModLoader.registerBlock(darkStoneSmooth);
/* Conflict 1 */ ModLoader.registerBlock(darkStonePillar);
/* Conflict 1 */ ModLoader.registerBlock(darkLog);
ModLoader.registerBlock(darkWood);
/* Conflict 1 */ ModLoader.registerBlock(darkWoodFence);
/* Conflict 2 */ ModLoader.registerBlock(darkGrass);
ModLoader.registerBlock(darkDirt);

冲突1的两个类示例:

public class BlockDarkStoneBrick extends Block {

public static Icon[] textures = new Icon[2];

@Override
public void registerIcons(IconRegister par1IconRegister) {

    textures[0] = par1IconRegister.registerIcon("darkStoneBrick");
    textures[1] = par1IconRegister.registerIcon("darkStoneTop");

}

public Icon getBlockTextureFromSideAndMetadata(int i, int j) {

    if (i == 0) return textures[1];
    if (i == 1) return textures[1];
    else
        return textures[0];
}

protected BlockDarkStoneBrick(int par1, int j) {

    super(par1, Material.iron);
    this.setCreativeTab(CreativeTabs.tabBlock);
}

public int idDropped(int i, Random random, int j) {

    return mod_DarkCraft.darkStoneBrick.blockID;
}

public int quantityDropped(Random random) {

    return 1;
}
}

public class BlockDarkStone extends Block {

public static Icon[] textures = new Icon[2];

@Override
public void registerIcons(IconRegister par1IconRegister) {

    textures[0] = par1IconRegister.registerIcon("darkStoneSide");
    textures[1] = par1IconRegister.registerIcon("darkStoneTop");

}

public Icon getBlockTextureFromSideAndMetadata(int i, int j) {

    if (i == 0) return textures[1];
    if (i == 1) return textures[1];
    else
        return textures[0];
}

protected BlockDarkStone(int par1, int j) {

    super(par1, Material.iron);
    this.setCreativeTab(CreativeTabs.tabBlock);
}

public int idDropped(int i, Random random, int j) {

    return mod_DarkCraft.darkStone.blockID;
}

public int quantityDropped(Random random) {

    return 1;
}
}

BlockDarkGrass类和冲突2的darkStoneSmooth代码:

public class BlockDarkGrass extends Block {

public static Icon[] textures = new Icon[3];

@Override
public void registerIcons(IconRegister par1IconRegister) {

    textures[0] = par1IconRegister.registerIcon("darkGrassSide");
    textures[1] = par1IconRegister.registerIcon("darkGrassTop");
    textures[2] = par1IconRegister.registerIcon("darkDirt");

}

public Icon getBlockTextureFromSideAndMetadata(int i, int j) {

    if (i == 0) return textures[2];
    if (i == 1) return textures[1];
    else
        return textures[0];
}

protected BlockDarkGrass(int par1, int j) {

    super(par1, Material.grass);
    this.setCreativeTab(CreativeTabs.tabBlock);
}

public int idDropped(int i, Random random, int j) {

    return mod_DarkCraft.darkDirt.blockID;
}

public int quantityDropped(Random random) {

    return 1;
}
}

public static final Block darkStoneSmooth = new Block(165, Block.stone.blockMaterial).setCreativeTab(CreativeTabs.tabBlock).setHardness(5F).setResistance(6F).setStepSound(Block.soundStoneFootstep).getIndirectPowerOutput("darkStoneTop");

冲突中的所有街区都以Darkwood Fence命名 冲突二下的所有街区都以黑草的名字命名

如果你能帮助你,那很好。也很抱歉,如果有一个问题已解决或任何问题,我试着看,但我的互联网是可怕的。我看过的那些并没有解决我的问题。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题!我相信我通过使用.setUnlocalizedName(“”)来修复它 例如:

public static final Block bloodStone = new BlockBloodStone(160, 0)
.setCreativeTab(CreativeTabs.tabBlock).setHardness(5F)
.setResistance(6F).setStepSound(Block.soundStoneFootstep)
.getIndirectPowerOutput("bloodStone").setUnlocalizedName("bloodStone");