0

你好 stackoverflow 社区。我为我的世界制作的模组有问题,并且由于某种原因,块正在取彼此的名字。

涉及块的主要模块类代码:

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;
}
}

冲突 2 的 BlockDarkGrass 类和 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 冲突二下的所有方块都取名为 Dark Grass

如果你能帮忙,谢谢,如果没有,那很好。也很抱歉,如果有问题已解决或任何问题,我试着寻找,但我的互联网很糟糕。我看过的那些并没有解决我的问题。

4

1 回答 1

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");
于 2013-05-28T04:01:49.000 回答