Oh non !
Faut pas que ça foire…
Chui dèg, je vais continuer les tests de mon côté
J’ai réussi !
A vous de juger le travail !
:::
package viruz.zeamateis.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import viruz.zeamateis.core.ViruZCore;
import viruz.zeamateis.proxy.client.ClientProxy;
import viruz.zeamateis.tileEntity.TileEntityCrossTomb;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockWoodenCrossTomb extends Block {
public BlockWoodenCrossTomb(int par1, Material par2Material)
{
super(par1, par2Material);
this.setHardness(5.5F);
this.setStepSound(Block.soundWoodFootstep);
this.setCreativeTab(ViruZCore.Blocks);
}
public void setBlockBoundsBasedOnState(IBlockAccess access, int x, int y, int z)
{
TileEntity te = access.getBlockTileEntity(x, y, z);
if(te instanceof TileEntityCrossTomb)
{
TileEntityCrossTomb tile = (TileEntityCrossTomb)te;
switch(tile.getDirection())
{
case 0:
this.setBlockBounds(0.125F, 0, 0.0625F, 0.875F, 1F, 0.1875F);
break;
case 1:
this.setBlockBounds(0.8125F, 0, 0.125F, 0.9375F, 1F, 0.875F);
break;
case 2:
this.setBlockBounds(0.125F, 0, 0.8125F, 0.875F, 1F, 0.9375F);
break;
case 3:
this.setBlockBounds(0.0625F, 0, 0.125F, 0.1875F, 1F, 0.875F);
break;
}
}
}
public boolean renderAsNormalBlock()
{
return false;
}
public boolean isOpaqueCube()
{
return false;
}
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return ClientProxy.renderInventoryTESRID;
}
public TileEntity createTileEntity(World world, int metadata)
{
return new TileEntityCrossTomb();
}
public boolean hasTileEntity(int metadata)
{
return true;
}
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;
TileEntity te = world.getBlockTileEntity(x, y, z);
if(te != null && te instanceof TileEntityCrossTomb)
{
((TileEntityCrossTomb)te).setDirection((byte)direction);
world.markBlockForUpdate(x, y, z);
}
}
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
{
this.setBlockBoundsBasedOnState(world, x, y, z);
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
this.setBlockBoundsBasedOnState(world, x, y, z);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
public Icon getIcon(int side, int metadata)
{
return Block.wood.getIcon(0, 0);
}
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec31, Vec3 vec32)
{
this.setBlockBoundsBasedOnState(world, x, y, z);
return super.collisionRayTrace(world, x, y, z, vec31, vec32);
}
}
:::