package JAKJ . RedstoneInMotion ;

public abstract class CarriageEntity extends TileEntity
{
	public boolean [ ] SideClosed = new boolean [ Directions . values ( ) . length ] ;

	public void ToggleSide ( int Side , boolean Sneaking )
	{
		if ( Sneaking )
		{
			Side = Directions . values ( ) [ Side ] . Opposite ( ) . ordinal ( ) ;
		}

		SideClosed [ Side ] = ! SideClosed [ Side ] ;

		Propagate ( ) ;
	}

	public int DecorationId ;

	public int DecorationMeta ;

	@Override
	public void Setup ( net . minecraft . entity . player . EntityPlayer Player , net . minecraft . item . ItemStack Item )
	{
		DecorationId = CarriageItem . GetDecorationId ( Item ) ;

		DecorationMeta = CarriageItem . GetDecorationMeta ( Item ) ;
	}

	@Override
	public void EmitDrops ( Block Block , int Meta )
	{
		EmitDrop ( Block , CarriageItem . Stack ( Meta , DecorationId , DecorationMeta ) ) ;
	}

	@Override
	public void ReadCommonRecord ( net . minecraft . nbt . NBTTagCompound TagCompound )
	{
		for ( int Index = 0 ; Index < SideClosed . length ; Index ++ )
		{
			SideClosed [ Index ] = TagCompound . getBoolean ( "SideClosed" + Index ) ;
		}

		DecorationId = TagCompound . getInteger ( "DecorationId" ) ;

		DecorationMeta = TagCompound . getInteger ( "DecorationMeta" ) ;
	}

	public void WriteCommonRecord ( net . minecraft . nbt . NBTTagCompound TagCompound )
	{
		for ( int Index = 0 ; Index < SideClosed . length ; Index ++ )
		{
			TagCompound . setBoolean ( "SideClosed" + Index , SideClosed [ Index ] ) ;
		}

		TagCompound . setInteger ( "DecorationId" , DecorationId ) ;

		TagCompound . setInteger ( "DecorationMeta" , DecorationMeta ) ;
	}

	public abstract void FillPackage ( CarriagePackage Package ) throws CarriageMotionException ;
}
