Probleme de texture
-
Bonjour, soir
j’ai un problème de texture avec mon blocks sa ne s’affiche pas
package com.mod.olicraft.blocks; import com.mod.olicraft.reference; import com.mod.olicraft.init.BlockMod; import com.mod.olicraft.init.ItemMod; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; public class BlockXPBush extends Block implements IPlantable { public IIcon fastIcons[]; public IIcon fancyIcons[]; public String textureNames[]; public IIcon icon; public Item item; public BlockXPBush(Item item) { super(Material.leaves); setTickRandomly(true); setHardness(0.0F); setBlockName("xpbush"); setStepSound(soundTypeGrass); disableStats(); setTickRandomly(true); float minZ; float minX = minZ = 0.125F; float maxZ; float maxX = maxZ = 0.875F; float maxY = 1.0F; setBlockBounds(minX, (float)minY, minZ, maxX, maxY, maxZ); this.item = item; textureNames = new String[2]; textureNames[0] = "Bush1"; textureNames[1] = "Bush2"; } public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { if(!world.isRemote) { int meta = world.getBlockMetadata(x, y, z); if(meta > 1) { world.setBlock(x, y, z, this, 0, 3); world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(item))); } } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { int meta = world.getBlockMetadata(x, y, z); if(meta >= 1) { if(world.isRemote) { return true; } else { world.setBlock(x, y, z, this, 0, 3); world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(ItemMod.experienceBerry))); return true; } } else { return false; } } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(BlockMod.experienceBush); } public void updateTick(World world, int x, int y, int z, Random random1) { if(world.isRemote) { return; } if(random1.nextInt(20) == 0) { int meta = world.getBlockMetadata(x, y, z); if(meta < 2) { world.setBlock(x, y, z, this, meta + 1, 3); } } } public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { return EnumPlantType.Cave; } public Block getPlant(IBlockAccess world, int x, int y, int i) { return this; } public int getPlantMetadata(IBlockAccess world, int x, int y, int z) { return world.getBlockMetadata(x, y, z); } public void registerBlockIcons(IIconRegister icon) { fastIcons = new IIcon[2]; fancyIcons = new IIcon[2]; for(int i = 0; i < fastIcons.length; i++) { if(textureNames* != "") { fancyIcons* = icon.registerIcon((new StringBuilder()).append("olicraft:").append(textureNames*).append("Fancy").toString()); fastIcons* = icon.registerIcon((new StringBuilder()).append("olicraft:").append(textureNames*).append("Fast").toString()); this.icon = icon.registerIcon(reference.MOD_ID + ":Bush2Fast"); } } } public IIcon getIcon(int side, int metadata) { if(metadata < 2) { return fancyIcons[metadata]; } else { return icon; } } public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int x, int y, int z, int meta) { if(meta > 1) { return super.shouldSideBeRendered(iblockaccess, x, y, z, meta); } else { return true; } } public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; player.attackEntityFrom(DamageSource.cactus, 0.5F); } } public boolean isOpaqueCube() { return false; } public boolean canPlaceBlockAt(World world, int x, int y, int z) { return world.getBlock(x, y - 1, z).isOpaqueCube(); } }
-
Salut,
A-t-il une erreur dans la console ?Sinon quelle est l’utilité de fastIcons alors qu’il n’est jamais utilisé ?
Pourquoi avoir mit la ligne
this.icon = icon.registerIcon(reference.MOD_ID + “:Bush2Fast”);
Dans la boucle for ? -
oui
[20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: The following texture errors were found. [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: ================================================== [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: DOMAIN olicraft [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: –------------------------------------------------ [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: domain olicraft is missing 4 textures [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: domain olicraft is missing a resource manager - it is probably a side-effect of automatic texture processing [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: –----------------------- [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: The missing resources for domain olicraft are: [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/Bush2Fancy.png [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/Bush1Fast.png [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/Bush2Fast.png [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: textures/blocks/Bush1Fancy.png [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: –----------------------- [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: No other errors exist for domain olicraft [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: ================================================== [20:54:50] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
et je sait pas pour le boucle
-
Il ne trouve pas les textures, les images sont manquantes.
Tu peux m’envoyer un screenshot du dossier src/main/resources ?