Résolu Orientation four
-
Bonsoir, mon problème est simple, la solution l’est surement aussi mais je ne vois pas.
quand je pose mon four, la face avant apparait seulement selon l’orientation de mon four, c’est à dire que si je pose mon four avec une autre orientation, elle n’apparait plus mais c’est celle du côté qui apparait.
voici le code du four:package Gallad.Mineald; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class PhytriteFurnace extends BlockContainer { @SideOnly(Side.CLIENT) private Icon furnaceIconTop; @SideOnly(Side.CLIENT) private Icon furnaceIconFront; private final boolean isActive; private static boolean keepFurnaceInventory = false; private final Random furnaceRand = new Random(); public PhytriteFurnace(int par1, boolean par2) { super(par1, Material.rock); this.isActive = par2; setHardness(5.0F); } public int idDropped(int par1, Random par2Random, int par3) { return Import.PhytriteFurnaceIdle.blockID; } @SideOnly(Side.CLIENT) public Icon getIcon(int side, int metadata) { return side == 1 ? this.furnaceIconTop : (side == 0 ? this.furnaceIconTop : (side == metadata ? this.furnaceIconFront : (side == 3 && metadata == 0 ? this.furnaceIconFront : this.blockIcon))); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("mineald:PhytriteFurnace"); this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "mineald:PhytriteFurnace_front_on" : "mineald:PhytriteFurnace_front_off"); this.furnaceIconTop = par1IconRegister.registerIcon("mineald:PhytriteFurnace_top"); } public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { TileEntityPhytriteFurnace PhytriteFurnace = (TileEntityPhytriteFurnace)par1World.getBlockTileEntity(par2, par3, par4); if (PhytriteFurnace != null) { par5EntityPlayer.openGui(Import.instance, 1, par1World, par2, par3, par4); } return true; } } public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4) { int l = par1World.getBlockMetadata(par2, par3, par4); TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4); keepFurnaceInventory = true; if (par0) { par1World.setBlock(par2, par3, par4, Import.PhytriteFurnace.blockID); } else { par1World.setBlock(par2, par3, par4, Import.PhytriteFurnaceIdle.blockID); } keepFurnaceInventory = false; par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); if (tileentity != null) { tileentity.validate(); par1World.setBlockTileEntity(par2, par3, par4, tileentity); } } @SideOnly(Side.CLIENT) /** * Tick au hasard qui fait spawn des flammes et de la fumee */ public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (this.isActive) { int l = par1World.getBlockMetadata(par2, par3, par4); float f = (float)par2 + 0.5F; float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; float f2 = (float)par4 + 0.5F; float f3 = 0.52F; float f4 = par5Random.nextFloat() * 0.6F - 0.3F; if (l == 4) { par1World.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { par1World.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } /** * Cree une entite Four quand le block est place */ public TileEntity createNewTileEntity(World par1World) { return new TileEntityPhytriteFurnace(); } /** * Appele quand le block est place */ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); } public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { if (!keepFurnaceInventory) { TileEntityPhytriteFurnace phytritefurnace = (TileEntityPhytriteFurnace)par1World.getBlockTileEntity(par2, par3, par4); if (phytritefurnace != null) { for (int j1 = 0; j1 < phytritefurnace.getSizeInventory(); ++j1) { ItemStack itemstack = phytritefurnace.getStackInSlot(j1); if (itemstack != null) { float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F; float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int k1 = this.furnaceRand.nextInt(21) + 10; if (k1 > itemstack.stackSize) { k1 = itemstack.stackSize; } itemstack.stackSize -= k1; EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)(itemstack).getTagCompound().copy()); } float f3 = 0.05F; entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3); entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3); par1World.spawnEntityInWorld(entityitem); } } } par1World.func_96440_m(par2, par3, par4, par5); } } super.breakBlock(par1World, par2, par3, par4, par5, par6); } public boolean hasComparatorInputOverride() { return true; } public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { return Container.calcRedstoneFromInventory((IInventory)par1World.getBlockTileEntity(par2, par3, par4)); } @SideOnly(Side.CLIENT) public int idPicked(World par1World, int par2, int par3, int par4) { return Import.PhytriteFurnaceIdle.blockID; } }
-
http://www.minecraftforgefrance.fr/showthread.php?tid=115
Ton code me parait assez court dans le getIcon. -
j’ai simplement pris celui du tutoriel sur le four en fait
EDIT: ça semble bon, peut être faut il vérifier cette même ligne sur le tuto?
-
Corrigé.