Résolu Probléme de textures sur les faces d'une machine
-
Voila imaginons je veux mettre la texture “Machine1” sur la première face de le machine celle qui s’allume sur le four,"Machine2"sur les coté de ma machine puis “Machine3” sur le derrier de la machine “Machine4” pour le dessous et puis “Machine5” pour le dessus.
j’ai fait ceci```java
package com.adamitemod.mod;import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;public class MachineStacker extends BlockContainer
{
private IIcon iconbottom;
private IIcon top;
private IIcon bottom;
private IIcon front;
private IIcon back;public MachineStacker()
{
super(Material.rock);
setResistance(8F);
setHarvestLevel(“pickaxe”, 2);
setCreativeTab(AdamiteMod.Ada);
setHardness(8F);
}public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityMachineStacker();
}public boolean hasTileEntity(int metadata)
{
return true;
}public void breakBlock(World world, int x, int y, int z, Block block, int metadata)
{
TileEntity tileentity = world.getTileEntity(x, y, z);
if(tileentity instanceof IInventory)
{
IInventory inv = (IInventory)tileentity;
for(int i1 = 0; i1 < inv.getSizeInventory(); i1++)
{
ItemStack itemstack = inv.getStackInSlot(i1);
if(itemstack == null)
continue;
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
while(itemstack.stackSize > 0)
{
int j1 = world.rand.nextInt(21) + 10;
if(j1 > itemstack.stackSize)
j1 = itemstack.stackSize;
itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(world, (float)x + f, (float)y + f1, (float)z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
float f3 = 0.05F;
entityitem.motionX = (float)world.rand.nextGaussian() * f3;
entityitem.motionY = (float)world.rand.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)world.rand.nextGaussian() * f3;
if(itemstack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, metadata);
}public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if(world.isRemote)
{
return true;
}
else
{
player.openGui(AdamiteMod.instance, 0, world, x, y, z);
return true;
}
}public void registerBlockIcons(IIconRegister iiconRegister)
{
blockIcon = iiconRegister.registerIcon(References.MOD_ID + “:2pk”);
top = iiconRegister.registerIcon(References.MOD_ID + “:Machine5”);
front = iiconRegister.registerIcon(References.MOD_ID + “:Machine1”);
bottom = iiconRegister.registerIcon(References.MOD_ID + “:Machine2”);
back = iiconRegister.registerIcon(References.MOD_ID + “:Machine3”);}
public IIcon getIcon(int side, int metadata)
{
if(side == 0)
{
return this.bottom;
}
else if(side == 1)
{
return this.top;
}
return this.blockIcon;
}
}mais sa ne fonctionne pas :/
-
et la ?
1. **package** com.adamitemod.mod; 2. **import** net.minecraft.block.Block; 3. **import** net.minecraft.block.BlockContainer; 4. **import** net.minecraft.block.material.Material; 5. **import** net.minecraft.client.renderer.texture.IIconRegister; 6. **import** net.minecraft.creativetab.CreativeTabs; 7. **import** net.minecraft.entity.item.EntityItem; 8. **import** net.minecraft.entity.player.EntityPlayer; 9. **import** net.minecraft.inventory.IInventory; 10. **import** net.minecraft.item.ItemStack; 11. **import** net.minecraft.nbt.NBTTagCompound; 12. **import** net.minecraft.tileentity.TileEntity; 13. **import** net.minecraft.util.IIcon; 14. **import** net.minecraft.world.World; 15. **public** **class** MachineStacker **extends** BlockContainer 16. { 17. **private** IIcon iconbottom; 18. **private** IIcon top; 19. **private** IIcon bottom; 20. **private** IIcon front; 21. **private** IIcon back; 22. 23. **public** MachineStacker() 24. { 25. **super**(Material.rock); 26. setResistance(8F); 27. setHarvestLevel("pickaxe", 2); 28. setCreativeTab(AdamiteMod.Ada); 29. setHardness(8F); 30. } 31. **public** TileEntity createNewTileEntity(World world, **int** metadata) 32. { 33. **return** **new** TileEntityMachineStacker(); 34. } 35. **public** **boolean** hasTileEntity(**int** metadata) 36. { 37. **return** **true**; 38. } 39. **public** **void** breakBlock(World world, **int** x, **int** y, **int** z, Block block, **int** metadata) 40. { 41. TileEntity tileentity = world.getTileEntity(x, y, z); 42. **if**(tileentity **instanceof** IInventory) 43. { 44. IInventory inv = (IInventory)tileentity; 45. **for**(**int** i1 = 0; i1 < inv.getSizeInventory(); i1++) 46. { 47. ItemStack itemstack = inv.getStackInSlot(i1); 48. **if**(itemstack == **null**) 49. **continue**; 50. **float** f = world.rand.nextFloat() %(#666600) 51. 0.8F + 0.1F; 52. **float** f1 = world.rand.nextFloat() %(#666600) 53. 0.8F + 0.1F; 54. **float** f2 = world.rand.nextFloat() %(#666600) 55. 0.8F + 0.1F; 56. **while**(itemstack.stackSize > 0) 57. { 58. **int** j1 = world.rand.nextInt(21) + 10; 59. **if**(j1 > itemstack.stackSize) 60. j1 = itemstack.stackSize; 61. itemstack.stackSize -= j1; 62. EntityItem entityitem = **new** EntityItem(world, (**float**)x + f, (**float**)y + f1, (**float**)z + f2, **new** ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); 63. **float** f3 = 0.05F; 64. entityitem.motionX = (**float**)world.rand.nextGaussian() %(#666600) 65. f3; 66. entityitem.motionY = (**float**)world.rand.nextGaussian() %(#666600) 67. f3 + 0.2F; 68. entityitem.motionZ = (**float**)world.rand.nextGaussian() %(#666600) 69. f3; 70. **if**(itemstack.hasTagCompound()) 71. entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); 72. world.spawnEntityInWorld(entityitem); 73. } 74. } 75. world.func_147453_f(x, y, z, block); 76. } 77. **super**.breakBlock(world, x, y, z, block, metadata); 78. } 79. **public** **boolean** onBlockActivated(World world, **int** x, **int** y, **int** z, EntityPlayer player, **int** side, **float** hitX, **float** hitY, **float** hitZ) 80. { 81. **if**(world.isRemote) 82. { 83. **return** **true**; 84. } 85. **else** 86. { 87. player.openGui(AdamiteMod.instance, 0, world, x, y, z); 88. **return** **true**; 89. } 90. } public void registerBlockIcons(IIconRegister iiconRegister) { blockIcon = iiconRegister.registerIcon(References.MOD_ID + ":2pk"); top = iiconRegister.registerIcon(References.MOD_ID + ":Machine5"); front = iiconRegister.registerIcon(References.MOD_ID + ":Machine1"); bottom = iiconRegister.registerIcon(References.MOD_ID + ":Machine2"); back = iiconRegister.registerIcon(References.MOD_ID + ":Machine3"); } public IIcon getIcon(int side, int metadata) { if(side == 0) { return this.bottom; } else if(side == 1) { return this.top; } return this.blockIcon; }} IIcon icontop; private IIcon iconbottom; private IIcon top; private IIcon bottom; 91.
-
Résolut ?